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

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

Issue 698973008: Referrer Policy: Distinguish "default" from "no referrer when downgrade" [2/2] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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/frame/UseCounter.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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 , m_isTransitionDocument(false) 489 , m_isTransitionDocument(false)
490 , m_renderView(0) 490 , m_renderView(0)
491 #if !ENABLE(OILPAN) 491 #if !ENABLE(OILPAN)
492 , m_weakFactory(this) 492 , m_weakFactory(this)
493 #endif 493 #endif
494 , m_contextDocument(initializer.contextDocument()) 494 , m_contextDocument(initializer.contextDocument())
495 , m_hasFullscreenSupplement(false) 495 , m_hasFullscreenSupplement(false)
496 , m_loadEventDelayCount(0) 496 , m_loadEventDelayCount(0)
497 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) 497 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired)
498 , m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired) 498 , m_pluginLoadingTimer(this, &Document::pluginLoadingTimerFired)
499 , m_didSetReferrerPolicy(false)
500 , m_referrerPolicy(ReferrerPolicyDefault) 499 , m_referrerPolicy(ReferrerPolicyDefault)
501 , m_directionSetOnDocumentElement(false) 500 , m_directionSetOnDocumentElement(false)
502 , m_writingModeSetOnDocumentElement(false) 501 , m_writingModeSetOnDocumentElement(false)
503 , m_containsAnyRareWritingMode(false) 502 , m_containsAnyRareWritingMode(false)
504 , m_writeRecursionIsTooDeep(false) 503 , m_writeRecursionIsTooDeep(false)
505 , m_writeRecursionDepth(0) 504 , m_writeRecursionDepth(0)
506 , m_taskRunner(MainThreadTaskRunner::create(this)) 505 , m_taskRunner(MainThreadTaskRunner::create(this))
507 , m_registrationContext(initializer.registrationContext(this)) 506 , m_registrationContext(initializer.registrationContext(this))
508 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi red) 507 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi red)
509 , m_timeline(AnimationTimeline::create(this)) 508 , m_timeline(AnimationTimeline::create(this))
(...skipping 2645 matching lines...) Expand 10 before | Expand all | Expand 10 after
3155 { 3154 {
3156 ASSERT(!policy.isNull()); 3155 ASSERT(!policy.isNull());
3157 3156
3158 if (equalIgnoringCase(policy, "no-referrer") || equalIgnoringCase(policy, "n ever")) { 3157 if (equalIgnoringCase(policy, "no-referrer") || equalIgnoringCase(policy, "n ever")) {
3159 setReferrerPolicy(ReferrerPolicyNever); 3158 setReferrerPolicy(ReferrerPolicyNever);
3160 } else if (equalIgnoringCase(policy, "unsafe-url") || equalIgnoringCase(poli cy, "always")) { 3159 } else if (equalIgnoringCase(policy, "unsafe-url") || equalIgnoringCase(poli cy, "always")) {
3161 setReferrerPolicy(ReferrerPolicyAlways); 3160 setReferrerPolicy(ReferrerPolicyAlways);
3162 } else if (equalIgnoringCase(policy, "origin")) { 3161 } else if (equalIgnoringCase(policy, "origin")) {
3163 setReferrerPolicy(ReferrerPolicyOrigin); 3162 setReferrerPolicy(ReferrerPolicyOrigin);
3164 } else if (equalIgnoringCase(policy, "no-referrer-when-downgrade") || equalI gnoringCase(policy, "default")) { 3163 } else if (equalIgnoringCase(policy, "no-referrer-when-downgrade") || equalI gnoringCase(policy, "default")) {
3165 setReferrerPolicy(ReferrerPolicyDefault); 3164 setReferrerPolicy(ReferrerPolicyNoReferrerWhenDowngrade);
3166 } else { 3165 } else {
3167 addConsoleMessage(ConsoleMessage::create(RenderingMessageSource, ErrorMe ssageLevel, "Failed to set referrer policy: The value '" + policy + "' is not on e of 'no-referrer', 'origin', 'no-referrer-when-downgrade', or 'unsafe-url'. Def aulting to 'no-referrer'.")); 3166 addConsoleMessage(ConsoleMessage::create(RenderingMessageSource, ErrorMe ssageLevel, "Failed to set referrer policy: The value '" + policy + "' is not on e of 'no-referrer', 'origin', 'no-referrer-when-downgrade', or 'unsafe-url'. Def aulting to 'no-referrer'."));
3168 setReferrerPolicy(ReferrerPolicyNever); 3167 setReferrerPolicy(ReferrerPolicyNever);
3169 } 3168 }
3170 } 3169 }
3171 3170
3172 void Document::setReferrerPolicy(ReferrerPolicy referrerPolicy) 3171 void Document::setReferrerPolicy(ReferrerPolicy referrerPolicy)
3173 { 3172 {
3174 // 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? 3173 // 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?
3175 if (m_didSetReferrerPolicy) 3174 UseCounter::count(this, UseCounter::SetReferrerPolicy);
3175 if (m_referrerPolicy != ReferrerPolicyDefault)
3176 UseCounter::count(this, UseCounter::ResetReferrerPolicy); 3176 UseCounter::count(this, UseCounter::ResetReferrerPolicy);
3177 m_didSetReferrerPolicy = true;
3178 3177
3179 m_referrerPolicy = referrerPolicy; 3178 m_referrerPolicy = referrerPolicy;
3180 } 3179 }
3181 3180
3182 String Document::outgoingReferrer() 3181 String Document::outgoingReferrer()
3183 { 3182 {
3184 // See http://www.whatwg.org/specs/web-apps/current-work/#fetching-resources 3183 // See http://www.whatwg.org/specs/web-apps/current-work/#fetching-resources
3185 // for why we walk the parent chain for srcdoc documents. 3184 // for why we walk the parent chain for srcdoc documents.
3186 Document* referrerDocument = this; 3185 Document* referrerDocument = this;
3187 if (LocalFrame* frame = m_frame) { 3186 if (LocalFrame* frame = m_frame) {
(...skipping 2643 matching lines...) Expand 10 before | Expand all | Expand 10 after
5831 #ifndef NDEBUG 5830 #ifndef NDEBUG
5832 using namespace blink; 5831 using namespace blink;
5833 void showLiveDocumentInstances() 5832 void showLiveDocumentInstances()
5834 { 5833 {
5835 WeakDocumentSet& set = liveDocumentSet(); 5834 WeakDocumentSet& set = liveDocumentSet();
5836 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5835 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5837 for (Document* document : set) 5836 for (Document* document : set)
5838 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5837 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5839 } 5838 }
5840 #endif 5839 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698