Don't preload scripts with unknown types
Categories
(Core :: DOM: HTML Parser, task, P3)
Tracking
()
People
(Reporter: hsivonen, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: good-first-bug, parity-chrome, parity-safari)
Attachments
(2 files)
Comment 1•10 years ago
|
||
Comment 2•5 years ago
|
||
Bulk-downgrade of unassigned, 4 years untouched DOM/Storage bugs' priority.
If you have reason to believe this is wrong (especially for the severity), please write a comment and ni :jstutte.
| Reporter | ||
Comment 3•5 years ago
|
||
Chrome has fixed their corresponding bug: https://bugs.chromium.org/p/chromium/issues/detail?id=626321
If chrome as fixed their corresponding bug does it also gets fixed on mozilla? If not then i would like to work on this bug.
| Reporter | ||
Comment 5•5 years ago
|
||
(In reply to yanshrey from comment #4)
If not then i would like to work on this bug.
That would be great. See https://searchfox.org/mozilla-central/rev/1ebc9745be02eebf7a694f5c527a44a045b8c97a/parser/html/nsHtml5TreeBuilderCppSupplement.h#207 for the starting point.
Hi,
Is anyone still working on this bug?
If not want to give it a shot
I was looking into but but you can also go ahead and try it.
Check comment #5
| Reporter | ||
Comment 8•2 years ago
|
||
Fixing bug 1848311 would have the side effect of fixing this.
| Reporter | ||
Comment 10•2 years ago
|
||
Not only should we not preload unknown type, we should not create speculations when seeing unknown types.
From the bug I marked as duplicate:
We should check for IE event handler scripts and unsupported type/language combinations in the HTML parser already (not just in ScriptLoader) to avoid creating speculations or preloads for scripts that will not execute anyway.
Comment 11•2 years ago
|
||
Based on
https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script
This affects mSpeculativeLoadQueue. I didn't change the behavior of
mCurrentHtmlScriptCannotDocumentWriteOrBlock.
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 12•2 years ago
|
||
I'm currently stuck trying to implement your suggestion to handle ScriptKind::eEvent like mozilla::dom::IsScriptEventHandler does. There isn't an nsHtml5AttributeName::ATTR_EVENT that I would need to detect an event attribute on a <script> element.
| Reporter | ||
Comment 13•2 years ago
|
||
Sorry about the delay. Indeed, ATTR_EVENT is needed and missing. I'm adding it in bug 1884108.
| Reporter | ||
Updated•2 years ago
|
Updated•2 years ago
|
Comment 14•2 years ago
|
||
This good-first-bug hasn't had any activity for 2 months, it is automatically unassigned.
For more information, please visit BugBot documentation.
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Comment 15•1 year ago
|
||
@smaug do you think you could land this for me? Or do you think it shouldn't land unless we add a new wpt for it?
Comment 16•1 year ago
|
||
I think this could use a test, if just possible. The change isn't trivial.
Comment 17•1 year ago
|
||
Comment 18•1 year ago
|
||
I modified some existing WPT that check for speculative load. Can you land this for me if everything looks good?
Updated•1 year ago
|
Comment 19•1 year ago
|
||
Which patches need landing? The stack in phabricator has 3 patches
Comment 20•1 year ago
|
||
All three need to land. First the two for this bug 957054, and then the one in bug 1975128 since it depends on the changes in IsScriptEventHandler
Comment 21•1 year ago
|
||
Comment 24•1 year ago
•
|
||
Backed out for causing BP bustages @ScriptLoader.cpp
Comment 25•11 months ago
|
||
Used explicit namespaces to fix nonunified build errors. Verified with ac_add_options --disable-unified-build and I didn't see any other failures in the treeherder link.
Could you land this again?
Comment 26•11 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/d67dd206a3f6
https://hg.mozilla.org/mozilla-central/rev/86e60753f501
Comment 29•11 months ago
|
||
Backed out here: https://hg-edge.mozilla.org/integration/autoland/rev/c58db972dcced4455e804ed530064a6a5014c27f
Comment 30•11 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/d67dd206a3f6
https://hg.mozilla.org/mozilla-central/rev/86e60753f501
Comment 31•11 months ago
|
||
(In reply to Cristina Horotan [:chorotan] from comment #29)
Backed out here: https://hg-edge.mozilla.org/integration/autoland/rev/c58db972dcced4455e804ed530064a6a5014c27f
Comment 32•11 months ago
|
||
Comment 34•11 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/6a3eb2f7b3b1
https://hg.mozilla.org/mozilla-central/rev/3179ff0b5ccb
Updated•11 months ago
|
Comment 37•11 months ago
|
||
Comment 38•11 months ago
|
||
Backed out on request https://hg.mozilla.org/integration/autoland/rev/26331ad8f0c8c57becc304f17975d6b3085c4d0c
Comment 39•11 months ago
|
||
Pushed by chorotan@mozilla.com:
https://github.com/mozilla-firefox/firefox/commit/9c44d5da4225
https://hg.mozilla.org/releases/mozilla-beta/rev/2e0c099f88fc
Revert "Bug 957054 - Test that unsupported script types don't speculatively load r=smaug" on request by smaug
Updated•11 months ago
|
Comment 40•11 months ago
|
||
Should I update the patch to do the more narrow change that's just for mSpeculativeLoadQueue and not change the way mCurrentHtmlScriptCannotDocumentWriteOrBlock is set?
Updated•11 months ago
|
| Reporter | ||
Comment 41•11 months ago
|
||
(In reply to Mathew Hodson from comment #40)
Should I update the patch to do the more narrow change that's just for
mSpeculativeLoadQueueand not change the waymCurrentHtmlScriptCannotDocumentWriteOrBlockis set?
Rather than generating two kinds of tree ops based on boolean mCurrentHtmlScriptCannotDocumentWriteOrBlock: execute script that may document.write or block and execute script that cannot document.write or block, there should be a third category: Scripts that must not be executed, so that the HTML parser's classification decision is final and the script execution code path doesn't get an opportunity to disagree.
We already have opPreventScriptExecution, but it doesn't perform a microtask checkpoint. From reading the spec, it looks to me that a new tree op opPreventScriptExecutionWithMicrotaskCheckpoint is needed. (When the spec pops a script off the stack at EOF, it prevents execution without a microtask checkpoint. However, when a script end tags is processed, a microtask checkpoint is performed before looking at the scripts type, etc.)
| Reporter | ||
Comment 42•11 months ago
|
||
(That is, let's not simply change mSpeculativeLoadQueue, because the path for executing a script that may document.write or block is expensive, so if we know we don't want to execute the script, it makes sense to do something less expensive. We just need the decision to be final.)
Comment 43•11 months ago
|
||
Backout merged to central: https://hg.mozilla.org/mozilla-central/rev/26331ad8f0c8
Updated•11 months ago
|
Comment 44•11 months ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #41)
We already have
opPreventScriptExecution, but it doesn't perform a microtask checkpoint. From reading the spec, it looks to me that a new tree opopPreventScriptExecutionWithMicrotaskCheckpointis needed. (When the spec pops ascriptoff the stack at EOF, it prevents execution without a microtask checkpoint. However, when ascriptend tags is processed, a microtask checkpoint is performed before looking at the scripts type, etc.)
Are there existing tests in this area I could look at? Sounds like we need a new test that checks script execution, and the WPTs I added for speculative fetching aren't sufficient.
Updated•11 months ago
|
Comment 47•8 months ago
|
||
This good-first-bug hasn't had any activity for 2 months, it is automatically unassigned.
For more information, please visit BugBot documentation.
Description
•