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 17 matching lines...) Expand all Loading... |
28 #include "core/dom/ContextFeatures.h" | 28 #include "core/dom/ContextFeatures.h" |
29 #include "core/dom/DOMImplementation.h" | 29 #include "core/dom/DOMImplementation.h" |
30 #include "core/dom/ExceptionCode.h" | 30 #include "core/dom/ExceptionCode.h" |
31 #include "core/dom/XMLDocument.h" | 31 #include "core/dom/XMLDocument.h" |
32 #include "core/editing/markup.h" | 32 #include "core/editing/markup.h" |
33 #include "core/events/Event.h" | 33 #include "core/events/Event.h" |
34 #include "core/fetch/CrossOriginAccessControl.h" | 34 #include "core/fetch/CrossOriginAccessControl.h" |
35 #include "core/fileapi/Blob.h" | 35 #include "core/fileapi/Blob.h" |
36 #include "core/fileapi/File.h" | 36 #include "core/fileapi/File.h" |
37 #include "core/fileapi/Stream.h" | 37 #include "core/fileapi/Stream.h" |
| 38 #include "core/frame/Settings.h" |
| 39 #include "core/frame/UseCounter.h" |
38 #include "core/frame/csp/ContentSecurityPolicy.h" | 40 #include "core/frame/csp/ContentSecurityPolicy.h" |
39 #include "core/html/DOMFormData.h" | 41 #include "core/html/DOMFormData.h" |
40 #include "core/html/HTMLDocument.h" | 42 #include "core/html/HTMLDocument.h" |
41 #include "core/html/parser/TextResourceDecoder.h" | 43 #include "core/html/parser/TextResourceDecoder.h" |
42 #include "core/inspector/InspectorInstrumentation.h" | 44 #include "core/inspector/InspectorInstrumentation.h" |
43 #include "core/inspector/InspectorTraceEvents.h" | 45 #include "core/inspector/InspectorTraceEvents.h" |
44 #include "core/loader/ThreadableLoader.h" | 46 #include "core/loader/ThreadableLoader.h" |
45 #include "core/frame/Settings.h" | |
46 #include "core/xml/XMLHttpRequestProgressEvent.h" | 47 #include "core/xml/XMLHttpRequestProgressEvent.h" |
47 #include "core/xml/XMLHttpRequestUpload.h" | 48 #include "core/xml/XMLHttpRequestUpload.h" |
48 #include "platform/Logging.h" | 49 #include "platform/Logging.h" |
49 #include "platform/RuntimeEnabledFeatures.h" | 50 #include "platform/RuntimeEnabledFeatures.h" |
50 #include "platform/SharedBuffer.h" | 51 #include "platform/SharedBuffer.h" |
51 #include "platform/blob/BlobData.h" | 52 #include "platform/blob/BlobData.h" |
52 #include "platform/network/HTTPParsers.h" | 53 #include "platform/network/HTTPParsers.h" |
53 #include "platform/network/ParsedContentType.h" | 54 #include "platform/network/ParsedContentType.h" |
54 #include "platform/network/ResourceError.h" | 55 #include "platform/network/ResourceError.h" |
55 #include "platform/network/ResourceRequest.h" | 56 #include "platform/network/ResourceRequest.h" |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 return; | 566 return; |
566 } | 567 } |
567 | 568 |
568 if (!ContentSecurityPolicy::shouldBypassMainWorld(executionContext()) && !ex
ecutionContext()->contentSecurityPolicy()->allowConnectToSource(url)) { | 569 if (!ContentSecurityPolicy::shouldBypassMainWorld(executionContext()) && !ex
ecutionContext()->contentSecurityPolicy()->allowConnectToSource(url)) { |
569 // We can safely expose the URL to JavaScript, as these checks happen sy
nchronously before redirection. JavaScript receives no new information. | 570 // We can safely expose the URL to JavaScript, as these checks happen sy
nchronously before redirection. JavaScript receives no new information. |
570 exceptionState.throwSecurityError("Refused to connect to '" + url.elided
String() + "' because it violates the document's Content Security Policy."); | 571 exceptionState.throwSecurityError("Refused to connect to '" + url.elided
String() + "' because it violates the document's Content Security Policy."); |
571 return; | 572 return; |
572 } | 573 } |
573 | 574 |
574 if (!async && executionContext()->isDocument()) { | 575 if (!async && executionContext()->isDocument()) { |
| 576 // Use count for XHR synchronous requests. |
| 577 UseCounter::count(document(), UseCounter::XMLHttpRequestSynchronous); |
| 578 |
575 if (document()->settings() && !document()->settings()->syncXHRInDocument
sEnabled()) { | 579 if (document()->settings() && !document()->settings()->syncXHRInDocument
sEnabled()) { |
576 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re
quests are disabled for this page."); | 580 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re
quests are disabled for this page."); |
577 return; | 581 return; |
578 } | 582 } |
579 | 583 |
580 // Newer functionality is not available to synchronous requests in windo
w contexts, as a spec-mandated | 584 // Newer functionality is not available to synchronous requests in windo
w contexts, as a spec-mandated |
581 // attempt to discourage synchronous XHR use. responseType is one such p
iece of functionality. | 585 // attempt to discourage synchronous XHR use. responseType is one such p
iece of functionality. |
582 if (m_responseTypeCode != ResponseTypeDefault) { | 586 if (m_responseTypeCode != ResponseTypeDefault) { |
583 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re
quests from a document must not set a response type."); | 587 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re
quests from a document must not set a response type."); |
584 return; | 588 return; |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 { | 1462 { |
1459 visitor->trace(m_responseBlob); | 1463 visitor->trace(m_responseBlob); |
1460 visitor->trace(m_responseStream); | 1464 visitor->trace(m_responseStream); |
1461 visitor->trace(m_responseDocument); | 1465 visitor->trace(m_responseDocument); |
1462 visitor->trace(m_progressEventThrottle); | 1466 visitor->trace(m_progressEventThrottle); |
1463 visitor->trace(m_upload); | 1467 visitor->trace(m_upload); |
1464 XMLHttpRequestEventTarget::trace(visitor); | 1468 XMLHttpRequestEventTarget::trace(visitor); |
1465 } | 1469 } |
1466 | 1470 |
1467 } // namespace WebCore | 1471 } // namespace WebCore |
OLD | NEW |