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

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

Issue 1030613002: [bindings] Make XMLHttpRequest.send() use the generated binding code over the custom one. (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 89f15e26b28d8347651cb66ea65f47c826815e4b..f10abe0c2f6232c1fa2d7783f2980af4b9082cee 100644
--- a/Source/core/xmlhttprequest/XMLHttpRequest.cpp
+++ b/Source/core/xmlhttprequest/XMLHttpRequest.cpp
@@ -24,6 +24,7 @@
#include "core/xmlhttprequest/XMLHttpRequest.h"
#include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/UnionTypesCore.h"
#include "core/dom/ContextFeatures.h"
#include "core/dom/DOMArrayBuffer.h"
#include "core/dom/DOMArrayBufferView.h"
@@ -793,8 +794,46 @@ bool XMLHttpRequest::initSend(ExceptionState& exceptionState)
return true;
}
+void XMLHttpRequest::send(const ArrayBufferOrArrayBufferViewOrBlobOrDocumentOrStringOrFormData& data, ExceptionState& exceptionState)
+{
+ if (data.isNull()) {
+ send(exceptionState);
+ return;
+ }
+
+ InspectorInstrumentation::willSendXMLHttpRequest(executionContext(), url());
+ if (data.isArrayBuffer()) {
+ send(data.getAsArrayBuffer().get(), exceptionState);
+ return;
+ }
+
+ if (data.isArrayBufferView()) {
+ send(data.getAsArrayBufferView().get(), exceptionState);
+ return;
+ }
+
+ if (data.isBlob()) {
+ send(data.getAsBlob(), exceptionState);
+ return;
+ }
+
+ if (data.isDocument()) {
+ send(data.getAsDocument().get(), exceptionState);
+ return;
+ }
+
+ if (data.isFormData()) {
+ send(data.getAsFormData().get(), exceptionState);
+ return;
+ }
+
+ ASSERT(data.isString());
+ send(data.getAsString(), exceptionState);
+}
+
void XMLHttpRequest::send(ExceptionState& exceptionState)
{
+ InspectorInstrumentation::willSendXMLHttpRequest(executionContext(), url());
send(String(), exceptionState);
}
« 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