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

Unified Diff: Source/bindings/core/v8/ScriptController.cpp

Issue 495743003: Add an extra guard to replaceDocument() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Landing Created 6 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
Index: Source/bindings/core/v8/ScriptController.cpp
diff --git a/Source/bindings/core/v8/ScriptController.cpp b/Source/bindings/core/v8/ScriptController.cpp
index 26f81df5fff5417f873c861135f85347b878354e..30482004680d0ffe285856ea4f2d91cca0fb404e 100644
--- a/Source/bindings/core/v8/ScriptController.cpp
+++ b/Source/bindings/core/v8/ScriptController.cpp
@@ -558,12 +558,7 @@ bool ScriptController::executeScriptIfJavaScriptURL(const KURL& url)
if (!locationChangeBefore && m_frame->navigationScheduler().locationChangePending())
return true;
- // DocumentWriter::replaceDocument can cause the DocumentLoader to get deref'ed and possible destroyed,
- // so protect it with a RefPtr.
- if (RefPtr<DocumentLoader> loader = m_frame->document()->loader()) {
- UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaScriptURL);
- loader->replaceDocument(scriptResult, ownerDocument.get());
- }
+ m_frame->loader().replaceDocumentWhileExecutingJavaScriptURL(scriptResult, ownerDocument.get());
return true;
}
« no previous file with comments | « LayoutTests/fast/loader/unload-mutation-crash-expected.txt ('k') | Source/core/dom/DecodedDataDocumentParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698