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

Side by Side Diff: Source/core/xmlhttprequest/XMLHttpRequest.cpp

Issue 1018903002: Show deprecation warnings for header values in XHR according to RFC 7230 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org>
4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org>
5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved.
6 * Copyright (C) 2012 Intel Corporation 6 * Copyright (C) 2012 Intel Corporation
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 if (!isValidHTTPToken(name)) { 1176 if (!isValidHTTPToken(name)) {
1177 exceptionState.throwDOMException(SyntaxError, "'" + name + "' is not a v alid HTTP header field name."); 1177 exceptionState.throwDOMException(SyntaxError, "'" + name + "' is not a v alid HTTP header field name.");
1178 return; 1178 return;
1179 } 1179 }
1180 1180
1181 if (!isValidHTTPHeaderValue(value)) { 1181 if (!isValidHTTPHeaderValue(value)) {
1182 exceptionState.throwDOMException(SyntaxError, "'" + value + "' is not a valid HTTP header field value."); 1182 exceptionState.throwDOMException(SyntaxError, "'" + value + "' is not a valid HTTP header field value.");
1183 return; 1183 return;
1184 } 1184 }
1185 1185
1186 // Show deprecation warnings and count occurrences of such deprecated header values
hiroshige 2015/09/01 11:21:18 nit: append '.' at the end of the statement.
shiva.jm 2015/09/01 14:29:11 Done.
1187 if (!isValidHTTPFieldContentRFC7230(value))
hiroshige 2015/09/01 11:21:18 After I saw the diff of xmlhttprequest-setrequesth
shiva.jm 2015/09/01 14:29:11 Done.
1188 UseCounter::countDeprecation(executionContext(), UseCounter::HeaderValue NotMatchingRFC7230);
1189
1186 // No script (privileged or not) can set unsafe headers. 1190 // No script (privileged or not) can set unsafe headers.
1187 if (FetchUtils::isForbiddenHeaderName(name)) { 1191 if (FetchUtils::isForbiddenHeaderName(name)) {
1188 logConsoleError(executionContext(), "Refused to set unsafe header \"" + name + "\""); 1192 logConsoleError(executionContext(), "Refused to set unsafe header \"" + name + "\"");
1189 return; 1193 return;
1190 } 1194 }
1191 1195
1192 setRequestHeaderInternal(name, value); 1196 setRequestHeaderInternal(name, value);
1193 } 1197 }
1194 1198
1195 void XMLHttpRequest::setRequestHeaderInternal(const AtomicString& name, const At omicString& value) 1199 void XMLHttpRequest::setRequestHeaderInternal(const AtomicString& name, const At omicString& value)
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1693 visitor->trace(m_responseDocumentParser); 1697 visitor->trace(m_responseDocumentParser);
1694 visitor->trace(m_progressEventThrottle); 1698 visitor->trace(m_progressEventThrottle);
1695 visitor->trace(m_upload); 1699 visitor->trace(m_upload);
1696 visitor->trace(m_blobLoader); 1700 visitor->trace(m_blobLoader);
1697 XMLHttpRequestEventTarget::trace(visitor); 1701 XMLHttpRequestEventTarget::trace(visitor);
1698 DocumentParserClient::trace(visitor); 1702 DocumentParserClient::trace(visitor);
1699 ActiveDOMObject::trace(visitor); 1703 ActiveDOMObject::trace(visitor);
1700 } 1704 }
1701 1705
1702 } // namespace blink 1706 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698