[Webkit-unassigned] [Bug 20710] WebKit should support defer and async on script elements

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jun 1 11:32:19 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=20710





--- Comment #26 from Tony Gentilcore <tonyg at chromium.org>  2010-06-01 11:32:11 PST ---
(In reply to comment #25)
> I recommend we split this into two patches.

Good idea.

> 
> 1.  Which just adds the "async" and "defer" parsing and idl changes.  We add some tests which tests parting variations of the modes and which one trumps which (assuming that's exposed to JS at the property level).

Sounds good, I'll mail this soon with tests in fast/dom (let me know if they should live somewhere else).

> 
> 2.  The patch which actually does the scheduling.  The scheduling parts are slightly tricky since HTML5ScriptRunner is still changing.
> 
> It will be simple to get patch #1 reviewed by anyone.  Patch #2 you and I can work through over the next couple days?
> 
> I think it's OK to put async scripts on the document.  We could also make the ScriptRunner out-live the tokenizer (be owned by the Document or something else instead).  But I think it's fine to put the logic on the document.  We could make a new class to handle holding the async scripts, unsure.

I think the cleanest approach would be to make ScriptRunner live longer, but that is a harder change and might be easier once the old parser is out of the picture. Perhaps I should add a FIXME comment in the Document mentioning that.

> 
> I'm not when exactly async scripts get executed.  The spec says:
> If the async attribute is present, then the script will be executed asynchronously, as soon as it is available.

That is defined here:
http://dev.w3.org/html5/spec/Overview.html#the-end

Unfortunately, we don't have one area that implements "the end", that is spread across parser/tokenizer, document and frameloader.

> 
> That seems to me that it should be executed as soon as stylesheets are ready but possibly before parsing is completed, no?  I guess since they may execute after the load event they can't be executed by the ScriptRunner exclusively (since I think the tokenizer is deleted before the load event).  But it seems like async scripts will have trouble with our current document.write implementation since it (wrongly) assumes that the only thing executing scripts during parsing is the HTML5ScriptRunner.
> 
> I think this is a good change, but we should do it in smaller pieces.  Then there is less possible discussion and risk with each piece.

Adam, I'll address your comments in #2 after #1 is landed.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list