Issue #2252 - Prevent crash when attempting to load a script with execution disallowed. This issue is due to the ExecutionContext added in Issue #1691 not handling GetScript() in a context where script execution is not allowed. This expressed itself in crashes when playing MP4s with the NoScript extension installed and enabled.

This commit is contained in:
Brian Smith
2023-05-21 07:55:37 -05:00
committed by roytam1
parent adaf6c3221
commit 106de86dc4
+8 -5
View File
@@ -2363,11 +2363,14 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
JS::Rooted<JSScript*> script(cx);
script = exec.GetScript();
// Create a ClassicScript object and associate it with the
// JSScript.
RefPtr<ClassicScript> classicScript = new ClassicScript(
aRequest->mFetchOptions, aRequest->mBaseURL);
classicScript->AssociateWithScript(script);
// With scripts disabled GetScript() will return nullptr
if (script) {
// Create a ClassicScript object and associate it with the
// JSScript.
RefPtr<ClassicScript> classicScript = new ClassicScript(
aRequest->mFetchOptions, aRequest->mBaseURL);
classicScript->AssociateWithScript(script);
}
rv = exec.ExecScript();
}