mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset a2a7009adafc (bug 1172246) for crashes.
This commit is contained in:
parent
30103e7e9d
commit
2a1a08dfdf
@ -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) &&
|
||||
|
@ -219,6 +219,7 @@ protected:
|
||||
// we should re-throw them.
|
||||
ErrorResult& mErrorResult;
|
||||
const ExceptionHandling mExceptionHandling;
|
||||
JS::ContextOptions mSavedJSContextOptions;
|
||||
const bool mIsMainThread;
|
||||
};
|
||||
};
|
||||
|
@ -61,4 +61,3 @@ skip-if = debug == false
|
||||
[test_worker_UnwrapArg.html]
|
||||
[test_unforgeablesonexpando.html]
|
||||
[test_crossOriginWindowSymbolAccess.html]
|
||||
[test_callback_exceptions.html]
|
||||
|
@ -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>
|
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user