mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 07:40:42 +00:00
Bug 1625500 - fix use of .then(x, x) in the tree, r=marionette-reviewers,Standard8,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D68614
This commit is contained in:
parent
92b577ebfa
commit
cc39a339a0
@ -1124,8 +1124,8 @@ add_task(async function testExtensionControlledProxyConfig() {
|
||||
async function closeProxyPanel(panelObj) {
|
||||
let dialog = panelObj.panel.document.getElementById("ConnectionsDialog");
|
||||
dialog.cancelDialog();
|
||||
let panelClosingEvent = await panelObj.closingPromise;
|
||||
ok(panelClosingEvent, "Proxy panel closed.");
|
||||
await panelObj.closingPromise;
|
||||
is(panelObj.pane.state, "closed", "Proxy panel closed.");
|
||||
}
|
||||
|
||||
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {
|
||||
|
@ -130,13 +130,12 @@ function waitForEvent(aSubject, aEventName, aTimeoutMs, aTarget) {
|
||||
eventDeferred.resolve(aEvent);
|
||||
};
|
||||
|
||||
function cleanup(aEventOrError) {
|
||||
function cleanup() {
|
||||
// unhook listener in case of success or failure
|
||||
aSubject.removeEventListener(aEventName, listener);
|
||||
return aEventOrError;
|
||||
}
|
||||
aSubject.addEventListener(aEventName, listener);
|
||||
return eventDeferred.promise.then(cleanup, cleanup);
|
||||
return eventDeferred.promise.finally(cleanup);
|
||||
}
|
||||
|
||||
function openPreferencesViaOpenPreferencesAPI(aPane, aOptions) {
|
||||
|
@ -2235,7 +2235,7 @@ var SessionStoreInternal = {
|
||||
deferred.resolve();
|
||||
}
|
||||
}, topic);
|
||||
deferred.promise.then(cleanup, cleanup);
|
||||
deferred.promise.finally(cleanup);
|
||||
return deferred;
|
||||
};
|
||||
|
||||
@ -6158,10 +6158,7 @@ var SessionStoreInternal = {
|
||||
);
|
||||
// Ensure that the timer is both canceled once we are done with it
|
||||
// and not garbage-collected until then.
|
||||
deferred.promise.then(
|
||||
() => timer.cancel(),
|
||||
() => timer.cancel()
|
||||
);
|
||||
deferred.promise.finally(() => timer.cancel());
|
||||
return deferred;
|
||||
},
|
||||
|
||||
|
@ -151,7 +151,7 @@ class FaviconLoad {
|
||||
this.dataBuffer = null;
|
||||
this.stream = null;
|
||||
};
|
||||
this._deferred.promise.then(cleanup, cleanup);
|
||||
this._deferred.promise.finally(cleanup);
|
||||
|
||||
this.dataBuffer = new StorageStream(STREAM_SEGMENT_SIZE, PR_UINT32_MAX);
|
||||
|
||||
|
@ -750,7 +750,7 @@ MarkupView.prototype = {
|
||||
this._briefBoxModelPromise = new Promise(resolve => {
|
||||
_resolve = resolve;
|
||||
this._briefBoxModelTimer = setTimeout(() => {
|
||||
this._hideBoxModel().then(resolve, resolve);
|
||||
this._hideBoxModel().finally(resolve);
|
||||
}, NEW_SELECTION_HIGHLIGHTER_TIMER);
|
||||
});
|
||||
this._briefBoxModelPromise.resolve = _resolve;
|
||||
|
@ -1891,9 +1891,7 @@ RuleViewTool.prototype = {
|
||||
|
||||
if (selectElement) {
|
||||
const done = this.inspector.updating("rule-view");
|
||||
this.view
|
||||
.selectElement(this.inspector.selection.nodeFront)
|
||||
.then(done, done);
|
||||
this.view.selectElement(this.inspector.selection.nodeFront).finally(done);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -24,13 +24,13 @@ class Scheduler {
|
||||
|
||||
dequeue() {
|
||||
const self = this;
|
||||
const recursive = resolve => {
|
||||
const recursive = () => {
|
||||
self.dequeue();
|
||||
};
|
||||
this.busy = true;
|
||||
const next = this.queue.shift();
|
||||
if (next) {
|
||||
next().then(recursive, recursive);
|
||||
next().finally(recursive);
|
||||
} else {
|
||||
this.busy = false;
|
||||
}
|
||||
|
@ -87,8 +87,6 @@ function evaluateExpression(expression, from = "input") {
|
||||
|
||||
// Even if the evaluation fails,
|
||||
// we still need to pass the error response to onExpressionEvaluated.
|
||||
const onSettled = res => res;
|
||||
|
||||
const response = await client
|
||||
.evaluateJSAsync(expression, {
|
||||
frameActor: await webConsoleUI.getFrameActor(),
|
||||
@ -96,7 +94,7 @@ function evaluateExpression(expression, from = "input") {
|
||||
selectedTargetFront: toolbox && toolbox.getSelectedTargetFront(),
|
||||
mapped,
|
||||
})
|
||||
.then(onSettled, onSettled);
|
||||
.catch(e => e);
|
||||
|
||||
return dispatch(onExpressionEvaluated(response));
|
||||
};
|
||||
|
@ -115,7 +115,7 @@ function tryActors(reachables, completed) {
|
||||
executeSoon(completed, "tryActors callback " + completed.name);
|
||||
}
|
||||
};
|
||||
promise.then(callback, callback);
|
||||
promise.catch(e => e).then(callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,8 @@ function StreamCopier(input, output, length) {
|
||||
// fail scenarios, but also emit events (due to the EventEmitter) for other
|
||||
// states, like progress.
|
||||
this.then = this._deferred.then.bind(this._deferred);
|
||||
this.then(this._destroy, this._destroy);
|
||||
this.finally = this._deferred.finally.bind(this._deferred);
|
||||
this.finally(this._destroy);
|
||||
|
||||
// Stream ready callback starts as |_copy|, but may switch to |_flush| at end
|
||||
// if flushing would block the output stream.
|
||||
|
@ -177,7 +177,7 @@ function grabHistogramsFromContent(use_counter_middlefix, page_before = null) {
|
||||
};
|
||||
return BrowserTestUtils.waitForCondition(() => {
|
||||
return page_before != gather()[0];
|
||||
}).then(gather, gather);
|
||||
}).finally(gather);
|
||||
}
|
||||
|
||||
var check_use_counter_iframe = async function(
|
||||
|
@ -511,14 +511,9 @@ function testMultipleCacheEntries() {
|
||||
|
||||
// Make sure to clean up after each test step.
|
||||
function step(testPromise) {
|
||||
return testPromise.then(
|
||||
function() {
|
||||
caches.delete(name);
|
||||
},
|
||||
function() {
|
||||
caches.delete(name);
|
||||
}
|
||||
);
|
||||
return testPromise.finally(function() {
|
||||
caches.delete(name);
|
||||
});
|
||||
}
|
||||
|
||||
step(testBasics())
|
||||
|
@ -153,6 +153,6 @@ onmessage = function(event) {
|
||||
doneTask();
|
||||
} else if (event.data.type == "testBug1239300") {
|
||||
var promise = testBug1239300();
|
||||
promise.then(doneTask, doneTask);
|
||||
promise.finally(doneTask);
|
||||
}
|
||||
};
|
||||
|
@ -92,7 +92,7 @@ if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -575,7 +575,7 @@ class RTCPeerConnection {
|
||||
this.updateNegotiationNeeded();
|
||||
}
|
||||
};
|
||||
p.then(doNextOperation, doNextOperation);
|
||||
p.finally(doNextOperation);
|
||||
});
|
||||
if (this._operations.length == 1) {
|
||||
this._operations[0]();
|
||||
|
@ -68,5 +68,5 @@ function check_ogg(v, enabled, finish) {
|
||||
.then(verify_opus_support)
|
||||
.then(opus_enable)
|
||||
.then(opus_disable)
|
||||
.then(unspported_ogg, unspported_ogg);
|
||||
.finally(unspported_ogg);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ if (isParent) {
|
||||
registerCleanupFunction(() => {
|
||||
return db.drop().then(_ => db.close());
|
||||
});
|
||||
setUpServiceInParent(PushService, db).then(run_next_test, run_next_test);
|
||||
setUpServiceInParent(PushService, db).finally(run_next_test);
|
||||
});
|
||||
}
|
||||
|
||||
@ -352,6 +352,6 @@ add_test(function test_subscribe_missing_principal() {
|
||||
|
||||
if (isParent) {
|
||||
add_test(function tearDown() {
|
||||
tearDownServiceInParent(db).then(run_next_test, run_next_test);
|
||||
tearDownServiceInParent(db).finally(run_next_test);
|
||||
});
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ function cleanup() {
|
||||
|
||||
function runTest() {
|
||||
if (!steps.length) {
|
||||
registration.unregister().then(cleanup, cleanup);
|
||||
registration.unregister().finally(cleanup);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@
|
||||
Promise.all([
|
||||
testPermissiveHeader(),
|
||||
testPreciseHeader(),
|
||||
]).then(SimpleTest.finish, SimpleTest.finish);
|
||||
]).finally(SimpleTest.finish);
|
||||
}, (x) => {
|
||||
ok(false, "Registration should not succeed, but it did");
|
||||
SimpleTest.finish();
|
||||
|
@ -32,16 +32,15 @@ addEventListener("message", function workerWrapperOnMessage(e) {
|
||||
var data = e.data;
|
||||
|
||||
function runTestAndReportToClient(event) {
|
||||
var done = function(res) {
|
||||
var done = function() {
|
||||
client.postMessage({ type: "finish", context });
|
||||
return res;
|
||||
};
|
||||
|
||||
try {
|
||||
// runTest() is provided by the test.
|
||||
var result = runTest().then(done, done);
|
||||
var promise = runTest().finally(done);
|
||||
if ("waitUntil" in event) {
|
||||
event.waitUntil(result);
|
||||
event.waitUntil(promise);
|
||||
}
|
||||
} catch (e) {
|
||||
client.postMessage({
|
||||
|
@ -30,7 +30,7 @@ function grabHistogramsFromContent(
|
||||
};
|
||||
return BrowserTestUtils.waitForCondition(() => {
|
||||
return counter_before != gather()[0];
|
||||
}).then(gather, gather);
|
||||
}).finally(gather);
|
||||
}
|
||||
|
||||
var check_use_counter_worker = async function(
|
||||
|
@ -16,7 +16,7 @@ FissionTestHelper.startTestPromise
|
||||
.then(loadOOPIFrame("testframe", "helper_fission_empty.html"))
|
||||
.then(waitUntilApzStable)
|
||||
.then(runAsyncContinuation(test))
|
||||
.then(FissionTestHelper.subtestDone, FissionTestHelper.subtestDone);
|
||||
.finally(FissionTestHelper.subtestDone);
|
||||
|
||||
async function setup_in_oopif() {
|
||||
const setup = function() {
|
||||
|
@ -16,7 +16,7 @@ FissionTestHelper.startTestPromise
|
||||
.then(loadOOPIFrame("testframe", "helper_fission_empty.html"))
|
||||
.then(waitUntilApzStable)
|
||||
.then(runAsyncContinuation(test))
|
||||
.then(FissionTestHelper.subtestDone, FissionTestHelper.subtestDone);
|
||||
.finally(FissionTestHelper.subtestDone);
|
||||
|
||||
async function setup_in_oopif() {
|
||||
const setup = function() {
|
||||
|
@ -16,7 +16,7 @@ FissionTestHelper.startTestPromise
|
||||
.then(loadOOPIFrame("testframe", "helper_fission_empty.html"))
|
||||
.then(waitUntilApzStable)
|
||||
.then(runAsyncContinuation(test))
|
||||
.then(FissionTestHelper.subtestDone, FissionTestHelper.subtestDone);
|
||||
.finally(FissionTestHelper.subtestDone);
|
||||
|
||||
|
||||
// The actual test
|
||||
|
@ -17,7 +17,7 @@ FissionTestHelper.startTestPromise
|
||||
.then(loadOOPIFrame("testframe", "helper_fission_empty.html"))
|
||||
.then(waitUntilApzStable)
|
||||
.then(runAsyncContinuation(test))
|
||||
.then(FissionTestHelper.subtestDone, FissionTestHelper.subtestDone);
|
||||
.finally(FissionTestHelper.subtestDone);
|
||||
|
||||
|
||||
// The actual test
|
||||
|
@ -17,7 +17,7 @@ FissionTestHelper.startTestPromise
|
||||
.then(loadOOPIFrame("testframe", "helper_fission_empty.html"))
|
||||
.then(waitUntilApzStable)
|
||||
.then(runAsyncContinuation(test))
|
||||
.then(FissionTestHelper.subtestDone, FissionTestHelper.subtestDone);
|
||||
.finally(FissionTestHelper.subtestDone);
|
||||
|
||||
|
||||
let code_for_oopif_to_run = function() {
|
||||
|
@ -17,7 +17,7 @@ FissionTestHelper.startTestPromise
|
||||
.then(loadOOPIFrame("testframe", "helper_fission_empty.html"))
|
||||
.then(waitUntilApzStable)
|
||||
.then(runAsyncContinuation(test))
|
||||
.then(FissionTestHelper.subtestDone, FissionTestHelper.subtestDone);
|
||||
.finally(FissionTestHelper.subtestDone);
|
||||
|
||||
|
||||
let code_for_oopif_to_run = function() {
|
||||
|
@ -20,7 +20,7 @@
|
||||
// inside an iframe which means we have no control over the root APZC.
|
||||
window.onload = () => {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
@ -24,7 +24,7 @@
|
||||
// inside an iframe which means we have no control over the root APZC.
|
||||
window.onload = () => {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
@ -25,7 +25,7 @@ if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
// inside an iframe which means we have no control over the root APZC.
|
||||
window.onload = () => {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
@ -47,7 +47,7 @@ if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ var subtests = [
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
} else {
|
||||
SimpleTest.ok(true, "Keyboard APZ is disabled");
|
||||
|
@ -17,7 +17,7 @@ if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ if (isApzEnabled()) {
|
||||
// inside an iframe which means we have no control over the root APZC.
|
||||
window.onload = () => {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
@ -47,7 +47,7 @@ if (isApzEnabled()) {
|
||||
SimpleTest.expectAssertions(0, 2); // from helper_bug1550510.html, bug 1232856
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1285070
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish, SimpleTest.finish);
|
||||
.finally(SimpleTest.finish);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ GeckoViewPermission.prototype = {
|
||||
};
|
||||
|
||||
if (dispatcher) {
|
||||
this.getAppPermissions(dispatcher, perms).then(callback, callback);
|
||||
this.getAppPermissions(dispatcher, perms).finally(callback);
|
||||
} else {
|
||||
// No dispatcher; just bail.
|
||||
callback();
|
||||
|
@ -97,7 +97,8 @@ function StreamCopier(input, output, length) {
|
||||
// or fail scenarios, but also emit events (due to the EventEmitter)
|
||||
// for other states, like progress.
|
||||
this.then = this._deferred.promise.then.bind(this._deferred.promise);
|
||||
this.then(this._destroy, this._destroy);
|
||||
this.finally = this._deferred.promise.finally.bind(this._deferred.promise);
|
||||
this.finally(this._destroy);
|
||||
|
||||
// Stream ready callback starts as |_copy|, but may switch to |_flush|
|
||||
// at end if flushing would block the output stream.
|
||||
|
@ -1639,7 +1639,7 @@ try {
|
||||
|
||||
let complete = false;
|
||||
let doComplete = () => (complete = true);
|
||||
_TelemetryController.testRegisterJsProbes().then(doComplete, doComplete);
|
||||
_TelemetryController.testRegisterJsProbes().finally(doComplete);
|
||||
_Services.tm.spinEventLoopUntil(() => complete);
|
||||
}
|
||||
} catch (e) {
|
||||
|
@ -288,10 +288,7 @@ function looseTimer(delay) {
|
||||
);
|
||||
// Ensure that the timer is both canceled once we are done with it
|
||||
// and not garbage-collected until then.
|
||||
deferred.promise.then(
|
||||
() => timer.cancel(),
|
||||
() => timer.cancel()
|
||||
);
|
||||
deferred.promise.finally(() => timer.cancel());
|
||||
return deferred;
|
||||
}
|
||||
|
||||
|
@ -802,7 +802,7 @@ Download.prototype = {
|
||||
if (!this._promiseCanceled) {
|
||||
// Start a new cancellation request.
|
||||
this._promiseCanceled = new Promise(resolve => {
|
||||
this._currentAttempt.then(resolve, resolve);
|
||||
this._currentAttempt.finally(resolve);
|
||||
});
|
||||
|
||||
// The download can already be restarted.
|
||||
|
@ -1033,7 +1033,7 @@ ParentAPIManager = {
|
||||
let remove = () => {
|
||||
listenerPromises.delete(promise);
|
||||
};
|
||||
promise.then(remove, remove);
|
||||
promise.finally(remove);
|
||||
}
|
||||
|
||||
let handler = await promise;
|
||||
|
@ -48,6 +48,8 @@ add_task(async function test_post_unload_promises() {
|
||||
|
||||
context.wrapPromise(Promise.resolve("resolved")).then(fail);
|
||||
|
||||
// We care about which way we fail here (if we do), so we don't want to use finally.
|
||||
// eslint-disable-next-line mozilla/use-finally
|
||||
context.wrapPromise(Promise.reject({ message: "rejected" })).then(fail, fail);
|
||||
|
||||
context.unload();
|
||||
|
@ -9,5 +9,5 @@ const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
OS.File.getCurrentDirectory().then(do_test_finished, do_test_finished);
|
||||
OS.File.getCurrentDirectory().finally(do_test_finished);
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ var ClientIDImpl = {
|
||||
|
||||
this._loadClientIdTask = this._doLoadClientID();
|
||||
let clear = () => (this._loadClientIdTask = null);
|
||||
this._loadClientIdTask.then(clear, clear);
|
||||
this._loadClientIdTask.finally(clear);
|
||||
return this._loadClientIdTask;
|
||||
},
|
||||
|
||||
@ -330,7 +330,7 @@ var ClientIDImpl = {
|
||||
// Asynchronous calls to getClientID will also be blocked on this.
|
||||
this._removeClientIdTask = this._doRemoveClientID();
|
||||
let clear = () => (this._removeClientIdTask = null);
|
||||
this._removeClientIdTask.then(clear, clear);
|
||||
this._removeClientIdTask.finally(clear);
|
||||
|
||||
await this._removeClientIdTask;
|
||||
|
||||
|
@ -469,7 +469,7 @@ var SendScheduler = {
|
||||
if (!this._sendTask) {
|
||||
this._sendTask = this._doSendTask();
|
||||
let clear = () => (this._sendTask = null);
|
||||
this._sendTask.then(clear, clear);
|
||||
this._sendTask.finally(clear);
|
||||
} else if (immediately) {
|
||||
CancellableTimeout.cancelTimeout();
|
||||
}
|
||||
@ -1521,7 +1521,7 @@ var TelemetrySendImpl = {
|
||||
*/
|
||||
_trackPendingPingTask(promise) {
|
||||
let clear = () => this._pendingPingActivity.delete(promise);
|
||||
promise.then(clear, clear);
|
||||
promise.finally(clear);
|
||||
this._pendingPingActivity.add(promise);
|
||||
},
|
||||
|
||||
|
@ -856,7 +856,7 @@ var TelemetryStorageImpl = {
|
||||
// Make sure to clear |_cleanArchiveTask| once done.
|
||||
let clear = () => (this._cleanArchiveTask = null);
|
||||
// Since there's no archive cleaning task running, start it.
|
||||
this._cleanArchiveTask = this._cleanArchive().then(clear, clear);
|
||||
this._cleanArchiveTask = this._cleanArchive().finally(clear);
|
||||
return this._cleanArchiveTask;
|
||||
},
|
||||
|
||||
@ -1541,7 +1541,7 @@ var TelemetryStorageImpl = {
|
||||
*/
|
||||
_trackPendingPingSaveTask(promise) {
|
||||
let clear = () => this._activePendingPingSaves.delete(promise);
|
||||
promise.then(clear, clear);
|
||||
promise.finally(clear);
|
||||
this._activePendingPingSaves.add(promise);
|
||||
},
|
||||
|
||||
|
@ -602,8 +602,7 @@ Capture.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
PageThumbs._store(this.url, data.finalURL, data.imageData, true).then(
|
||||
done,
|
||||
PageThumbs._store(this.url, data.finalURL, data.imageData, true).finally(
|
||||
done
|
||||
);
|
||||
},
|
||||
|
@ -127,7 +127,7 @@ let loop = function loop(index) {
|
||||
loop(index + 1);
|
||||
};
|
||||
let result = executeTest(test);
|
||||
result.then(next, next);
|
||||
result.finally(next);
|
||||
};
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -723,7 +723,7 @@ ConnectionData.prototype = Object.freeze({
|
||||
shrinkMemory() {
|
||||
this._log.info("Shrinking memory usage.");
|
||||
let onShrunk = this._clearIdleShrinkTimer.bind(this);
|
||||
return this.execute("PRAGMA shrink_memory").then(onShrunk, onShrunk);
|
||||
return this.execute("PRAGMA shrink_memory").finally(onShrunk);
|
||||
},
|
||||
|
||||
discardCachedStatements() {
|
||||
|
@ -31,7 +31,7 @@ var run_promise_tests = function run_promise_tests(tests, cb) {
|
||||
});
|
||||
};
|
||||
let result = test();
|
||||
result.then(next, next);
|
||||
result.finally(next);
|
||||
};
|
||||
return loop(0);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user