Backed out changeset a2a7009adafc (bug 1172246) for crashes.

This commit is contained in:
Ryan VanderMeulen 2015-06-09 13:40:44 -04:00
parent 30103e7e9d
commit 2a1a08dfdf
5 changed files with 5 additions and 27 deletions

View File

@ -187,7 +187,8 @@ CallbackObject::CallSetup::CallSetup(CallbackObject* aCallback,
// Make sure the JS engine doesn't report exceptions we want to re-throw
if ((mCompartment && mExceptionHandling == eRethrowContentExceptions) ||
mExceptionHandling == eRethrowExceptions) {
mAutoEntryScript->TakeOwnershipOfErrorReporting();
mSavedJSContextOptions = JS::ContextOptionsRef(cx);
JS::ContextOptionsRef(cx).setDontReportUncaught(true);
}
}
@ -257,8 +258,9 @@ CallbackObject::CallSetup::~CallSetup()
bool needToDealWithException = JS_IsExceptionPending(mCx);
if ((mCompartment && mExceptionHandling == eRethrowContentExceptions) ||
mExceptionHandling == eRethrowExceptions) {
// Restore the old context options
JS::ContextOptionsRef(mCx) = mSavedJSContextOptions;
mErrorResult.MightThrowJSException();
MOZ_ASSERT(mAutoEntryScript->OwnsErrorReporting());
if (needToDealWithException) {
JS::Rooted<JS::Value> exn(mCx);
if (JS_GetPendingException(mCx, &exn) &&

View File

@ -219,6 +219,7 @@ protected:
// we should re-throw them.
ErrorResult& mErrorResult;
const ExceptionHandling mExceptionHandling;
JS::ContextOptions mSavedJSContextOptions;
const bool mIsMainThread;
};
};

View File

@ -61,4 +61,3 @@ skip-if = debug == false
[test_worker_UnwrapArg.html]
[test_unforgeablesonexpando.html]
[test_crossOriginWindowSymbolAccess.html]
[test_callback_exceptions.html]

View File

@ -1,17 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Test for ...</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
promise_test(function(t) {
var iterator = document.createNodeIterator(document, NodeFilter.SHOW_ALL, JSON.parse);
return promise_rejects(t, new SyntaxError,
Promise.resolve().then(iterator.nextNode.bind(iterator)));
}, "Trying to use JSON.parse as filter should throw a catchable SyntaxError exception even when the filter is invoked async");
promise_test(function(t) {
return promise_rejects(t, new SyntaxError, Promise.resolve('{').then(JSON.parse));
}, "Trying to use JSON.parse as a promise callback should allow the next promise to handle the resulting exception.");
</script>

View File

@ -464,12 +464,6 @@ policies and contribution forms [3].
}));
}
function promise_rejects(test, expected, promise) {
return promise.then(test.unreached_func("Should have rejected.")).catch(function(e) {
assert_throws(expected, function() { throw e });
});
}
/**
* This constructor helper allows DOM events to be handled using Promises,
* which can make it a lot easier to test a very specific series of events,
@ -585,7 +579,6 @@ policies and contribution forms [3].
expose(test, 'test');
expose(async_test, 'async_test');
expose(promise_test, 'promise_test');
expose(promise_rejects, 'promise_rejects');
expose(generate_tests, 'generate_tests');
expose(setup, 'setup');
expose(done, 'done');