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

Unified Diff: third_party/WebKit/Source/core/page/ScopedPageLoadDeferrer.cpp

Issue 2242923002: Copy Page::ordinaryPages() before undeferring loads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/page/ScopedPageLoadDeferrer.cpp
diff --git a/third_party/WebKit/Source/core/page/ScopedPageLoadDeferrer.cpp b/third_party/WebKit/Source/core/page/ScopedPageLoadDeferrer.cpp
index be85168aa42537058c73dbf285db5754b4cd3d53..bedf6765e1a1a15cde093789c0e290078ce79a03 100644
--- a/third_party/WebKit/Source/core/page/ScopedPageLoadDeferrer.cpp
+++ b/third_party/WebKit/Source/core/page/ScopedPageLoadDeferrer.cpp
@@ -37,7 +37,12 @@ unsigned s_deferralCount = 0;
void setDefersLoading(bool isDeferred)
{
+ // Make a copy of the collection. Undeferring loads can cause script to run,
+ // which would mutate ordinaryPages() in the middle of iteration.
+ HeapVector<Member<Page>> pages;
for (const auto& page : Page::ordinaryPages())
+ pages.append(page);
esprehn 2016/08/16 02:31:42 copyToVector(pages, Page::ordinaryPages())
+ for (const auto& page : pages)
page->setDefersLoading(isDeferred);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698