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

Side by Side Diff: third_party/WebKit/Source/core/loader/HttpEquiv.cpp

Issue 2035263002: Extract SourceLocation for ConsoleMessages on call sites. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2037593004
Patch Set: Created 4 years, 6 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/loader/HttpEquiv.h" 5 #include "core/loader/HttpEquiv.h"
6 6
7 #include "bindings/core/v8/SourceLocation.h"
7 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
8 #include "core/dom/ScriptableDocumentParser.h" 9 #include "core/dom/ScriptableDocumentParser.h"
9 #include "core/dom/StyleEngine.h" 10 #include "core/dom/StyleEngine.h"
10 #include "core/fetch/ClientHintsPreferences.h" 11 #include "core/fetch/ClientHintsPreferences.h"
11 #include "core/frame/UseCounter.h" 12 #include "core/frame/UseCounter.h"
12 #include "core/frame/csp/ContentSecurityPolicy.h" 13 #include "core/frame/csp/ContentSecurityPolicy.h"
13 #include "core/html/HTMLDocument.h" 14 #include "core/html/HTMLDocument.h"
14 #include "core/inspector/ConsoleMessage.h" 15 #include "core/inspector/ConsoleMessage.h"
15 #include "core/loader/DocumentLoader.h" 16 #include "core/loader/DocumentLoader.h"
16 #include "core/origin_trials/OriginTrialContext.h" 17 #include "core/origin_trials/OriginTrialContext.h"
(...skipping 11 matching lines...) Expand all
28 processHttpEquivDefaultStyle(document, content); 29 processHttpEquivDefaultStyle(document, content);
29 } else if (equalIgnoringCase(equiv, "refresh")) { 30 } else if (equalIgnoringCase(equiv, "refresh")) {
30 processHttpEquivRefresh(document, content); 31 processHttpEquivRefresh(document, content);
31 } else if (equalIgnoringCase(equiv, "set-cookie")) { 32 } else if (equalIgnoringCase(equiv, "set-cookie")) {
32 processHttpEquivSetCookie(document, content); 33 processHttpEquivSetCookie(document, content);
33 } else if (equalIgnoringCase(equiv, "content-language")) { 34 } else if (equalIgnoringCase(equiv, "content-language")) {
34 document.setContentLanguage(content); 35 document.setContentLanguage(content);
35 } else if (equalIgnoringCase(equiv, "x-dns-prefetch-control")) { 36 } else if (equalIgnoringCase(equiv, "x-dns-prefetch-control")) {
36 document.parseDNSPrefetchControlHeader(content); 37 document.parseDNSPrefetchControlHeader(content);
37 } else if (equalIgnoringCase(equiv, "x-frame-options")) { 38 } else if (equalIgnoringCase(equiv, "x-frame-options")) {
38 document.addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "X-Frame-Options may only be set via an HTTP header sent alo ng with a document. It may not be set inside <meta>.")); 39 document.addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "X-Frame-Options may only be set via an HTTP header sent alo ng with a document. It may not be set inside <meta>.", SourceLocation::capture(& document)));
39 } else if (equalIgnoringCase(equiv, "accept-ch")) { 40 } else if (equalIgnoringCase(equiv, "accept-ch")) {
40 processHttpEquivAcceptCH(document, content); 41 processHttpEquivAcceptCH(document, content);
41 } else if (equalIgnoringCase(equiv, "content-security-policy") || equalIgnor ingCase(equiv, "content-security-policy-report-only")) { 42 } else if (equalIgnoringCase(equiv, "content-security-policy") || equalIgnor ingCase(equiv, "content-security-policy-report-only")) {
42 if (inDocumentHeadElement) 43 if (inDocumentHeadElement)
43 processHttpEquivContentSecurityPolicy(document, equiv, content); 44 processHttpEquivContentSecurityPolicy(document, equiv, content);
44 else 45 else
45 document.contentSecurityPolicy()->reportMetaOutsideHead(content); 46 document.contentSecurityPolicy()->reportMetaOutsideHead(content);
46 } else if (equalIgnoringCase(equiv, "suborigin")) { 47 } else if (equalIgnoringCase(equiv, "suborigin")) {
47 document.addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "Error with Suborigin header: Suborigin header with value '" + content + "' was delivered via a <meta> element and not an HTTP header, which is disallowed. The Suborigin has been ignored.")); 48 document.addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "Error with Suborigin header: Suborigin header with value '" + content + "' was delivered via a <meta> element and not an HTTP header, which is disallowed. The Suborigin has been ignored.", SourceLocation::capture(&docum ent)));
48 } else if (equalIgnoringCase(equiv, HTTPNames::Origin_Trial)) { 49 } else if (equalIgnoringCase(equiv, HTTPNames::Origin_Trial)) {
49 if (inDocumentHeadElement) 50 if (inDocumentHeadElement)
50 OriginTrialContext::from(&document)->addToken(content); 51 OriginTrialContext::from(&document)->addToken(content);
51 } 52 }
52 } 53 }
53 54
54 void HttpEquiv::processHttpEquivContentSecurityPolicy(Document& document, const AtomicString& equiv, const AtomicString& content) 55 void HttpEquiv::processHttpEquivContentSecurityPolicy(Document& document, const AtomicString& equiv, const AtomicString& content)
55 { 56 {
56 if (document.importLoader()) 57 if (document.importLoader())
57 return; 58 return;
(...skipping 28 matching lines...) Expand all
86 { 87 {
87 // FIXME: make setCookie work on XML documents too; e.g. in case of <html:me ta .....> 88 // FIXME: make setCookie work on XML documents too; e.g. in case of <html:me ta .....>
88 if (!document.isHTMLDocument()) 89 if (!document.isHTMLDocument())
89 return; 90 return;
90 91
91 // Exception (for sandboxed documents) ignored. 92 // Exception (for sandboxed documents) ignored.
92 toHTMLDocument(document).setCookie(content, IGNORE_EXCEPTION); 93 toHTMLDocument(document).setCookie(content, IGNORE_EXCEPTION);
93 } 94 }
94 95
95 } // namespace blink 96 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameLoader.cpp ('k') | third_party/WebKit/Source/core/loader/LinkLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698