OLD | NEW |
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 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 HTTPHeaderMap::AddResult result = m_requestHeaders.add(name, value); | 1109 HTTPHeaderMap::AddResult result = m_requestHeaders.add(name, value); |
1110 if (!result.isNewEntry) | 1110 if (!result.isNewEntry) |
1111 result.iterator->value = result.iterator->value + ", " + value; | 1111 result.iterator->value = result.iterator->value + ", " + value; |
1112 } | 1112 } |
1113 | 1113 |
1114 const AtomicString& XMLHttpRequest::getRequestHeader(const AtomicString& name) c
onst | 1114 const AtomicString& XMLHttpRequest::getRequestHeader(const AtomicString& name) c
onst |
1115 { | 1115 { |
1116 return m_requestHeaders.get(name); | 1116 return m_requestHeaders.get(name); |
1117 } | 1117 } |
1118 | 1118 |
1119 String XMLHttpRequest::getAllResponseHeaders(ExceptionState& exceptionState) con
st | 1119 String XMLHttpRequest::getAllResponseHeaders() const |
1120 { | 1120 { |
1121 if (m_state < HEADERS_RECEIVED || m_error) | 1121 if (m_state < HEADERS_RECEIVED || m_error) |
1122 return ""; | 1122 return ""; |
1123 | 1123 |
1124 StringBuilder stringBuilder; | 1124 StringBuilder stringBuilder; |
1125 | 1125 |
1126 HTTPHeaderSet accessControlExposeHeaderSet; | 1126 HTTPHeaderSet accessControlExposeHeaderSet; |
1127 parseAccessControlExposeHeadersAllowList(m_response.httpHeaderField("Access-
Control-Expose-Headers"), accessControlExposeHeaderSet); | 1127 parseAccessControlExposeHeadersAllowList(m_response.httpHeaderField("Access-
Control-Expose-Headers"), accessControlExposeHeaderSet); |
1128 HTTPHeaderMap::const_iterator end = m_response.httpHeaderFields().end(); | 1128 HTTPHeaderMap::const_iterator end = m_response.httpHeaderFields().end(); |
1129 for (HTTPHeaderMap::const_iterator it = m_response.httpHeaderFields().begin(
); it!= end; ++it) { | 1129 for (HTTPHeaderMap::const_iterator it = m_response.httpHeaderFields().begin(
); it!= end; ++it) { |
(...skipping 13 matching lines...) Expand all Loading... |
1143 stringBuilder.append(':'); | 1143 stringBuilder.append(':'); |
1144 stringBuilder.append(' '); | 1144 stringBuilder.append(' '); |
1145 stringBuilder.append(it->value); | 1145 stringBuilder.append(it->value); |
1146 stringBuilder.append('\r'); | 1146 stringBuilder.append('\r'); |
1147 stringBuilder.append('\n'); | 1147 stringBuilder.append('\n'); |
1148 } | 1148 } |
1149 | 1149 |
1150 return stringBuilder.toString(); | 1150 return stringBuilder.toString(); |
1151 } | 1151 } |
1152 | 1152 |
1153 const AtomicString& XMLHttpRequest::getResponseHeader(const AtomicString& name,
ExceptionState& exceptionState) const | 1153 const AtomicString& XMLHttpRequest::getResponseHeader(const AtomicString& name)
const |
1154 { | 1154 { |
1155 if (m_state < HEADERS_RECEIVED || m_error) | 1155 if (m_state < HEADERS_RECEIVED || m_error) |
1156 return nullAtom; | 1156 return nullAtom; |
1157 | 1157 |
1158 // See comment in getAllResponseHeaders above. | 1158 // See comment in getAllResponseHeaders above. |
1159 if (isSetCookieHeader(name) && !securityOrigin()->canLoadLocalResources()) { | 1159 if (isSetCookieHeader(name) && !securityOrigin()->canLoadLocalResources()) { |
1160 logConsoleError(executionContext(), "Refused to get unsafe header \"" +
name + "\""); | 1160 logConsoleError(executionContext(), "Refused to get unsafe header \"" +
name + "\""); |
1161 return nullAtom; | 1161 return nullAtom; |
1162 } | 1162 } |
1163 | 1163 |
(...skipping 22 matching lines...) Expand all Loading... |
1186 return mimeType; | 1186 return mimeType; |
1187 } | 1187 } |
1188 | 1188 |
1189 bool XMLHttpRequest::responseIsXML() const | 1189 bool XMLHttpRequest::responseIsXML() const |
1190 { | 1190 { |
1191 // FIXME: Remove the lower() call when DOMImplementation.isXMLMIMEType() is
modified | 1191 // FIXME: Remove the lower() call when DOMImplementation.isXMLMIMEType() is
modified |
1192 // to do case insensitive MIME type matching. | 1192 // to do case insensitive MIME type matching. |
1193 return DOMImplementation::isXMLMIMEType(responseMIMEType().lower()); | 1193 return DOMImplementation::isXMLMIMEType(responseMIMEType().lower()); |
1194 } | 1194 } |
1195 | 1195 |
1196 int XMLHttpRequest::status(ExceptionState& exceptionState) const | 1196 int XMLHttpRequest::status() const |
1197 { | 1197 { |
1198 if (m_state == UNSENT || m_state == OPENED || m_error) | 1198 if (m_state == UNSENT || m_state == OPENED || m_error) |
1199 return 0; | 1199 return 0; |
1200 | 1200 |
1201 if (m_response.httpStatusCode()) | 1201 if (m_response.httpStatusCode()) |
1202 return m_response.httpStatusCode(); | 1202 return m_response.httpStatusCode(); |
1203 | 1203 |
1204 return 0; | 1204 return 0; |
1205 } | 1205 } |
1206 | 1206 |
1207 String XMLHttpRequest::statusText(ExceptionState& exceptionState) const | 1207 String XMLHttpRequest::statusText() const |
1208 { | 1208 { |
1209 if (m_state == UNSENT || m_state == OPENED || m_error) | 1209 if (m_state == UNSENT || m_state == OPENED || m_error) |
1210 return String(); | 1210 return String(); |
1211 | 1211 |
1212 if (!m_response.httpStatusText().isNull()) | 1212 if (!m_response.httpStatusText().isNull()) |
1213 return m_response.httpStatusText(); | 1213 return m_response.httpStatusText(); |
1214 | 1214 |
1215 return String(); | 1215 return String(); |
1216 } | 1216 } |
1217 | 1217 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 { | 1427 { |
1428 return EventTargetNames::XMLHttpRequest; | 1428 return EventTargetNames::XMLHttpRequest; |
1429 } | 1429 } |
1430 | 1430 |
1431 ExecutionContext* XMLHttpRequest::executionContext() const | 1431 ExecutionContext* XMLHttpRequest::executionContext() const |
1432 { | 1432 { |
1433 return ActiveDOMObject::executionContext(); | 1433 return ActiveDOMObject::executionContext(); |
1434 } | 1434 } |
1435 | 1435 |
1436 } // namespace WebCore | 1436 } // namespace WebCore |
OLD | NEW |