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

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: Cover both paths for InspectorInstrumentation 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
Index: Source/core/xmlhttprequest/XMLHttpRequest.cpp
diff --git a/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/Source/core/xmlhttprequest/XMLHttpRequest.cpp
index 89f15e26b28d8347651cb66ea65f47c826815e4b..156a6e21b7dd0da7bb0718ad8ea55b2e1cc42c2d 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,52 @@ bool XMLHttpRequest::initSend(ExceptionState& exceptionState)
return true;
}
+void XMLHttpRequest::send(const ArrayBufferOrArrayBufferViewOrBlobOrDocumentOrHTMLDocumentOrStringOrFormData& data, ExceptionState& exceptionState)
+{
+ InspectorInstrumentation::willSendXMLHttpRequest(executionContext(), url());
+ if (data.isNull()) {
+ send(exceptionState);
+ return;
+ }
+
+ 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() || data.isHTMLDocument()) {
+ Document* document = data.isDocument() ? data.getAsDocument().get() : data.getAsHTMLDocument().get();
+ send(document, exceptionState);
+ return;
+ }
+
+ if (data.isHTMLDocument()) {
yhirano 2015/03/23 11:50:41 This branch will never be taken.
vivekg 2015/03/23 11:57:36 Right!
+ send(data.getAsHTMLDocument().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());
yhirano 2015/03/23 11:50:41 Is this change related to the issue?
vivekg 2015/03/23 11:57:36 Yes this is being handled in https://code.google.c
yhirano 2015/03/23 12:44:33 Thanks, I see.
send(String(), exceptionState);
}

Powered by Google App Engine
This is Rietveld 408576698