Bug 1387123 - Replace all usages of require(promise).defer by require(devtools/shared/defer).defer. r=tromey

In prevision of Promise.jsm removal, use defer helper module instead of Promise.jsm
as that's the only one feature that DOM Promise don't support.

PART2: Substitutes promise.defer usages with defer
$ sed -i 's/promise.defer/defer/gI' $(egrep -lir "promise.defer\(\)" devtools)
  Reset modification to the following files as they are using deprecated syncable promises as we don't want to touch them.
  http://searchfox.org/mozilla-central/search?q=deprecated-sync-thenables&case=true&regexp=false&path=
$ git checkout devtools/client/debugger/test/mochitest/
$ git checkout devtools/shared/client/main.js
$ git checkout devtools/client/debugger/
$ git checkout devtools/server/main.js

MozReview-Commit-ID: DGN5ae68wtn

--HG--
extra : rebase_source : 57602d89b0bcc1c905bee7723e30f87fa434c6d9
This commit is contained in:
Alexandre Poirot 2017-08-08 15:24:04 +02:00
Родитель 2bd76261bb
Коммит a8c68f2955
100 изменённых файлов: 188 добавлений и 188 удалений

Просмотреть файл

@ -79,7 +79,7 @@ function* ifTestingSupported() {
} }
function waitForMozSetImageElement(panel) { function waitForMozSetImageElement(panel) {
let deferred = promise.defer(); let deferred = defer();
panel._onMozSetImageElement = deferred.resolve; panel._onMozSetImageElement = deferred.resolve;
return deferred.promise; return deferred.promise;
} }

Просмотреть файл

