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

Side by Side 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, 7 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 2709 matching lines...) Expand 10 before | Expand all | Expand 10 after
2720 } 2720 }
2721 2721
2722 if (entered_document) { 2722 if (entered_document) {
2723 if (!GetSecurityOrigin()->IsSameSchemeHostPortAndSuborigin( 2723 if (!GetSecurityOrigin()->IsSameSchemeHostPortAndSuborigin(
2724 entered_document->GetSecurityOrigin())) { 2724 entered_document->GetSecurityOrigin())) {
2725 exception_state.ThrowSecurityError( 2725 exception_state.ThrowSecurityError(
2726 "Can only call open() on same-origin documents."); 2726 "Can only call open() on same-origin documents.");
2727 return; 2727 return;
2728 } 2728 }
2729 SetSecurityOrigin(entered_document->GetSecurityOrigin()); 2729 SetSecurityOrigin(entered_document->GetSecurityOrigin());
2730 SetURL(entered_document->Url()); 2730
2731 if (this != entered_document) {
2732 // Clear the hash fragment from the inherited URL to prevent a
2733 // scroll-into-view for any document.open()'d frame.
2734 KURL new_url = entered_document->Url();
2735 new_url.SetFragmentIdentifier(String());
2736 SetURL(new_url);
2737 }
2738
2731 cookie_url_ = entered_document->CookieURL(); 2739 cookie_url_ = entered_document->CookieURL();
2732 } 2740 }
2733 2741
2734 open(); 2742 open();
2735 } 2743 }
2736 2744
2737 void Document::open() { 2745 void Document::open() {
2738 DCHECK(!ImportLoader()); 2746 DCHECK(!ImportLoader());
2739 2747
2740 if (frame_) { 2748 if (frame_) {
(...skipping 3980 matching lines...) Expand 10 before | Expand all | Expand 10 after
6721 } 6729 }
6722 6730
6723 void showLiveDocumentInstances() { 6731 void showLiveDocumentInstances() {
6724 WeakDocumentSet& set = liveDocumentSet(); 6732 WeakDocumentSet& set = liveDocumentSet();
6725 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6733 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6726 for (blink::Document* document : set) 6734 for (blink::Document* document : set)
6727 fprintf(stderr, "- Document %p URL: %s\n", document, 6735 fprintf(stderr, "- Document %p URL: %s\n", document,
6728 document->Url().GetString().Utf8().data()); 6736 document->Url().GetString().Utf8().data());
6729 } 6737 }
6730 #endif 6738 #endif
OLDNEW
« 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