Bug 107602

Summary: HTMLTreeBuilder should not block on <script> tags inside templates
Product: WebKit Reporter: Adam Klein <adamk>
Component: DOMAssignee: Adam Klein <adamk>
Status: NEW    
Severity: Normal CC: abarth, ahmad.saleem792, apavlov, bfulgham, eric, ojan.autocc, rafaelw, rniwa, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 154614    
Attachments:
Description Flags
WIP none

Adam Klein
Reported 2013-01-22 17:23:22 PST
Because the tree builder does block, the parser kicks off a preload scanner. And because the preload scanner starts _inside_ the template, it's not able to make use of its m_templateCount counter to ignore resources it finds inside the scanner. This is what was causing the failure noted in bug 106810. Since the tree builder knows it's in a template, it could simply avoid queueing an scripts inside the template for processing. But that might be somewhat ugly, since it requires the tree builder to "know" that scripts are inert in templates (currently that knowledge is handled at the ScriptElement level instead, by examining the <script>'s ownerDocument).
Attachments
WIP (6.79 KB, patch)
2013-01-23 15:31 PST, Adam Klein
no flags
Adam Klein
Comment 1 2013-01-22 17:26:15 PST
It's possible this bug should instead be titled "HTMLPreloadScanner should be able to handle starting inside a <template>"; the title depends somewhat on how this should be fixed, which is a question I pose to our resident parser experts, eseidel and abarth.
Adam Barth
Comment 2 2013-01-22 17:27:52 PST
We're in the process of removing the HTMLPreloadScanner. We shouldn't spend too much effort polishing these issues in the old design.
Adam Barth
Comment 3 2013-01-22 17:29:20 PST
(Maybe that argues for fixing this issue in the tree builder?)
Adam Klein
Comment 4 2013-01-23 15:31:14 PST
Adam Klein
Comment 5 2013-01-23 15:32:39 PST
The WIP patch here unfortunately takes the approach of messing with the preload scanner's logic rather than trying to fix things in the tree builder. My first attempt at that (which was simply to avoid setting m_scriptToProcess when in template contents) didn't work, as the script wouldn't run later when attached to the page.
Note You need to log in before you can comment on or make changes to this bug.