diff options
author | Pale Moon <git-repo@palemoon.org> | 2015-10-26 17:30:27 +0100 |
---|---|---|
committer | Pale Moon <git-repo@palemoon.org> | 2015-10-30 12:17:42 +0100 |
commit | 2829e9f8d92bc819326f4b655904d83aec6b9435 (patch) | |
tree | 498b80f60bb6f1b8c40a64e43c20b493b39b1889 /browser/devtools | |
parent | da98ef4ffaf032a0c2bfce44405d6b63867fd995 (diff) | |
download | palemoon-gre-2829e9f8d92bc819326f4b655904d83aec6b9435.tar.gz |
Change promise references in devtools to avoid name collisions with Promise in the global Chrome scope.
Diffstat (limited to 'browser/devtools')
24 files changed, 156 insertions, 156 deletions
diff --git a/browser/devtools/commandline/BuiltinCommands.jsm b/browser/devtools/commandline/BuiltinCommands.jsm index 670783eab..6251539ff 100644 --- a/browser/devtools/commandline/BuiltinCommands.jsm +++ b/browser/devtools/commandline/BuiltinCommands.jsm @@ -13,7 +13,7 @@ this.EXPORTED_SYMBOLS = [ "CmdAddonFlags", "CmdCommands", "DEFAULT_DEBUG_PORT", Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js"); +let promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js").Promise; Cu.import("resource://gre/modules/osfile.jsm"); Cu.import("resource://gre/modules/devtools/gcli.jsm"); @@ -644,8 +644,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "AppCacheUtils", dirName = homeDir + dirName; } - let promise = OS.File.stat(dirName); - promise = promise.then( + let statPromise = OS.File.stat(dirName); + statPromise = statPromise.then( function onSuccess(stat) { if (!stat.isDir) { throw new Error('\'' + dirName + '\' is not a directory.'); @@ -662,7 +662,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "AppCacheUtils", } ); - promise.then( + statPromise.then( function onSuccess() { let iterator = new OS.File.DirectoryIterator(dirName); let iterPromise = iterator.forEach( @@ -695,8 +695,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "AppCacheUtils", * we eval the script from the .mozcmd file. This should be a chrome window. */ function loadCommandFile(aFileEntry, aSandboxPrincipal) { - let promise = OS.File.read(aFileEntry.path); - promise = promise.then( + let readPromise = OS.File.read(aFileEntry.path); + readPromise = readPromise.then( function onSuccess(array) { let decoder = new TextDecoder(); let source = decoder.decode(array); diff --git a/browser/devtools/debugger/DebuggerPanel.jsm b/browser/devtools/debugger/DebuggerPanel.jsm index bd25b740f..afac5c7c9 100644 --- a/browser/devtools/debugger/DebuggerPanel.jsm +++ b/browser/devtools/debugger/DebuggerPanel.jsm @@ -12,8 +12,8 @@ this.EXPORTED_SYMBOLS = ["DebuggerPanel"]; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource:///modules/devtools/shared/event-emitter.js"); -XPCOMUtils.defineLazyModuleGetter(this, "Promise", - "resource://gre/modules/commonjs/sdk/core/promise.js"); +XPCOMUtils.defineLazyModuleGetter(this, "promise", + "resource://gre/modules/commonjs/sdk/core/promise.js", "Promise"); this.DebuggerPanel = function DebuggerPanel(iframeWindow, toolbox) { this.panelWin = iframeWindow; @@ -35,19 +35,19 @@ DebuggerPanel.prototype = { * Open is effectively an asynchronous constructor. * * @return object - * A Promise that is resolved when the Debugger completes opening. + * A promise that is resolved when the Debugger completes opening. */ open: function DebuggerPanel_open() { - let promise; + let targetPromise; // Local debugging needs to make the target remote. if (!this.target.isRemote) { - promise = this.target.makeRemote(); + targetPromise = this.target.makeRemote(); } else { - promise = Promise.resolve(this.target); + targetPromise = promise.resolve(this.target); } - return promise + return targetPromise .then(() => this._controller.startupDebugger()) .then(() => this._controller.connect()) .then(() => { @@ -70,7 +70,7 @@ DebuggerPanel.prototype = { this.target.off("thread-paused", this.highlightWhenPaused); this.target.off("thread-resumed", this.unhighlightWhenResumed); this.emit("destroyed"); - return Promise.resolve(null); + return promise.resolve(null); }, // DebuggerPanel API diff --git a/browser/devtools/debugger/debugger-controller.js b/browser/devtools/debugger/debugger-controller.js index a3f86c592..bbb441bcc 100644 --- a/browser/devtools/debugger/debugger-controller.js +++ b/browser/devtools/debugger/debugger-controller.js @@ -17,7 +17,7 @@ const CALL_STACK_PAGE_SIZE = 25; // frames Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/devtools/dbg-client.jsm"); -Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js"); +let promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js").Promise; Cu.import("resource:///modules/source-editor.jsm"); Cu.import("resource:///modules/devtools/LayoutHelpers.jsm"); Cu.import("resource:///modules/devtools/BreadcrumbsWidget.jsm"); @@ -73,7 +73,7 @@ let DebuggerController = { window.removeEventListener("DOMContentLoaded", this.startupDebugger, true); } - let deferred = this._startup = Promise.defer(); + let deferred = this._startup = promise.defer(); DebuggerView.initialize(() => { DebuggerView._isInitialized = true; @@ -108,7 +108,7 @@ let DebuggerController = { window.removeEventListener("unload", this.shutdownDebugger, true); } - let deferred = this._shutdown = Promise.defer(); + let deferred = this._shutdown = promise.defer(); DebuggerView.destroy(() => { DebuggerView._isDestroyed = true; @@ -142,7 +142,7 @@ let DebuggerController = { return this._connection.promise; } - let deferred = this._connection = Promise.defer(); + let deferred = this._connection = promise.defer(); if (!window._isChromeDebugger) { let target = this._target; @@ -1020,7 +1020,7 @@ SourceScripts.prototype = { return aSource._fetched; } - let deferred = Promise.defer(); + let deferred = promise.defer(); aSource._fetched = deferred.promise; // If the source text takes a long time to fetch, invoke a callback. @@ -1053,7 +1053,7 @@ SourceScripts.prototype = { * A promise that is resolved after source texts have been fetched. */ getTextForSources: function(aUrls) { - let deferred = Promise.defer(); + let deferred = promise.defer(); let pending = new Set(aUrls); let fetched = []; diff --git a/browser/devtools/framework/gDevTools.jsm b/browser/devtools/framework/gDevTools.jsm index b0be08002..e53de4fce 100644 --- a/browser/devtools/framework/gDevTools.jsm +++ b/browser/devtools/framework/gDevTools.jsm @@ -11,7 +11,7 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource:///modules/devtools/shared/event-emitter.js"); -Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js"); +let promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js").Promise; Cu.import("resource://gre/modules/devtools/Loader.jsm"); const FORBIDDEN_IDS = new Set(["toolbox", ""]); @@ -185,22 +185,22 @@ DevTools.prototype = { * The toolbox that was opened */ showToolbox: function(target, toolId, hostType) { - let deferred = Promise.defer(); + let deferred = promise.defer(); let toolbox = this._toolboxes.get(target); if (toolbox) { - let promise = (hostType != null && toolbox.hostType != hostType) ? + let hostPromise = (hostType != null && toolbox.hostType != hostType) ? toolbox.switchHost(hostType) : - Promise.resolve(null); + promise.resolve(null); if (toolId != null && toolbox.currentToolId != toolId) { - promise = promise.then(function() { + hostPromise = hostPromise.then(function() { return toolbox.selectTool(toolId); }); } - return promise.then(function() { + return hostPromise.then(function() { toolbox.raise(); return toolbox; }); diff --git a/browser/devtools/framework/sidebar.js b/browser/devtools/framework/sidebar.js index 48e373642..ea247cb96 100644 --- a/browser/devtools/framework/sidebar.js +++ b/browser/devtools/framework/sidebar.js @@ -8,7 +8,7 @@ const {Cu} = require("chrome"); Cu.import("resource://gre/modules/Services.jsm"); -var Promise = require("sdk/core/promise"); +var promise = require("sdk/core/promise"); var EventEmitter = require("devtools/shared/event-emitter"); const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; @@ -202,7 +202,7 @@ ToolSidebar.prototype = { */ destroy: function ToolSidebar_destroy() { if (this._destroyed) { - return Promise.resolve(null); + return promise.resolve(null); } this._destroyed = true; @@ -223,6 +223,6 @@ ToolSidebar.prototype = { this._panelDoc = null; this._toolPanel = null; - return Promise.resolve(null); + return promise.resolve(null); }, } diff --git a/browser/devtools/framework/target.js b/browser/devtools/framework/target.js index d76ec7f98..b42bf7cf0 100644 --- a/browser/devtools/framework/target.js +++ b/browser/devtools/framework/target.js @@ -6,7 +6,7 @@ const {Cc, Ci, Cu} = require("chrome"); -var Promise = require("sdk/core/promise"); +var promise = require("sdk/core/promise"); var EventEmitter = require("devtools/shared/event-emitter"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); @@ -51,13 +51,13 @@ exports.TargetFactory = { * @return A promise of a target object */ forRemoteTab: function TF_forRemoteTab(options) { - let promise = promiseTargets.get(options); - if (promise == null) { + let targetPromise = promiseTargets.get(options); + if (targetPromise == null) { let target = new TabTarget(options); - promise = target.makeRemote().then(() => target); - promiseTargets.set(options, promise); + targetPromise = target.makeRemote().then(() => target); + promiseTargets.set(options, targetPromise); } - return promise; + return targetPromise; }, /** @@ -260,7 +260,7 @@ TabTarget.prototype = { return this._remote.promise; } - this._remote = Promise.defer(); + this._remote = promise.defer(); if (this.isLocalTab) { // Since a remote protocol connection will be made, let's start the @@ -388,7 +388,7 @@ TabTarget.prototype = { return this._destroyer.promise; } - this._destroyer = Promise.defer(); + this._destroyer = promise.defer(); // Before taking any action, notify listeners that destruction is imminent. this.emit("close"); @@ -592,7 +592,7 @@ WindowTarget.prototype = { this._window = null; } - return Promise.resolve(null); + return promise.resolve(null); }, toString: function() { diff --git a/browser/devtools/framework/toolbox-hosts.js b/browser/devtools/framework/toolbox-hosts.js index c3c3556c8..f4ed648b7 100644 --- a/browser/devtools/framework/toolbox-hosts.js +++ b/browser/devtools/framework/toolbox-hosts.js @@ -6,7 +6,7 @@ const {Cu} = require("chrome"); -let Promise = require("sdk/core/promise"); +let promise = require("sdk/core/promise"); let EventEmitter = require("devtools/shared/event-emitter"); Cu.import("resource://gre/modules/Services.jsm"); @@ -44,7 +44,7 @@ BottomHost.prototype = { * Create a box at the bottom of the host tab. */ create: function BH_create() { - let deferred = Promise.defer(); + let deferred = promise.defer(); let gBrowser = this.hostTab.ownerDocument.defaultView.gBrowser; let ownerDocument = gBrowser.ownerDocument; @@ -104,7 +104,7 @@ BottomHost.prototype = { this._nbox.removeChild(this.frame); } - return Promise.resolve(null); + return promise.resolve(null); } } @@ -127,7 +127,7 @@ SidebarHost.prototype = { * Create a box in the sidebar of the host tab. */ create: function SH_create() { - let deferred = Promise.defer(); + let deferred = promise.defer(); let gBrowser = this.hostTab.ownerDocument.defaultView.gBrowser; let ownerDocument = gBrowser.ownerDocument; @@ -185,7 +185,7 @@ SidebarHost.prototype = { this._sidebar.removeChild(this.frame); } - return Promise.resolve(null); + return promise.resolve(null); } } @@ -207,7 +207,7 @@ WindowHost.prototype = { * Create a new xul window to contain the toolbox. */ create: function WH_create() { - let deferred = Promise.defer(); + let deferred = promise.defer(); let flags = "chrome,centerscreen,resizable,dialog=no"; let win = Services.ww.openWindow(null, this.WINDOW_URL, "_blank", @@ -268,7 +268,7 @@ WindowHost.prototype = { this._window.close(); } - return Promise.resolve(null); + return promise.resolve(null); } } diff --git a/browser/devtools/framework/toolbox-options.js b/browser/devtools/framework/toolbox-options.js index 845c33d01..27e63454f 100644 --- a/browser/devtools/framework/toolbox-options.js +++ b/browser/devtools/framework/toolbox-options.js @@ -6,7 +6,7 @@ const {Cu, Cc, Ci} = require("chrome"); -let Promise = require("sdk/core/promise"); +let promise = require("sdk/core/promise"); let EventEmitter = require("devtools/shared/event-emitter"); Cu.import('resource://gre/modules/XPCOMUtils.jsm'); @@ -53,7 +53,7 @@ OptionsPanel.prototype = { }, open: function() { - let deferred = Promise.defer(); + let deferred = promise.defer(); this.setupToolsList(); this.populatePreferences(); diff --git a/browser/devtools/framework/toolbox.js b/browser/devtools/framework/toolbox.js index d6999d528..5315a7981 100644 --- a/browser/devtools/framework/toolbox.js +++ b/browser/devtools/framework/toolbox.js @@ -6,7 +6,7 @@ const {Cc, Ci, Cu} = require("chrome"); const MAX_ORDINAL = 99; -let Promise = require("sdk/core/promise"); +let promise = require("sdk/core/promise"); let EventEmitter = require("devtools/shared/event-emitter"); Cu.import('resource://gre/modules/XPCOMUtils.jsm'); @@ -189,7 +189,7 @@ Toolbox.prototype = { * Open the toolbox */ open: function TBOX_open() { - let deferred = Promise.defer(); + let deferred = promise.defer(); this._host.create().then(iframe => { let domReady = () => { @@ -420,7 +420,7 @@ Toolbox.prototype = { * The id of the tool to load. */ loadTool: function TBOX_loadTool(id) { - let deferred = Promise.defer(); + let deferred = promise.defer(); let iframe = this.doc.getElementById("toolbox-panel-iframe-" + id); if (iframe) { @@ -454,7 +454,7 @@ Toolbox.prototype = { iframe.removeEventListener("DOMContentLoaded", onLoad, true); let built = definition.build(iframe.contentWindow, this); - Promise.resolve(built).then((panel) => { + promise.resolve(built).then((panel) => { this._toolPanels.set(id, panel); this.emit(id + "-ready", panel); gDevTools.emit(id + "-ready", this, panel); @@ -485,7 +485,7 @@ Toolbox.prototype = { if (this._currentToolId == id) { // Return the existing panel in order to have a consistent return value. - return Promise.resolve(this._toolPanels.get(id)); + return promise.resolve(this._toolPanels.get(id)); } if (!this.isReady) { @@ -722,7 +722,7 @@ Toolbox.prototype = { // Assign the "_destroyer" property before calling the other // destroyer methods to guarantee that the Toolbox's destroy // method is only executed once. - let deferred = Promise.defer(); + let deferred = promise.defer(); this._destroyer = deferred.promise; this._target.off("navigate", this._refreshHostTitle); @@ -761,7 +761,7 @@ Toolbox.prototype = { } this._target = null; - Promise.all(outstanding).then(function() { + promise.all(outstanding).then(function() { this.emit("destroyed"); // Free _host after the call to destroyed in order to let a chance // to destroyed listeners to still query toolbox attributes diff --git a/browser/devtools/inspector/inspector-panel.js b/browser/devtools/inspector/inspector-panel.js index 5d809cfa0..33e7a5db3 100644 --- a/browser/devtools/inspector/inspector-panel.js +++ b/browser/devtools/inspector/inspector-panel.js @@ -8,7 +8,7 @@ const {Cc, Ci, Cu, Cr} = require("chrome"); Cu.import("resource://gre/modules/Services.jsm"); -let Promise = require("sdk/core/promise"); +let promise = require("sdk/core/promise"); let EventEmitter = require("devtools/shared/event-emitter"); let {CssLogic} = require("devtools/styleinspector/css-logic"); @@ -44,7 +44,7 @@ InspectorPanel.prototype = { * open is effectively an asynchronous constructor */ open: function InspectorPanel_open() { - let deferred = Promise.defer(); + let deferred = promise.defer(); this.onNavigatedAway = this.onNavigatedAway.bind(this); this.target.on("navigate", this.onNavigatedAway); @@ -325,7 +325,7 @@ InspectorPanel.prototype = { */ destroy: function InspectorPanel__destroy() { if (this._destroyed) { - return Promise.resolve(null); + return promise.resolve(null); } this._destroyed = true; @@ -374,7 +374,7 @@ InspectorPanel.prototype = { this.nodemenu = null; this.highlighter = null; - return Promise.resolve(null); + return promise.resolve(null); }, /** diff --git a/browser/devtools/netmonitor/NetMonitorPanel.jsm b/browser/devtools/netmonitor/NetMonitorPanel.jsm index 4f778bae1..fb1f4ab4b 100644 --- a/browser/devtools/netmonitor/NetMonitorPanel.jsm +++ b/browser/devtools/netmonitor/NetMonitorPanel.jsm @@ -12,8 +12,8 @@ this.EXPORTED_SYMBOLS = ["NetMonitorPanel"]; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource:///modules/devtools/shared/event-emitter.js"); -XPCOMUtils.defineLazyModuleGetter(this, "Promise", - "resource://gre/modules/commonjs/sdk/core/promise.js"); +XPCOMUtils.defineLazyModuleGetter(this, "promise", + "resource://gre/modules/commonjs/sdk/core/promise.js", "Promise"); this.NetMonitorPanel = function NetMonitorPanel(iframeWindow, toolbox) { this.panelWin = iframeWindow; @@ -31,19 +31,19 @@ NetMonitorPanel.prototype = { * Open is effectively an asynchronous constructor. * * @return object - * A Promise that is resolved when the NetMonitor completes opening. + * A promise that is resolved when the NetMonitor completes opening. */ open: function() { - let promise; + let targetPromise; // Local monitoring needs to make the target remote. if (!this.target.isRemote) { - promise = this.target.makeRemote(); + targetPromise = this.target.makeRemote(); } else { - promise = Promise.resolve(this.target); + targetPromise = promise.resolve(this.target); } - return promise + return targetPromise .then(() => this._controller.startupNetMonitor()) .then(() => this._controller.connect()) .then(() => { diff --git a/browser/devtools/netmonitor/netmonitor-controller.js b/browser/devtools/netmonitor/netmonitor-controller.js index 72e7a8a70..a4733c048 100644 --- a/browser/devtools/netmonitor/netmonitor-controller.js +++ b/browser/devtools/netmonitor/netmonitor-controller.js @@ -9,7 +9,7 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components; Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js"); +let promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js").Promise; Cu.import("resource:///modules/source-editor.jsm"); Cu.import("resource:///modules/devtools/shared/event-emitter.js"); Cu.import("resource:///modules/devtools/SideMenuWidget.jsm"); @@ -42,7 +42,7 @@ let NetMonitorController = { } this._isInitialized = true; - let deferred = this._startup = Promise.defer(); + let deferred = this._startup = promise.defer(); NetMonitorView.initialize(() => { NetMonitorView._isInitialized = true; @@ -65,7 +65,7 @@ let NetMonitorController = { this._isDestroyed = true; this._startup = null; - let deferred = this._shutdown = Promise.defer(); + let deferred = this._shutdown = promise.defer(); NetMonitorView.destroy(() => { NetMonitorView._isDestroyed = true; @@ -91,7 +91,7 @@ let NetMonitorController = { return this._connection.promise; } - let deferred = this._connection = Promise.defer(); + let deferred = this._connection = promise.defer(); let target = this._target; let { client, form } = target; @@ -493,14 +493,14 @@ NetworkEventsHandler.prototype = { getString: function(aStringGrip) { // Make sure this is a long string. if (typeof aStringGrip != "object" || aStringGrip.type != "longString") { - return Promise.resolve(aStringGrip); // Go home string, you're drunk. + return promise.resolve(aStringGrip); // Go home string, you're drunk. } // Fetch the long string only once. if (aStringGrip._fullText) { return aStringGrip._fullText.promise; } - let deferred = aStringGrip._fullText = Promise.defer(); + let deferred = aStringGrip._fullText = promise.defer(); let { actor, initial, length } = aStringGrip; let longStringClient = this.webConsoleClient.longString(aStringGrip); diff --git a/browser/devtools/netmonitor/netmonitor-view.js b/browser/devtools/netmonitor/netmonitor-view.js index b8437dc6b..42b2ce0cf 100644 --- a/browser/devtools/netmonitor/netmonitor-view.js +++ b/browser/devtools/netmonitor/netmonitor-view.js @@ -175,7 +175,7 @@ let NetMonitorView = { * @param string aId * The id of the editor placeholder node. * @return object - * A Promise that is resolved when the editor is available. + * A promise that is resolved when the editor is available. */ editor: function(aId) { dumpn("Getting a NetMonitorView editor: " + aId); @@ -184,7 +184,7 @@ let NetMonitorView = { return this._editorPromises.get(aId); } - let deferred = Promise.defer(); + let deferred = promise.defer(); this._editorPromises.set(aId, deferred.promise); // Initialize the source editor and store the newly created instance diff --git a/browser/devtools/scratchpad/scratchpad.js b/browser/devtools/scratchpad/scratchpad.js index 816c7aa31..bedbe95c2 100644 --- a/browser/devtools/scratchpad/scratchpad.js +++ b/browser/devtools/scratchpad/scratchpad.js @@ -27,7 +27,7 @@ Cu.import("resource:///modules/devtools/scratchpad-manager.jsm"); Cu.import("resource://gre/modules/jsdebugger.jsm"); Cu.import("resource:///modules/devtools/gDevTools.jsm"); Cu.import("resource://gre/modules/osfile.jsm"); -Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js"); +let promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js").Promise; XPCOMUtils.defineLazyModuleGetter(this, "VariablesView", "resource:///modules/devtools/VariablesView.jsm"); @@ -382,7 +382,7 @@ var Scratchpad = { */ evalForContext: function SP_evaluateForContext(aString) { - let deferred = Promise.defer(); + let deferred = promise.defer(); // This setTimeout is temporary and will be replaced by DebuggerClient // execution in a future patch (bug 825039). The purpose for using @@ -427,8 +427,8 @@ var Scratchpad = { */ run: function SP_run() { - let promise = this.execute(); - promise.then(([, aError, ]) => { + let execPromise = this.execute(); + execPromise.then(([, aError, ]) => { if (aError) { this.writeAsErrorComment(aError); } @@ -436,7 +436,7 @@ var Scratchpad = { this.deselect(); } }); - return promise; + return execPromise; }, /** @@ -449,7 +449,7 @@ var Scratchpad = { */ inspect: function SP_inspect() { - let deferred = Promise.defer(); + let deferred = promise.defer(); let reject = aReason => deferred.reject(aReason); this.execute().then(([aString, aError, aResult]) => { @@ -482,7 +482,7 @@ var Scratchpad = { */ reloadAndRun: function SP_reloadAndRun() { - let deferred = Promise.defer(); + let deferred = promise.defer(); if (this.executionContext !== SCRATCHPAD_CONTEXT_CONTENT) { Cu.reportError(this.strings. @@ -519,8 +519,8 @@ var Scratchpad = { */ display: function SP_display() { - let promise = this.execute(); - promise.then(([aString, aError, aResult]) => { + let execPromise = this.execute(); + execPromise.then(([aString, aError, aResult]) => { if (aError) { this.writeAsErrorComment(aError); } @@ -528,7 +528,7 @@ var Scratchpad = { this.writeAsComment(aResult); } }); - return promise; + return execPromise; }, /** @@ -618,8 +618,8 @@ var Scratchpad = { let encoder = new TextEncoder(); let buffer = encoder.encode(this.getText()); - let promise = OS.File.writeAtomic(aFile.path, buffer,{tmpPath: aFile.path + ".tmp"}); - promise.then(value => { + let writePromise = OS.File.writeAtomic(aFile.path, buffer,{tmpPath: aFile.path + ".tmp"}); + writePromise.then(value => { if (aCallback) { aCallback.call(this, Components.results.NS_OK); } @@ -1512,7 +1512,7 @@ ScratchpadSidebar.prototype = { { this.show(); - let deferred = Promise.defer(); + let deferred = promise.defer(); let onTabReady = () => { if (!this.variablesView) { @@ -1570,7 +1570,7 @@ ScratchpadSidebar.prototype = { */ _update: function SS__update(aObject) { - let deferred = Promise.defer(); + let deferred = promise.defer(); this.variablesView.rawObject = aObject; diff --git a/browser/devtools/shared/AppCacheUtils.jsm b/browser/devtools/shared/AppCacheUtils.jsm index 0c3579084..debfd926a 100644 --- a/browser/devtools/shared/AppCacheUtils.jsm +++ b/browser/devtools/shared/AppCacheUtils.jsm @@ -29,7 +29,7 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components; let { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {}); let { Services } = Cu.import("resource://gre/modules/Services.jsm", {}); -let { Promise } = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {}); +let { Promise: promise } = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {}); this.EXPORTED_SYMBOLS = ["AppCacheUtils"]; @@ -52,7 +52,7 @@ AppCacheUtils.prototype = { }, validateManifest: function ACU_validateManifest() { - let deferred = Promise.defer(); + let deferred = promise.defer(); this.errors = []; // Check for missing manifest. this._getManifestURI().then(manifestURI => { @@ -78,7 +78,7 @@ AppCacheUtils.prototype = { }, _parseManifest: function ACU__parseManifest(uriInfo) { - let deferred = Promise.defer(); + let deferred = promise.defer(); let manifestName = uriInfo.name; let manifestLastModified = new Date(uriInfo.responseHeaders["Last-Modified"]); @@ -181,7 +181,7 @@ AppCacheUtils.prototype = { _getURIInfo: function ACU__getURIInfo(uri) { let inputStream = Cc["@mozilla.org/scriptableinputstream;1"] .createInstance(Ci.nsIScriptableInputStream); - let deferred = Promise.defer(); + let deferred = promise.defer(); let channelCharset = ""; let buffer = ""; let channel = Services.io.newChannel(uri, null, null); @@ -318,7 +318,7 @@ AppCacheUtils.prototype = { }, _getManifestURI: function ACU__getManifestURI() { - let deferred = Promise.defer(); + let deferred = promise.defer(); let getURI = node => { let htmlNode = this.doc.querySelector("html[manifest]"); @@ -331,7 +331,7 @@ AppCacheUtils.prototype = { if (this.doc) { let uri = getURI(this.doc); - return Promise.resolve(uri); + return promise.resolve(uri); } else { this._getURIInfo(this.uri).then(uriInfo => { if (uriInfo.success) { diff --git a/browser/devtools/shared/widgets/VariablesView.jsm b/browser/devtools/shared/widgets/VariablesView.jsm index 7a4d5531b..cc2c575ec 100644 --- a/browser/devtools/shared/widgets/VariablesView.jsm +++ b/browser/devtools/shared/widgets/VariablesView.jsm @@ -21,7 +21,7 @@ Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource:///modules/devtools/ViewHelpers.jsm"); Cu.import("resource:///modules/devtools/shared/event-emitter.js"); -Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js"); +let promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js").Promise; XPCOMUtils.defineLazyModuleGetter(this, "NetworkHelper", "resource://gre/modules/devtools/NetworkHelper.jsm"); diff --git a/browser/devtools/shared/widgets/VariablesViewController.jsm b/browser/devtools/shared/widgets/VariablesViewController.jsm index 56704b2d2..92f6f836f 100644 --- a/browser/devtools/shared/widgets/VariablesViewController.jsm +++ b/browser/devtools/shared/widgets/VariablesViewController.jsm @@ -9,7 +9,7 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components; Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js"); +let promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js").Promise; Cu.import("resource:///modules/devtools/VariablesView.jsm"); Cu.import("resource:///modules/devtools/ViewHelpers.jsm"); Cu.import("resource://gre/modules/devtools/WebConsoleUtils.jsm"); @@ -88,7 +88,7 @@ VariablesViewController.prototype = { * The promise that will be resolved when the string is retrieved. */ _populateFromLongString: function(aTarget, aGrip){ - let deferred = Promise.defer(); + let deferred = promise.defer(); let from = aGrip.initial.length; let to = Math.min(aGrip.length, MAX_LONG_STRING_LENGTH); @@ -120,7 +120,7 @@ VariablesViewController.prototype = { * The grip to use to populate the target. */ _populateFromObject: function(aTarget, aGrip) { - let deferred = Promise.defer(); + let deferred = promise.defer(); this._getGripClient(aGrip).getPrototypeAndProperties(aResponse => { let { ownProperties, prototype, safeGetterValues } = aResponse; @@ -235,7 +235,7 @@ VariablesViewController.prototype = { return aTarget._fetched; } - let deferred = Promise.defer(); + let deferred = promise.defer(); aTarget._fetched = deferred.promise; if (!aSource) { diff --git a/browser/devtools/styleeditor/StyleEditorDebuggee.jsm b/browser/devtools/styleeditor/StyleEditorDebuggee.jsm index 48c346dd9..e0c6a6cf4 100644 --- a/browser/devtools/styleeditor/StyleEditorDebuggee.jsm +++ b/browser/devtools/styleeditor/StyleEditorDebuggee.jsm @@ -14,8 +14,8 @@ Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource:///modules/devtools/shared/event-emitter.js"); -XPCOMUtils.defineLazyModuleGetter(this, "Promise", - "resource://gre/modules/commonjs/sdk/core/promise.js"); +XPCOMUtils.defineLazyModuleGetter(this, "promise", + "resource://gre/modules/commonjs/sdk/core/promise.js", "Promise"); /** * A StyleEditorDebuggee represents the document the style editor is debugging. diff --git a/browser/devtools/styleeditor/StyleEditorPanel.jsm b/browser/devtools/styleeditor/StyleEditorPanel.jsm index 783dfe84d..dcfe00709 100644 --- a/browser/devtools/styleeditor/StyleEditorPanel.jsm +++ b/browser/devtools/styleeditor/StyleEditorPanel.jsm @@ -10,7 +10,7 @@ this.EXPORTED_SYMBOLS = ["StyleEditorPanel"]; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js"); +let promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js").Promise; Cu.import("resource:///modules/devtools/shared/event-emitter.js"); Cu.import("resource:///modules/devtools/StyleEditorDebuggee.jsm"); Cu.import("resource:///modules/devtools/StyleEditorUI.jsm"); @@ -41,17 +41,17 @@ StyleEditorPanel.prototype = { * open is effectively an asynchronous constructor */ open: function() { - let deferred = Promise.defer(); + let deferred = promise.defer(); - let promise; + let targetPromise; // We always interact with the target as if it were remote if (!this.target.isRemote) { - promise = this.target.makeRemote(); + targetPromise = this.target.makeRemote(); } else { - promise = Promise.resolve(this.target); + targetPromise = promise.resolve(this.target); } - promise.then(() => { + targetPromise.then(() => { this.target.on("close", this.destroy); this._debuggee = new StyleEditorDebuggee(this.target); @@ -119,7 +119,7 @@ StyleEditorPanel.prototype = { this.UI.destroy(); } - return Promise.resolve(null); + return promise.resolve(null); }, } diff --git a/browser/devtools/styleeditor/StyleEditorUI.jsm b/browser/devtools/styleeditor/StyleEditorUI.jsm index d6d41d1fc..7e1f8dcda 100644 --- a/browser/devtools/styleeditor/StyleEditorUI.jsm +++ b/browser/devtools/styleeditor/StyleEditorUI.jsm @@ -14,7 +14,7 @@ const Cu = Components.utils; Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/PluralForm.jsm"); Cu.import("resource://gre/modules/NetUtil.jsm"); -Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js"); +let promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js").Promise; Cu.import("resource:///modules/devtools/shared/event-emitter.js"); Cu.import("resource:///modules/devtools/StyleEditorUtil.jsm"); Cu.import("resource:///modules/devtools/SplitView.jsm"); diff --git a/browser/devtools/styleeditor/StyleSheetEditor.jsm b/browser/devtools/styleeditor/StyleSheetEditor.jsm index 0ede23446..0936a817d 100644 --- a/browser/devtools/styleeditor/StyleSheetEditor.jsm +++ b/browser/devtools/styleeditor/StyleSheetEditor.jsm @@ -11,7 +11,7 @@ const Cc = Components.classes; const Ci = Components.interfaces; const Cu = Components.utils; -Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js"); +let promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js").Promise; Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/FileUtils.jsm"); Cu.import("resource://gre/modules/NetUtil.jsm"); @@ -241,10 +241,10 @@ StyleSheetEditor.prototype = { * Promise that will resolve with the editor. */ getSourceEditor: function() { - let deferred = Promise.defer(); + let deferred = promise.defer(); if (this.sourceEditor) { - return Promise.resolve(this); + return promise.resolve(this); } this.on("source-editor-load", (event) => { deferred.resolve(this); diff --git a/browser/devtools/webconsole/HUDService.jsm b/browser/devtools/webconsole/HUDService.jsm index 74882670c..3eb54073b 100644 --- a/browser/devtools/webconsole/HUDService.jsm +++ b/browser/devtools/webconsole/HUDService.jsm @@ -30,8 +30,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "DebuggerClient", XPCOMUtils.defineLazyModuleGetter(this, "WebConsoleUtils", "resource://gre/modules/devtools/WebConsoleUtils.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Promise", - "resource://gre/modules/commonjs/sdk/core/promise.js"); +XPCOMUtils.defineLazyModuleGetter(this, "promise", + "resource://gre/modules/commonjs/sdk/core/promise.js", "Promise"); XPCOMUtils.defineLazyModuleGetter(this, "Heritage", "resource:///modules/devtools/ViewHelpers.jsm"); @@ -92,7 +92,7 @@ HUD_SERVICE.prototype = * @param nsIDOMWindow aChromeWindow * The window of the web console owner. * @return object - * A Promise object for the opening of the new WebConsole instance. + * A promise object for the opening of the new WebConsole instance. */ openWebConsole: function HS_openWebConsole(aTarget, aIframeWindow, aChromeWindow) @@ -114,7 +114,7 @@ HUD_SERVICE.prototype = * @param nsIDOMWindow aChromeWindow * The window of the browser console owner. * @return object - * A Promise object for the opening of the new BrowserConsole instance. + * A promise object for the opening of the new BrowserConsole instance. */ openBrowserConsole: function HS_openBrowserConsole(aTarget, aIframeWindow, aChromeWindow) @@ -252,7 +252,7 @@ WebConsole.prototype = { * Initialize the Web Console instance. * * @return object - * A Promise for the initialization. + * A promise for the initialization. */ init: function WC_init() { @@ -461,7 +461,7 @@ WebConsole.prototype = { * Console is closed. * * @return object - * A Promise object that is resolved once the Web Console is closed. + * A promise object that is resolved once the Web Console is closed. */ destroy: function WC_destroy() { @@ -471,7 +471,7 @@ WebConsole.prototype = { delete HUDService.hudReferences[this.hudId]; - this._destroyer = Promise.defer(); + this._destroyer = promise.defer(); let popupset = this.mainPopupSet; let panels = popupset.querySelectorAll("panel[hudId=" + this.hudId + "]"); @@ -539,7 +539,7 @@ BrowserConsole.prototype = Heritage.extend(WebConsole.prototype, * Initialize the Browser Console instance. * * @return object - * A Promise for the initialization. + * A promise for the initialization. */ init: function BC_init() { @@ -580,7 +580,7 @@ BrowserConsole.prototype = Heritage.extend(WebConsole.prototype, return this._bc_destroyer.promise; } - this._bc_destroyer = Promise.defer(); + this._bc_destroyer = promise.defer(); let chromeWindow = this.chromeWindow; this.$destroy().then(() => @@ -607,8 +607,8 @@ var HeadsUpDisplayUICommands = { * Toggle the Web Console for the current tab. * * @return object - * A Promise for either the opening of the toolbox that holds the Web - * Console, or a Promise for the closing of the toolbox. + * A promise for either the opening of the toolbox that holds the Web + * Console, or a promise for the closing of the toolbox. */ toggleHUD: function UIC_toggleHUD() { @@ -654,11 +654,11 @@ var HeadsUpDisplayUICommands = { return this._browserConsoleDefer.promise; } - this._browserConsoleDefer = Promise.defer(); + this._browserConsoleDefer = promise.defer(); function connect() { - let deferred = Promise.defer(); + let deferred = promise.defer(); if (!DebuggerServer.initialized) { DebuggerServer.init(); @@ -700,7 +700,7 @@ var HeadsUpDisplayUICommands = { { target = aTarget; - let deferred = Promise.defer(); + let deferred = promise.defer(); let win = Services.ww.openWindow(null, devtools.Tools.webConsole.url, "_blank", BROWSER_CONSOLE_WINDOW_FEATURES, null); diff --git a/browser/devtools/webconsole/WebConsolePanel.jsm b/browser/devtools/webconsole/WebConsolePanel.jsm index c170d91f2..03f421b42 100644 --- a/browser/devtools/webconsole/WebConsolePanel.jsm +++ b/browser/devtools/webconsole/WebConsolePanel.jsm @@ -10,8 +10,8 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Promise", - "resource://gre/modules/commonjs/sdk/core/promise.js"); +XPCOMUtils.defineLazyModuleGetter(this, "promise", + "resource://gre/modules/commonjs/sdk/core/promise.js", "Promise"); XPCOMUtils.defineLazyModuleGetter(this, "HUDService", "resource:///modules/HUDService.jsm"); @@ -35,7 +35,7 @@ WebConsolePanel.prototype = { * Open is effectively an asynchronous constructor. * * @return object - * A Promise that is resolved when the Web Console completes opening. + * A promise that is resolved when the Web Console completes opening. */ open: function WCP_open() { @@ -44,7 +44,7 @@ WebConsolePanel.prototype = { iframe.className = "web-console-frame"; // Make sure the iframe content window is ready. - let deferredIframe = Promise.defer(); + let deferredIframe = promise.defer(); let win, doc; if ((win = iframe.contentWindow) && (doc = win.document) && @@ -64,7 +64,7 @@ WebConsolePanel.prototype = { promiseTarget = this.target.makeRemote(); } else { - promiseTarget = Promise.resolve(this.target); + promiseTarget = promise.resolve(this.target); } // 1. Wait for the iframe to load. diff --git a/browser/devtools/webconsole/webconsole.js b/browser/devtools/webconsole/webconsole.js index e0ccc5a77..e9a5b277e 100644 --- a/browser/devtools/webconsole/webconsole.js +++ b/browser/devtools/webconsole/webconsole.js @@ -31,8 +31,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "AutocompletePopup", XPCOMUtils.defineLazyModuleGetter(this, "WebConsoleUtils", "resource://gre/modules/devtools/WebConsoleUtils.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Promise", - "resource://gre/modules/commonjs/sdk/core/promise.js"); +XPCOMUtils.defineLazyModuleGetter(this, "promise", + "resource://gre/modules/commonjs/sdk/core/promise.js", "Promise"); XPCOMUtils.defineLazyModuleGetter(this, "VariablesView", "resource:///modules/devtools/VariablesView.jsm"); @@ -239,7 +239,7 @@ WebConsoleFrame.prototype = { get popupset() this.owner.mainPopupSet, /** - * Holds the initialization Promise object. + * Holds the initialization promise object. * @private * @type object */ @@ -367,7 +367,7 @@ WebConsoleFrame.prototype = { */ getSaveRequestAndResponseBodies: function WCF_getSaveRequestAndResponseBodies() { - let deferred = Promise.defer(); + let deferred = promise.defer(); let toGet = [ "NetworkMonitor.saveRequestAndResponseBodies" ]; @@ -394,7 +394,7 @@ WebConsoleFrame.prototype = { */ setSaveRequestAndResponseBodies: function WCF_setSaveRequestAndResponseBodies(aValue) { - let deferred = Promise.defer(); + let deferred = promise.defer(); let newValue = !!aValue; let toSet = { "NetworkMonitor.saveRequestAndResponseBodies": newValue, @@ -453,7 +453,7 @@ WebConsoleFrame.prototype = { return this._initDefer.promise; } - this._initDefer = Promise.defer(); + this._initDefer = promise.defer(); this.proxy = new WebConsoleConnectionProxy(this, this.owner.target); this.proxy.connect().then(() => { // on success @@ -2733,7 +2733,7 @@ WebConsoleFrame.prototype = { * when the Web Console is closed. * * @return object - * A Promise that is resolved when the WebConsoleFrame instance is + * A promise that is resolved when the WebConsoleFrame instance is * destroyed. */ destroy: function WCF_destroy() @@ -2742,7 +2742,7 @@ WebConsoleFrame.prototype = { return this._destroyer.promise; } - this._destroyer = Promise.defer(); + this._destroyer = promise.defer(); this._repeatNodes = {}; this._outputQueue = []; @@ -3140,12 +3140,12 @@ JSTerm.prototype = { * If you do not provide a |frame| the string will be evaluated in the * global content window. * @return object - * A Promise object that is resolved when the server response is + * A promise object that is resolved when the server response is * received. */ requestEvaluation: function JST_requestEvaluation(aString, aOptions = {}) { - let deferred = Promise.defer(); + let deferred = promise.defer(); function onResult(aResponse) { if (!aResponse.error) { @@ -3214,7 +3214,7 @@ JSTerm.prototype = { * - autofocus: optional boolean, |true| if you want to give focus to * the variables view window after open, |false| otherwise. * @return object - * A Promise object that is resolved when the variables view has + * A promise object that is resolved when the variables view has * opened. The new variables view instance is given to the callbacks. */ openVariablesView: function JST_openVariablesView(aOptions) @@ -3244,10 +3244,10 @@ JSTerm.prototype = { return view; }; - let promise; + let openPromise; if (aOptions.targetElement) { - let deferred = Promise.defer(); - promise = deferred.promise; + let deferred = promise.defer(); + openPromise = deferred.promise; let document = aOptions.targetElement.ownerDocument; let iframe = document.createElement("iframe"); @@ -3264,10 +3264,10 @@ JSTerm.prototype = { if (!this.sidebar) { this._createSidebar(); } - promise = this._addVariablesViewSidebarTab(); + openPromise = this._addVariablesViewSidebarTab(); } - return promise.then(onContainerReady); + return openPromise.then(onContainerReady); }, /** @@ -3289,11 +3289,11 @@ JSTerm.prototype = { * * @private * @return object - * A Promise object for the adding of the new tab. + * A promise object for the adding of the new tab. */ _addVariablesViewSidebarTab: function JST__addVariablesViewSidebarTab() { - let deferred = Promise.defer(); + let deferred = promise.defer(); let onTabReady = () => { let window = this.sidebar.getWindowForTab("variablesview"); @@ -4660,7 +4660,7 @@ WebConsoleConnectionProxy.prototype = { * Initialize a debugger client and connect it to the debugger server. * * @return object - * A Promise object that is resolved/rejected based on the success of + * A promise object that is resolved/rejected based on the success of * the connection initialization. */ connect: function WCCP_connect() @@ -4669,15 +4669,15 @@ WebConsoleConnectionProxy.prototype = { return this._connectDefer.promise; } - this._connectDefer = Promise.defer(); + this._connectDefer = promise.defer(); let timeout = Services.prefs.getIntPref(PREF_CONNECTION_TIMEOUT); this._connectTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); this._connectTimer.initWithCallback(this._connectionTimeout, timeout, Ci.nsITimer.TYPE_ONE_SHOT); - let promise = this._connectDefer.promise; - promise.then(function _onSucess() { + let connPromise = this._connectDefer.promise; + connPromise.then(function _onSucess() { this._connectTimer.cancel(); this._connectTimer = null; }.bind(this), function _onFailure() { @@ -4703,7 +4703,7 @@ WebConsoleConnectionProxy.prototype = { } this._attachConsole(); - return promise; + return connPromise; }, /** @@ -4776,7 +4776,7 @@ WebConsoleConnectionProxy.prototype = { } if (!this._connectTimer) { - // This happens if the Promise is rejected (eg. a timeout), but the + // This happens if the promise is rejected (eg. a timeout), but the // connection attempt is successful, nonetheless. Cu.reportError("Web Console getCachedMessages error: invalid state."); } @@ -4958,7 +4958,7 @@ WebConsoleConnectionProxy.prototype = { * Disconnect the Web Console from the remote server. * * @return object - * A Promise object that is resolved when disconnect completes. + * A promise object that is resolved when disconnect completes. */ disconnect: function WCCP_disconnect() { @@ -4966,7 +4966,7 @@ WebConsoleConnectionProxy.prototype = { return this._disconnecter.promise; } - this._disconnecter = Promise.defer(); + this._disconnecter = promise.defer(); if (!this.client) { this._disconnecter.resolve(null); |