mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Back out bug 1172246 because of mochitest-JP bustage. Who needs tests that we care about running on try anyway?
This commit is contained in:
parent
c471ba59f3
commit
94ba1d4d1d
@ -543,26 +543,17 @@ AutoJSAPI::ReportException()
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
AutoJSAPI::PeekException(JS::MutableHandle<JS::Value> aVal)
|
||||
{
|
||||
MOZ_ASSERT_IF(mIsMainThread, CxPusherIsStackTop());
|
||||
MOZ_ASSERT(HasException());
|
||||
MOZ_ASSERT(js::GetContextCompartment(cx()));
|
||||
if (!JS_GetPendingException(cx(), aVal)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AutoJSAPI::StealException(JS::MutableHandle<JS::Value> aVal)
|
||||
{
|
||||
if (!PeekException(aVal)) {
|
||||
return false;
|
||||
}
|
||||
JS_ClearPendingException(cx());
|
||||
return true;
|
||||
MOZ_ASSERT_IF(mIsMainThread, CxPusherIsStackTop());
|
||||
MOZ_ASSERT(HasException());
|
||||
MOZ_ASSERT(js::GetContextCompartment(cx()));
|
||||
if (!JS_GetPendingException(cx(), aVal)) {
|
||||
return false;
|
||||
}
|
||||
JS_ClearPendingException(cx());
|
||||
return true;
|
||||
}
|
||||
|
||||
AutoEntryScript::AutoEntryScript(nsIGlobalObject* aGlobalObject,
|
||||
|
@ -291,14 +291,6 @@ public:
|
||||
// into the current compartment.
|
||||
bool StealException(JS::MutableHandle<JS::Value> aVal);
|
||||
|
||||
// Peek the current exception from the JS engine, without stealing it.
|
||||
// Callers must ensure that HasException() is true, and that cx() is in a
|
||||
// non-null compartment.
|
||||
//
|
||||
// Note that this fails if and only if we OOM while wrapping the exception
|
||||
// into the current compartment.
|
||||
bool PeekException(JS::MutableHandle<JS::Value> aVal);
|
||||
|
||||
void ClearException() {
|
||||
MOZ_ASSERT_IF(NS_IsMainThread(), CxPusherIsStackTop());
|
||||
JS_ClearPendingException(cx());
|
||||
|
@ -190,8 +190,12 @@ CallbackObject::CallSetup::CallSetup(CallbackObject* aCallback,
|
||||
// And now we're ready to go.
|
||||
mCx = cx;
|
||||
|
||||
// Make sure the JS engine doesn't report exceptions we want to re-throw.
|
||||
mAutoEntryScript->TakeOwnershipOfErrorReporting();
|
||||
// Make sure the JS engine doesn't report exceptions we want to re-throw
|
||||
if ((mCompartment && mExceptionHandling == eRethrowContentExceptions) ||
|
||||
mExceptionHandling == eRethrowExceptions) {
|
||||
mSavedJSContextOptions = JS::ContextOptionsRef(cx);
|
||||
JS::ContextOptionsRef(cx).setDontReportUncaught(true);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
@ -249,18 +253,18 @@ CallbackObject::CallSetup::~CallSetup()
|
||||
// Now, if we have a JSContext, report any pending errors on it, unless we
|
||||
// were told to re-throw them.
|
||||
if (mCx) {
|
||||
bool needToDealWithException = mAutoEntryScript->HasException();
|
||||
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 (mAutoEntryScript->PeekException(&exn) &&
|
||||
if (JS_GetPendingException(mCx, &exn) &&
|
||||
ShouldRethrowException(exn)) {
|
||||
mAutoEntryScript->ClearException();
|
||||
MOZ_ASSERT(!mAutoEntryScript->HasException());
|
||||
mErrorResult.ThrowJSException(mCx, exn);
|
||||
JS_ClearPendingException(mCx);
|
||||
needToDealWithException = false;
|
||||
}
|
||||
}
|
||||
@ -268,7 +272,7 @@ CallbackObject::CallSetup::~CallSetup()
|
||||
|
||||
if (needToDealWithException) {
|
||||
// Either we're supposed to report our exceptions, or we're supposed to
|
||||
// re-throw them but we failed to get the exception value. Either way,
|
||||
// re-throw them but we failed to JS_GetPendingException. Either way,
|
||||
// just report the pending exception, if any.
|
||||
//
|
||||
// We don't use nsJSUtils::ReportPendingException here because all it
|
||||
@ -279,9 +283,7 @@ CallbackObject::CallSetup::~CallSetup()
|
||||
// screw up our compartment, which is exactly what we do not want.
|
||||
//
|
||||
// XXXbz FIXME: bug 979525 means we don't always JS_SaveFrameChain here,
|
||||
// so we need to go ahead and do that. This is also the reason we don't
|
||||
// just rely on ~AutoJSAPI reporting the exception for us. I think if we
|
||||
// didn't need to JS_SaveFrameChain here, we could just rely on that.
|
||||
// so we need to go ahead and do that.
|
||||
JS::Rooted<JSObject*> oldGlobal(mCx, JS::CurrentGlobalOrNull(mCx));
|
||||
MOZ_ASSERT(oldGlobal, "How can we not have a global here??");
|
||||
bool saved = JS_SaveFrameChain(mCx);
|
||||
@ -292,10 +294,7 @@ CallbackObject::CallSetup::~CallSetup()
|
||||
MOZ_ASSERT(!JS::DescribeScriptedCaller(mCx),
|
||||
"Our comment above about JS_SaveFrameChain having been "
|
||||
"called is a lie?");
|
||||
// Note that we don't JS_ReportPendingException here because we want to
|
||||
// go through our AutoEntryScript's reporting mechanism instead, since
|
||||
// it currently owns error reporting.
|
||||
mAutoEntryScript->ReportException();
|
||||
JS_ReportPendingException(mCx);
|
||||
}
|
||||
if (saved) {
|
||||
JS_RestoreFrameChain(mCx);
|
||||
|
@ -261,6 +261,7 @@ protected:
|
||||
// we should re-throw them.
|
||||
ErrorResult& mErrorResult;
|
||||
const ExceptionHandling mExceptionHandling;
|
||||
JS::ContextOptions mSavedJSContextOptions;
|
||||
const bool mIsMainThread;
|
||||
};
|
||||
};
|
||||
|
@ -64,7 +64,6 @@ skip-if = debug == false
|
||||
[test_worker_UnwrapArg.html]
|
||||
[test_unforgeablesonexpando.html]
|
||||
[test_crossOriginWindowSymbolAccess.html]
|
||||
[test_callback_exceptions.html]
|
||||
[test_bug1123516_maplikesetlike.html]
|
||||
skip-if = debug == false
|
||||
[test_jsimplemented_eventhandler.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>
|
Loading…
Reference in New Issue
Block a user