diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /dom/promise | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/promise')
-rw-r--r-- | dom/promise/Promise.cpp | 53 | ||||
-rw-r--r-- | dom/promise/Promise.h | 7 | ||||
-rw-r--r-- | dom/promise/tests/promise_uncatchable_exception.js | 4 | ||||
-rw-r--r-- | dom/promise/tests/test_bug883683.html | 4 | ||||
-rw-r--r-- | dom/promise/tests/test_on_promise_settled_duplicates.html | 2 | ||||
-rw-r--r-- | dom/promise/tests/test_promise.html | 92 | ||||
-rw-r--r-- | dom/promise/tests/test_promise_uncatchable_exception.html | 2 | ||||
-rw-r--r-- | dom/promise/tests/test_promise_utils.html | 12 | ||||
-rw-r--r-- | dom/promise/tests/test_promise_xrays.html | 26 | ||||
-rw-r--r-- | dom/promise/tests/test_resolve.html | 2 | ||||
-rw-r--r-- | dom/promise/tests/test_webassembly_compile.html | 2 | ||||
-rw-r--r-- | dom/promise/tests/unit/test_monitor_uncaught.js | 8 | ||||
-rw-r--r-- | dom/promise/tests/unit/test_promise_job_across_sandbox.js | 5 |
13 files changed, 80 insertions, 139 deletions
diff --git a/dom/promise/Promise.cpp b/dom/promise/Promise.cpp index fb4989c43d..3abb517ac7 100644 --- a/dom/promise/Promise.cpp +++ b/dom/promise/Promise.cpp @@ -213,59 +213,6 @@ already_AddRefed<Promise> Promise::All( return CreateFromExisting(global, result, aPropagateUserInteraction); } -void Promise::Then(JSContext* aCx, - // aCalleeGlobal may not be in the compartment of aCx, when - // called over Xrays. - JS::Handle<JSObject*> aCalleeGlobal, - AnyCallback* aResolveCallback, AnyCallback* aRejectCallback, - JS::MutableHandle<JS::Value> aRetval, ErrorResult& aRv) { - NS_ASSERT_OWNINGTHREAD(Promise); - - // Let's hope this does the right thing with Xrays... Ensure everything is - // just in the caller compartment; that ought to do the trick. In theory we - // should consider aCalleeGlobal, but in practice our only caller is - // DOMRequest::Then, which is not working with a Promise subclass, so things - // should be OK. - JS::Rooted<JSObject*> promise(aCx, PromiseObj()); - if (!promise) { - // This promise is no-op, so do nothing. - return; - } - - if (!JS_WrapObject(aCx, &promise)) { - aRv.NoteJSContextException(aCx); - return; - } - - JS::Rooted<JSObject*> resolveCallback(aCx); - if (aResolveCallback) { - resolveCallback = aResolveCallback->CallbackOrNull(); - if (!JS_WrapObject(aCx, &resolveCallback)) { - aRv.NoteJSContextException(aCx); - return; - } - } - - JS::Rooted<JSObject*> rejectCallback(aCx); - if (aRejectCallback) { - rejectCallback = aRejectCallback->CallbackOrNull(); - if (!JS_WrapObject(aCx, &rejectCallback)) { - aRv.NoteJSContextException(aCx); - return; - } - } - - JS::Rooted<JSObject*> retval(aCx); - retval = JS::CallOriginalPromiseThen(aCx, promise, resolveCallback, - rejectCallback); - if (!retval) { - aRv.NoteJSContextException(aCx); - return; - } - - aRetval.setObject(*retval); -} - static void SettlePromise(Promise* aSettlingPromise, Promise* aCallbackPromise, ErrorResult& aRv) { if (!aSettlingPromise) { diff --git a/dom/promise/Promise.h b/dom/promise/Promise.h index 76c657d5a6..f2b70a95cd 100644 --- a/dom/promise/Promise.h +++ b/dom/promise/Promise.h @@ -255,13 +255,6 @@ class Promise : public SupportsWeakPtr { PropagateUserInteraction aPropagateUserInteraction = eDontPropagateUserInteraction); - void Then(JSContext* aCx, - // aCalleeGlobal may not be in the compartment of aCx, when called - // over Xrays. - JS::Handle<JSObject*> aCalleeGlobal, AnyCallback* aResolveCallback, - AnyCallback* aRejectCallback, JS::MutableHandle<JS::Value> aRetval, - ErrorResult& aRv); - template <typename Callback, typename... Args> using IsHandlerCallback = std::is_same<already_AddRefed<Promise>, diff --git a/dom/promise/tests/promise_uncatchable_exception.js b/dom/promise/tests/promise_uncatchable_exception.js index eafc9e5448..1b1f62e774 100644 --- a/dom/promise/tests/promise_uncatchable_exception.js +++ b/dom/promise/tests/promise_uncatchable_exception.js @@ -2,10 +2,10 @@ postMessage("Done", "*"); -var p = new Promise(function (resolve, reject) { +var p = new Promise(function () { TestFunctions.throwUncatchableException(); ok(false, "Shouldn't get here!"); -}).catch(function (exception) { +}).catch(function () { ok(false, "Shouldn't get here!"); }); ok(false, "Shouldn't get here!"); diff --git a/dom/promise/tests/test_bug883683.html b/dom/promise/tests/test_bug883683.html index 1b31e32330..b2f776fe53 100644 --- a/dom/promise/tests/test_bug883683.html +++ b/dom/promise/tests/test_bug883683.html @@ -23,10 +23,10 @@ function runTest() { [{}, {}, {}, {}, {}].reduce(Promise.resolve.bind(Promise)); ok(true, "No leaks with resolve?"); - [{}, {}, {}, {}, {}].reduce(function(a, b, c, d) { return new Promise(function(r1, r2) { throw a; }); }); + [{}, {}, {}, {}, {}].reduce(function(a) { return new Promise(function() { throw a; }); }); ok(true, "No leaks with exception?"); - [{}, {}, {}, {}, {}].reduce(function(a, b, c, d) { return new Promise(function(r1, r2) { }); }); + [{}, {}, {}, {}, {}].reduce(function() { return new Promise(function() { }); }); ok(true, "No leaks with empty promise?"); SimpleTest.finish(); diff --git a/dom/promise/tests/test_on_promise_settled_duplicates.html b/dom/promise/tests/test_on_promise_settled_duplicates.html index e11f4eaa60..324c63b74f 100644 --- a/dom/promise/tests/test_on_promise_settled_duplicates.html +++ b/dom/promise/tests/test_on_promise_settled_duplicates.html @@ -38,7 +38,7 @@ Bug 1084065 - Test that Debugger.prototype.onPromiseResolved doesn't get dupes. seen.add(wp); }; - var promise = new Promise(function(fulfill, reject) { + var promise = new Promise(function(fulfill) { fulfill(1); fulfill(2); fulfill(3); diff --git a/dom/promise/tests/test_promise.html b/dom/promise/tests/test_promise.html index 7c724daf51..95126bd6ba 100644 --- a/dom/promise/tests/test_promise.html +++ b/dom/promise/tests/test_promise.html @@ -56,7 +56,7 @@ function promiseReject() { var promise = new Promise(function(resolve, reject) { reject(42); }); - promise.then(function(what) { + promise.then(function() { ok(false, "Then - resolveCb has been called"); runTest(); }, function(what) { @@ -70,7 +70,7 @@ function promiseRejectNoHandler() { // This test only checks that the code that reports unhandled errors in the // Promises implementation does not crash or leak. - new Promise(function(res, rej) { + new Promise(function() { // eslint-disable-next-line no-undef noSuchMethod(); }); @@ -81,7 +81,7 @@ function promiseRejectNoArg() { var promise = new Promise(function(resolve, reject) { reject(); }); - promise.then(function(what) { + promise.then(function() { ok(false, "Then - resolveCb has been called"); runTest(); }, function(what) { @@ -92,11 +92,11 @@ function promiseRejectNoArg() { } function promiseException() { - var promise = new Promise(function(resolve, reject) { + var promise = new Promise(function() { // eslint-disable-next-line no-throw-literal throw 42; }); - promise.then(function(what) { + promise.then(function() { ok(false, "Then - resolveCb has been called"); runTest(); }, function(what) { @@ -108,10 +108,10 @@ function promiseException() { function promiseGC() { var resolve; - var promise = new Promise(function(r1, r2) { + var promise = new Promise(function(r1) { resolve = r1; }); - promise.then(function(what) { + promise.then(function() { ok(true, "Then - promise is still alive"); runTest(); }); @@ -199,7 +199,7 @@ function promiseAsync_SyncXHR() { function promiseDoubleThen() { var steps = 0; - var promise = new Promise(function(r1, r2) { + var promise = new Promise(function(r1) { r1(42); }); @@ -207,7 +207,7 @@ function promiseDoubleThen() { ok(true, "Then.resolve has been called"); is(what, 42, "Value == 42"); steps++; - }, function(what) { + }, function() { ok(false, "Then.reject has been called"); }); @@ -216,28 +216,28 @@ function promiseDoubleThen() { is(steps, 1, "Then.resolve - step == 1"); is(what, 42, "Value == 42"); runTest(); - }, function(what) { + }, function() { ok(false, "Then.reject has been called"); }); } function promiseThenException() { - var promise = new Promise(function(resolve, reject) { + var promise = new Promise(function(resolve) { resolve(42); }); - promise.then(function(what) { + promise.then(function() { ok(true, "Then.resolve has been called"); // eslint-disable-next-line no-throw-literal throw "booh"; - }).catch(function(e) { + }).catch(function() { ok(true, "window.onerror has been called!"); runTest(); }); } function promiseThenCatchThen() { - var promise = new Promise(function(resolve, reject) { + var promise = new Promise(function(resolve) { resolve(42); }); @@ -245,7 +245,7 @@ function promiseThenCatchThen() { ok(true, "Then.resolve has been called"); is(what, 42, "Value == 42"); return what + 1; - }, function(what) { + }, function() { ok(false, "Then.reject has been called"); }); @@ -255,7 +255,7 @@ function promiseThenCatchThen() { ok(true, "Then.resolve has been called"); is(what, 43, "Value == 43"); return what + 1; - }, function(what) { + }, function() { ok(false, "Then.reject has been called"); }).catch(function() { ok(false, "Catch has been called"); @@ -263,13 +263,13 @@ function promiseThenCatchThen() { ok(true, "Then.resolve has been called"); is(what, 44, "Value == 44"); runTest(); - }, function(what) { + }, function() { ok(false, "Then.reject has been called"); }); } function promiseThenNoArg() { - var promise = new Promise(function(resolve, reject) { + var promise = new Promise(function(resolve) { resolve(42); }); @@ -318,7 +318,7 @@ function promiseRejectThenCatchThen() { reject(42); }); - var promise2 = promise.then(function(what) { + var promise2 = promise.then(function() { ok(false, "Then.resolve has been called"); }, function(what) { ok(true, "Then.reject has been called"); @@ -332,7 +332,7 @@ function promiseRejectThenCatchThen() { ok(true, "Then.resolve has been called"); is(what, 43, "Value == 43"); return what + 1; - }).catch(function(what) { + }).catch(function() { ok(false, "Catch has been called"); }).then(function(what) { ok(true, "Then.resolve has been called"); @@ -366,7 +366,7 @@ function promiseRejectThenCatchExceptionThen() { reject(42); }); - promise.then(function(what) { + promise.then(function() { ok(false, "Then.resolve has been called"); }, function(what) { ok(true, "Then.reject has been called"); @@ -386,7 +386,7 @@ function promiseRejectThenCatchExceptionThen() { function promiseThenCatchOrderingResolve() { var global = 0; - var f = new Promise(function(r1, r2) { + var f = new Promise(function(r1) { r1(42); }); @@ -446,8 +446,8 @@ function promiseCatchNoArg() { } function promiseNestedPromise() { - new Promise(function(resolve, reject) { - resolve(new Promise(function(res, rej) { + new Promise(function(resolve) { + resolve(new Promise(function(res) { ok(true, "Nested promise is executed"); res(42); })); @@ -458,8 +458,8 @@ function promiseNestedPromise() { } function promiseNestedNestedPromise() { - new Promise(function(resolve, reject) { - resolve(new Promise(function(res, rej) { + new Promise(function(resolve) { + resolve(new Promise(function(res) { ok(true, "Nested promise is executed"); res(42); }).then(function(what) { return what + 1; })); @@ -471,7 +471,7 @@ function promiseNestedNestedPromise() { function promiseWrongNestedPromise() { new Promise(function(resolve, reject) { - resolve(new Promise(function(r, r2) { + resolve(new Promise(function(r) { ok(true, "Nested promise is executed"); r(42); })); @@ -479,16 +479,16 @@ function promiseWrongNestedPromise() { }).then(function(value) { is(value, 42, "Nested promise is executed and then == 42"); runTest(); - }, function(value) { + }, function() { ok(false, "This is wrong"); }); } function promiseLoop() { - new Promise(function(resolve, reject) { - resolve(new Promise(function(res, rej) { + new Promise(function(resolve) { + resolve(new Promise(function(res) { ok(true, "Nested promise is executed"); - res(new Promise(function(resInner, rejInner) { + res(new Promise(function(resInner) { ok(true, "Nested nested promise is executed"); resInner(42); })); @@ -496,14 +496,14 @@ function promiseLoop() { }).then(function(value) { is(value, 42, "Nested nested promise is executed and then == 42"); runTest(); - }, function(value) { + }, function() { ok(false, "This is wrong"); }); } function promiseStaticReject() { var promise = Promise.reject(42); - promise.then(function(what) { + promise.then(function() { ok(false, "This should not be called"); }, function(what) { is(what, 42, "Value == 42"); @@ -522,7 +522,7 @@ function promiseStaticResolve() { } function promiseResolveNestedPromise() { - var promise = Promise.resolve(new Promise(function(r, r2) { + var promise = Promise.resolve(new Promise(function(r) { ok(true, "Nested promise is executed"); r(42); }, function() { @@ -538,21 +538,21 @@ function promiseResolveNestedPromise() { function promiseSimpleThenableResolve() { var thenable = { then(resolve) { resolve(5); } }; - var promise = new Promise(function(resolve, reject) { + var promise = new Promise(function(resolve) { resolve(thenable); }); promise.then(function(v) { ok(v === 5, "promiseSimpleThenableResolve"); runTest(); - }, function(e) { + }, function() { ok(false, "promiseSimpleThenableResolve: Should not reject"); }); } function promiseSimpleThenableReject() { var thenable = { then(resolve, reject) { reject(5); } }; - var promise = new Promise(function(resolve, reject) { + var promise = new Promise(function(resolve) { resolve(thenable); }); @@ -574,7 +574,7 @@ function promiseThenableThrowsBeforeCallback() { }}; var promise = Promise.resolve(thenable); - promise.then(function(v) { + promise.then(function() { ok(false, "promiseThenableThrowsBeforeCallback: Should've rejected"); runTest(); }, function(e) { @@ -593,7 +593,7 @@ function promiseThenableThrowsAfterCallback() { promise.then(function(v) { ok(v === 5, "promiseThenableThrowsAfterCallback"); runTest(); - }, function(e) { + }, function() { ok(false, "promiseThenableThrowsAfterCallback: Should've resolved"); runTest(); }); @@ -606,7 +606,7 @@ function promiseThenableRejectThenResolve() { }}; var promise = Promise.resolve(thenable); - promise.then(function(v) { + promise.then(function() { ok(false, "promiseThenableRejectThenResolve should have rejected"); runTest(); }, function(e) { @@ -617,7 +617,7 @@ function promiseThenableRejectThenResolve() { function promiseWithThenReplaced() { // Ensure that we call the 'then' on the promise and not the internal then. - var promise = new Promise(function(resolve, reject) { + var promise = new Promise(function(resolve) { resolve(5); }); @@ -627,7 +627,7 @@ function promiseWithThenReplaced() { }; var promise2 = Promise.resolve(promise); - promise2.then(function(v) { + promise2.then(function() { ok(false, "promiseWithThenReplaced: Should've rejected"); runTest(); }, function(e) { @@ -646,7 +646,7 @@ function promiseStrictHandlers() { } function promiseStrictExecutorThisArg() { - new Promise(function(resolve, reject) { + new Promise(function() { "use strict"; ok(this === undefined, "thisArg should be undefined."); runTest(); @@ -667,12 +667,12 @@ function promiseResolveArray() { } function promiseResolveThenable() { - var p = Promise.resolve({ then(onFulfill, onReject) { onFulfill(2); } }); + var p = Promise.resolve({ then(onFulfill) { onFulfill(2); } }); ok(p instanceof Promise, "Should cast to a Promise."); p.then(function(v) { is(v, 2, "Should resolve to 2."); runTest(); - }, function(e) { + }, function() { ok(false, "promiseResolveThenable should've resolved"); runTest(); }); @@ -748,7 +748,7 @@ function promiseTestAsyncThenableResolution() { // Bug 1062323 function promiseWrapperAsyncResolution() { - var p = new Promise(function(resolve, reject) { + var p = new Promise(function(resolve) { resolve(); }); diff --git a/dom/promise/tests/test_promise_uncatchable_exception.html b/dom/promise/tests/test_promise_uncatchable_exception.html index 2bb6f1fe17..b8e4bdb103 100644 --- a/dom/promise/tests/test_promise_uncatchable_exception.html +++ b/dom/promise/tests/test_promise_uncatchable_exception.html @@ -16,7 +16,7 @@ <pre id="test"> <script type="application/javascript"> -onmessage = function(evt) { +onmessage = function() { ok(true, "finished"); SimpleTest.finish(); }; diff --git a/dom/promise/tests/test_promise_utils.html b/dom/promise/tests/test_promise_utils.html index b20d909351..44777dd965 100644 --- a/dom/promise/tests/test_promise_utils.html +++ b/dom/promise/tests/test_promise_utils.html @@ -69,7 +69,7 @@ function promiseAllIterable() { is(values[1], 1, "Array values should match."); is(values[2], undefined, "Array values should match."); runTest(); - }, function(e) { + }, function() { ok(false, "Promise.all shouldn't fail when an iterable is passed."); runTest(); }); @@ -125,7 +125,7 @@ function promiseAllRejectFails() { ]; var p = Promise.all(arr); - p.then(function(values) { + p.then(function() { ok(false, "Promise.all shouldn't resolve when iterable has rejected Promises."); runTest(); }, function(e) { @@ -140,7 +140,7 @@ function promiseAllCastError() { throw new ReferenceError("placeholder for nonexistent function call"); } }]); ok(p instanceof Promise, "Should cast to a Promise."); - p.then(function(v) { + p.then(function() { ok(false, "promiseAllCastError: should've rejected."); runTest(); }, function(e) { @@ -161,7 +161,7 @@ function promiseAllEnumerable() { } is(count, 3, "Resolved array from Promise.all should be enumerable"); runTest(); - }, function(e) { + }, function() { ok(false, "promiseAllEnumerable: should've resolved."); runTest(); }); @@ -230,7 +230,7 @@ function promiseRaceIterable() { Promise.race(participants()).then(function(winner) { is(winner, 10, "Winner should be the one that finished earlier."); runTest(); - }, function(e) { + }, function() { ok(false, "Promise.race shouldn't throw when an iterable is passed!"); runTest(); }); @@ -257,7 +257,7 @@ function promiseRaceReject() { function promiseRaceThrow() { var p = Promise.race([ - new Promise(function(resolve) { + new Promise(function() { throw new ReferenceError("placeholder for nonexistent function call"); }), new Promise(function(resolve) { diff --git a/dom/promise/tests/test_promise_xrays.html b/dom/promise/tests/test_promise_xrays.html index 8559dbb2a4..782251d332 100644 --- a/dom/promise/tests/test_promise_xrays.html +++ b/dom/promise/tests/test_promise_xrays.html @@ -44,24 +44,24 @@ function testHaveXray() { } function testConstructor1() { - var p = new win.Promise(function(resolve, reject) { resolve(win.Promise.resolve(5)); }); + var p = new win.Promise(function(resolve) { resolve(win.Promise.resolve(5)); }); p.then( function(arg) { is(arg, 5, "Content Promise constructor resolved with content promise should work"); }, - function(e) { + function() { ok(false, "Content Promise constructor resolved with content promise should not fail"); } ).then(nextTest); } function testConstructor2() { - var p = new win.Promise(function(resolve, reject) { resolve(Promise.resolve(5)); }); + var p = new win.Promise(function(resolve) { resolve(Promise.resolve(5)); }); p.then( function(arg) { is(arg, 5, "Content Promise constructor resolved with chrome promise should work"); }, - function(e) { + function() { ok(false, "Content Promise constructor resolved with chrome promise should not fail"); } ).then(nextTest); @@ -223,20 +223,20 @@ function testResolve3() { function(arg) { is(arg, 5, "Promise.resolve with chrome Promise should work"); }, - function(e) { + function() { ok(false, "Promise.resolve with chrome Promise should not fail"); } ).then(nextTest); } function testResolve4() { - var p = new win.Promise((res, rej) => {}); + var p = new win.Promise(() => {}); Cu.getJSTestingFunctions().resolvePromise(p, 42); p.then( function(arg) { is(arg, 42, "Resolving an Xray to a promise with TestingFunctions resolvePromise should work"); }, - function(e) { + function() { ok(false, "Resolving an Xray to a promise with TestingFunctions resolvePromise should not fail"); } ).then(nextTest); @@ -246,7 +246,7 @@ function testReject1() { var p = win.Promise.reject(5); ok(p instanceof win.Promise, "Promise.reject should return a promise"); p.then( - function(arg) { + function() { ok(false, "Promise should be rejected"); }, function(e) { @@ -256,10 +256,10 @@ function testReject1() { } function testReject2() { - var p = new win.Promise((res, rej) => {}); + var p = new win.Promise(() => {}); Cu.getJSTestingFunctions().rejectPromise(p, 42); p.then( - function(arg) { + function() { ok(false, "Rejecting an Xray to a promise with TestingFunctions rejectPromise should trigger catch handler"); }, function(e) { @@ -277,7 +277,7 @@ function testThen1() { function(arg) { is(arg, 25, "Promise.then should work"); }, - function(e) { + function() { ok(false, "Promise.then should not fail"); } ).then(nextTest); @@ -292,7 +292,7 @@ function testThen2() { function(arg) { is(arg, 25, "Promise.then resolved with chrome promise should work"); }, - function(e) { + function() { ok(false, "Promise.then resolved with chrome promise should not fail"); } ).then(nextTest); @@ -308,7 +308,7 @@ function testCatch1() { function(arg) { is(arg, 25, "Promise.catch should work"); }, - function(e) { + function() { ok(false, "Promise.catch should not fail"); } ).then(nextTest); diff --git a/dom/promise/tests/test_resolve.html b/dom/promise/tests/test_resolve.html index 7e4745b47a..04101c94d3 100644 --- a/dom/promise/tests/test_resolve.html +++ b/dom/promise/tests/test_resolve.html @@ -44,7 +44,7 @@ function runTest() { var test = tests.pop(); - new Promise(function(resolve, reject) { + new Promise(function(resolve) { resolve(test); }).then(function(what) { ok(test === what, "What is: " + what); diff --git a/dom/promise/tests/test_webassembly_compile.html b/dom/promise/tests/test_webassembly_compile.html index 351f0f4ae4..5a1e669e0a 100644 --- a/dom/promise/tests/test_webassembly_compile.html +++ b/dom/promise/tests/test_webassembly_compile.html @@ -207,7 +207,7 @@ function compileStreamingDoubleUseFail() { }) .then( () => ok(false, "should have failed on second use"), - err => { ok(true, "failed on second use"); runTest(); } + () => { ok(true, "failed on second use"); runTest(); } ); }); } diff --git a/dom/promise/tests/unit/test_monitor_uncaught.js b/dom/promise/tests/unit/test_monitor_uncaught.js index afa328cb97..043e6dac8f 100644 --- a/dom/promise/tests/unit/test_monitor_uncaught.js +++ b/dom/promise/tests/unit/test_monitor_uncaught.js @@ -23,8 +23,8 @@ add_task(async function test_globals() { }); add_task(async function test_promiseID() { - let p1 = new Promise(resolve => {}); - let p2 = new Promise(resolve => {}); + let p1 = new Promise(() => {}); + let p2 = new Promise(() => {}); let p3 = p2.catch(null); let promise = [p1, p2, p3]; @@ -111,7 +111,7 @@ add_task(async function test_observe_uncaught() { let onConsumed = new CallbackResults("onConsumed"); let observer = { - onLeftUncaught(promise, data) { + onLeftUncaught(promise) { onLeftUncaught.observe(promise); }, onConsumed(promise) { @@ -121,7 +121,7 @@ add_task(async function test_observe_uncaught() { let resolveLater = function (delay = 20) { // eslint-disable-next-line mozilla/no-arbitrary-setTimeout - return new Promise((resolve, reject) => setTimeout(resolve, delay)); + return new Promise(resolve => setTimeout(resolve, delay)); }; let rejectLater = function (delay = 20) { // eslint-disable-next-line mozilla/no-arbitrary-setTimeout diff --git a/dom/promise/tests/unit/test_promise_job_across_sandbox.js b/dom/promise/tests/unit/test_promise_job_across_sandbox.js index ff1d1575e3..d98947cccc 100644 --- a/dom/promise/tests/unit/test_promise_job_across_sandbox.js +++ b/dom/promise/tests/unit/test_promise_job_across_sandbox.js @@ -114,7 +114,7 @@ add_task(async function testThenableJob() { const p = new Promise(resolve => { // Create a bound function where its realm is privileged realm, and // its target is from sandbox realm. - sandbox.then = function (onFulfilled, onRejected) { + sandbox.then = function () { resolve(10); }; }); @@ -138,7 +138,7 @@ add_task(async function testThenableJobNuked() { const sandbox = createSandbox(); let called = false; - sandbox.then = function (onFulfilled, onRejected) { + sandbox.then = function () { called = true; }; @@ -175,6 +175,7 @@ add_task(async function testThenableJobAccessError() { sandbox.thenable = { get then() { accessed = true; + return undefined; }, }; |