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

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

Issue 1117203002: Enforce referrer policies for workers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix layout test indentation Created 5 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 | « Source/core/dom/Document.h ('k') | Source/core/dom/ExecutionContext.h » ('j') | 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 r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 , m_isTransitionDocument(false) 458 , m_isTransitionDocument(false)
459 , m_layoutView(0) 459 , m_layoutView(0)
460 #if !ENABLE(OILPAN) 460 #if !ENABLE(OILPAN)
461 , m_weakFactory(this) 461 , m_weakFactory(this)
462 #endif 462 #endif
463 , m_contextDocument(initializer.contextDocument()) 463 , m_contextDocument(initializer.contextDocument())
464 , m_hasFullscreenSupplement(false) 464 , m_hasFullscreenSupplement(false)
465 , m_loadEventDelayCount(0) 465 , m_loadEventDelayCount(0)
466 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) 466 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired)
467 , m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired) 467 , m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired)
468 , m_referrerPolicy(ReferrerPolicyDefault)
469 , m_writeRecursionIsTooDeep(false) 468 , m_writeRecursionIsTooDeep(false)
470 , m_writeRecursionDepth(0) 469 , m_writeRecursionDepth(0)
471 , m_taskRunner(MainThreadTaskRunner::create(this)) 470 , m_taskRunner(MainThreadTaskRunner::create(this))
472 , m_registrationContext(initializer.registrationContext(this)) 471 , m_registrationContext(initializer.registrationContext(this))
473 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi red) 472 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi red)
474 , m_timeline(AnimationTimeline::create(this)) 473 , m_timeline(AnimationTimeline::create(this))
475 , m_templateDocumentHost(nullptr) 474 , m_templateDocumentHost(nullptr)
476 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired) 475 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired)
477 , m_hasViewportUnits(false) 476 , m_hasViewportUnits(false)
478 , m_styleRecalcElementCounter(0) 477 , m_styleRecalcElementCounter(0)
(...skipping 2579 matching lines...) Expand 10 before | Expand all | Expand 10 after
3058 else if (equalIgnoringCase(policy, "origin")) 3057 else if (equalIgnoringCase(policy, "origin"))
3059 setReferrerPolicy(ReferrerPolicyOrigin); 3058 setReferrerPolicy(ReferrerPolicyOrigin);
3060 else if (equalIgnoringCase(policy, "origin-when-crossorigin")) 3059 else if (equalIgnoringCase(policy, "origin-when-crossorigin"))
3061 setReferrerPolicy(ReferrerPolicyOriginWhenCrossOrigin); 3060 setReferrerPolicy(ReferrerPolicyOriginWhenCrossOrigin);
3062 else if (equalIgnoringCase(policy, "no-referrer-when-downgrade") || equalIgn oringCase(policy, "default")) 3061 else if (equalIgnoringCase(policy, "no-referrer-when-downgrade") || equalIgn oringCase(policy, "default"))
3063 setReferrerPolicy(ReferrerPolicyNoReferrerWhenDowngrade); 3062 setReferrerPolicy(ReferrerPolicyNoReferrerWhenDowngrade);
3064 else 3063 else
3065 addConsoleMessage(ConsoleMessage::create(RenderingMessageSource, ErrorMe ssageLevel, "Failed to set referrer policy: The value '" + policy + "' is not on e of 'always', 'default', 'never', 'no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-crossorigin', or 'unsafe-url'. This document's referrer p olicy has been left unchanged.")); 3064 addConsoleMessage(ConsoleMessage::create(RenderingMessageSource, ErrorMe ssageLevel, "Failed to set referrer policy: The value '" + policy + "' is not on e of 'always', 'default', 'never', 'no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-crossorigin', or 'unsafe-url'. This document's referrer p olicy has been left unchanged."));
3066 } 3065 }
3067 3066
3068 void Document::setReferrerPolicy(ReferrerPolicy referrerPolicy)
3069 {
3070 // FIXME: Can we adopt the CSP referrer policy merge algorithm? Or does the web rely on being able to modify the referrer policy in-flight?
3071 UseCounter::count(this, UseCounter::SetReferrerPolicy);
3072 if (m_referrerPolicy != ReferrerPolicyDefault)
3073 UseCounter::count(this, UseCounter::ResetReferrerPolicy);
3074
3075 m_referrerPolicy = referrerPolicy;
3076 }
3077
3078 String Document::outgoingReferrer() 3067 String Document::outgoingReferrer()
3079 { 3068 {
3080 // See http://www.whatwg.org/specs/web-apps/current-work/#fetching-resources 3069 // See http://www.whatwg.org/specs/web-apps/current-work/#fetching-resources
3081 // for why we walk the parent chain for srcdoc documents. 3070 // for why we walk the parent chain for srcdoc documents.
3082 Document* referrerDocument = this; 3071 Document* referrerDocument = this;
3083 if (LocalFrame* frame = m_frame) { 3072 if (LocalFrame* frame = m_frame) {
3084 while (frame->document()->isSrcdocDocument()) { 3073 while (frame->document()->isSrcdocDocument()) {
3085 // Srcdoc documents must be local within the containing frame. 3074 // Srcdoc documents must be local within the containing frame.
3086 frame = toLocalFrame(frame->tree().parent()); 3075 frame = toLocalFrame(frame->tree().parent());
3087 // Srcdoc documents cannot be top-level documents, by definition, 3076 // Srcdoc documents cannot be top-level documents, by definition,
(...skipping 2667 matching lines...) Expand 10 before | Expand all | Expand 10 after
5755 #ifndef NDEBUG 5744 #ifndef NDEBUG
5756 using namespace blink; 5745 using namespace blink;
5757 void showLiveDocumentInstances() 5746 void showLiveDocumentInstances()
5758 { 5747 {
5759 WeakDocumentSet& set = liveDocumentSet(); 5748 WeakDocumentSet& set = liveDocumentSet();
5760 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5749 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5761 for (Document* document : set) 5750 for (Document* document : set)
5762 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5751 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5763 } 5752 }
5764 #endif 5753 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/ExecutionContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698