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

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

Issue 2633253002: Split content script injections into multiple tasks (Closed)
Patch Set: Inject document_idle scripts before window.onload 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 26bd2f95c92e404ed37be2e1c80177c58efb2a69..7716e68f40964cec32bcf4776d60a1c3f1cfef5a 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -716,6 +716,15 @@ void FrameLoader::checkCompleted() {
if (!shouldComplete(m_frame->document()))
return;
+ if (client()) {
+ client()->runScriptsAtDocumentIdle();
+
+ // Check again, because runScriptsAtDocumentIdle() may have delayed the load
+ // event.
+ if (!shouldComplete(m_frame->document()))
Devlin 2017/02/21 18:56:26 m_frame may be deleted at this point.
Kunihiko Sakamoto 2017/02/23 09:49:01 Check added.
+ return;
+ }
+
// OK, completed.
m_frame->document()->setReadyState(Document::Complete);
if (m_frame->document()->loadEventStillNeeded())

Powered by Google App Engine
This is Rietveld 408576698