New issue
Advanced search Search tips

Issue 618101 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Consider dispatching preloads in HTMLDocumentParser before extension content scripts run

Project Member Reported by csharrison@chromium.org, Jun 7 2016

Issue description

Right now we defer dispatching preloads until the document element is available, to wait for ApplicationCache to be initialized.

Extensions run their content scripts keyed off of the document being initialized as well.

We could dispatch preloads *after* ApplicationCache is ready, but *before* extensions run their scripts. Local testing shows this could be a win of ~130ms on the critical rendering path.
 
Cc: rdevlin....@chromium.org kouhei@chromium.org
Components: Blink>HTML>Parser Blink>Loader
Owner: csharrison@chromium.org
Status: Assigned (was: Untriaged)
+kouhei@ and rdevin.cronin@ for feasibility. Also adding you as reviewers to the CL.
Labels: DevRel-Facebook
Project Member

Comment 3 by bugdroid1@chromium.org, Jun 9 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d63bd15666f24c048b0caa641cace3eec9460769

commit d63bd15666f24c048b0caa641cace3eec9460769
Author: csharrison <csharrison@chromium.org>
Date: Thu Jun 09 17:40:30 2016

Notify the HTMLDocumentParser on document element available

This patch adds logic to the HTMLHtmlElement so that it can notify
the HTMLDocumentParser immediately when the document element is available.
This is triggered in HTMLHtmlElement::insertedByParser. Additionally,
logic to dispatch notifications to the embedder is  refactored into
insertedByParser.

insertedByParser initializes the ApplicationCache, then sends the
notification to the HTMLDocumentParser to issue any queued preloads (the
preloads wait for ApplicationCache so they don't download needlessly).
Next, the method dispatches notifications to embedders, via
FrameLoader::dispatchDocumentElementAvailable and
FrameLoader::runscriptsAtDocumentAvailable.

Note the latter is used by extensions, which can run extremely expensive
content scripts. This patch changes ordering so that preloads can be sent
before this happens.

BUG= 618101 

Review-Url: https://codereview.chromium.org/2042413002
Cr-Commit-Position: refs/heads/master@{#398937}

[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/LayoutTests/fast/images/width-on-broken-data-src.html
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/resources/passive-mixed-content-iframe.html
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/dom/DocumentParser.h
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/html/HTMLHtmlElement.cpp
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/html/HTMLHtmlElement.h
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/html/ImageDocument.cpp
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/html/MediaDocument.cpp
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/html/PluginDocument.cpp
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.h
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp

Project Member

Comment 4 by bugdroid1@chromium.org, Jun 15 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d63bd15666f24c048b0caa641cace3eec9460769

commit d63bd15666f24c048b0caa641cace3eec9460769
Author: csharrison <csharrison@chromium.org>
Date: Thu Jun 09 17:40:30 2016

Notify the HTMLDocumentParser on document element available

This patch adds logic to the HTMLHtmlElement so that it can notify
the HTMLDocumentParser immediately when the document element is available.
This is triggered in HTMLHtmlElement::insertedByParser. Additionally,
logic to dispatch notifications to the embedder is  refactored into
insertedByParser.

insertedByParser initializes the ApplicationCache, then sends the
notification to the HTMLDocumentParser to issue any queued preloads (the
preloads wait for ApplicationCache so they don't download needlessly).
Next, the method dispatches notifications to embedders, via
FrameLoader::dispatchDocumentElementAvailable and
FrameLoader::runscriptsAtDocumentAvailable.

Note the latter is used by extensions, which can run extremely expensive
content scripts. This patch changes ordering so that preloads can be sent
before this happens.

BUG= 618101 

Review-Url: https://codereview.chromium.org/2042413002
Cr-Commit-Position: refs/heads/master@{#398937}

[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/LayoutTests/fast/images/width-on-broken-data-src.html
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/resources/passive-mixed-content-iframe.html
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/dom/DocumentParser.h
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/html/HTMLHtmlElement.cpp
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/html/HTMLHtmlElement.h
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/html/ImageDocument.cpp
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/html/MediaDocument.cpp
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/html/PluginDocument.cpp
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.h
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h
[modify] https://crrev.com/d63bd15666f24c048b0caa641cace3eec9460769/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp

Status: Fixed (was: Assigned)

Sign in to add a comment