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

Side by Side Diff: third_party/WebKit/Source/core/css/StyleRuleImport.cpp

Issue 2780533002: Use Referrer-Policy headers for CSS stylesheets (Closed)
Patch Set: rebase 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
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2002, 2005, 2006, 2008, 2009, 2010, 2012 Apple Inc. All rights 4 * Copyright (C) 2002, 2005, 2006, 2008, 2009, 2010, 2012 Apple Inc. All rights
5 * reserved. 5 * reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 visitor->trace(m_parentStyleSheet); 60 visitor->trace(m_parentStyleSheet);
61 visitor->trace(m_mediaQueries); 61 visitor->trace(m_mediaQueries);
62 visitor->trace(m_styleSheet); 62 visitor->trace(m_styleSheet);
63 visitor->trace(m_resource); 63 visitor->trace(m_resource);
64 StyleRuleBase::traceAfterDispatch(visitor); 64 StyleRuleBase::traceAfterDispatch(visitor);
65 } 65 }
66 66
67 void StyleRuleImport::setCSSStyleSheet( 67 void StyleRuleImport::setCSSStyleSheet(
68 const String& href, 68 const String& href,
69 const KURL& baseURL, 69 const KURL& baseURL,
70 ReferrerPolicy referrerPolicy,
70 const String& charset, 71 const String& charset,
71 const CSSStyleSheetResource* cachedStyleSheet) { 72 const CSSStyleSheetResource* cachedStyleSheet) {
72 if (m_styleSheet) 73 if (m_styleSheet)
73 m_styleSheet->clearOwnerRule(); 74 m_styleSheet->clearOwnerRule();
74 75
75 Document* document = nullptr; 76 Document* document = nullptr;
76 const CSSParserContext* context = strictCSSParserContext(); 77 const CSSParserContext* context = strictCSSParserContext();
77 if (m_parentStyleSheet) { 78 if (m_parentStyleSheet) {
78 document = m_parentStyleSheet->singleOwnerDocument(); 79 document = m_parentStyleSheet->singleOwnerDocument();
79 context = m_parentStyleSheet->parserContext(); 80 context = m_parentStyleSheet->parserContext();
80 } 81 }
81 context = 82 context = CSSParserContext::create(context, baseURL, referrerPolicy, charset,
82 CSSParserContext::create(context, baseURL, 83 document);
83 document ? document->getReferrerPolicy()
84 : context->referrer().referrerPolicy,
85 charset, document);
86 84
87 m_styleSheet = StyleSheetContents::create(this, href, context); 85 m_styleSheet = StyleSheetContents::create(this, href, context);
88 86
89 m_styleSheet->parseAuthorStyleSheet( 87 m_styleSheet->parseAuthorStyleSheet(
90 cachedStyleSheet, document ? document->getSecurityOrigin() : 0); 88 cachedStyleSheet, document ? document->getSecurityOrigin() : 0);
91 89
92 m_loading = false; 90 m_loading = false;
93 91
94 if (m_parentStyleSheet) { 92 if (m_parentStyleSheet) {
95 m_parentStyleSheet->notifyLoadedSheet(cachedStyleSheet); 93 m_parentStyleSheet->notifyLoadedSheet(cachedStyleSheet);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // the sheet being imported is pending. 139 // the sheet being imported is pending.
142 if (m_parentStyleSheet && m_parentStyleSheet->loadCompleted() && 140 if (m_parentStyleSheet && m_parentStyleSheet->loadCompleted() &&
143 rootSheet == m_parentStyleSheet) 141 rootSheet == m_parentStyleSheet)
144 m_parentStyleSheet->startLoadingDynamicSheet(); 142 m_parentStyleSheet->startLoadingDynamicSheet();
145 m_loading = true; 143 m_loading = true;
146 m_resource->addClient(m_styleSheetClient); 144 m_resource->addClient(m_styleSheetClient);
147 } 145 }
148 } 146 }
149 147
150 } // namespace blink 148 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698