本文整理汇总了C++中V8TRYCATCH_FOR_V8STRINGRESOURCE函数的典型用法代码示例。如果您正苦于以下问题:C++ V8TRYCATCH_FOR_V8STRINGRESOURCE函数的具体用法?C++ V8TRYCATCH_FOR_V8STRINGRESOURCE怎么用?C++ V8TRYCATCH_FOR_V8STRINGRESOURCE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了V8TRYCATCH_FOR_V8STRINGRESOURCE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: changeVersionCallback
static v8::Handle<v8::Value> changeVersionCallback(const v8::Arguments& args)
{
if (args.Length() < 2)
return throwNotEnoughArgumentsError(args.GetIsolate());
Database* imp = V8Database::toNative(args.Holder());
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, oldVersion, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, newVersion, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
RefPtr<SQLTransactionCallback> callback;
if (args.Length() > 2 && !args[2]->IsNull() && !args[2]->IsUndefined()) {
if (!args[2]->IsFunction())
return throwTypeError(0, args.GetIsolate());
callback = V8SQLTransactionCallback::create(args[2], getScriptExecutionContext());
}
RefPtr<SQLTransactionErrorCallback> errorCallback;
if (args.Length() > 3 && !args[3]->IsNull() && !args[3]->IsUndefined()) {
if (!args[3]->IsFunction())
return throwTypeError(0, args.GetIsolate());
errorCallback = V8SQLTransactionErrorCallback::create(args[3], getScriptExecutionContext());
}
RefPtr<VoidCallback> successCallback;
if (args.Length() > 4 && !args[4]->IsNull() && !args[4]->IsUndefined()) {
if (!args[4]->IsFunction())
return throwTypeError(0, args.GetIsolate());
successCallback = V8VoidCallback::create(args[4], getScriptExecutionContext());
}
imp->changeVersion(oldVersion, newVersion, callback, errorCallback, successCallback);
return v8Undefined();
}
示例2: V8TestNamedConstructorConstructorCallback
static v8::Handle<v8::Value> V8TestNamedConstructorConstructorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.TestNamedConstructor.Constructor");
if (!args.IsConstructCall())
return throwTypeError("DOM object constructor cannot be called as a function.");
if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
return args.Holder();
Document* document = currentDocument(BindingState::instance());
// Make sure the document is added to the DOM Node map. Otherwise, the TestNamedConstructor instance
// may end up being the only node in the map and get garbage-collected prematurely.
toV8(document, args.Holder(), args.GetIsolate());
if (args.Length() < 1)
return throwNotEnoughArgumentsError(args.GetIsolate());
ExceptionCode ec = 0;
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, str1, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, str2, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, str3, MAYBE_MISSING_PARAMETER(args, 2, DefaultIsNullString));
RefPtr<TestNamedConstructor> impl = TestNamedConstructor::createForJSConstructor(document, str1, str2, str3, ec);
v8::Handle<v8::Object> wrapper = args.Holder();
if (ec)
goto fail;
V8DOMWrapper::createDOMWrapper(impl.release(), &V8TestNamedConstructorConstructor::info, wrapper, args.GetIsolate());
return wrapper;
fail:
return setDOMException(ec, args.GetIsolate());
}
示例3: setDataCallback
static v8::Handle<v8::Value> setDataCallback(const v8::Arguments& args)
{
if (args.Length() < 2)
return throwNotEnoughArgumentsError(args.GetIsolate());
Clipboard* imp = V8Clipboard::toNative(args.Holder());
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, type, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, data, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
return v8Boolean(imp->setData(type, data), args.GetIsolate());
}
示例4: webkitGetEntriesByNameCallback
static v8::Handle<v8::Value> webkitGetEntriesByNameCallback(const v8::Arguments& args)
{
if (args.Length() < 1)
return throwNotEnoughArgumentsError(args.GetIsolate());
Performance* imp = V8Performance::toNative(args.Holder());
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, name, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, entryType, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsNullString));
return toV8(imp->webkitGetEntriesByName(name, entryType), args.Holder(), args.GetIsolate());
}
示例5: appendCallback
static v8::Handle<v8::Value> appendCallback(const v8::Arguments& args)
{
if (args.Length() < 2)
return throwNotEnoughArgumentsError(args.GetIsolate());
InspectorFrontendHost* imp = V8InspectorFrontendHost::toNative(args.Holder());
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, url, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, content, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
imp->append(url, content);
return v8Undefined();
}
示例6: initMutationEventCallback
static v8::Handle<v8::Value> initMutationEventCallback(const v8::Arguments& args)
{
MutationEvent* imp = V8MutationEvent::toNative(args.Holder());
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, type, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
V8TRYCATCH(bool, canBubble, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)->BooleanValue());
V8TRYCATCH(bool, cancelable, MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)->BooleanValue());
V8TRYCATCH(Node*, relatedNode, V8Node::HasInstance(MAYBE_MISSING_PARAMETER(args, 3, DefaultIsUndefined)) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 3, DefaultIsUndefined))) : 0);
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, prevValue, MAYBE_MISSING_PARAMETER(args, 4, DefaultIsUndefined));
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, newValue, MAYBE_MISSING_PARAMETER(args, 5, DefaultIsUndefined));
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, attrName, MAYBE_MISSING_PARAMETER(args, 6, DefaultIsUndefined));
V8TRYCATCH(int, attrChange, toUInt32(MAYBE_MISSING_PARAMETER(args, 7, DefaultIsUndefined)));
imp->initMutationEvent(type, canBubble, cancelable, relatedNode, prevValue, newValue, attrName, attrChange);
return v8Undefined();
}
示例7: V8TRYCATCH_FOR_V8STRINGRESOURCE
v8::Handle<v8::Value> V8History::replaceStateMethodCustom(const v8::Arguments& args)
{
bool didThrow = false;
RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(args[0], 0, 0, didThrow, args.GetIsolate());
if (didThrow)
return v8::Undefined();
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<WithUndefinedOrNullCheck>, title, args[1]);
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<WithUndefinedOrNullCheck>, url, argumentOrNull(args, 2));
ExceptionCode ec = 0;
History* history = V8History::toNative(args.Holder());
history->stateObjectAdded(historyState.release(), title, url, History::StateObjectReplace, ec);
args.Holder()->DeleteHiddenValue(V8HiddenPropertyName::state());
return setDOMException(ec, args.GetIsolate());
}
示例8: webkitClearMeasuresCallback
static v8::Handle<v8::Value> webkitClearMeasuresCallback(const v8::Arguments& args)
{
Performance* imp = V8Performance::toNative(args.Holder());
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, measureName, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsNullString));
imp->webkitClearMeasures(measureName);
return v8Undefined();
}
示例9: readAsTextCallback
static v8::Handle<v8::Value> readAsTextCallback(const v8::Arguments& args)
{
if (args.Length() < 1)
return throwNotEnoughArgumentsError(args.GetIsolate());
FileReaderSync* imp = V8FileReaderSync::toNative(args.Holder());
ExceptionCode ec = 0;
{
V8TRYCATCH(Blob*, blob, V8Blob::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8Blob::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
if (args.Length() <= 1) {
ScriptExecutionContext* scriptContext = getScriptExecutionContext();
String result = imp->readAsText(scriptContext, blob, ec);
if (UNLIKELY(ec))
goto fail;
return v8String(result, args.GetIsolate());
}
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, encoding, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
ScriptExecutionContext* scriptContext = getScriptExecutionContext();
String result = imp->readAsText(scriptContext, blob, encoding, ec);
if (UNLIKELY(ec))
goto fail;
return v8String(result, args.GetIsolate());
}
fail:
return setDOMException(ec, args.GetIsolate());
}
示例10: setRGBColorICCColorCallback
static v8::Handle<v8::Value> setRGBColorICCColorCallback(const v8::Arguments& args)
{
if (args.Length() < 2)
return throwNotEnoughArgumentsError(args.GetIsolate());
SVGColor* imp = V8SVGColor::toNative(args.Holder());
ExceptionCode ec = 0;
{
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, rgbColor, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, iccColor, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
imp->setRGBColorICCColor(rgbColor, iccColor, ec);
if (UNLIKELY(ec))
goto fail;
return v8Undefined();
}
fail:
return setDOMException(ec, args.GetIsolate());
}
示例11: namedItemCallback
static v8::Handle<v8::Value> namedItemCallback(const v8::Arguments& args)
{
if (args.Length() < 1)
return throwNotEnoughArgumentsError(args.GetIsolate());
DOMNamedFlowCollection* imp = V8DOMNamedFlowCollection::toNative(args.Holder());
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, name, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
return toV8(imp->namedItem(name), args.Holder(), args.GetIsolate());
}
示例12: unregisterProtocolHandlerCallback
static v8::Handle<v8::Value> unregisterProtocolHandlerCallback(const v8::Arguments& args)
{
if (args.Length() < 2)
return throwNotEnoughArgumentsError(args.GetIsolate());
Navigator* imp = V8Navigator::toNative(args.Holder());
ExceptionCode ec = 0;
{
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, scheme, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, url, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));
NavigatorContentUtils::unregisterProtocolHandler(imp, scheme, url, ec);
if (UNLIKELY(ec))
goto fail;
return v8Undefined();
}
fail:
return setDOMException(ec, args.GetIsolate());
}
示例13: localizeNumberStringCallback
static v8::Handle<v8::Value> localizeNumberStringCallback(const v8::Arguments& args)
{
if (args.Length() < 1)
return throwNotEnoughArgumentsError(args.GetIsolate());
PagePopupController* imp = V8PagePopupController::toNative(args.Holder());
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, numberString, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
return v8String(imp->localizeNumberString(numberString), args.GetIsolate());
}
示例14: webkitMeasureCallback
static v8::Handle<v8::Value> webkitMeasureCallback(const v8::Arguments& args)
{
if (args.Length() < 1)
return throwNotEnoughArgumentsError(args.GetIsolate());
Performance* imp = V8Performance::toNative(args.Holder());
ExceptionCode ec = 0;
{
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, measureName, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, startMark, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsNullString));
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, endMark, MAYBE_MISSING_PARAMETER(args, 2, DefaultIsNullString));
imp->webkitMeasure(measureName, startMark, endMark, ec);
if (UNLIKELY(ec))
goto fail;
return v8Undefined();
}
fail:
return setDOMException(ec, args.GetIsolate());
}
示例15: setCustomValidityCallback
static v8::Handle<v8::Value> setCustomValidityCallback(const v8::Arguments& args)
{
if (args.Length() < 1)
return throwNotEnoughArgumentsError(args.GetIsolate());
HTMLButtonElement* imp = V8HTMLButtonElement::toNative(args.Holder());
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<WithUndefinedOrNullCheck>, error, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
imp->setCustomValidity(error);
return v8Undefined();
}