import from UXP: Issue #2686 - Don't rely on return value of ExecutionContext::Compile when the context may forbid running scripts (0590764f)

This commit is contained in:
2025-01-29 12:53:04 +08:00
parent a94d1a733b
commit 36eaeed46c
4 changed files with 12 additions and 8 deletions
+1 -4
View File
@@ -2396,10 +2396,7 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
rv = exec.Compile(options, srcBuf);
}
if (rv == NS_OK) {
JS::Rooted<JSScript*> script(cx);
script = exec.GetScript();
// With scripts disabled GetScript() will return nullptr
JS::Rooted<JSScript*> script(cx, exec.GetScript());
if (script) {
// Create a ClassicScript object and associate it with the
// JSScript.