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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1444183003: Cancel javascript: URL navigations if the frame was navigated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More comments Created 5 years, 1 month 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 | third_party/WebKit/Source/core/frame/LocalFrame.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index fa6942c7490bd60df74c479be7a2c5e3461f56e0..cb15d60c880e77551955d84a19d2777387ff585c 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -2182,7 +2182,17 @@ void Document::detach(const AttachContext& context)
if (!isActive())
return;
+ // Frame navigation can cause a new Document to be attached. Don't allow that, since that will
+ // cause a situation where LocalFrame still has a Document attached after this finishes!
+ // Normally, it shouldn't actually be possible to trigger navigation here. However, plugins
+ // (see below) can cause lots of crazy things to happen, since plugin detach involves nested
+ // message loops.
+ FrameNavigationDisabler navigationDisabler(*m_frame);
+ // Defer widget updates to avoid plugins trying to run script inside ScriptForbiddenScope,
+ // which will crash the renderer after https://crrev.com/200984
HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates;
+ // Don't allow script to run in the middle of detach() because a detaching Document is not in a
+ // consistent state.
ScriptForbiddenScope forbidScript;
view()->dispose();
m_markers->prepareForDestruction();
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/LocalFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698