author | Ryan VanderMeulen <ryanvm@gmail.com> |
Wed, 24 Sep 2014 17:08:28 -0400 | |
changeset 207084 | 1735ff2bb23e1de2308a69071368644a6776b27d |
parent 207083 | 4e596b0a38e244aedeb23227ab73a3e372ca2c01 |
child 207091 | cb4f750b2ed5f5c875acb967a88cd9ee56b399c4 |
child 207119 | f5bb15cbc8e7e390f053b09a160e88585fb6502d |
child 207177 | ea2894eea2d0dd789c70b2508f23e5948418fce1 |
push id | 27544 |
push user | ryanvm@gmail.com |
push date | Wed, 24 Sep 2014 21:10:36 +0000 |
treeherder | mozilla-central@1735ff2bb23e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1062323 |
milestone | 35.0a1 |
backs out | ebd8df8e8631fd0792c4b5a99c0628e721f71576 |
first release with | nightly linux32
1735ff2bb23e
/
35.0a1
/
20140925030203
/
files
nightly linux64
1735ff2bb23e
/
35.0a1
/
20140925030203
/
files
nightly mac
1735ff2bb23e
/
35.0a1
/
20140925030203
/
files
nightly win32
1735ff2bb23e
/
35.0a1
/
20140925030203
/
files
nightly win64
1735ff2bb23e
/
35.0a1
/
20140925030203
/
files
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly linux32
35.0a1
/
20140925030203
/
pushlog to previous
nightly linux64
35.0a1
/
20140925030203
/
pushlog to previous
nightly mac
35.0a1
/
20140925030203
/
pushlog to previous
nightly win32
35.0a1
/
20140925030203
/
pushlog to previous
nightly win64
35.0a1
/
20140925030203
/
pushlog to previous
|
dom/promise/PromiseCallback.cpp | file | annotate | diff | comparison | revisions | |
dom/promise/tests/test_promise.html | file | annotate | diff | comparison | revisions |
--- a/dom/promise/PromiseCallback.cpp +++ b/dom/promise/PromiseCallback.cpp @@ -198,33 +198,33 @@ WrapperPromiseCallback::Call(JSContext* JS::Rooted<JS::Value> value(aCx, aValue); if (!JS_WrapValue(aCx, &value)) { NS_WARNING("Failed to wrap value into the right compartment."); return; } ErrorResult rv; - // PromiseReactionTask step 6 + // If invoking callback threw an exception, run resolver's reject with the + // thrown exception as argument and the synchronous flag set. JS::Rooted<JS::Value> retValue(aCx); mCallback->Call(value, &retValue, rv, CallbackObject::eRethrowExceptions); rv.WouldReportJSException(); - // PromiseReactionTask step 7 if (rv.Failed() && rv.IsJSException()) { JS::Rooted<JS::Value> value(aCx); rv.StealJSException(aCx, &value); if (!JS_WrapValue(aCx, &value)) { NS_WARNING("Failed to wrap value into the right compartment."); return; } - mNextPromise->RejectInternal(aCx, value); + mNextPromise->RejectInternal(aCx, value, Promise::SyncTask); return; } // If the return value is the same as the promise itself, throw TypeError. if (retValue.isObject()) { JS::Rooted<JSObject*> valueObj(aCx, &retValue.toObject()); Promise* returnedPromise; nsresult r = UNWRAP_OBJECT(Promise, valueObj, returnedPromise); @@ -279,23 +279,24 @@ WrapperPromiseCallback::Call(JSContext* return; } mNextPromise->RejectInternal(aCx, typeError, Promise::SyncTask); return; } } - // Otherwise, run resolver's resolve with value. + // Otherwise, run resolver's resolve with value and the synchronous flag + // set. if (!JS_WrapValue(aCx, &retValue)) { NS_WARNING("Failed to wrap value into the right compartment."); return; } - mNextPromise->ResolveInternal(aCx, retValue); + mNextPromise->ResolveInternal(aCx, retValue, Promise::SyncTask); } // NativePromiseCallback NS_IMPL_CYCLE_COLLECTION_INHERITED(NativePromiseCallback, PromiseCallback, mHandler) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(NativePromiseCallback)
--- a/dom/promise/tests/test_promise.html +++ b/dom/promise/tests/test_promise.html @@ -669,55 +669,16 @@ function promiseTestAsyncThenableResolut k--; if (k > 0) return Promise.resolve().then(next); }).then(function () { ok(true, "Resolution of a chain of thenables should not be synchronous."); runTest(); }); } -// Bug 1062323 -function promiseWrapperAsyncResolution() -{ - var p = new Promise(function(resolve, reject){ - resolve(); - }); - - var results = []; - var q = p.then(function () { - results.push("1-1"); - }).then(function () { - results.push("1-2"); - }).then(function () { - results.push("1-3"); - }); - - var r = p.then(function () { - results.push("2-1"); - }).then(function () { - results.push("2-2"); - }).then(function () { - results.push("2-3"); - }); - - Promise.all([q, r]).then(function() { - var match = results[0] == "1-1" && - results[1] == "2-1" && - results[2] == "1-2" && - results[3] == "2-2" && - results[4] == "1-3" && - results[5] == "2-3"; - ok(match, "Chained promises should resolve asynchronously."); - runTest(); - }, function() { - ok(false, "promiseWrapperAsyncResolution: One of the promises failed."); - runTest(); - }); -} - var tests = [ promiseResolve, promiseReject, promiseException, promiseGC, promiseAsync, promiseDoubleThen, promiseThenException, promiseThenCatchThen, promiseRejectThenCatchThen, promiseRejectThenCatchThen2, promiseRejectThenCatchExceptionThen, promiseThenCatchOrderingResolve, promiseThenCatchOrderingReject, @@ -740,17 +701,16 @@ var tests = [ promiseResolve, promiseRej promiseWithThenReplaced, promiseStrictHandlers, promiseStrictExecutorThisArg, promiseResolveArray, promiseResolveThenable, promiseResolvePromise, promiseResolveThenableCleanStack, promiseTestAsyncThenableResolution, - promiseWrapperAsyncResolution, ]; function runTest() { if (!tests.length) { SimpleTest.finish(); return; }