Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Unified Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2633253002: Split content script injections into multiple tasks (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/FrameLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
index 23cfc3127925bb5cc53ff1ba70685395d28f2158..d8e941fa33129c3d5addbbdc418bc0916d37b8fd 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -718,6 +718,19 @@ void FrameLoader::checkCompleted() {
if (!shouldComplete(m_frame->document()))
return;
+ if (client()) {
+ client()->runScriptsAtDocumentIdle();
+
+ // Injected scripts may have disconnected this frame.
+ if (!m_frame->client())
haraken 2017/03/02 03:54:32 m_frame->client() => client()
Kunihiko Sakamoto 2017/03/06 09:11:06 Done.
+ return;
+
+ // Check again, because runScriptsAtDocumentIdle() may have delayed the load
+ // event.
+ if (!shouldComplete(m_frame->document()))
+ return;
+ }
+
// OK, completed.
m_frame->document()->setReadyState(Document::Complete);
if (m_frame->document()->loadEventStillNeeded())

Powered by Google App Engine
This is Rietveld 408576698