Usage of ScriptPreloader should be consistent about sourceIsLazy options
Categories
(Core :: XPConnect, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox87 | --- | fixed |
People
(Reporter: tcampbell, Assigned: tcampbell)
References
Details
Attachments
(2 files)
ScriptPreloader usage by nsFrameMessageManager does not force the sourceIsLazy script like other uses of the preloader. This leads to potential inconsistencies in the batch ScriptPreloader decode steps.
We (spidermonkey) would like to further disallow these sorts of mismatches to allow improving perf for all chrome-js caching. The fix here is simply to mark the few frame-scripts as having lazy source. The source hook will be able to fetch if needed, but in practice isn't used.
The tradeoff here is that the cache will have full bytecode for the few scripts and avoid storing source. Locally I only see about 6kB of source JS, so this is largely inconsequential either way.
Assignee | ||
Comment 1•4 years ago
|
||
(This made me discover Bug 1689733 where there are existing cases of sources being fetched during startup that should not happen)
Assignee | ||
Comment 2•4 years ago
|
||
For consistency with other uses of the ScriptPreloader, we ensure we use lazy
script source when compiling for the cache. This generates full bytecode for
the cache but also avoids saving a copy of the source. If the frame script
were to call Function.prototype.toString, the existing source-hook would load
it in the same way as the JSM loader. In practice, we avoid relying on this
in our chrome code. If we will not be writing to the cache, we can instead
compile with the JS syntax parser, similar to what we do for JSM loader.
Assignee | ||
Comment 3•4 years ago
|
||
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
Comment 5•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/4a4a2311a274
https://hg.mozilla.org/mozilla-central/rev/bb3cce82c923
Description
•