[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:23:30 PDT 2010


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





--- Comment #25 from Eric Seidel <eric at webkit.org>  2010-06-01 11:23:21 PST ---
I recommend we split this into two patches.

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).

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'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 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.

-- 
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