Bug 1689734 - Further restrict ScriptPreloader use of CompileOptions. r=kmag,arai

The JS CompileOptions used to load cache entries must be consistent with
eachother to avoid subtle and serious bugs. This adds additional checks and
makes more consistent use of `FillCompileOptionsForCachedScript`.

This patch is a refactoring and should not change any behaviour.

Depends on D103515

Differential Revision: https://phabricator.services.mozilla.com/D103516
This commit is contained in:
Ted Campbell
2021-01-29 22:54:59 +00:00
parent 6ef1a05a25
commit a70ecb7afa
4 changed files with 26 additions and 30 deletions

View File

@@ -1260,7 +1260,6 @@ void nsMessageManagerScriptExecutor::TryCacheLoadAndCompileScript(
ScriptPreloader::FillCompileOptionsForCachedScript(options);
options.setFileAndLine(url.get(), 1);
options.setNonSyntacticScope(true);
options.setSourceIsLazy(true);
JS::Rooted<JSScript*> script(cx);
script =