v8::Handle<v8::Value> V8XMLHttpRequest::sendMethodCustom(const v8::Arguments& args) { XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder()); InspectorInstrumentation::willSendXMLHttpRequest(xmlHttpRequest->scriptExecutionContext(), xmlHttpRequest->url()); ExceptionCode ec = 0; if (args.Length() < 1) xmlHttpRequest->send(ec); else { v8::Handle<v8::Value> arg = args[0]; WrapperWorldType currentWorldType = worldType(args.GetIsolate()); if (isUndefinedOrNull(arg)) xmlHttpRequest->send(ec); else if (isDocumentType(arg, args.GetIsolate(), currentWorldType)) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); Document* document = V8Document::toNative(object); ASSERT(document); xmlHttpRequest->send(document, ec); } else if (V8Blob::HasInstance(arg, args.GetIsolate(), currentWorldType)) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); Blob* blob = V8Blob::toNative(object); ASSERT(blob); xmlHttpRequest->send(blob, ec); } else if (V8DOMFormData::HasInstance(arg, args.GetIsolate(), currentWorldType)) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); DOMFormData* domFormData = V8DOMFormData::toNative(object); ASSERT(domFormData); xmlHttpRequest->send(domFormData, ec); #if ENABLE(WEBGL) || ENABLE(BLOB) } else if (V8ArrayBuffer::HasInstance(arg, args.GetIsolate(), currentWorldType)) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); ArrayBuffer* arrayBuffer = V8ArrayBuffer::toNative(object); ASSERT(arrayBuffer); xmlHttpRequest->send(arrayBuffer, ec); } else if (V8ArrayBufferView::HasInstance(arg, args.GetIsolate(), currentWorldType)) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); ArrayBufferView* arrayBufferView = V8ArrayBufferView::toNative(object); ASSERT(arrayBufferView); xmlHttpRequest->send(arrayBufferView, ec); #endif } else xmlHttpRequest->send(toWebCoreStringWithNullCheck(arg), ec); } if (ec) return setDOMException(ec, args.GetIsolate()); return v8::Undefined(); }
void V8XMLHttpRequest::sendMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) { XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder()); InspectorInstrumentation::willSendXMLHttpRequest(xmlHttpRequest->executionContext(), xmlHttpRequest->url()); ExceptionState exceptionState(ExceptionState::ExecutionContext, "send", "XMLHttpRequest", info.Holder(), info.GetIsolate()); if (info.Length() < 1) { xmlHttpRequest->send(exceptionState); } else { v8::Handle<v8::Value> arg = info[0]; if (isUndefinedOrNull(arg)) { xmlHttpRequest->send(exceptionState); } else if (isDocumentType(arg, info.GetIsolate())) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); Document* document = V8Document::toNative(object); ASSERT(document); xmlHttpRequest->send(document, exceptionState); } else if (V8Blob::hasInstance(arg, info.GetIsolate())) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); Blob* blob = V8Blob::toNative(object); ASSERT(blob); xmlHttpRequest->send(blob, exceptionState); } else if (V8FormData::hasInstance(arg, info.GetIsolate())) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); DOMFormData* domFormData = V8FormData::toNative(object); ASSERT(domFormData); xmlHttpRequest->send(domFormData, exceptionState); } else if (V8ArrayBuffer::hasInstance(arg, info.GetIsolate())) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); ArrayBuffer* arrayBuffer = V8ArrayBuffer::toNative(object); ASSERT(arrayBuffer); xmlHttpRequest->send(arrayBuffer, exceptionState); } else if (V8ArrayBufferView::hasInstance(arg, info.GetIsolate())) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); ArrayBufferView* arrayBufferView = V8ArrayBufferView::toNative(object); ASSERT(arrayBufferView); xmlHttpRequest->send(arrayBufferView, exceptionState); } else { TOSTRING_VOID(V8StringResource<TreatNullAsNullString>, argString, arg); xmlHttpRequest->send(argString, exceptionState); } } exceptionState.throwIfNeeded(); }
v8::Handle<v8::Value> V8XMLHttpRequest::sendCallback(const v8::Arguments& args) { INC_STATS("DOM.XMLHttpRequest.send()"); XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder()); InspectorInstrumentation::willSendXMLHttpRequest(xmlHttpRequest->scriptExecutionContext(), xmlHttpRequest->url()); ExceptionCode ec = 0; if (args.Length() < 1) xmlHttpRequest->send(ec); else { v8::Handle<v8::Value> arg = args[0]; if (isUndefinedOrNull(arg)) xmlHttpRequest->send(ec); else if (isDocumentType(arg)) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); Document* document = V8Document::toNative(object); ASSERT(document); xmlHttpRequest->send(document, ec); } else if (V8Blob::HasInstance(arg)) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); Blob* blob = V8Blob::toNative(object); ASSERT(blob); xmlHttpRequest->send(blob, ec); } else if (V8DOMFormData::HasInstance(arg)) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); DOMFormData* domFormData = V8DOMFormData::toNative(object); ASSERT(domFormData); xmlHttpRequest->send(domFormData, ec); #if ENABLE(WEBGL) || ENABLE(BLOB) } else if (V8ArrayBuffer::HasInstance(arg)) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); ArrayBuffer* arrayBuffer = V8ArrayBuffer::toNative(object); ASSERT(arrayBuffer); xmlHttpRequest->send(arrayBuffer, ec); #endif } else xmlHttpRequest->send(toWebCoreStringWithNullCheck(arg), ec); } if (ec) return throwError(ec); return v8::Undefined(); }
v8::Handle<v8::Value> V8XMLHttpRequest::sendCallback(const v8::Arguments& args) { INC_STATS("DOM.XMLHttpRequest.send()"); XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder()); ExceptionCode ec = 0; if (args.Length() < 1) xmlHttpRequest->send(ec); else { v8::Handle<v8::Value> arg = args[0]; if (isUndefinedOrNull(arg)) xmlHttpRequest->send(ec); else if (isDocumentType(arg)) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); Document* document = V8Document::toNative(object); ASSERT(document); xmlHttpRequest->send(document, ec); } else if (V8Blob::HasInstance(arg)) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); Blob* blob = V8Blob::toNative(object); ASSERT(blob); xmlHttpRequest->send(blob, ec); } else if (V8DOMFormData::HasInstance(arg)) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); DOMFormData* domFormData = V8DOMFormData::toNative(object); ASSERT(domFormData); xmlHttpRequest->send(domFormData, ec); } else xmlHttpRequest->send(toWebCoreStringWithNullCheck(arg), ec); } if (ec) return throwError(ec); return v8::Undefined(); }