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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2400443004: Walk up frame tree for srcdoc referrer policies (Closed)
Patch Set: fix dynamic policy test Created 4 years, 2 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
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 3363 matching lines...) Expand 10 before | Expand all | Expand 10 after
3374 frame = toLocalFrame(frame->tree().parent()); 3374 frame = toLocalFrame(frame->tree().parent());
3375 // Srcdoc documents cannot be top-level documents, by definition, 3375 // Srcdoc documents cannot be top-level documents, by definition,
3376 // because they need to be contained in iframes with the srcdoc. 3376 // because they need to be contained in iframes with the srcdoc.
3377 DCHECK(frame); 3377 DCHECK(frame);
3378 } 3378 }
3379 referrerDocument = frame->document(); 3379 referrerDocument = frame->document();
3380 } 3380 }
3381 return referrerDocument->m_url.strippedForUseAsReferrer(); 3381 return referrerDocument->m_url.strippedForUseAsReferrer();
3382 } 3382 }
3383 3383
3384 ReferrerPolicy Document::getReferrerPolicy() const {
3385 ReferrerPolicy policy = ExecutionContext::getReferrerPolicy();
3386 // For srcdoc documents without their own policy, walk up the frame
3387 // tree to find the document that is either not a srcdoc or doesn't
3388 // have its own policy. This algorithm is defined in
3389 // https://html.spec.whatwg.org/multipage/browsers.html#set-up-a-browsing-cont ext-environment-settings-object.
3390 if (!m_frame || policy != ReferrerPolicyDefault || !isSrcdocDocument()) {
3391 return policy;
3392 }
3393 LocalFrame* frame = toLocalFrame(m_frame->tree().parent());
3394 DCHECK(frame);
3395 return frame->document()->getReferrerPolicy();
3396 }
3397
3384 MouseEventWithHitTestResults Document::performMouseEventHitTest( 3398 MouseEventWithHitTestResults Document::performMouseEventHitTest(
3385 const HitTestRequest& request, 3399 const HitTestRequest& request,
3386 const LayoutPoint& documentPoint, 3400 const LayoutPoint& documentPoint,
3387 const PlatformMouseEvent& event) { 3401 const PlatformMouseEvent& event) {
3388 DCHECK(layoutViewItem().isNull() || layoutViewItem().isLayoutView()); 3402 DCHECK(layoutViewItem().isNull() || layoutViewItem().isLayoutView());
3389 3403
3390 // LayoutView::hitTest causes a layout, and we don't want to hit that until 3404 // LayoutView::hitTest causes a layout, and we don't want to hit that until
3391 // the first layout because until then, there is nothing shown on the screen - 3405 // the first layout because until then, there is nothing shown on the screen -
3392 // the user can't have intentionally clicked on something belonging to this 3406 // the user can't have intentionally clicked on something belonging to this
3393 // page. Furthermore, mousemove events before the first layout should not 3407 // page. Furthermore, mousemove events before the first layout should not
(...skipping 2994 matching lines...) Expand 10 before | Expand all | Expand 10 after
6388 } 6402 }
6389 6403
6390 void showLiveDocumentInstances() { 6404 void showLiveDocumentInstances() {
6391 WeakDocumentSet& set = liveDocumentSet(); 6405 WeakDocumentSet& set = liveDocumentSet();
6392 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6406 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6393 for (Document* document : set) 6407 for (Document* document : set)
6394 fprintf(stderr, "- Document %p URL: %s\n", document, 6408 fprintf(stderr, "- Document %p URL: %s\n", document,
6395 document->url().getString().utf8().data()); 6409 document->url().getString().utf8().data());
6396 } 6410 }
6397 #endif 6411 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/ExecutionContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698