@ -73,7 +73,7 @@ function loadFrameScripts() {
function addTab(aUrl, aWindow) { function addTab(aUrl, aWindow) {
info("Adding tab: " + aUrl); info("Adding tab: " + aUrl);
let deferred = promise.defer(); let deferred = defer();
let targetWindow = aWindow || window; let targetWindow = aWindow || window;
let targetBrowser = targetWindow.gBrowser; let targetBrowser = targetWindow.gBrowser;
@ -93,7 +93,7 @@ function addTab(aUrl, aWindow) {
function removeTab(aTab, aWindow) { function removeTab(aTab, aWindow) {
info("Removing tab."); info("Removing tab.");
let deferred = promise.defer(); let deferred = defer();
let targetWindow = aWindow || window; let targetWindow = aWindow || window;
let targetBrowser = targetWindow.gBrowser; let targetBrowser = targetWindow.gBrowser;
let tabContainer = targetBrowser.tabContainer; let tabContainer = targetBrowser.tabContainer;
@ -149,7 +149,7 @@ function isTestingSupported() {
function once(aTarget, aEventName, aUseCapture = false) { function once(aTarget, aEventName, aUseCapture = false) {
info("Waiting for event: '" + aEventName + "' on " + aTarget + "."); info("Waiting for event: '" + aEventName + "' on " + aTarget + ".");
let deferred = promise.defer(); let deferred = defer();
for (let [add, remove] of [ for (let [add, remove] of [
["on", "off"], // Use event emitter before DOM events for consistency ["on", "off"], // Use event emitter before DOM events for consistency
@ -170,7 +170,7 @@ function once(aTarget, aEventName, aUseCapture = false) {
} }
function waitForTick() { function waitForTick() {
let deferred = promise.defer(); let deferred = defer();
executeSoon(deferred.resolve); executeSoon(deferred.resolve);
return deferred.promise; return deferred.promise;
} }
@ -257,7 +257,7 @@ function teardown({target}) {
* in potentially a different process. * in potentially a different process.
*/ */
function evalInDebuggee(script) { function evalInDebuggee(script) {
let deferred = promise.defer(); let deferred = defer();
if (!mm) { if (!mm) {
throw new Error("`loadFrameScripts()` must be called when using MessageManager."); throw new Error("`loadFrameScripts()` must be called when using MessageManager.");
@ -296,7 +296,7 @@ function* waitUntil(predicate, interval = 10) {
if (yield predicate()) { if (yield predicate()) {
return Promise.resolve(true); return Promise.resolve(true);
} }
let deferred = Promise.defer(); let deferred = defer();
setTimeout(function () { setTimeout(function () {
waitUntil(predicate).then(() => deferred.resolve(true)); waitUntil(predicate).then(() => deferred.resolve(true));
}, interval); }, interval);

Просмотреть файл

@ -43,7 +43,7 @@ DomPanel.prototype = {
return this._opening; return this._opening;
} }
let deferred = promise.defer(); let deferred = defer();
this._opening = deferred.promise; this._opening = deferred.promise;
// Local monitoring needs to make the target remote. // Local monitoring needs to make the target remote.
@ -83,7 +83,7 @@ DomPanel.prototype = {
return this._destroying; return this._destroying;
} }
let deferred = promise.defer(); let deferred = defer();
this._destroying = deferred.promise; this._destroying = deferred.promise;
this.target.off("navigate", this.onTabNavigated); this.target.off("navigate", this.onTabNavigated);

Просмотреть файл

@ -35,7 +35,7 @@ registerCleanupFunction(() => {
function addJsonViewTab(url, timeout = -1) { function addJsonViewTab(url, timeout = -1) {
info("Adding a new JSON tab with URL: '" + url + "'"); info("Adding a new JSON tab with URL: '" + url + "'");
let deferred = promise.defer(); let deferred = defer();
addTab(url).then(tab => { addTab(url).then(tab => {
let browser = tab.linkedBrowser; let browser = tab.linkedBrowser;
@ -151,7 +151,7 @@ function sendString(str, selector) {
} }
function waitForTime(delay) { function waitForTime(delay) {
let deferred = promise.defer(); let deferred = defer();
setTimeout(deferred.resolve, delay); setTimeout(deferred.resolve, delay);
return deferred.promise; return deferred.promise;
} }

Просмотреть файл

@ -220,7 +220,7 @@ GraphsController.prototype = {
return; return;
} }
this._rendering = promise.defer(); this._rendering = defer();
for (let graph of (yield this._getEnabled())) { for (let graph of (yield this._getEnabled())) {
yield graph.setPerformanceData(recordingData, resolution); yield graph.setPerformanceData(recordingData, resolution);
this.emit("rendered", graph.graphName); this.emit("rendered", graph.graphName);

Просмотреть файл

@ -32,7 +32,7 @@ PerformancePanel.prototype = {
if (this._opening) { if (this._opening) {
return this._opening; return this._opening;
} }
let deferred = promise.defer(); let deferred = defer();
this._opening = deferred.promise; this._opening = deferred.promise;
this.panelWin.gToolbox = this.toolbox; this.panelWin.gToolbox = this.toolbox;

Просмотреть файл

@ -536,7 +536,7 @@ var PerformanceController = {
* @return {Promise} * @return {Promise}
*/ */
waitForStateChangeOnRecording: Task.async(function* (recording, expectedState) { waitForStateChangeOnRecording: Task.async(function* (recording, expectedState) {
let deferred = promise.defer(); let deferred = defer();
this.on(EVENTS.RECORDING_STATE_CHANGE, function handler(state, model) { this.on(EVENTS.RECORDING_STATE_CHANGE, function handler(state, model) {
if (state === expectedState && model === recording) { if (state === expectedState && model === recording) {
this.off(EVENTS.RECORDING_STATE_CHANGE, handler); this.off(EVENTS.RECORDING_STATE_CHANGE, handler);

Просмотреть файл

@ -38,7 +38,7 @@ function getUnicodeConverter() {
} }
function asyncCopy(data, file) { function asyncCopy(data, file) {
let deferred = Promise.defer(); let deferred = defer();
let string = JSON.stringify(data); let string = JSON.stringify(data);
let inputStream = getUnicodeConverter().convertToInputStream(string); let inputStream = getUnicodeConverter().convertToInputStream(string);

Просмотреть файл

@ -160,7 +160,7 @@ function getUnicodeConverter() {
} }
function asyncCopy(data, file) { function asyncCopy(data, file) {
let deferred = Promise.defer(); let deferred = defer();
let string = JSON.stringify(data); let string = JSON.stringify(data);
let inputStream = getUnicodeConverter().convertToInputStream(string); let inputStream = getUnicodeConverter().convertToInputStream(string);

Просмотреть файл

@ -124,7 +124,7 @@ function getUnicodeConverter() {
} }
function asyncCopy(data, file) { function asyncCopy(data, file) {
let deferred = Promise.defer(); let deferred = defer();
let string = JSON.stringify(data); let string = JSON.stringify(data);
let inputStream = getUnicodeConverter().convertToInputStream(string); let inputStream = getUnicodeConverter().convertToInputStream(string);

Просмотреть файл

@ -73,7 +73,7 @@ function testWorkerMarkerUI(node) {
*/ */
function evalInDebuggee(script) { function evalInDebuggee(script) {
let { generateUUID } = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator); let { generateUUID } = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
let deferred = Promise.defer(); let deferred = defer();
if (!mm) { if (!mm) {
throw new Error("`loadFrameScripts()` must be called when using MessageManager."); throw new Error("`loadFrameScripts()` must be called when using MessageManager.");

Просмотреть файл

@ -20,7 +20,7 @@ function ScratchpadPanel(iframeWindow, toolbox) {
Scratchpad.target = this.target; Scratchpad.target = this.target;
Scratchpad.hideMenu(); Scratchpad.hideMenu();
let deferred = promise.defer(); let deferred = defer();
this._readyObserver = deferred.promise; this._readyObserver = deferred.promise;
Scratchpad.addObserver({ Scratchpad.addObserver({
onReady: function () { onReady: function () {

Просмотреть файл

@ -507,7 +507,7 @@ var Scratchpad = {
let evalOptions = { url: this.uniqueName }; let evalOptions = { url: this.uniqueName };
return connection.then(({ debuggerClient, webConsoleClient }) => { return connection.then(({ debuggerClient, webConsoleClient }) => {
let deferred = promise.defer(); let deferred = defer();
webConsoleClient.evaluateJSAsync(aString, aResponse => { webConsoleClient.evaluateJSAsync(aString, aResponse => {
this.debuggerClient = debuggerClient; this.debuggerClient = debuggerClient;
@ -550,7 +550,7 @@ var Scratchpad = {
*/ */
run: function SP_run() run: function SP_run()
{ {
let deferred = promise.defer(); let deferred = defer();
let reject = aReason => deferred.reject(aReason); let reject = aReason => deferred.reject(aReason);
this.execute().then(([aString, aError, aResult]) => { this.execute().then(([aString, aError, aResult]) => {
@ -577,7 +577,7 @@ var Scratchpad = {
*/ */
inspect: function SP_inspect() inspect: function SP_inspect()
{ {
let deferred = promise.defer(); let deferred = defer();
let reject = aReason => deferred.reject(aReason); let reject = aReason => deferred.reject(aReason);
this.execute().then(([aString, aError, aResult]) => { this.execute().then(([aString, aError, aResult]) => {
@ -605,7 +605,7 @@ var Scratchpad = {
*/ */
reloadAndRun: function SP_reloadAndRun() reloadAndRun: function SP_reloadAndRun()
{ {
let deferred = promise.defer(); let deferred = defer();
if (this.executionContext !== SCRATCHPAD_CONTEXT_CONTENT) { if (this.executionContext !== SCRATCHPAD_CONTEXT_CONTENT) {
console.error(this.strings. console.error(this.strings.
@ -633,7 +633,7 @@ var Scratchpad = {
*/ */
display: function SP_display() display: function SP_display()
{ {
let deferred = promise.defer(); let deferred = defer();
let reject = aReason => deferred.reject(aReason); let reject = aReason => deferred.reject(aReason);
this.execute().then(([aString, aError, aResult]) => { this.execute().then(([aString, aError, aResult]) => {
@ -876,7 +876,7 @@ var Scratchpad = {
*/ */
_writePrimitiveAsComment: function SP__writePrimitiveAsComment(aValue) _writePrimitiveAsComment: function SP__writePrimitiveAsComment(aValue)
{ {
let deferred = promise.defer(); let deferred = defer();
if (aValue.type == "longString") { if (aValue.type == "longString") {
let client = this.webConsoleClient; let client = this.webConsoleClient;
@ -935,7 +935,7 @@ var Scratchpad = {
*/ */
writeAsErrorComment: function SP_writeAsErrorComment(aError) writeAsErrorComment: function SP_writeAsErrorComment(aError)
{ {
let deferred = promise.defer(); let deferred = defer();
if (VariablesView.isPrimitive({ value: aError.exception })) { if (VariablesView.isPrimitive({ value: aError.exception })) {
let error = aError.exception; let error = aError.exception;
@ -2112,7 +2112,7 @@ ScratchpadTab.prototype = {
return this._connector; return this._connector;
} }
let deferred = promise.defer(); let deferred = defer();
this._connector = deferred.promise; this._connector = deferred.promise;
let connectTimer = setTimeout(() => { let connectTimer = setTimeout(() => {
@ -2263,7 +2263,7 @@ ScratchpadSidebar.prototype = {
{ {
this.show(); this.show();
let deferred = promise.defer(); let deferred = defer();
let onTabReady = () => { let onTabReady = () => {
if (this.variablesView) { if (this.variablesView) {

Просмотреть файл

@ -53,7 +53,7 @@ function runTests()
let browser = gBrowser.selectedBrowser; let browser = gBrowser.selectedBrowser;
let deferred = promise.defer(); let deferred = defer();
browser.addEventListener("DOMWindowCreated", function () { browser.addEventListener("DOMWindowCreated", function () {
browser.contentWindow.addEventListener("foo", function () { browser.contentWindow.addEventListener("foo", function () {
is(browser.contentWindow.document.body.innerHTML, "Modified text", is(browser.contentWindow.document.body.innerHTML, "Modified text",

Просмотреть файл

@ -154,7 +154,7 @@ function createTempFile(aName, aContent, aCallback = function () {})
*/ */
function runAsyncTests(aScratchpad, aTests) function runAsyncTests(aScratchpad, aTests)
{ {
let deferred = promise.defer(); let deferred = defer();
(function runTest() { (function runTest() {
if (aTests.length) { if (aTests.length) {

Просмотреть файл

@ -426,7 +426,7 @@ var ShadersEditorsView = {
return this._editorPromises.get(type); return this._editorPromises.get(type);
} }
let deferred = promise.defer(); let deferred = defer();
this._editorPromises.set(type, deferred.promise); this._editorPromises.set(type, deferred.promise);
// Initialize the source editor and store the newly created instance // Initialize the source editor and store the newly created instance

Просмотреть файл

@ -163,7 +163,7 @@ function getBlackBoxCheckbox(aPanel, aIndex) {
} }
function once(aTarget, aEvent) { function once(aTarget, aEvent) {
let deferred = promise.defer(); let deferred = defer();
aTarget.once(aEvent, deferred.resolve); aTarget.once(aEvent, deferred.resolve);
return deferred.promise; return deferred.promise;
} }

Просмотреть файл

@ -69,7 +69,7 @@ function loadFrameScripts() {
function addTab(aUrl, aWindow) { function addTab(aUrl, aWindow) {
info("Adding tab: " + aUrl); info("Adding tab: " + aUrl);
let deferred = promise.defer(); let deferred = defer();
let targetWindow = aWindow || window; let targetWindow = aWindow || window;
let targetBrowser = targetWindow.gBrowser; let targetBrowser = targetWindow.gBrowser;
@ -88,7 +88,7 @@ function addTab(aUrl, aWindow) {
function removeTab(aTab, aWindow) { function removeTab(aTab, aWindow) {
info("Removing tab."); info("Removing tab.");
let deferred = promise.defer(); let deferred = defer();
let targetWindow = aWindow || window; let targetWindow = aWindow || window;
let targetBrowser = targetWindow.gBrowser; let targetBrowser = targetWindow.gBrowser;
let tabContainer = targetBrowser.tabContainer; let tabContainer = targetBrowser.tabContainer;
@ -129,7 +129,7 @@ function createCanvas() {
function once(aTarget, aEventName, aUseCapture = false) { function once(aTarget, aEventName, aUseCapture = false) {
info("Waiting for event: '" + aEventName + "' on " + aTarget + "."); info("Waiting for event: '" + aEventName + "' on " + aTarget + ".");
let deferred = promise.defer(); let deferred = defer();
for (let [add, remove] of [ for (let [add, remove] of [
["on", "off"], // Use event emitter before DOM events for consistency ["on", "off"], // Use event emitter before DOM events for consistency
@ -153,7 +153,7 @@ function once(aTarget, aEventName, aUseCapture = false) {
// array of all of the arguments in the handler. These should be consolidated // array of all of the arguments in the handler. These should be consolidated
// into the same function, but many tests will need to be changed. // into the same function, but many tests will need to be changed.
function onceSpread(aTarget, aEvent) { function onceSpread(aTarget, aEvent) {
let deferred = promise.defer(); let deferred = defer();
aTarget.once(aEvent, (...args) => deferred.resolve(args)); aTarget.once(aEvent, (...args) => deferred.resolve(args));
return deferred.promise; return deferred.promise;
} }
@ -161,7 +161,7 @@ function onceSpread(aTarget, aEvent) {
function observe(aNotificationName, aOwnsWeak = false) { function observe(aNotificationName, aOwnsWeak = false) {
info("Waiting for observer notification: '" + aNotificationName + "."); info("Waiting for observer notification: '" + aNotificationName + ".");
let deferred = promise.defer(); let deferred = defer();
Services.obs.addObserver(function onNotification(...aArgs) { Services.obs.addObserver(function onNotification(...aArgs) {
Services.obs.removeObserver(onNotification, aNotificationName); Services.obs.removeObserver(onNotification, aNotificationName);
@ -277,7 +277,7 @@ function teardown(aPanel) {
// `onAdd` function that calls with the entire actors array on program link // `onAdd` function that calls with the entire actors array on program link
function getPrograms(front, count, onAdd) { function getPrograms(front, count, onAdd) {
let actors = []; let actors = [];
let deferred = promise.defer(); let deferred = defer();
front.on("program-linked", function onLink(actor) { front.on("program-linked", function onLink(actor) {
if (actors.length !== count) { if (actors.length !== count) {
actors.push(actor); actors.push(actor);

Просмотреть файл

@ -1724,7 +1724,7 @@ Messages.ConsoleTable.prototype = extend(Messages.Extended.prototype, {
* null if the arguments are invalid. * null if the arguments are invalid.
*/ */
_populateTableData: function () { _populateTableData: function () {
let deferred = promise.defer(); let deferred = defer();
if (this._arguments.length <= 0) { if (this._arguments.length <= 0) {
return deferred.reject(); return deferred.reject();
@ -3176,7 +3176,7 @@ Widgets.ObjectRenderers.add({
let isAttached = yield this.toolbox.walker.isInDOMTree(this._nodeFront); let isAttached = yield this.toolbox.walker.isInDOMTree(this._nodeFront);
if (isAttached) { if (isAttached) {
let onReady = promise.defer(); let onReady = defer();
this.toolbox.inspector.once("inspector-updated", onReady.resolve); this.toolbox.inspector.once("inspector-updated", onReady.resolve);
yield this.toolbox.selection.setNodeFront(this._nodeFront, "console"); yield this.toolbox.selection.setNodeFront(this._nodeFront, "console");
yield onReady.promise; yield onReady.promise;

Просмотреть файл

@ -174,11 +174,11 @@ HUD_SERVICE.prototype =
return this._browserConsoleDefer.promise; return this._browserConsoleDefer.promise;
} }
this._browserConsoleDefer = promise.defer(); this._browserConsoleDefer = defer();
function connect() function connect()
{ {
let deferred = promise.defer(); let deferred = defer();
if (!DebuggerServer.initialized) { if (!DebuggerServer.initialized) {
DebuggerServer.init(); DebuggerServer.init();
@ -203,7 +203,7 @@ HUD_SERVICE.prototype =
function openWindow(aTarget) function openWindow(aTarget)
{ {
target = aTarget; target = aTarget;
let deferred = promise.defer(); let deferred = defer();
// Using the old frontend for now in the browser console. This can be switched to // Using the old frontend for now in the browser console. This can be switched to
// Tools.webConsole.url to use whatever is preffed on. // Tools.webConsole.url to use whatever is preffed on.
let url = Tools.webConsole.oldWebConsoleURL; let url = Tools.webConsole.oldWebConsoleURL;
@ -558,7 +558,7 @@ WebConsole.prototype = {
HUDService.consoles.delete(this.hudId); HUDService.consoles.delete(this.hudId);
this._destroyer = promise.defer(); this._destroyer = defer();
// The document may already be removed // The document may already be removed
if (this.chromeUtilsWindow && this.mainPopupSet) { if (this.chromeUtilsWindow && this.mainPopupSet) {
@ -678,7 +678,7 @@ BrowserConsole.prototype = extend(WebConsole.prototype, {
this._telemetry.toolClosed("browserconsole"); this._telemetry.toolClosed("browserconsole");
this._bc_destroyer = promise.defer(); this._bc_destroyer = defer();
let chromeWindow = this.chromeWindow; let chromeWindow = this.chromeWindow;
this.$destroy().then(() => this.$destroy().then(() =>

Просмотреть файл

@ -434,7 +434,7 @@ JSTerm.prototype = {
* Resolves with the message once the result is displayed. * Resolves with the message once the result is displayed.
*/ */
execute: function (executeString, callback) { execute: function (executeString, callback) {
let deferred = promise.defer(); let deferred = defer();
let resultCallback; let resultCallback;
if (this.hud.NEW_CONSOLE_OUTPUT_ENABLED) { if (this.hud.NEW_CONSOLE_OUTPUT_ENABLED) {
resultCallback = (msg) => deferred.resolve(msg); resultCallback = (msg) => deferred.resolve(msg);
@ -523,7 +523,7 @@ JSTerm.prototype = {
* received. * received.
*/ */
requestEvaluation: function (str, options = {}) { requestEvaluation: function (str, options = {}) {
let deferred = promise.defer(); let deferred = defer();
function onResult(response) { function onResult(response) {
if (!response.error) { if (!response.error) {
@ -627,7 +627,7 @@ JSTerm.prototype = {
let openPromise; let openPromise;
if (options.targetElement) { if (options.targetElement) {
let deferred = promise.defer(); let deferred = defer();
openPromise = deferred.promise; openPromise = deferred.promise;
let document = options.targetElement.ownerDocument; let document = options.targetElement.ownerDocument;
let iframe = document.createElementNS(XHTML_NS, "iframe"); let iframe = document.createElementNS(XHTML_NS, "iframe");
@ -672,7 +672,7 @@ JSTerm.prototype = {
* A promise object for the adding of the new tab. * A promise object for the adding of the new tab.
*/ */
_addVariablesViewSidebarTab: function () { _addVariablesViewSidebarTab: function () {
let deferred = promise.defer(); let deferred = defer();
let onTabReady = () => { let onTabReady = () => {
let window = this.sidebar.getWindowForTab("variablesview"); let window = this.sidebar.getWindowForTab("variablesview");

Просмотреть файл

@ -29,7 +29,7 @@ var DataProvider = {
return p; return p;
} }
let deferred = promise.defer(); let deferred = defer();
let realMethodName = "get" + method.charAt(0).toUpperCase() + let realMethodName = "get" + method.charAt(0).toUpperCase() +
method.slice(1); method.slice(1);

Просмотреть файл

@ -46,7 +46,7 @@ WebConsolePanel.prototype = {
let iframe = parentDoc.getElementById("toolbox-panel-iframe-webconsole"); let iframe = parentDoc.getElementById("toolbox-panel-iframe-webconsole");
// Make sure the iframe content window is ready. // Make sure the iframe content window is ready.
let deferredIframe = promise.defer(); let deferredIframe = defer();
let win, doc; let win, doc;
if ((win = iframe.contentWindow) && if ((win = iframe.contentWindow) &&
(doc = win.document) && (doc = win.document) &&

Просмотреть файл

@ -77,7 +77,7 @@ add_task(function* () {
info("expected clipboard value: " + message.url); info("expected clipboard value: " + message.url);
let deferred = promise.defer(); let deferred = defer();
waitForClipboard((aData) => { waitForClipboard((aData) => {
return aData.trim() == message.url; return aData.trim() == message.url;

Просмотреть файл

@ -23,9 +23,9 @@ add_task(function* () {
let hud = yield openConsole(); let hud = yield openConsole();
ok(hud, "Web Console opened"); ok(hud, "Web Console opened");
let tabClosed = promise.defer(); let tabClosed = defer();
let toolboxDestroyed = promise.defer(); let toolboxDestroyed = defer();
let tabSelected = promise.defer(); let tabSelected = defer();
let target = TargetFactory.forTab(gBrowser.selectedTab); let target = TargetFactory.forTab(gBrowser.selectedTab);
let toolbox = gDevTools.getToolbox(target); let toolbox = gDevTools.getToolbox(target);
@ -59,7 +59,7 @@ add_task(function* () {
hud = yield HUDService.toggleBrowserConsole(); hud = yield HUDService.toggleBrowserConsole();
ok(hud, "Browser Console opened"); ok(hud, "Browser Console opened");
let deferred = promise.defer(); let deferred = defer();
Services.obs.addObserver(function onDestroy() { Services.obs.addObserver(function onDestroy() {
Services.obs.removeObserver(onDestroy, "web-console-destroyed"); Services.obs.removeObserver(onDestroy, "web-console-destroyed");

Просмотреть файл

@ -200,7 +200,7 @@ function* testCPOWInspection(hud) {
} }
function waitForConsole() { function waitForConsole() {
let deferred = promise.defer(); let deferred = defer();
Services.obs.addObserver(function observer(aSubject) { Services.obs.addObserver(function observer(aSubject) {
Services.obs.removeObserver(observer, "web-console-created"); Services.obs.removeObserver(observer, "web-console-created");

Просмотреть файл

@ -67,7 +67,7 @@ function test() {
let viewSource = browserconsole.viewSource; let viewSource = browserconsole.viewSource;
let URL = null; let URL = null;
let clickPromise = promise.defer(); let clickPromise = defer();
browserconsole.viewSourceInDebugger = (sourceURL) => { browserconsole.viewSourceInDebugger = (sourceURL) => {
info("browserconsole.viewSourceInDebugger() was invoked: " + sourceURL); info("browserconsole.viewSourceInDebugger() was invoked: " + sourceURL);
URL = sourceURL; URL = sourceURL;

Просмотреть файл

@ -117,7 +117,7 @@ add_task(function* () {
let clickable = consoleErrorMsg.clickableElements[0]; let clickable = consoleErrorMsg.clickableElements[0];
ok(clickable, "clickable object found for console.error"); ok(clickable, "clickable object found for console.error");
let deferred = promise.defer(); let deferred = defer();
let onFetch = (aEvent, aVar) => { let onFetch = (aEvent, aVar) => {
// Skip the notification from console.dir variablesview-fetched. // Skip the notification from console.dir variablesview-fetched.

Просмотреть файл

@ -50,7 +50,7 @@ add_task(function* testCopy() {
] ]
]; ];
for (let [source, reference] of samples) { for (let [source, reference] of samples) {
let deferredResult = promise.defer(); let deferredResult = defer();
SimpleTest.waitForClipboard( SimpleTest.waitForClipboard(
"" + reference, "" + reference,

Просмотреть файл

@ -35,7 +35,7 @@ add_task(function* () {
hud.setFilterState("exception", true); hud.setFilterState("exception", true);
// We need to let the console opening event loop to finish. // We need to let the console opening event loop to finish.
let deferred = promise.defer(); let deferred = defer();
executeSoon(() => closeConsole().then(() => deferred.resolve(null))); executeSoon(() => closeConsole().then(() => deferred.resolve(null)));
yield deferred.promise; yield deferred.promise;

Просмотреть файл

@ -32,7 +32,7 @@ function* getVariablesView(hud) {
deferred.resolve(vview._variablesView); deferred.resolve(vview._variablesView);
} }
let deferred = promise.defer(); let deferred = defer();
// Filter out other messages to ensure ours stays visible. // Filter out other messages to ensure ours stays visible.
hud.ui.filterBox.value = "browser_console_hide_jsterm_test"; hud.ui.filterBox.value = "browser_console_hide_jsterm_test";

Просмотреть файл

@ -73,7 +73,7 @@ function waitForThreadEvents(aPanel, aEventName, aEventRepeat = 1) {
info("Waiting for thread event: '" + aEventName + "' to fire: " + info("Waiting for thread event: '" + aEventName + "' to fire: " +
aEventRepeat + " time(s)."); aEventRepeat + " time(s).");
let deferred = promise.defer(); let deferred = defer();
let thread = aPanel.panelWin.gThreadClient; let thread = aPanel.panelWin.gThreadClient;
let count = 0; let count = 0;

Просмотреть файл

@ -109,7 +109,7 @@ add_task(function* () {
}); });
function updateServerLoggingListener(hud) { function updateServerLoggingListener(hud) {
let deferred = promise.defer(); let deferred = defer();
hud.ui._updateServerLoggingListener(response => { hud.ui._updateServerLoggingListener(response => {
deferred.resolve(response); deferred.resolve(response);
}); });

Просмотреть файл

@ -36,7 +36,7 @@ function test() {
const hud = yield openConsole(tab); const hud = yield openConsole(tab);
const jsterm = hud.jsterm; const jsterm = hud.jsterm;
let deferred = promise.defer(); let deferred = defer();
jsterm.once("variablesview-fetched", (_, val) => deferred.resolve(val)); jsterm.once("variablesview-fetched", (_, val) => deferred.resolve(val));
jsterm.execute("inspect(document.querySelectorAll('div'))"); jsterm.execute("inspect(document.querySelectorAll('div'))");

Просмотреть файл

@ -83,7 +83,7 @@ function test() {
*/ */
function* testNotSorted(aObject) { function* testNotSorted(aObject) {
info("Testing " + aObject); info("Testing " + aObject);
let deferred = promise.defer(); let deferred = defer();
jsterm.once("variablesview-fetched", (_, aVar) => deferred.resolve(aVar)); jsterm.once("variablesview-fetched", (_, aVar) => deferred.resolve(aVar));
jsterm.execute("inspect(" + aObject + ")"); jsterm.execute("inspect(" + aObject + ")");
@ -109,7 +109,7 @@ function test() {
*/ */
function* testSorted(aObject) { function* testSorted(aObject) {
info("Testing " + aObject); info("Testing " + aObject);
let deferred = promise.defer(); let deferred = defer();
jsterm.once("variablesview-fetched", (_, aVar) => deferred.resolve(aVar)); jsterm.once("variablesview-fetched", (_, aVar) => deferred.resolve(aVar));
jsterm.execute("inspect(" + aObject + ")"); jsterm.execute("inspect(" + aObject + ")");

Просмотреть файл

@ -30,8 +30,8 @@ add_task(function* () {
let {DebuggerController} = panelWin; let {DebuggerController} = panelWin;
let {activeThread} = DebuggerController; let {activeThread} = DebuggerController;
let firstCall = promise.defer(); let firstCall = defer();
let frameAdded = promise.defer(); let frameAdded = defer();
executeSoon(() => { executeSoon(() => {
info("Executing firstCall"); info("Executing firstCall");
activeThread.addOneTimeListener("framesadded", () => { activeThread.addOneTimeListener("framesadded", () => {

Просмотреть файл

@ -50,7 +50,7 @@ add_task(function* () {
}); });
function loadDocument(browser) { function loadDocument(browser) {
let deferred = promise.defer(); let deferred = defer();
browser.addEventListener("load", function () { browser.addEventListener("load", function () {
deferred.resolve(); deferred.resolve();

Просмотреть файл

@ -79,7 +79,7 @@ add_task(function* () {
}); });
function execute(hud, str) { function execute(hud, str) {
let deferred = promise.defer(); let deferred = defer();
hud.jsterm.execute(str, deferred.resolve); hud.jsterm.execute(str, deferred.resolve);
return deferred.promise; return deferred.promise;
} }

Просмотреть файл

@ -34,7 +34,7 @@ add_task(function* () {
}); });
function execute(hud, str) { function execute(hud, str) {
let deferred = promise.defer(); let deferred = defer();
hud.jsterm.execute(str, deferred.resolve); hud.jsterm.execute(str, deferred.resolve);
return deferred.promise; return deferred.promise;
} }

Просмотреть файл

@ -31,7 +31,7 @@ add_task(function* () {
}); });
function testWarningNotPresent(hud) { function testWarningNotPresent(hud) {
let deferred = promise.defer(); let deferred = defer();
is(hud.outputNode.textContent.indexOf("logging API"), -1, is(hud.outputNode.textContent.indexOf("logging API"), -1,
"no warning displayed"); "no warning displayed");
@ -60,7 +60,7 @@ function testWarningNotPresent(hud) {
function testWarningPresent(hud) { function testWarningPresent(hud) {
info("wait for the warning to show"); info("wait for the warning to show");
let deferred = promise.defer(); let deferred = defer();
let warning = { let warning = {
webconsole: hud, webconsole: hud,

Просмотреть файл

@ -52,7 +52,7 @@ add_task(function* () {
}); });
function pushPrefEnv() { function pushPrefEnv() {
let deferred = promise.defer(); let deferred = defer();
let options = {"set": let options = {"set":
[["security.mixed_content.block_active_content", false], [["security.mixed_content.block_active_content", false],
["security.mixed_content.block_display_content", false] ["security.mixed_content.block_display_content", false]

Просмотреть файл

@ -14,7 +14,7 @@ add_task(function* () {
yield loadTab(TEST_URI); yield loadTab(TEST_URI);
function* autocomplete(term) { function* autocomplete(term) {
let deferred = promise.defer(); let deferred = defer();
jsterm.setInputValue(term); jsterm.setInputValue(term);
jsterm.complete(jsterm.COMPLETE_HINT_ONLY, deferred.resolve); jsterm.complete(jsterm.COMPLETE_HINT_ONLY, deferred.resolve);

Просмотреть файл

@ -21,7 +21,7 @@ add_task(function* () {
}); });
function consoleOpened(HUD) { function consoleOpened(HUD) {
let deferred = promise.defer(); let deferred = defer();
let jsterm = HUD.jsterm; let jsterm = HUD.jsterm;
let stringToCopy = "foobazbarBug642615"; let stringToCopy = "foobazbarBug642615";

Просмотреть файл

@ -56,7 +56,7 @@ add_task(function* () {
}); });
function pushPrefEnv() { function pushPrefEnv() {
let deferred = promise.defer(); let deferred = defer();
let options = { let options = {
"set": [ "set": [
["security.mixed_content.block_active_content", true], ["security.mixed_content.block_active_content", true],
@ -70,7 +70,7 @@ function pushPrefEnv() {
} }
function mixedContentOverrideTest2(hud, browser) { function mixedContentOverrideTest2(hud, browser) {
let deferred = promise.defer(); let deferred = defer();
let {gIdentityHandler} = browser.ownerGlobal; let {gIdentityHandler} = browser.ownerGlobal;
ok(gIdentityHandler._identityBox.classList.contains("mixedActiveBlocked"), ok(gIdentityHandler._identityBox.classList.contains("mixedActiveBlocked"),
"Mixed Active Content state appeared on identity box"); "Mixed Active Content state appeared on identity box");

Просмотреть файл

@ -19,7 +19,7 @@ add_task(function* () {
}); });
function testClosingAfterCompletion(hud, browser) { function testClosingAfterCompletion(hud, browser) {
let deferred = promise.defer(); let deferred = defer();
let errorWhileClosing = false; let errorWhileClosing = false;
function errorListener() { function errorListener() {

Просмотреть файл

@ -31,7 +31,7 @@ add_task(function* () {
}); });
var consoleOpened = Task.async(function* (hud) { var consoleOpened = Task.async(function* (hud) {
let deferred = promise.defer(); let deferred = defer();
HUD = hud; HUD = hud;
info("web console opened"); info("web console opened");
@ -146,7 +146,7 @@ var consoleOpened = Task.async(function* (hud) {
}); });
function popupHideAfterTab() { function popupHideAfterTab() {
let deferred = promise.defer(); let deferred = defer();
// At this point the completion suggestion should be accepted. // At this point the completion suggestion should be accepted.
ok(!popup.isOpen, "popup is not open"); ok(!popup.isOpen, "popup is not open");
@ -198,7 +198,7 @@ function popupHideAfterTab() {
} }
function testReturnKey() { function testReturnKey() {
let deferred = promise.defer(); let deferred = defer();
popup.once("popup-opened", function onShown() { popup.once("popup-opened", function onShown() {
ok(popup.isOpen, "popup is open"); ok(popup.isOpen, "popup is open");
@ -250,7 +250,7 @@ function testReturnKey() {
} }
function* dontShowArrayNumbers() { function* dontShowArrayNumbers() {
let deferred = promise.defer(); let deferred = defer();
info("dontShowArrayNumbers"); info("dontShowArrayNumbers");
yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () { yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
@ -286,7 +286,7 @@ function* dontShowArrayNumbers() {
} }
function testReturnWithNoSelection() { function testReturnWithNoSelection() {
let deferred = promise.defer(); let deferred = defer();
info("test pressing return with open popup, but no selection, see bug 873250"); info("test pressing return with open popup, but no selection, see bug 873250");
@ -325,7 +325,7 @@ function popupHideAfterReturnWithNoSelection() {
function testCompletionInText() { function testCompletionInText() {
info("test that completion works inside text, see bug 812618"); info("test that completion works inside text, see bug 812618");
let deferred = promise.defer(); let deferred = defer();
popup.once("popup-opened", function onShown() { popup.once("popup-opened", function onShown() {
ok(popup.isOpen, "popup is open"); ok(popup.isOpen, "popup is open");

Просмотреть файл

@ -16,7 +16,7 @@ add_task(function* () {
}); });
function consoleOpened(HUD) { function consoleOpened(HUD) {
let deferred = promise.defer(); let deferred = defer();
let items = [ let items = [
{label: "item0", value: "value0"}, {label: "item0", value: "value0"},

Просмотреть файл

@ -24,7 +24,7 @@ add_task(function* () {
function consoleOpened(hud) { function consoleOpened(hud) {
HUD = hud; HUD = hud;
let deferred = promise.defer(); let deferred = defer();
// See bugs 574036, 586386 and 587617. // See bugs 574036, 586386 and 587617.
outputNode = HUD.outputNode; outputNode = HUD.outputNode;
@ -77,7 +77,7 @@ function consoleOpened(hud) {
// Test that the context menu "Copy" (which has a different code path) works // Test that the context menu "Copy" (which has a different code path) works
// properly as well. // properly as well.
function testContextMenuCopy() { function testContextMenuCopy() {
let deferred = promise.defer(); let deferred = defer();
let contextMenuId = HUD.ui.outputWrapper.getAttribute("context"); let contextMenuId = HUD.ui.outputWrapper.getAttribute("context");
let contextMenu = HUD.ui.document.getElementById(contextMenuId); let contextMenu = HUD.ui.document.getElementById(contextMenuId);

Просмотреть файл

@ -21,7 +21,7 @@ add_task(function* () {
// Test for bug 588730: Adding a text node to an existing label element causes // Test for bug 588730: Adding a text node to an existing label element causes
// warnings // warnings
function testTextNodeInsertion(hud) { function testTextNodeInsertion(hud) {
let deferred = promise.defer(); let deferred = defer();
let outputNode = hud.outputNode; let outputNode = hud.outputNode;
let label = document.createElementNS( let label = document.createElementNS(

Просмотреть файл

@ -23,7 +23,7 @@ add_task(function* () {
}); });
function consoleOpened(hud) { function consoleOpened(hud) {
let deferred = promise.defer(); let deferred = defer();
for (let i = 0; i < 200; i++) { for (let i = 0; i < 200; i++) {
content.console.log("test message " + i); content.console.log("test message " + i);

Просмотреть файл

@ -10,7 +10,7 @@ const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
"test/test-bug-599725-response-headers.sjs"; "test/test-bug-599725-response-headers.sjs";
function performTest(request, hud) { function performTest(request, hud) {
let deferred = promise.defer(); let deferred = defer();
let headers = null; let headers = null;

Просмотреть файл

@ -10,7 +10,7 @@ const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
"test/test-bug-600183-charset.html"; "test/test-bug-600183-charset.html";
function performTest(lastFinishedRequest, console) { function performTest(lastFinishedRequest, console) {
let deferred = promise.defer(); let deferred = defer();
ok(lastFinishedRequest, "charset test page was loaded and logged"); ok(lastFinishedRequest, "charset test page was loaded and logged");
HUDService.lastFinishedRequest.callback = null; HUDService.lastFinishedRequest.callback = null;
@ -37,7 +37,7 @@ function performTest(lastFinishedRequest, console) {
} }
function waitForRequest() { function waitForRequest() {
let deferred = promise.defer(); let deferred = defer();
HUDService.lastFinishedRequest.callback = (req, console) => { HUDService.lastFinishedRequest.callback = (req, console) => {
performTest(req, console).then(deferred.resolve); performTest(req, console).then(deferred.resolve);
}; };

Просмотреть файл

@ -37,7 +37,7 @@ add_task(function* () {
// scroll to the first node // scroll to the first node
outputNode.focus(); outputNode.focus();
let scrolled = promise.defer(); let scrolled = defer();
scrollBox.onscroll = () => { scrollBox.onscroll = () => {
info("onscroll top " + scrollBox.scrollTop); info("onscroll top " + scrollBox.scrollTop);
@ -66,7 +66,7 @@ add_task(function* () {
}], }],
}); });
scrolled = promise.defer(); scrolled = defer();
scrollBox.onscroll = () => { scrollBox.onscroll = () => {
if (scrollBox.scrollTop != 0) { if (scrollBox.scrollTop != 0) {
// Wait for scroll to stabilize at the top. // Wait for scroll to stabilize at the top.
@ -86,7 +86,7 @@ add_task(function* () {
// scroll back to the bottom // scroll back to the bottom
outputNode.lastChild.focus(); outputNode.lastChild.focus();
scrolled = promise.defer(); scrolled = defer();
scrollBox.onscroll = () => { scrollBox.onscroll = () => {
if (scrollBox.scrollTop == 0) { if (scrollBox.scrollTop == 0) {
// Wait for scroll to bottom. // Wait for scroll to bottom.
@ -104,7 +104,7 @@ add_task(function* () {
ContentTask.spawn(gBrowser.selectedBrowser, null, ContentTask.spawn(gBrowser.selectedBrowser, null,
"() => content.console.log('test message 151')"); "() => content.console.log('test message 151')");
scrolled = promise.defer(); scrolled = defer();
scrollBox.onscroll = () => { scrollBox.onscroll = () => {
if (scrollBox.scrollTop == oldScrollTop) { if (scrollBox.scrollTop == oldScrollTop) {
// Wait for scroll to change. // Wait for scroll to change.

Просмотреть файл

@ -18,7 +18,7 @@ add_task(function* () {
}); });
function* test$(HUD) { function* test$(HUD) {
let deferred = promise.defer(); let deferred = defer();
HUD.jsterm.clearOutput(); HUD.jsterm.clearOutput();
@ -32,7 +32,7 @@ function* test$(HUD) {
} }
function test$$(HUD) { function test$$(HUD) {
let deferred = promise.defer(); let deferred = defer();
HUD.jsterm.clearOutput(); HUD.jsterm.clearOutput();

Просмотреть файл

@ -58,7 +58,7 @@ add_task(function* () {
}); });
function onConsoleOpen(hud) { function onConsoleOpen(hud) {
let deferred = promise.defer(); let deferred = defer();
let hudBox = hud.ui.rootElement; let hudBox = hud.ui.rootElement;
@ -92,7 +92,7 @@ function onConsoleOpen(hud) {
function onConsoleReopen1(hud) { function onConsoleReopen1(hud) {
info("testing after reopening once"); info("testing after reopening once");
let deferred = promise.defer(); let deferred = defer();
let hudBox = hud.ui.rootElement; let hudBox = hud.ui.rootElement;

Просмотреть файл

@ -26,7 +26,7 @@ add_task(function* () {
}); });
function consoleOpened(hud) { function consoleOpened(hud) {
let deferred = promise.defer(); let deferred = defer();
webConsoleClient = hud.ui.webConsoleClient; webConsoleClient = hud.ui.webConsoleClient;
HUDService.lastFinishedRequest.callback = (aHttpRequest) => { HUDService.lastFinishedRequest.callback = (aHttpRequest) => {
@ -43,7 +43,7 @@ function consoleOpened(hud) {
} }
function getHeaders() { function getHeaders() {
let deferred = promise.defer(); let deferred = defer();
HUDService.lastFinishedRequest.callback = null; HUDService.lastFinishedRequest.callback = null;
@ -64,7 +64,7 @@ function getHeaders() {
} }
function getContent() { function getContent() {
let deferred = promise.defer(); let deferred = defer();
webConsoleClient.getResponseContent(lastFinishedRequests["301"].actor, webConsoleClient.getResponseContent(lastFinishedRequests["301"].actor,
function (response) { function (response) {

Просмотреть файл

@ -26,7 +26,7 @@ add_task(function* () {
}); });
function consoleOpened() { function consoleOpened() {
let deferred = promise.defer(); let deferred = defer();
let jsterm = gHUD.jsterm; let jsterm = gHUD.jsterm;
let popup = jsterm.autocompletePopup; let popup = jsterm.autocompletePopup;
@ -58,7 +58,7 @@ function consoleOpened() {
} }
function autocompletePopupHidden() { function autocompletePopupHidden() {
let deferred = promise.defer(); let deferred = defer();
let jsterm = gHUD.jsterm; let jsterm = gHUD.jsterm;
let popup = jsterm.autocompletePopup; let popup = jsterm.autocompletePopup;
@ -80,7 +80,7 @@ function autocompletePopupHidden() {
} }
function testPropertyPanel() { function testPropertyPanel() {
let deferred = promise.defer(); let deferred = defer();
let jsterm = gHUD.jsterm; let jsterm = gHUD.jsterm;
jsterm.clearOutput(); jsterm.clearOutput();

Просмотреть файл

@ -17,7 +17,7 @@ add_task(function* () {
}); });
function consoleOpened(HUD) { function consoleOpened(HUD) {
let deferred = promise.defer(); let deferred = defer();
let jsterm = HUD.jsterm; let jsterm = HUD.jsterm;
let popup = jsterm.autocompletePopup; let popup = jsterm.autocompletePopup;

Просмотреть файл

@ -89,7 +89,7 @@ function testOnNetActivity() {
} }
function onNetworkMessage(results) { function onNetworkMessage(results) {
let deferred = promise.defer(); let deferred = defer();
outputNode.focus(); outputNode.focus();
let msg = [...results[0].matched][0]; let msg = [...results[0].matched][0];
@ -125,7 +125,7 @@ function onNetworkMessage(results) {
} }
function testOnNetActivityContextMenu(msg) { function testOnNetActivityContextMenu(msg) {
let deferred = promise.defer(); let deferred = defer();
outputNode.focus(); outputNode.focus();
HUD.ui.output.selectMessage(msg); HUD.ui.output.selectMessage(msg);

Просмотреть файл

@ -22,7 +22,7 @@ add_task(function* () {
}); });
function testViewSource() { function testViewSource() {
let deferred = promise.defer(); let deferred = defer();
waitForMessages({ waitForMessages({
webconsole: hud, webconsole: hud,
@ -58,7 +58,7 @@ function testViewSource() {
} }
function onStyleEditorReady(panel) { function onStyleEditorReady(panel) {
let deferred = promise.defer(); let deferred = defer();
let win = panel.panelWindow; let win = panel.panelWindow;
ok(win, "Style Editor Window is defined"); ok(win, "Style Editor Window is defined");
@ -115,7 +115,7 @@ function checkStyleEditorForSheetAndLine(href, line) {
} }
function performLineCheck(editor, line) { function performLineCheck(editor, line) {
let deferred = promise.defer(); let deferred = defer();
function checkForCorrectState() { function checkForCorrectState() {
is(editor.sourceEditor.getCursor().line, line, is(editor.sourceEditor.getCursor().line, line,

Просмотреть файл

@ -32,7 +32,7 @@ add_task(function* () {
}); });
function pushPrefEnv() { function pushPrefEnv() {
let deferred = promise.defer(); let deferred = defer();
let options = { let options = {
set: [["security.mixed_content.block_active_content", true]] set: [["security.mixed_content.block_active_content", true]]
}; };

Просмотреть файл

@ -26,7 +26,7 @@ function test() {
input.value = "docu"; input.value = "docu";
input.setSelectionRange(4, 4); input.setSelectionRange(4, 4);
let deferred = promise.defer(); let deferred = defer();
jsterm.complete(jsterm.COMPLETE_HINT_ONLY, function () { jsterm.complete(jsterm.COMPLETE_HINT_ONLY, function () {
is(jsterm.completeNode.value, " ment", "'docu' completion"); is(jsterm.completeNode.value, " ment", "'docu' completion");

Просмотреть файл

@ -35,7 +35,7 @@ function test() {
loadTab(TEST_URI).then(() => { loadTab(TEST_URI).then(() => {
openConsole().then((hud) => { openConsole().then((hud) => {
openDebugger().then(({ toolbox, panelWin }) => { openDebugger().then(({ toolbox, panelWin }) => {
let deferred = promise.defer(); let deferred = defer();
fetchScopes(hud, toolbox, panelWin, deferred); fetchScopes(hud, toolbox, panelWin, deferred);
ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () { ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {

Просмотреть файл

@ -40,7 +40,7 @@ function test() {
let networkEventMessage = messages[0].matched.values().next().value; let networkEventMessage = messages[0].matched.values().next().value;
let urlNode = networkEventMessage.querySelector(".url"); let urlNode = networkEventMessage.querySelector(".url");
let deferred = promise.defer(); let deferred = defer();
urlNode.addEventListener("click", function (event) { urlNode.addEventListener("click", function (event) {
ok(event.defaultPrevented, "The default action was prevented."); ok(event.defaultPrevented, "The default action was prevented.");

Просмотреть файл

@ -27,7 +27,7 @@ function testFilterButtons(aHud) {
} }
function testRightClick(aCategory, hudBox, aHud) { function testRightClick(aCategory, hudBox, aHud) {
let deferred = promise.defer(); let deferred = defer();
let selector = ".webconsole-filter-button[category=\"" + aCategory + "\"]"; let selector = ".webconsole-filter-button[category=\"" + aCategory + "\"]";
let button = hudBox.querySelector(selector); let button = hudBox.querySelector(selector);
let mainButton = getMainButton(button, aHud); let mainButton = getMainButton(button, aHud);

Просмотреть файл

@ -18,7 +18,7 @@ add_task(function* () {
}); });
function testForOf(hud) { function testForOf(hud) {
let deferred = promise.defer(); let deferred = defer();
let jsterm = hud.jsterm; let jsterm = hud.jsterm;
jsterm.execute("{ let _nodes = []; for (let x of document.body.childNodes) { if (x.nodeType === 1) { _nodes.push(x.tagName); } } _nodes.join(' '); }", jsterm.execute("{ let _nodes = []; for (let x of document.body.childNodes) { if (x.nodeType === 1) { _nodes.push(x.tagName); } } _nodes.join(' '); }",

Просмотреть файл

@ -19,7 +19,7 @@ add_task(function* () {
}); });
function checkResult(msg, desc) { function checkResult(msg, desc) {
let def = promise.defer(); let def = defer();
waitForMessages({ waitForMessages({
webconsole: jsterm.hud.owner, webconsole: jsterm.hud.owner,
messages: [{ messages: [{

Просмотреть файл

@ -88,7 +88,7 @@ function testMessages() {
} }
function pushPrefEnv() { function pushPrefEnv() {
let deferred = promise.defer(); let deferred = defer();
let options = { let options = {
set: [["devtools.webconsole.filter.networkinfo", true]] set: [["devtools.webconsole.filter.networkinfo", true]]
}; };

Просмотреть файл

@ -11,7 +11,7 @@ const TEST_URI = "data:text/html;charset=utf-8,<p>Web Console test for " +
add_task(function* () { add_task(function* () {
yield loadTab(TEST_URI); yield loadTab(TEST_URI);
let consoleOpened = promise.defer(); let consoleOpened = defer();
let gotEvents = waitForEvents(consoleOpened.promise); let gotEvents = waitForEvents(consoleOpened.promise);
yield openConsole().then(() => { yield openConsole().then(() => {
consoleOpened.resolve(); consoleOpened.resolve();
@ -21,7 +21,7 @@ add_task(function* () {
}); });
function waitForEvents(onConsoleOpened) { function waitForEvents(onConsoleOpened) {
let deferred = promise.defer(); let deferred = defer();
function webConsoleCreated(id) { function webConsoleCreated(id) {
Services.obs.removeObserver(observer, "web-console-created"); Services.obs.removeObserver(observer, "web-console-created");

Просмотреть файл

@ -103,7 +103,7 @@ function* getWidgetAndMessage(result) {
} }
function reloadPage() { function reloadPage() {
let def = promise.defer(); let def = defer();
gBrowser.selectedBrowser.addEventListener("load", function () { gBrowser.selectedBrowser.addEventListener("load", function () {
def.resolve(); def.resolve();
}, {capture: true, once: true}); }, {capture: true, once: true});

Просмотреть файл

@ -12,7 +12,7 @@ var { Tools } = require("devtools/client/definitions");
var { isTargetSupported } = Tools.scratchpad; var { isTargetSupported } = Tools.scratchpad;
function pushPrefEnv() { function pushPrefEnv() {
let deferred = promise.defer(); let deferred = defer();
let options = {"set": let options = {"set":
[["devtools.scratchpad.enabled", true] [["devtools.scratchpad.enabled", true]
]}; ]};

Просмотреть файл

@ -50,7 +50,7 @@ add_task(function* () {
}); });
function loadDocument(browser) { function loadDocument(browser) {
let deferred = promise.defer(); let deferred = defer();
browser.addEventListener("load", function () { browser.addEventListener("load", function () {
deferred.resolve(); deferred.resolve();

Просмотреть файл

@ -194,7 +194,7 @@ function test() {
}); });
function openPanel(toolId) { function openPanel(toolId) {
let deferred = promise.defer(); let deferred = defer();
let target = TargetFactory.forTab(gBrowser.selectedTab); let target = TargetFactory.forTab(gBrowser.selectedTab);
gDevTools.showToolbox(target, toolId).then(function (box) { gDevTools.showToolbox(target, toolId).then(function (box) {
toolbox = box; toolbox = box;

Просмотреть файл

@ -78,7 +78,7 @@
} }
function testHideAutoCompletePopupAfterEscape() { function testHideAutoCompletePopupAfterEscape() {
let deferred = promise.defer(); let deferred = defer();
let popup = jsterm.autocompletePopup; let popup = jsterm.autocompletePopup;
popup.once("popup-closed", () => { popup.once("popup-closed", () => {

Просмотреть файл

@ -187,7 +187,7 @@ function findLogEntry(str) {
* A promise that is resolved once the web console is open. * A promise that is resolved once the web console is open.
*/ */
var openConsole = function (tab) { var openConsole = function (tab) {
let webconsoleOpened = promise.defer(); let webconsoleOpened = defer();
let target = TargetFactory.forTab(tab || gBrowser.selectedTab); let target = TargetFactory.forTab(tab || gBrowser.selectedTab);
gDevTools.showToolbox(target, "webconsole").then(toolbox => { gDevTools.showToolbox(target, "webconsole").then(toolbox => {
let hud = toolbox.getCurrentPanel().hud; let hud = toolbox.getCurrentPanel().hud;
@ -346,7 +346,7 @@ waitForExplicitFinish();
* A Promise object that is resolved based on the validator function. * A Promise object that is resolved based on the validator function.
*/ */
function waitForSuccess(options) { function waitForSuccess(options) {
let deferred = promise.defer(); let deferred = defer();
let start = Date.now(); let start = Date.now();
let timeout = options.timeout || 5000; let timeout = options.timeout || 5000;
let {validator} = options; let {validator} = options;
@ -452,7 +452,7 @@ function findVariableViewProperties(view, rules, options) {
return promise.resolve(null); return promise.resolve(null);
} }
let deferred = promise.defer(); let deferred = defer();
let expandOptions = { let expandOptions = {
rootVariable: view, rootVariable: view,
expandTo: rule.name, expandTo: rule.name,
@ -594,7 +594,7 @@ function isVariableViewPropertyIterator(prop, webConsole) {
return promise.resolve(true); return promise.resolve(true);
} }
let deferred = promise.defer(); let deferred = defer();
variablesViewExpandTo({ variablesViewExpandTo({
rootVariable: prop, rootVariable: prop,
@ -630,7 +630,7 @@ function variablesViewExpandTo(options) {
let root = options.rootVariable; let root = options.rootVariable;
let expandTo = options.expandTo.split("."); let expandTo = options.expandTo.split(".");
let jsterm = (options.webconsole || {}).jsterm; let jsterm = (options.webconsole || {}).jsterm;
let lastDeferred = promise.defer(); let lastDeferred = defer();
function fetch(prop) { function fetch(prop) {
if (!prop.onexpand) { if (!prop.onexpand) {
@ -638,7 +638,7 @@ function variablesViewExpandTo(options) {
return promise.reject(prop); return promise.reject(prop);
} }
let deferred = promise.defer(); let deferred = defer();
if (prop._fetched || !jsterm) { if (prop._fetched || !jsterm) {
executeSoon(function () { executeSoon(function () {
@ -716,7 +716,7 @@ var updateVariablesViewProperty = Task.async(function* (options) {
throw new Error("options.field is incorrect"); throw new Error("options.field is incorrect");
} }
let deferred = promise.defer(); let deferred = defer();
executeSoon(() => { executeSoon(() => {
EventUtils.synthesizeKey("A", { accelKey: true }, view.window); EventUtils.synthesizeKey("A", { accelKey: true }, view.window);
@ -762,7 +762,7 @@ function openDebugger(options = {}) {
options.tab = gBrowser.selectedTab; options.tab = gBrowser.selectedTab;
} }
let deferred = promise.defer(); let deferred = defer();
let target = TargetFactory.forTab(options.tab); let target = TargetFactory.forTab(options.tab);
let toolbox = gDevTools.getToolbox(target); let toolbox = gDevTools.getToolbox(target);
@ -892,7 +892,7 @@ function waitForMessages(options) {
let rules = WebConsoleUtils.cloneObject(options.messages, true); let rules = WebConsoleUtils.cloneObject(options.messages, true);
let rulesMatched = 0; let rulesMatched = 0;
let listenerAdded = false; let listenerAdded = false;
let deferred = promise.defer(); let deferred = defer();
options.matchCondition = options.matchCondition || "all"; options.matchCondition = options.matchCondition || "all";
function checkText(rule, text) { function checkText(rule, text) {
@ -1495,12 +1495,12 @@ function checkOutputForInputs(hud, inputTests) {
} }
ok(body, "the message body"); ok(body, "the message body");
let deferredVariablesView = promise.defer(); let deferredVariablesView = defer();
entry._onVariablesViewOpen = onVariablesViewOpen.bind(null, entry, entry._onVariablesViewOpen = onVariablesViewOpen.bind(null, entry,
deferredVariablesView); deferredVariablesView);
hud.jsterm.on("variablesview-open", entry._onVariablesViewOpen); hud.jsterm.on("variablesview-open", entry._onVariablesViewOpen);
let deferredTab = promise.defer(); let deferredTab = defer();
entry._onTabOpen = onTabOpen.bind(null, entry, deferredTab); entry._onTabOpen = onTabOpen.bind(null, entry, deferredTab);
container.addEventListener("TabOpen", entry._onTabOpen, true); container.addEventListener("TabOpen", entry._onTabOpen, true);
@ -1716,7 +1716,7 @@ function waitForFinishedRequest(predicate = () => true) {
function once(target, eventName, useCapture = false) { function once(target, eventName, useCapture = false) {
info("Waiting for event: '" + eventName + "' on " + target + "."); info("Waiting for event: '" + eventName + "' on " + target + ".");
let deferred = promise.defer(); let deferred = defer();
for (let [add, remove] of [ for (let [add, remove] of [
["addEventListener", "removeEventListener"], ["addEventListener", "removeEventListener"],
@ -1775,7 +1775,7 @@ function getSourceActor(sources, URL) {
* open the expected URL. * open the expected URL.
*/ */
function simulateMessageLinkClick(element, expectedLink) { function simulateMessageLinkClick(element, expectedLink) {
let deferred = promise.defer(); let deferred = defer();
// Invoke the click event and check if a new tab would // Invoke the click event and check if a new tab would
// open to the correct page. // open to the correct page.

Просмотреть файл

@ -406,7 +406,7 @@ WebConsoleFrame.prototype = {
return promise.resolve(null); return promise.resolve(null);
} }
let deferred = promise.defer(); let deferred = defer();
let newValue = !!value; let newValue = !!value;
let toSet = { let toSet = {
"NetworkMonitor.saveRequestAndResponseBodies": newValue, "NetworkMonitor.saveRequestAndResponseBodies": newValue,
@ -437,7 +437,7 @@ WebConsoleFrame.prototype = {
return promise.resolve(null); return promise.resolve(null);
} }
let deferred = promise.defer(); let deferred = defer();
let toSet = { let toSet = {
"NetworkMonitor.throttleData": value, "NetworkMonitor.throttleData": value,
}; };
@ -506,7 +506,7 @@ WebConsoleFrame.prototype = {
return this._initDefer.promise; return this._initDefer.promise;
} }
this._initDefer = promise.defer(); this._initDefer = defer();
this.proxy = new WebConsoleConnectionProxy(this, this.owner.target); this.proxy = new WebConsoleConnectionProxy(this, this.owner.target);
this.proxy.connect().then(() => { this.proxy.connect().then(() => {
@ -2711,7 +2711,7 @@ WebConsoleFrame.prototype = {
return this._destroyer.promise; return this._destroyer.promise;
} }
this._destroyer = promise.defer(); this._destroyer = defer();
let toolbox = gDevTools.getToolbox(this.owner.target); let toolbox = gDevTools.getToolbox(this.owner.target);
if (toolbox) { if (toolbox) {

Просмотреть файл

@ -204,7 +204,7 @@ exports.CanvasActor = protocol.ActorClassWithSpec(canvasSpec, {
this._webGLPrimitiveCounter.resetCounts(); this._webGLPrimitiveCounter.resetCounts();
this._callWatcher.resumeRecording(); this._callWatcher.resumeRecording();
let deferred = this._currentAnimationFrameSnapshot = promise.defer(); let deferred = this._currentAnimationFrameSnapshot = defer();
return deferred.promise; return deferred.promise;
}, },

Просмотреть файл

@ -22,7 +22,7 @@ exports.DeviceActor = protocol.ActorClassWithSpec(deviceSpec, {
}, },
getWallpaper: function () { getWallpaper: function () {
let deferred = promise.defer(); let deferred = defer();
getSetting("wallpaper.image").then((blob) => { getSetting("wallpaper.image").then((blob) => {
let reader = new FileReader(); let reader = new FileReader();
let conn = this.conn; let conn = this.conn;

Просмотреть файл

@ -2751,7 +2751,7 @@ exports.InspectorActor = protocol.ActorClassWithSpec(inspectorSpec, {
return this._walkerPromise; return this._walkerPromise;
} }
let deferred = promise.defer(); let deferred = defer();
this._walkerPromise = deferred.promise; this._walkerPromise = deferred.promise;
let window = this.window; let window = this.window;

Просмотреть файл

@ -78,7 +78,7 @@ var storageTypePool = new Map();
* The wait time in milliseconds. * The wait time in milliseconds.
*/ */
function sleep(time) { function sleep(time) {
let deferred = promise.defer(); let deferred = defer();
setTimeout(() => { setTimeout(() => {
deferred.resolve(null); deferred.resolve(null);
@ -1852,7 +1852,7 @@ StorageActors.createActor({
let unresolvedPromises = new Map(); let unresolvedPromises = new Map();
function callParentProcessAsync(methodName, ...args) { function callParentProcessAsync(methodName, ...args) {
let deferred = promise.defer(); let deferred = defer();
unresolvedPromises.set(methodName, deferred); unresolvedPromises.set(methodName, deferred);
@ -1925,7 +1925,7 @@ var indexedDBHelpers = {
*/ */
getDBMetaData: Task.async(function* (host, principal, name, storage) { getDBMetaData: Task.async(function* (host, principal, name, storage) {
let request = this.openWithPrincipal(principal, name, storage); let request = this.openWithPrincipal(principal, name, storage);
let success = promise.defer(); let success = defer();
request.onsuccess = event => { request.onsuccess = event => {
let db = event.target.result; let db = event.target.result;
@ -2287,7 +2287,7 @@ var indexedDBHelpers = {
getObjectStoreData(host, principal, dbName, storage, requestOptions) { getObjectStoreData(host, principal, dbName, storage, requestOptions) {
let {name} = this.splitNameAndStorage(dbName); let {name} = this.splitNameAndStorage(dbName);
let request = this.openWithPrincipal(principal, name, storage); let request = this.openWithPrincipal(principal, name, storage);
let success = promise.defer(); let success = defer();
let {objectStore, id, index, offset, size} = requestOptions; let {objectStore, id, index, offset, size} = requestOptions;
let data = []; let data = [];
let db; let db;

Просмотреть файл

@ -320,7 +320,7 @@ var StyleSheetActor = protocol.ActorClassWithSpec(styleSheetSpec, {
return this._cssRules; return this._cssRules;
} }
let deferred = promise.defer(); let deferred = defer();
let onSheetLoaded = (event) => { let onSheetLoaded = (event) => {
this.ownerNode.removeEventListener("load", onSheetLoaded); this.ownerNode.removeEventListener("load", onSheetLoaded);
@ -547,7 +547,7 @@ var StyleSheetActor = protocol.ActorClassWithSpec(styleSheetSpec, {
* A promise that resolves with a SourceMapConsumer, or null. * A promise that resolves with a SourceMapConsumer, or null.
*/ */
_fetchSourceMap: function () { _fetchSourceMap: function () {
let deferred = promise.defer(); let deferred = defer();
this._getText().then(sheetContent => { this._getText().then(sheetContent => {
let url = this._extractSourceMapUrl(sheetContent); let url = this._extractSourceMapUrl(sheetContent);

Просмотреть файл

@ -743,7 +743,7 @@ BrowserTabActor.prototype = {
// so only request form update if some code is still listening on the other // so only request form update if some code is still listening on the other
// side. // side.
if (!this.exited) { if (!this.exited) {
this._deferredUpdate = promise.defer(); this._deferredUpdate = defer();
let onFormUpdate = msg => { let onFormUpdate = msg => {
// There may be more than just one childtab.js up and running // There may be more than just one childtab.js up and running
if (this._form.actor != msg.json.actor) { if (this._form.actor != msg.json.actor) {
@ -830,7 +830,7 @@ function BrowserAddonList(connection) {
} }
BrowserAddonList.prototype.getList = function () { BrowserAddonList.prototype.getList = function () {
let deferred = promise.defer(); let deferred = defer();
AddonManager.getAllAddons((addons) => { AddonManager.getAllAddons((addons) => {
for (let addon of addons) { for (let addon of addons) {
let actor = this._actorByAddonId.get(addon.id); let actor = this._actorByAddonId.get(addon.id);

Просмотреть файл

@ -259,7 +259,7 @@ exports.WebGLActor = protocol.ActorClassWithSpec(webGLSpec, {
* Used in tests. * Used in tests.
*/ */
waitForFrame: function () { waitForFrame: function () {
let deferred = promise.defer(); let deferred = defer();
this.tabActor.window.requestAnimationFrame(deferred.resolve); this.tabActor.window.requestAnimationFrame(deferred.resolve);
return deferred.promise; return deferred.promise;
}, },

Просмотреть файл

@ -732,7 +732,7 @@ var DebuggerServer = {
}, },
connectToContent(connection, mm, onDestroy) { connectToContent(connection, mm, onDestroy) {
let deferred = SyncPromise.defer(); let deferred = Syncdefer();
let prefix = connection.allocID("content-process"); let prefix = connection.allocID("content-process");
let actor, childTransport; let actor, childTransport;
@ -1022,7 +1022,7 @@ var DebuggerServer = {
* established. * established.
*/ */
connectToChild(connection, frame, onDestroy, {addonId} = {}) { connectToChild(connection, frame, onDestroy, {addonId} = {}) {
let deferred = SyncPromise.defer(); let deferred = Syncdefer();
// Get messageManager from XUL browser (which might be a specialized tunnel for RDM) // Get messageManager from XUL browser (which might be a specialized tunnel for RDM)
// or else fallback to asking the frameLoader itself. // or else fallback to asking the frameLoader itself.

Просмотреть файл

@ -90,7 +90,7 @@ function attachURL(url, callback) {
} }
function promiseOnce(target, event) { function promiseOnce(target, event) {
let deferred = promise.defer(); let deferred = defer();
target.on(event, (...args) => { target.on(event, (...args) => {
if (args.length === 1) { if (args.length === 1) {
deferred.resolve(args[0]); deferred.resolve(args[0]);
@ -174,11 +174,11 @@ function assertOwnershipTrees(walker) {
// Verify that an actorID is inaccessible both from the client library and the server. // Verify that an actorID is inaccessible both from the client library and the server.
function checkMissing(client, actorID) { function checkMissing(client, actorID) {
let deferred = promise.defer(); let deferred = defer();
let front = client.getActor(actorID); let front = client.getActor(actorID);
ok(!front, "Front shouldn't be accessible from the client for actorID: " + actorID); ok(!front, "Front shouldn't be accessible from the client for actorID: " + actorID);
deferred = promise.defer(); deferred = defer();
client.request({ client.request({
to: actorID, to: actorID,
type: "request", type: "request",
@ -191,11 +191,11 @@ function checkMissing(client, actorID) {
// Verify that an actorID is accessible both from the client library and the server. // Verify that an actorID is accessible both from the client library and the server.
function checkAvailable(client, actorID) { function checkAvailable(client, actorID) {
let deferred = promise.defer(); let deferred = defer();
let front = client.getActor(actorID); let front = client.getActor(actorID);
ok(front, "Front should be accessible from the client for actorID: " + actorID); ok(front, "Front should be accessible from the client for actorID: " + actorID);
deferred = promise.defer(); deferred = defer();
client.request({ client.request({
to: actorID, to: actorID,
type: "garbageAvailableTest", type: "garbageAvailableTest",
@ -278,7 +278,7 @@ function assertChildList(mutations) {
// Load mutations aren't predictable, so keep accumulating mutations until // Load mutations aren't predictable, so keep accumulating mutations until
// the one we're looking for shows up. // the one we're looking for shows up.
function waitForMutation(walker, test, mutations = []) { function waitForMutation(walker, test, mutations = []) {
let deferred = promise.defer(); let deferred = defer();
for (let change of mutations) { for (let change of mutations) {
if (test(change)) { if (test(change)) {
deferred.resolve(mutations); deferred.resolve(mutations);

Просмотреть файл

@ -24,7 +24,7 @@ let gDoc = null;
addAsyncTest(function* () { addAsyncTest(function* () {
let url = document.getElementById("inspectorContent").href; let url = document.getElementById("inspectorContent").href;
let def = promise.defer(); let def = defer();
attachURL(url, function (err, client, tab, doc) { attachURL(url, function (err, client, tab, doc) {
def.resolve({client, tab, doc}); def.resolve({client, tab, doc});
}); });

Просмотреть файл

@ -822,7 +822,7 @@ function getSourceContent(sourceClient) {
* @returns Promise<SourceClient> * @returns Promise<SourceClient>
*/ */
function getSource(threadClient, url) { function getSource(threadClient, url) {
let deferred = promise.defer(); let deferred = defer();
threadClient.getSources((res) => { threadClient.getSources((res) => {
let source = res.sources.filter(function (s) { let source = res.sources.filter(function (s) {
return s.url === url; return s.url === url;
@ -843,7 +843,7 @@ function getSource(threadClient, url) {
* @returns Promise<response> * @returns Promise<response>
*/ */
function reload(tabClient) { function reload(tabClient) {
let deferred = promise.defer(); let deferred = defer();
tabClient._reload({}, deferred.resolve); tabClient._reload({}, deferred.resolve);
return deferred.promise; return deferred.promise;
} }

Просмотреть файл

@ -70,7 +70,7 @@ function setup_code() {
} }
function black_box_code() { function black_box_code() {
const d = promise.defer(); const d = defer();
gThreadClient.getSources(function ({ sources, error }) { gThreadClient.getSources(function ({ sources, error }) {
do_check_true(!error, "Shouldn't get an error getting sources"); do_check_true(!error, "Shouldn't get an error getting sources");
@ -89,7 +89,7 @@ function black_box_code() {
} }
function run_code() { function run_code() {
const d = promise.defer(); const d = defer();
gClient.addOneTimeListener("paused", function (event, packet) { gClient.addOneTimeListener("paused", function (event, packet) {
d.resolve(packet); d.resolve(packet);

Просмотреть файл

@ -149,7 +149,7 @@ function test_close_client_while_sending_requests() {
type: "hello" type: "hello"
}); });
let expectReply = promise.defer(); let expectReply = defer();
gClient.expectReply("root", function (response) { gClient.expectReply("root", function (response) {
do_check_eq(response.error, "connectionClosed"); do_check_eq(response.error, "connectionClosed");
do_check_eq(response.message, do_check_eq(response.message,

Просмотреть файл

@ -30,7 +30,7 @@ function run_test() {
function test_nesting() { function test_nesting() {
const thread = gThreadActor; const thread = gThreadActor;
const { resolve, promise: p } = promise.defer(); const { resolve, promise: p } = defer();
let currentStep = 0; let currentStep = 0;

Просмотреть файл

@ -31,7 +31,7 @@ function run_test() {
function test_nesting() { function test_nesting() {
const thread = gThreadActor; const thread = gThreadActor;
const { resolve, promise: p } = promise.defer(); const { resolve, promise: p } = defer();
// The following things should happen (in order): // The following things should happen (in order):
// 1. In the new event loop (created by unsafeSynchronize) // 1. In the new event loop (created by unsafeSynchronize)

Просмотреть файл

@ -57,7 +57,7 @@ add_task(function* () {
}); });
function getChromeActors() { function getChromeActors() {
let deferred = promise.defer(); let deferred = defer();
get_chrome_actors((client, form) => deferred.resolve([client, form])); get_chrome_actors((client, form) => deferred.resolve([client, form]));
return deferred.promise; return deferred.promise;
} }

Просмотреть файл

@ -24,7 +24,7 @@ add_task(function* () {
// happen if the MOZ_PROFILER_STARTUP environment variable is set). // happen if the MOZ_PROFILER_STARTUP environment variable is set).
Profiler.StopProfiler(); Profiler.StopProfiler();
let eventsCalled = 0; let eventsCalled = 0;
let handledThreeTimes = promise.defer(); let handledThreeTimes = defer();
front.on("profiler-status", (response) => { front.on("profiler-status", (response) => {
dump("'profiler-status' fired\n"); dump("'profiler-status' fired\n");
@ -67,7 +67,7 @@ add_task(function* () {
}); });
function getChromeActors() { function getChromeActors() {
let deferred = promise.defer(); let deferred = defer();
get_chrome_actors((client, form) => deferred.resolve([client, form])); get_chrome_actors((client, form) => deferred.resolve([client, form]));
return deferred.promise; return deferred.promise;
} }

Просмотреть файл

@ -57,7 +57,7 @@ var RootActor = protocol.ActorClassWithSpec(rootSpec, {
promiseReturn: function (toWait) { promiseReturn: function (toWait) {
// Guarantee that this resolves after simpleReturn returns. // Guarantee that this resolves after simpleReturn returns.
let deferred = promise.defer(); let deferred = defer();
let sequence = this.sequence++; let sequence = this.sequence++;
// Wait until the number of requests specified by toWait have // Wait until the number of requests specified by toWait have
@ -80,7 +80,7 @@ var RootActor = protocol.ActorClassWithSpec(rootSpec, {
promiseThrow: function () { promiseThrow: function () {
// Guarantee that this resolves after simpleReturn returns. // Guarantee that this resolves after simpleReturn returns.
let deferred = promise.defer(); let deferred = defer();
let sequence = this.sequence++; let sequence = this.sequence++;
// This should be enough to force a failure if the code is broken. // This should be enough to force a failure if the code is broken.
do_timeout(150, () => { do_timeout(150, () => {
@ -148,7 +148,7 @@ function run_test() {
// While packets are sent in the correct order, rejection handlers // While packets are sent in the correct order, rejection handlers
// registered in "Promise.jsm" may be invoked later than fulfillment // registered in "Promise.jsm" may be invoked later than fulfillment
// handlers, meaning that we can't check the actual order with certainty. // handlers, meaning that we can't check the actual order with certainty.
let deferAfterRejection = promise.defer(); let deferAfterRejection = defer();
calls.push(rootClient.promiseThrow().then(() => { calls.push(rootClient.promiseThrow().then(() => {
do_check_true(false, "promiseThrow shouldn't succeed!"); do_check_true(false, "promiseThrow shouldn't succeed!");

Просмотреть файл

@ -165,7 +165,7 @@ function run_test() {
// That reference should be removed now. // That reference should be removed now.
expectRootChildren(0); expectRootChildren(0);
}).then(() => { }).then(() => {
let deferred = promise.defer(); let deferred = defer();
rootClient.once("string-event", (str) => { rootClient.once("string-event", (str) => {
trace.expectSend({"type": "emitShortString", "to": "<actorid>"}); trace.expectSend({"type": "emitShortString", "to": "<actorid>"});
trace.expectReceive({"type": "string-event", "str": "abc", "from": "<actorid>"}); trace.expectReceive({"type": "string-event", "str": "abc", "from": "<actorid>"});
@ -187,7 +187,7 @@ function run_test() {
// Will generate no packets // Will generate no packets
return strfront.release(); return strfront.release();
}).then(() => { }).then(() => {
let deferred = promise.defer(); let deferred = defer();
rootClient.once("string-event", (str) => { rootClient.once("string-event", (str) => {
trace.expectSend({"type": "emitLongString", "to": "<actorid>"}); trace.expectSend({"type": "emitLongString", "to": "<actorid>"});
trace.expectReceive({"type": "string-event", trace.expectReceive({"type": "string-event",

Просмотреть файл

@ -300,7 +300,7 @@ function run_test() {
do_check_eq(str, "hello"); do_check_eq(str, "hello");
let deferred = promise.defer(); let deferred = defer();
rootClient.on("oneway", (response) => { rootClient.on("oneway", (response) => {
trace.expectSend({"type": "testOneWay", "a": "hello", "to": "<actorid>"}); trace.expectSend({"type": "testOneWay", "a": "hello", "to": "<actorid>"});
trace.expectReceive({"type": "oneway", "a": "hello", "from": "<actorid>"}); trace.expectReceive({"type": "oneway", "a": "hello", "from": "<actorid>"});
@ -311,7 +311,7 @@ function run_test() {
do_check_true(typeof (rootClient.testOneWay("hello")) === "undefined"); do_check_true(typeof (rootClient.testOneWay("hello")) === "undefined");
return deferred.promise; return deferred.promise;
}).then(() => { }).then(() => {
let deferred = promise.defer(); let deferred = defer();
rootClient.on("falsyOptions", res => { rootClient.on("falsyOptions", res => {
trace.expectSend({"type": "emitFalsyOptions", "to": "<actorid>"}); trace.expectSend({"type": "emitFalsyOptions", "to": "<actorid>"});
trace.expectReceive({"type": "falsyOptions", trace.expectReceive({"type": "falsyOptions",

Просмотреть файл

@ -61,7 +61,7 @@ function define_code() {
} }
function run_code() { function run_code() {
const d = promise.defer(); const d = defer();
gClient.addOneTimeListener("paused", function (event, packet) { gClient.addOneTimeListener("paused", function (event, packet) {
d.resolve(packet); d.resolve(packet);
gThreadClient.resume(); gThreadClient.resume();

Просмотреть файл

@ -61,7 +61,7 @@ function define_code() {
} }
function run_code() { function run_code() {
const d = promise.defer(); const d = defer();
gClient.addOneTimeListener("paused", function () { gClient.addOneTimeListener("paused", function () {
gThreadClient.getFrames(0, 3, function (response) { gThreadClient.getFrames(0, 3, function (response) {
d.resolve(response); d.resolve(response);

Просмотреть файл

@ -21,7 +21,7 @@ this.rpc = function (method, ...params) {
id: id id: id
})); }));
let deferred = Promise.defer(); let deferred = defer();
rpcDeferreds[id] = deferred; rpcDeferreds[id] = deferred;
return deferred.promise; return deferred.promise;
}; };

Просмотреть файл

@ -43,7 +43,7 @@ TestStreamListener.prototype = {
onStateChanged: function () { onStateChanged: function () {
if (!this._deferred) { if (!this._deferred) {
this._deferred = promise.defer(); this._deferred = defer();
} }
return this._deferred.promise; return this._deferred.promise;
} }