WebCore: [V8] Make XMLHttpRequest.send handle File object.
[WebKit-https.git] / WebCore / bindings / v8 / custom / V8XMLHttpRequestCustom.cpp
index b980680..8f2366b 100644 (file)
@@ -33,8 +33,9 @@
 
 #include "Frame.h"
 #include "V8Binding.h"
-#include "V8Document.h"
 #include "V8CustomBinding.h"
+#include "V8Document.h"
+#include "V8File.h"
 #include "V8HTMLDocument.h"
 #include "V8ObjectEventListener.h"
 #include "V8Proxy.h"
@@ -366,12 +367,16 @@ CALLBACK_FUNC_DECL(XMLHttpRequestSend)
         xmlHttpRequest->send(ec);
     else {
         v8::Handle<v8::Value> arg = args[0];
-        // FIXME: upstream handles "File" objects too.
         if (IsDocumentType(arg)) {
             v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
             Document* document = V8DOMWrapper::convertDOMWrapperToNode<Document>(object);
             ASSERT(document);
             xmlHttpRequest->send(document, ec);
+        } else if (V8File::HasInstance(arg)) {
+            v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg);
+            File* file = V8DOMWrapper::convertDOMWrapperToNative<File>(object);
+            ASSERT(file);
+            xmlHttpRequest->send(file, ec);
         } else
             xmlHttpRequest->send(toWebCoreStringWithNullCheck(arg), ec);
     }