[webkit-reviews] review granted: [Bug 187748] Add SPI to defer running async script until after document load : [Attachment 345229] First pass

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 18 00:14:46 PDT 2018


Ryosuke Niwa <rniwa at webkit.org> has granted Wenson Hsieh
<wenson_hsieh at apple.com>'s request for review:
Bug 187748: Add SPI to defer running async script until after document load
https://bugs.webkit.org/show_bug.cgi?id=187748

Attachment 345229: First pass

https://bugs.webkit.org/attachment.cgi?id=345229&action=review




--- Comment #3 from Ryosuke Niwa <rniwa at webkit.org> ---
Comment on attachment 345229
  --> https://bugs.webkit.org/attachment.cgi?id=345229
First pass

View in context: https://bugs.webkit.org/attachment.cgi?id=345229&action=review

> Source/WebCore/dom/ScriptRunner.cpp:109
> +	   if (m_document.shouldDeferAsynchronousScriptsUntilParsingFinishes())
> +	      
m_scriptsToExecuteAfterDocumentFinishesParsing.append(pendingAsyncScript);
> +	   else
> +	       m_scriptsToExecuteSoon.append(pendingAsyncScript);

I don't think it makes sense to have a separate vector for this since 
m_scriptsToExecuteAfterDocumentFinishesParsing and m_scriptsToExecuteSoon
should never have entires at the same time.

Instead, ScriptRunner::timerFired() should check
m_document.shouldDeferAsynchronousScriptsUntilParsingFinishes()
and avoid executing scripts in m_scriptsToExecuteSoon.


More information about the webkit-reviews mailing list