mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1181619. Make sure we've entered a microtask before we call nsJSUtils::EvaluateString, and put those microtasks outside the relevant AutoEntryScripts so we report any possible exceptions before doing the microtask checkpoint. r=bholley
This commit is contained in:
parent
de55ddcd67
commit
7d8173071e
14
dom/base/crashtests/1181619.html
Normal file
14
dom/base/crashtests/1181619.html
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
var obs = new MutationObserver(function() {
|
||||||
|
// Just need something here to assert exception is not pending. Any
|
||||||
|
// binding method will do.
|
||||||
|
console.log("hello");
|
||||||
|
});
|
||||||
|
obs.observe(document.body, { childList: true });
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
noSuchMethodYo();
|
||||||
|
</script>
|
||||||
|
</body>
|
@ -203,3 +203,4 @@ load xhr_html_nullresponse.html
|
|||||||
load structured_clone_container_throws.html
|
load structured_clone_container_throws.html
|
||||||
load 1154598.xhtml
|
load 1154598.xhtml
|
||||||
load 1157995.html
|
load 1157995.html
|
||||||
|
load 1181619.html
|
||||||
|
@ -12014,6 +12014,7 @@ nsGlobalWindow::RunTimeoutHandler(nsTimeout* aTimeout,
|
|||||||
|
|
||||||
// New script entry point required, due to the "Create a script" sub-step of
|
// New script entry point required, due to the "Create a script" sub-step of
|
||||||
// http://www.whatwg.org/specs/web-apps/current-work/#timer-initialisation-steps
|
// http://www.whatwg.org/specs/web-apps/current-work/#timer-initialisation-steps
|
||||||
|
nsAutoMicroTask mt;
|
||||||
AutoEntryScript entryScript(this, reason, true, aScx->GetNativeContext());
|
AutoEntryScript entryScript(this, reason, true, aScx->GetNativeContext());
|
||||||
entryScript.TakeOwnershipOfErrorReporting();
|
entryScript.TakeOwnershipOfErrorReporting();
|
||||||
JS::CompileOptions options(entryScript.cx());
|
JS::CompileOptions options(entryScript.cx());
|
||||||
|
@ -174,6 +174,8 @@ nsJSUtils::EvaluateString(JSContext* aCx,
|
|||||||
MOZ_ASSERT(js::GetGlobalForObjectCrossCompartment(aEvaluationGlobal) ==
|
MOZ_ASSERT(js::GetGlobalForObjectCrossCompartment(aEvaluationGlobal) ==
|
||||||
aEvaluationGlobal);
|
aEvaluationGlobal);
|
||||||
MOZ_ASSERT_IF(aOffThreadToken, aCompileOptions.noScriptRval);
|
MOZ_ASSERT_IF(aOffThreadToken, aCompileOptions.noScriptRval);
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
MOZ_ASSERT(nsContentUtils::IsInMicroTask());
|
||||||
|
|
||||||
// Unfortunately, the JS engine actually compiles scripts with a return value
|
// Unfortunately, the JS engine actually compiles scripts with a return value
|
||||||
// in a different, less efficient way. Furthermore, it can't JIT them in many
|
// in a different, less efficient way. Furthermore, it can't JIT them in many
|
||||||
@ -183,7 +185,6 @@ nsJSUtils::EvaluateString(JSContext* aCx,
|
|||||||
// aCompileOptions.noScriptRval set to true.
|
// aCompileOptions.noScriptRval set to true.
|
||||||
aRetValue.setUndefined();
|
aRetValue.setUndefined();
|
||||||
|
|
||||||
nsAutoMicroTask mt;
|
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
|
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
|
||||||
|
@ -1113,6 +1113,7 @@ nsScriptLoader::EvaluateScript(nsScriptLoadRequest* aRequest,
|
|||||||
|
|
||||||
// New script entry point required, due to the "Create a script" sub-step of
|
// New script entry point required, due to the "Create a script" sub-step of
|
||||||
// http://www.whatwg.org/specs/web-apps/current-work/#execute-the-script-block
|
// http://www.whatwg.org/specs/web-apps/current-work/#execute-the-script-block
|
||||||
|
nsAutoMicroTask mt;
|
||||||
AutoEntryScript entryScript(globalObject, "<script> element", true,
|
AutoEntryScript entryScript(globalObject, "<script> element", true,
|
||||||
context->GetNativeContext());
|
context->GetNativeContext());
|
||||||
entryScript.TakeOwnershipOfErrorReporting();
|
entryScript.TakeOwnershipOfErrorReporting();
|
||||||
|
@ -250,6 +250,7 @@ nsresult nsJSThunk::EvaluateScript(nsIChannel *aChannel,
|
|||||||
|
|
||||||
// New script entry point required, due to the "Create a script" step of
|
// New script entry point required, due to the "Create a script" step of
|
||||||
// http://www.whatwg.org/specs/web-apps/current-work/#javascript-protocol
|
// http://www.whatwg.org/specs/web-apps/current-work/#javascript-protocol
|
||||||
|
nsAutoMicroTask mt;
|
||||||
AutoEntryScript entryScript(innerGlobal, "javascript: URI", true,
|
AutoEntryScript entryScript(innerGlobal, "javascript: URI", true,
|
||||||
scriptContext->GetNativeContext());
|
scriptContext->GetNativeContext());
|
||||||
// We want to make sure we report any exceptions that happen before we
|
// We want to make sure we report any exceptions that happen before we
|
||||||
|
@ -1479,6 +1479,7 @@ _evaluate(NPP npp, NPObject* npobj, NPString *script, NPVariant *result)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsAutoMicroTask mt;
|
||||||
dom::AutoEntryScript aes(win, "NPAPI NPN_evaluate");
|
dom::AutoEntryScript aes(win, "NPAPI NPN_evaluate");
|
||||||
aes.TakeOwnershipOfErrorReporting();
|
aes.TakeOwnershipOfErrorReporting();
|
||||||
JSContext* cx = aes.cx();
|
JSContext* cx = aes.cx();
|
||||||
|
Loading…
Reference in New Issue
Block a user