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

Unified Diff: Source/core/xmlhttprequest/XMLHttpRequest.cpp

Issue 1040073002: [bindings] Remove XMLHttpRequest CustomConstructor (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing. Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/xmlhttprequest/XMLHttpRequest.h ('k') | Source/core/xmlhttprequest/XMLHttpRequest.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « Source/core/xmlhttprequest/XMLHttpRequest.h ('k') | Source/core/xmlhttprequest/XMLHttpRequest.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698