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 |
11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
12 * | 12 * |
13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 * Lesser General Public License for more details. | 16 * Lesser General Public License for more details. |
17 * | 17 * |
18 * You should have received a copy of the GNU Lesser General Public | 18 * You should have received a copy of the GNU Lesser General Public |
19 * License along with this library; if not, write to the Free Software | 19 * License along with this library; if not, write to the Free Software |
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 U
SA | 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 U
SA |
21 */ | 21 */ |
22 | 22 |
23 #include "config.h" | 23 #include "config.h" |
24 #include "core/xmlhttprequest/XMLHttpRequest.h" | 24 #include "core/xmlhttprequest/XMLHttpRequest.h" |
25 | 25 |
| 26 #include "bindings/core/v8/DOMWrapperWorld.h" |
26 #include "bindings/core/v8/ExceptionState.h" | 27 #include "bindings/core/v8/ExceptionState.h" |
| 28 #include "bindings/core/v8/ScriptState.h" |
27 #include "bindings/core/v8/UnionTypesCore.h" | 29 #include "bindings/core/v8/UnionTypesCore.h" |
28 #include "core/dom/ContextFeatures.h" | 30 #include "core/dom/ContextFeatures.h" |
29 #include "core/dom/DOMArrayBuffer.h" | 31 #include "core/dom/DOMArrayBuffer.h" |
30 #include "core/dom/DOMArrayBufferView.h" | 32 #include "core/dom/DOMArrayBufferView.h" |
31 #include "core/dom/DOMException.h" | 33 #include "core/dom/DOMException.h" |
32 #include "core/dom/DOMImplementation.h" | 34 #include "core/dom/DOMImplementation.h" |
33 #include "core/dom/DOMTypedArray.h" | 35 #include "core/dom/DOMTypedArray.h" |
34 #include "core/dom/DocumentParser.h" | 36 #include "core/dom/DocumentParser.h" |
35 #include "core/dom/ExceptionCode.h" | 37 #include "core/dom/ExceptionCode.h" |
36 #include "core/dom/XMLDocument.h" | 38 #include "core/dom/XMLDocument.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 : m_xhr(xhr) | 312 : m_xhr(xhr) |
311 , m_loader(FileReaderLoader::ReadByClient, this) | 313 , m_loader(FileReaderLoader::ReadByClient, this) |
312 { | 314 { |
313 m_loader.start(m_xhr->executionContext(), handle); | 315 m_loader.start(m_xhr->executionContext(), handle); |
314 } | 316 } |
315 | 317 |
316 RawPtrWillBeMember<XMLHttpRequest> m_xhr; | 318 RawPtrWillBeMember<XMLHttpRequest> m_xhr; |
317 FileReaderLoader m_loader; | 319 FileReaderLoader m_loader; |
318 }; | 320 }; |
319 | 321 |
320 PassRefPtrWillBeRawPtr<XMLHttpRequest> XMLHttpRequest::create(ExecutionContext*
context, PassRefPtr<SecurityOrigin> securityOrigin) | 322 PassRefPtrWillBeRawPtr<XMLHttpRequest> XMLHttpRequest::create(ScriptState* scrip
tState) |
321 { | 323 { |
| 324 RefPtr<SecurityOrigin> securityOrigin; |
| 325 ExecutionContext* context = scriptState->executionContext(); |
| 326 if (context->isDocument()) { |
| 327 DOMWrapperWorld& world = scriptState->world(); |
| 328 securityOrigin = world.isIsolatedWorld() ? world.isolatedWorldSecurityOr
igin() : nullptr; |
| 329 } |
322 RefPtrWillBeRawPtr<XMLHttpRequest> xmlHttpRequest = adoptRefWillBeNoop(new X
MLHttpRequest(context, securityOrigin)); | 330 RefPtrWillBeRawPtr<XMLHttpRequest> xmlHttpRequest = adoptRefWillBeNoop(new X
MLHttpRequest(context, securityOrigin)); |
323 xmlHttpRequest->suspendIfNeeded(); | 331 xmlHttpRequest->suspendIfNeeded(); |
324 | 332 |
325 return xmlHttpRequest.release(); | 333 return xmlHttpRequest.release(); |
326 } | 334 } |
327 | 335 |
| 336 PassRefPtrWillBeRawPtr<XMLHttpRequest> XMLHttpRequest::create(ExecutionContext*
context) |
| 337 { |
| 338 RefPtrWillBeRawPtr<XMLHttpRequest> xmlHttpRequest = adoptRefWillBeNoop(new X
MLHttpRequest(context, nullptr)); |
| 339 xmlHttpRequest->suspendIfNeeded(); |
| 340 |
| 341 return xmlHttpRequest.release(); |
| 342 } |
| 343 |
328 XMLHttpRequest::XMLHttpRequest(ExecutionContext* context, PassRefPtr<SecurityOri
gin> securityOrigin) | 344 XMLHttpRequest::XMLHttpRequest(ExecutionContext* context, PassRefPtr<SecurityOri
gin> securityOrigin) |
329 : ActiveDOMObject(context) | 345 : ActiveDOMObject(context) |
330 , m_timeoutMilliseconds(0) | 346 , m_timeoutMilliseconds(0) |
331 , m_loaderIdentifier(0) | 347 , m_loaderIdentifier(0) |
332 , m_state(UNSENT) | 348 , m_state(UNSENT) |
333 , m_lengthDownloadedToFile(0) | 349 , m_lengthDownloadedToFile(0) |
334 , m_receivedLength(0) | 350 , m_receivedLength(0) |
335 , m_exceptionCode(0) | 351 , m_exceptionCode(0) |
336 , m_progressEventThrottle(this) | 352 , m_progressEventThrottle(this) |
337 , m_responseTypeCode(ResponseTypeDefault) | 353 , m_responseTypeCode(ResponseTypeDefault) |
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 visitor->trace(m_responseDocumentParser); | 1890 visitor->trace(m_responseDocumentParser); |
1875 visitor->trace(m_progressEventThrottle); | 1891 visitor->trace(m_progressEventThrottle); |
1876 visitor->trace(m_upload); | 1892 visitor->trace(m_upload); |
1877 visitor->trace(m_blobLoader); | 1893 visitor->trace(m_blobLoader); |
1878 XMLHttpRequestEventTarget::trace(visitor); | 1894 XMLHttpRequestEventTarget::trace(visitor); |
1879 DocumentParserClient::trace(visitor); | 1895 DocumentParserClient::trace(visitor); |
1880 ActiveDOMObject::trace(visitor); | 1896 ActiveDOMObject::trace(visitor); |
1881 } | 1897 } |
1882 | 1898 |
1883 } // namespace blink | 1899 } // namespace blink |
OLD | NEW |