本文整理汇总了C++中XMLHttpRequest::open方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLHttpRequest::open方法的具体用法?C++ XMLHttpRequest::open怎么用?C++ XMLHttpRequest::open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLHttpRequest
的用法示例。
在下文中一共展示了XMLHttpRequest::open方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exceptionState
void V8XMLHttpRequest::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
// Four cases:
// open(method, url)
// open(method, url, async)
// open(method, url, async, user)
// open(method, url, async, user, passwd)
ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "XMLHttpRequest", info.Holder(), info.GetIsolate());
if (info.Length() < 2) {
exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, info.Length()));
exceptionState.throwIfNeeded();
return;
}
XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder());
TOSTRING_VOID(V8StringResource<>, method, info[0]);
TOSTRING_VOID(V8StringResource<>, urlstring, info[1]);
ExecutionContext* context = currentExecutionContext(info.GetIsolate());
KURL url = context->completeURL(urlstring);
if (info.Length() >= 3) {
bool async = info[2]->BooleanValue();
if (info.Length() >= 4 && !info[3]->IsUndefined()) {
TOSTRING_VOID(V8StringResource<TreatNullAsNullString>, user, info[3]);
if (info.Length() >= 5 && !info[4]->IsUndefined()) {
TOSTRING_VOID(V8StringResource<TreatNullAsNullString>, password, info[4]);
xmlHttpRequest->open(method, url, async, user, password, exceptionState);
} else {
xmlHttpRequest->open(method, url, async, user, exceptionState);
}
} else {
xmlHttpRequest->open(method, url, async, exceptionState);
}
} else {
xmlHttpRequest->open(method, url, exceptionState);
}
exceptionState.throwIfNeeded();
}
开发者ID:xin3liang,项目名称:platform_external_chromium_org_third_party_WebKit,代码行数:45,代码来源:V8XMLHttpRequestCustom.cpp
示例2: throwError
v8::Handle<v8::Value> V8XMLHttpRequest::openCallback(const v8::Arguments& args)
{
INC_STATS("DOM.XMLHttpRequest.open()");
// Four cases:
// open(method, url)
// open(method, url, async)
// open(method, url, async, user)
// open(method, url, async, user, passwd)
if (args.Length() < 2)
return throwError("Not enough arguments", V8Proxy::SyntaxError);
XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder());
String method = toWebCoreString(args[0]);
String urlstring = toWebCoreString(args[1]);
ScriptExecutionContext* context = getScriptExecutionContext();
if (!context)
return v8::Undefined();
KURL url = context->completeURL(urlstring);
ExceptionCode ec = 0;
if (args.Length() >= 3) {
bool async = args[2]->BooleanValue();
if (args.Length() >= 4 && !args[3]->IsUndefined()) {
String user = toWebCoreStringWithNullCheck(args[3]);
if (args.Length() >= 5 && !args[4]->IsUndefined()) {
String passwd = toWebCoreStringWithNullCheck(args[4]);
xmlHttpRequest->open(method, url, async, user, passwd, ec);
} else
xmlHttpRequest->open(method, url, async, user, ec);
} else
xmlHttpRequest->open(method, url, async, ec);
} else
xmlHttpRequest->open(method, url, ec);
if (ec)
return throwError(ec);
return v8::Undefined();
}
示例3: throwNotEnoughArgumentsError
v8::Handle<v8::Value> V8XMLHttpRequest::openMethodCustom(const v8::Arguments& args)
{
// Four cases:
// open(method, url)
// open(method, url, async)
// open(method, url, async, user)
// open(method, url, async, user, passwd)
if (args.Length() < 2)
return throwNotEnoughArgumentsError(args.GetIsolate());
XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder());
String method = toWebCoreString(args[0]);
String urlstring = toWebCoreString(args[1]);
ScriptExecutionContext* context = getScriptExecutionContext();
KURL url = context->completeURL(urlstring);
ExceptionCode ec = 0;
if (args.Length() >= 3) {
bool async = args[2]->BooleanValue();
if (args.Length() >= 4 && !args[3]->IsUndefined()) {
String user = toWebCoreStringWithNullCheck(args[3]);
if (args.Length() >= 5 && !args[4]->IsUndefined()) {
String passwd = toWebCoreStringWithNullCheck(args[4]);
xmlHttpRequest->open(method, url, async, user, passwd, ec);
} else
xmlHttpRequest->open(method, url, async, user, ec);
} else
xmlHttpRequest->open(method, url, async, ec);
} else
xmlHttpRequest->open(method, url, ec);
if (ec)
return setDOMException(ec, args.GetIsolate());
return v8::Undefined();
}