Index: Source/core/xmlhttprequest/XMLHttpRequest.cpp |
diff --git a/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/Source/core/xmlhttprequest/XMLHttpRequest.cpp |
index 0a253c6e6f2640ada09868ceee44fe2cfc8f5a79..1bc1bc45076d74e8dc20b961905d9b0e904e9aff 100644 |
--- a/Source/core/xmlhttprequest/XMLHttpRequest.cpp |
+++ b/Source/core/xmlhttprequest/XMLHttpRequest.cpp |
@@ -23,7 +23,9 @@ |
#include "config.h" |
#include "core/xmlhttprequest/XMLHttpRequest.h" |
+#include "bindings/core/v8/DOMWrapperWorld.h" |
#include "bindings/core/v8/ExceptionState.h" |
+#include "bindings/core/v8/ScriptState.h" |
#include "bindings/core/v8/UnionTypesCore.h" |
#include "core/dom/ContextFeatures.h" |
#include "core/dom/DOMArrayBuffer.h" |
@@ -317,14 +319,28 @@ private: |
FileReaderLoader m_loader; |
}; |
-PassRefPtrWillBeRawPtr<XMLHttpRequest> XMLHttpRequest::create(ExecutionContext* context, PassRefPtr<SecurityOrigin> securityOrigin) |
+PassRefPtrWillBeRawPtr<XMLHttpRequest> XMLHttpRequest::create(ScriptState* scriptState) |
{ |
+ RefPtr<SecurityOrigin> securityOrigin; |
+ ExecutionContext* context = scriptState->executionContext(); |
+ if (context->isDocument()) { |
+ DOMWrapperWorld& world = scriptState->world(); |
+ securityOrigin = world.isIsolatedWorld() ? world.isolatedWorldSecurityOrigin() : nullptr; |
+ } |
RefPtrWillBeRawPtr<XMLHttpRequest> xmlHttpRequest = adoptRefWillBeNoop(new XMLHttpRequest(context, securityOrigin)); |
xmlHttpRequest->suspendIfNeeded(); |
return xmlHttpRequest.release(); |
} |
+PassRefPtrWillBeRawPtr<XMLHttpRequest> XMLHttpRequest::create(ExecutionContext* context) |
+{ |
+ RefPtrWillBeRawPtr<XMLHttpRequest> xmlHttpRequest = adoptRefWillBeNoop(new XMLHttpRequest(context, nullptr)); |
+ xmlHttpRequest->suspendIfNeeded(); |
+ |
+ return xmlHttpRequest.release(); |
+} |
+ |
XMLHttpRequest::XMLHttpRequest(ExecutionContext* context, PassRefPtr<SecurityOrigin> securityOrigin) |
: ActiveDOMObject(context) |
, m_timeoutMilliseconds(0) |