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

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: Clear hash for document.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 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 // Clear the hash fragment from the inerited URL to prevent a
skobes 2017/04/21 17:19:56 typo: inherited
bokan 2017/04/24 17:39:04 Done.
2732 // scroll-into-view for any document.open()'d frame.
2733 KURL new_url = entered_document->Url();
2734 new_url.SetFragmentIdentifier(String());
2735
2736 SetURL(new_url);
skobes 2017/04/21 17:19:56 Does this code run only for cross-frame document.o
bokan 2017/04/24 17:39:04 Currently this was for any frame. I've changed it
2731 cookie_url_ = entered_document->CookieURL(); 2737 cookie_url_ = entered_document->CookieURL();
2732 } 2738 }
2733 2739
2734 open(); 2740 open();
2735 } 2741 }
2736 2742
2737 void Document::open() { 2743 void Document::open() {
2738 DCHECK(!ImportLoader()); 2744 DCHECK(!ImportLoader());
2739 2745
2740 if (frame_) { 2746 if (frame_) {
(...skipping 3911 matching lines...) Expand 10 before | Expand all | Expand 10 after
6652 } 6658 }
6653 6659
6654 void showLiveDocumentInstances() { 6660 void showLiveDocumentInstances() {
6655 WeakDocumentSet& set = liveDocumentSet(); 6661 WeakDocumentSet& set = liveDocumentSet();
6656 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6662 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6657 for (blink::Document* document : set) 6663 for (blink::Document* document : set)
6658 fprintf(stderr, "- Document %p URL: %s\n", document, 6664 fprintf(stderr, "- Document %p URL: %s\n", document,
6659 document->Url().GetString().Utf8().Data()); 6665 document->Url().GetString().Utf8().Data());
6660 } 6666 }
6661 #endif 6667 #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