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

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

Issue 2801093002: Clear hash when setting URL in document.open (Closed)
Patch Set: Rebase + Only clear hash on cross-frame open() Created 3 years, 8 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 | « third_party/WebKit/LayoutTests/fast/scrolling/doc-write-to-iframe.html ('k') | 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/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index a3642619f5eee819a093f00845bf188effd22243..fb7aae58bf9133a4cbcee0bd87f75a9a0359f1b1 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -2727,7 +2727,15 @@ void Document::open(Document* entered_document,
return;
}
SetSecurityOrigin(entered_document->GetSecurityOrigin());
- SetURL(entered_document->Url());
+
+ if (this != entered_document) {
+ // Clear the hash fragment from the inherited URL to prevent a
+ // scroll-into-view for any document.open()'d frame.
+ KURL new_url = entered_document->Url();
+ new_url.SetFragmentIdentifier(String());
+ SetURL(new_url);
+ }
+
cookie_url_ = entered_document->CookieURL();
}
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/scrolling/doc-write-to-iframe.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698