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

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

Issue 1235563004: Apply meta tag referrer policy for preloaded requests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: style fix Created 5 years, 5 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 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 3135 matching lines...) Expand 10 before | Expand all | Expand 10 after
3146 3146
3147 void Document::updateViewportDescription() 3147 void Document::updateViewportDescription()
3148 { 3148 {
3149 if (frame() && frame()->isMainFrame()) { 3149 if (frame() && frame()->isMainFrame()) {
3150 frameHost()->chromeClient().dispatchViewportPropertiesDidChange(m_viewpo rtDescription); 3150 frameHost()->chromeClient().dispatchViewportPropertiesDidChange(m_viewpo rtDescription);
3151 } 3151 }
3152 } 3152 }
3153 3153
3154 void Document::processReferrerPolicy(const String& policy) 3154 void Document::processReferrerPolicy(const String& policy)
3155 { 3155 {
3156 ASSERT(!policy.isNull()); 3156 ReferrerPolicy referrerPolicy;
3157 if (!SecurityPolicy::referrerPolicyFromString(policy, &referrerPolicy)) {
3158 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."));
3159 return;
3160 }
3157 3161
3158 if (equalIgnoringCase(policy, "no-referrer") || equalIgnoringCase(policy, "n ever")) 3162 setReferrerPolicy(referrerPolicy);
3159 setReferrerPolicy(ReferrerPolicyNever);
3160 else if (equalIgnoringCase(policy, "unsafe-url") || equalIgnoringCase(policy , "always"))
3161 setReferrerPolicy(ReferrerPolicyAlways);
3162 else if (equalIgnoringCase(policy, "origin"))
3163 setReferrerPolicy(ReferrerPolicyOrigin);
3164 else if (equalIgnoringCase(policy, "origin-when-cross-origin") || equalIgnor ingCase(policy, "origin-when-crossorigin"))
3165 setReferrerPolicy(ReferrerPolicyOriginWhenCrossOrigin);
3166 else if (equalIgnoringCase(policy, "no-referrer-when-downgrade") || equalIgn oringCase(policy, "default"))
3167 setReferrerPolicy(ReferrerPolicyNoReferrerWhenDowngrade);
3168 else
3169 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."));
3170 } 3163 }
3171 3164
3172 String Document::outgoingReferrer() 3165 String Document::outgoingReferrer()
3173 { 3166 {
3174 // See http://www.whatwg.org/specs/web-apps/current-work/#fetching-resources 3167 // See http://www.whatwg.org/specs/web-apps/current-work/#fetching-resources
3175 // for why we walk the parent chain for srcdoc documents. 3168 // for why we walk the parent chain for srcdoc documents.
3176 Document* referrerDocument = this; 3169 Document* referrerDocument = this;
3177 if (LocalFrame* frame = m_frame) { 3170 if (LocalFrame* frame = m_frame) {
3178 while (frame->document()->isSrcdocDocument()) { 3171 while (frame->document()->isSrcdocDocument()) {
3179 // Srcdoc documents must be local within the containing frame. 3172 // Srcdoc documents must be local within the containing frame.
(...skipping 2629 matching lines...) Expand 10 before | Expand all | Expand 10 after
5809 #ifndef NDEBUG 5802 #ifndef NDEBUG
5810 using namespace blink; 5803 using namespace blink;
5811 void showLiveDocumentInstances() 5804 void showLiveDocumentInstances()
5812 { 5805 {
5813 WeakDocumentSet& set = liveDocumentSet(); 5806 WeakDocumentSet& set = liveDocumentSet();
5814 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5807 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5815 for (Document* document : set) 5808 for (Document* document : set)
5816 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5809 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5817 } 5810 }
5818 #endif 5811 #endif
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/security/resources/referrer-policy-script.php ('k') | Source/core/html/parser/CSSPreloadScanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698