本文整理汇总了C++中createNotEnoughArgumentsError函数的典型用法代码示例。如果您正苦于以下问题:C++ createNotEnoughArgumentsError函数的具体用法?C++ createNotEnoughArgumentsError怎么用?C++ createNotEnoughArgumentsError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createNotEnoughArgumentsError函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: constructJSMutationObserver
EncodedJSValue JSC_HOST_CALL constructJSMutationObserver(ExecState& exec)
{
if (exec.argumentCount() < 1)
return throwVMError(&exec, createNotEnoughArgumentsError(&exec));
JSObject* object = exec.uncheckedArgument(0).getObject();
CallData callData;
if (!object || object->methodTable()->getCallData(object, callData) == CallType::None)
return throwVMTypeError(&exec, ASCIILiteral("Callback argument must be a function"));
DOMConstructorObject* jsConstructor = jsCast<DOMConstructorObject*>(exec.callee());
auto callback = JSMutationCallback::create(object, jsConstructor->globalObject());
JSObject* jsObserver = asObject(toJSNewlyCreated(&exec, jsConstructor->globalObject(), MutationObserver::create(WTFMove(callback))));
PrivateName propertyName;
jsObserver->putDirect(jsConstructor->globalObject()->vm(), propertyName, object);
return JSValue::encode(jsObserver);
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:17,代码来源:JSMutationObserverCustom.cpp
示例2: DECLARE_THROW_SCOPE
JSValue JSWebGL2RenderingContext::getIndexedParameter(ExecState& exec)
{
VM& vm = exec.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
if (exec.argumentCount() != 2)
return throwException(&exec, scope, createNotEnoughArgumentsError(&exec));
WebGL2RenderingContext& context = wrapped();
unsigned pname = exec.uncheckedArgument(0).toInt32(&exec);
if (exec.hadException())
return jsUndefined();
unsigned index = exec.uncheckedArgument(1).toInt32(&exec);
if (exec.hadException())
return jsUndefined();
WebGLGetInfo info = context.getIndexedParameter(pname, index);
return toJS(&exec, globalObject(), info);
}
开发者ID:endlessm,项目名称:WebKit,代码行数:18,代码来源:JSWebGL2RenderingContextCustom.cpp
示例3: DECLARE_THROW_SCOPE
JSValue JSWebKitSubtleCrypto::sign(ExecState& state)
{
VM& vm = state.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
if (state.argumentCount() < 3)
return throwException(&state, scope, createNotEnoughArgumentsError(&state));
auto algorithm = createAlgorithmFromJSValue(state, scope, state.uncheckedArgument(0));
RETURN_IF_EXCEPTION(scope, { });
auto parameters = JSCryptoAlgorithmDictionary::createParametersForSign(state, scope, algorithm->identifier(), state.uncheckedArgument(0));
RETURN_IF_EXCEPTION(scope, { });
RefPtr<CryptoKey> key = JSCryptoKey::toWrapped(vm, state.uncheckedArgument(1));
if (!key)
return throwTypeError(&state, scope);
if (!key->allows(CryptoKeyUsageSign)) {
wrapped().document()->addConsoleMessage(MessageSource::JS, MessageLevel::Error, ASCIILiteral("Key usages do not include 'sign'"));
throwNotSupportedError(state, scope);
return jsUndefined();
}
auto data = cryptoOperationDataFromJSValue(state, scope, state.uncheckedArgument(2));
RETURN_IF_EXCEPTION(scope, { });
RefPtr<DeferredPromise> wrapper = createDeferredPromise(state, domWindow());
auto promise = wrapper->promise();
auto successCallback = [wrapper](const Vector<uint8_t>& result) mutable {
fulfillPromiseWithArrayBuffer(wrapper.releaseNonNull(), result.data(), result.size());
};
auto failureCallback = [wrapper]() mutable {
wrapper->reject(); // FIXME: This should reject with an Exception.
};
auto result = algorithm->sign(*parameters, *key, data, WTFMove(successCallback), WTFMove(failureCallback));
if (result.hasException()) {
propagateException(state, scope, result.releaseException());
return { };
}
return promise;
}
开发者ID:caiolima,项目名称:webkit,代码行数:44,代码来源:JSWebKitSubtleCryptoCustom.cpp
示例4: jsSVGStringListPrototypeFunctionRemoveItem
EncodedJSValue JSC_HOST_CALL jsSVGStringListPrototypeFunctionRemoveItem(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSSVGStringList* castedThis = jsDynamicCast<JSSVGStringList*>(thisValue);
if (!castedThis)
return throwVMTypeError(exec);
ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGStringList::info());
SVGStaticListPropertyTearOff<SVGStringList> & impl = castedThis->impl();
if (exec->argumentCount() < 1)
return throwVMError(exec, createNotEnoughArgumentsError(exec));
ExceptionCode ec = 0;
unsigned index(toUInt32(exec, exec->argument(0), NormalConversion));
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSC::JSValue result = jsStringWithCache(exec, impl.removeItem(index, ec));
setDOMException(exec, ec);
return JSValue::encode(result);
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:19,代码来源:JSSVGStringList.cpp
示例5: jsSVGStringListPrototypeFunctionAppendItem
EncodedJSValue JSC_HOST_CALL jsSVGStringListPrototypeFunctionAppendItem(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSSVGStringList* castedThis = jsDynamicCast<JSSVGStringList*>(thisValue);
if (!castedThis)
return throwVMTypeError(exec);
ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGStringList::info());
SVGStaticListPropertyTearOff<SVGStringList> & impl = castedThis->impl();
if (exec->argumentCount() < 1)
return throwVMError(exec, createNotEnoughArgumentsError(exec));
ExceptionCode ec = 0;
const String& item(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSC::JSValue result = jsStringWithCache(exec, impl.appendItem(item, ec));
setDOMException(exec, ec);
return JSValue::encode(result);
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:19,代码来源:JSSVGStringList.cpp
示例6: jsTestEventTargetPrototypeFunctionDispatchEvent
EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionDispatchEvent(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestEventTarget::s_info))
return throwVMTypeError(exec);
JSTestEventTarget* castedThis = jsCast<JSTestEventTarget*>(asObject(thisValue));
ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestEventTarget::s_info);
TestEventTarget* impl = static_cast<TestEventTarget*>(castedThis->impl());
if (exec->argumentCount() < 1)
return throwVMError(exec, createNotEnoughArgumentsError(exec));
ExceptionCode ec = 0;
Event* evt(toEvent(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSC::JSValue result = jsBoolean(impl->dispatchEvent(evt, ec));
setDOMException(exec, ec);
return JSValue::encode(result);
}
开发者ID:dzhshf,项目名称:WebKit,代码行数:19,代码来源:JSTestEventTarget.cpp
示例7: createNotEnoughArgumentsError
JSValue JSWebGLRenderingContext::getProgramParameter(ExecState* exec)
{
if (exec->argumentCount() != 2)
return exec->vm().throwException(exec, createNotEnoughArgumentsError(exec));
ExceptionCode ec = 0;
WebGLRenderingContext& context = impl();
WebGLProgram* program = toWebGLProgram(exec->uncheckedArgument(0));
if (!program && !exec->uncheckedArgument(0).isUndefinedOrNull())
return throwTypeError(exec);
unsigned pname = exec->uncheckedArgument(1).toInt32(exec);
if (exec->hadException())
return jsUndefined();
WebGLGetInfo info = context.getProgramParameter(program, pname, ec);
if (ec) {
setDOMException(exec, ec);
return jsUndefined();
}
return toJS(exec, globalObject(), info);
}
开发者ID:boska,项目名称:webkit,代码行数:20,代码来源:JSWebGLRenderingContextCustom.cpp
示例8: throwError
JSValue JSWebGLRenderingContext::getShaderParameter(ExecState* exec)
{
if (exec->argumentCount() != 2)
return throwError(exec, createNotEnoughArgumentsError(exec));
ExceptionCode ec = 0;
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(&JSWebGLShader::s_info))
return throwTypeError(exec);
WebGLShader* shader = toWebGLShader(exec->argument(0));
unsigned pname = exec->argument(1).toInt32(exec);
if (exec->hadException())
return jsUndefined();
WebGLGetInfo info = context->getShaderParameter(shader, pname, ec);
if (ec) {
setDOMException(exec, ec);
return jsUndefined();
}
return toJS(exec, globalObject(), info);
}
开发者ID:jbat100,项目名称:webkit,代码行数:20,代码来源:JSWebGLRenderingContextCustom.cpp
示例9: createNotEnoughArgumentsError
JSValue JSWebGLRenderingContextBase::getShaderParameter(ExecState* exec)
{
if (exec->argumentCount() != 2)
return exec->vm().throwException(exec, createNotEnoughArgumentsError(exec));
ExceptionCode ec = 0;
WebGLRenderingContextBase& context = impl();
if (!exec->uncheckedArgument(0).isUndefinedOrNull() && !exec->uncheckedArgument(0).inherits(JSWebGLShader::info()))
return throwTypeError(exec);
WebGLShader* shader = JSWebGLShader::toWrapped(exec->uncheckedArgument(0));
unsigned pname = exec->uncheckedArgument(1).toInt32(exec);
if (exec->hadException())
return jsUndefined();
WebGLGetInfo info = context.getShaderParameter(shader, pname, ec);
if (ec) {
setDOMException(exec, ec);
return jsUndefined();
}
return toJS(exec, globalObject(), info);
}
开发者ID:houzhenggang,项目名称:webkit,代码行数:20,代码来源:JSWebGLRenderingContextBaseCustom.cpp
示例10: constructJSMutationObserver
EncodedJSValue JSC_HOST_CALL constructJSMutationObserver(ExecState& exec)
{
VM& vm = exec.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
if (exec.argumentCount() < 1)
return throwVMError(&exec, scope, createNotEnoughArgumentsError(&exec));
JSObject* object = exec.uncheckedArgument(0).getObject();
CallData callData;
if (!object || object->methodTable()->getCallData(object, callData) == CallType::None)
return throwArgumentTypeError(exec, scope, 0, "callback", "MutationObserver", nullptr, "MutationCallback");
DOMConstructorObject* jsConstructor = jsCast<DOMConstructorObject*>(exec.jsCallee());
auto callback = JSMutationCallback::create(object, jsConstructor->globalObject());
JSObject* jsObserver = asObject(toJSNewlyCreated(&exec, jsConstructor->globalObject(), MutationObserver::create(WTFMove(callback))));
PrivateName propertyName;
jsObserver->putDirect(vm, propertyName, object);
return JSValue::encode(jsObserver);
}
开发者ID:eocanha,项目名称:webkit,代码行数:20,代码来源:JSMutationObserverCustom.cpp
示例11: createNotEnoughArgumentsError
JSValue JSWebGLRenderingContextBase::getProgramParameter(ExecState& state)
{
if (state.argumentCount() != 2)
return state.vm().throwException(&state, createNotEnoughArgumentsError(&state));
ExceptionCode ec = 0;
WebGLRenderingContextBase& context = wrapped();
WebGLProgram* program = JSWebGLProgram::toWrapped(state.uncheckedArgument(0));
if (!program && !state.uncheckedArgument(0).isUndefinedOrNull())
return throwTypeError(&state);
unsigned pname = state.uncheckedArgument(1).toInt32(&state);
if (state.hadException())
return jsUndefined();
WebGLGetInfo info = context.getProgramParameter(program, pname, ec);
if (ec) {
setDOMException(&state, ec);
return jsUndefined();
}
return toJS(&state, globalObject(), info);
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:20,代码来源:JSWebGLRenderingContextBaseCustom.cpp
示例12: createNotEnoughArgumentsError
JSValue JSCrypto::getRandomValues(ExecState* exec)
{
if (exec->argumentCount() < 1)
return exec->vm().throwException(exec, createNotEnoughArgumentsError(exec));
JSValue buffer = exec->argument(0);
RefPtr<ArrayBufferView> arrayBufferView = toArrayBufferView(buffer);
if (!arrayBufferView)
return throwTypeError(exec);
ExceptionCode ec = 0;
impl()->getRandomValues(arrayBufferView.get(), ec);
if (ec) {
setDOMException(exec, ec);
return jsUndefined();
}
return buffer;
}
开发者ID:webOS-ports,项目名称:webkit,代码行数:20,代码来源:JSCryptoCustom.cpp
示例13: DECLARE_THROW_SCOPE
JSValue JSWebKitSubtleCrypto::digest(ExecState& state)
{
VM& vm = state.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
if (state.argumentCount() < 2)
return throwException(&state, scope, createNotEnoughArgumentsError(&state));
auto algorithm = createAlgorithmFromJSValue(state, state.uncheckedArgument(0));
ASSERT(scope.exception() || algorithm);
if (!algorithm)
return jsUndefined();
auto parameters = JSCryptoAlgorithmDictionary::createParametersForDigest(&state, algorithm->identifier(), state.uncheckedArgument(0));
ASSERT(scope.exception() || parameters);
if (!parameters)
return jsUndefined();
CryptoOperationData data;
auto success = cryptoOperationDataFromJSValue(&state, state.uncheckedArgument(1), data);
ASSERT(scope.exception() || success);
if (!success)
return jsUndefined();
RefPtr<DeferredPromise> wrapper = createDeferredPromise(state, domWindow());
auto promise = wrapper->promise();
auto successCallback = [wrapper](const Vector<uint8_t>& result) mutable {
fulfillPromiseWithArrayBuffer(wrapper.releaseNonNull(), result.data(), result.size());
};
auto failureCallback = [wrapper]() mutable {
wrapper->reject(nullptr);
};
auto result = algorithm->digest(*parameters, data, WTFMove(successCallback), WTFMove(failureCallback));
if (result.hasException()) {
propagateException(state, scope, result.releaseException());
return { };
}
return promise;
}
开发者ID:ollie314,项目名称:webkit,代码行数:41,代码来源:JSWebKitSubtleCryptoCustom.cpp
示例14: createNotEnoughArgumentsError
JSValue JSSubtleCrypto::digest(ExecState* exec)
{
if (exec->argumentCount() < 2)
return exec->vm().throwException(exec, createNotEnoughArgumentsError(exec));
auto algorithm = createAlgorithmFromJSValue(exec, exec->uncheckedArgument(0));
if (!algorithm) {
ASSERT(exec->hadException());
return jsUndefined();
}
auto parameters = JSCryptoAlgorithmDictionary::createParametersForDigest(exec, algorithm->identifier(), exec->uncheckedArgument(0));
if (!parameters) {
ASSERT(exec->hadException());
return jsUndefined();
}
CryptoOperationData data;
if (!cryptoOperationDataFromJSValue(exec, exec->uncheckedArgument(1), data)) {
ASSERT(exec->hadException());
return jsUndefined();
}
JSPromiseDeferred* promiseDeferred = JSPromiseDeferred::create(exec, globalObject());
DeferredWrapper wrapper(exec, globalObject(), promiseDeferred);
auto successCallback = [wrapper](const Vector<uint8_t>& result) mutable {
wrapper.resolve(result);
};
auto failureCallback = [wrapper]() mutable {
wrapper.reject(nullptr);
};
ExceptionCode ec = 0;
algorithm->digest(*parameters, data, WTF::move(successCallback), WTF::move(failureCallback), ec);
if (ec) {
setDOMException(exec, ec);
return jsUndefined();
}
return promiseDeferred->promise();
}
开发者ID:LianYue1,项目名称:webkit,代码行数:41,代码来源:JSSubtleCryptoCustom.cpp
示例15: createNotEnoughArgumentsError
JSValue JSHTMLCanvasElement::probablySupportsContext(ExecState& state)
{
if (UNLIKELY(state.argumentCount() < 1))
return state.vm().throwException(&state, createNotEnoughArgumentsError(&state));
HTMLCanvasElement& canvas = wrapped();
const String& contextId = state.uncheckedArgument(0).toWTFString(&state);
if (state.hadException())
return jsUndefined();
RefPtr<CanvasContextAttributes> attrs;
#if ENABLE(WEBGL)
if (HTMLCanvasElement::is3dType(contextId)) {
get3DContextAttributes(state, attrs);
if (state.hadException())
return jsUndefined();
}
#endif
return jsBoolean(canvas.probablySupportsContext(contextId, attrs.get()));
}
开发者ID:xiejinfeng850414,项目名称:webkit,代码行数:21,代码来源:JSHTMLCanvasElementCustom.cpp
示例16: jsTestEventTargetPrototypeFunctionItem
EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionItem(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestEventTarget::s_info))
return throwVMTypeError(exec);
JSTestEventTarget* castedThis = jsCast<JSTestEventTarget*>(asObject(thisValue));
ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestEventTarget::s_info);
TestEventTarget* impl = static_cast<TestEventTarget*>(castedThis->impl());
if (exec->argumentCount() < 1)
return throwVMError(exec, createNotEnoughArgumentsError(exec));
int index(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toUInt32(exec));
if (index < 0) {
setDOMException(exec, INDEX_SIZE_ERR);
return JSValue::encode(jsUndefined());
}
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->item(index)));
return JSValue::encode(result);
}
开发者ID:dzhshf,项目名称:WebKit,代码行数:21,代码来源:JSTestEventTarget.cpp
示例17: DECLARE_THROW_SCOPE
JSValue JSDOMWindow::showModalDialog(ExecState& state)
{
VM& vm = state.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
if (UNLIKELY(state.argumentCount() < 1))
return throwException(&state, scope, createNotEnoughArgumentsError(&state));
String urlString = convert<IDLNullable<IDLDOMString>>(state, state.argument(0));
RETURN_IF_EXCEPTION(scope, JSValue());
String dialogFeaturesString = convert<IDLNullable<IDLDOMString>>(state, state.argument(2));
RETURN_IF_EXCEPTION(scope, JSValue());
DialogHandler handler(state);
wrapped().showModalDialog(urlString, dialogFeaturesString, activeDOMWindow(&state), firstDOMWindow(&state), [&handler](DOMWindow& dialog) {
handler.dialogCreated(dialog);
});
return handler.returnValue();
}
开发者ID:ollie314,项目名称:webkit,代码行数:21,代码来源:JSDOMWindowCustom.cpp
示例18: constructJSWorker
EncodedJSValue JSC_HOST_CALL constructJSWorker(ExecState& state)
{
VM& vm = state.vm();
auto scope = DECLARE_THROW_SCOPE(vm);
ASSERT(jsCast<DOMConstructorObject*>(state.jsCallee()));
ASSERT(jsCast<DOMConstructorObject*>(state.jsCallee())->globalObject());
auto& globalObject = *jsCast<DOMConstructorObject*>(state.jsCallee())->globalObject();
if (!state.argumentCount())
return throwVMError(&state, scope, createNotEnoughArgumentsError(&state));
String scriptURL = state.uncheckedArgument(0).toWTFString(&state);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
// See section 4.8.2 step 14 of WebWorkers for why this is the lexicalGlobalObject.
auto& window = asJSDOMWindow(state.lexicalGlobalObject())->wrapped();
ASSERT(window.document());
return JSValue::encode(toJSNewlyCreated(state, globalObject, scope, Worker::create(*window.document(), scriptURL, globalObject.runtimeFlags())));
}
开发者ID:eocanha,项目名称:webkit,代码行数:21,代码来源:JSWorkerCustom.cpp
示例19: jsSVGTransformPrototypeFunctionSetSkewY
EncodedJSValue JSC_HOST_CALL jsSVGTransformPrototypeFunctionSetSkewY(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSSVGTransform* castedThis = jsDynamicCast<JSSVGTransform*>(thisValue);
if (!castedThis)
return throwVMTypeError(exec);
ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGTransform::info());
SVGPropertyTearOff<SVGTransform> & impl = castedThis->impl();
if (impl.isReadOnly()) {
setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);
return JSValue::encode(jsUndefined());
}
SVGTransform& podImpl = impl.propertyReference();
if (exec->argumentCount() < 1)
return throwVMError(exec, createNotEnoughArgumentsError(exec));
float angle(exec->argument(0).toFloat(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
podImpl.setSkewY(angle);
impl.commitChange();
return JSValue::encode(jsUndefined());
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:22,代码来源:JSSVGTransform.cpp
示例20: throwVMError
template<> EncodedJSValue JSC_HOST_CALL JSTestInterfaceConstructor::construct(ExecState* state)
{
auto* castedThis = jsCast<JSTestInterfaceConstructor*>(state->callee());
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
ExceptionCode ec = 0;
auto str1 = state->argument(0).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
auto str2 = state->argument(1).isUndefined() ? ASCIILiteral("defaultString") : state->uncheckedArgument(1).toWTFString(state);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
ScriptExecutionContext* context = castedThis->scriptExecutionContext();
if (UNLIKELY(!context))
return throwConstructorDocumentUnavailableError(*state, "TestInterface");
auto object = TestInterface::create(*context, str1, str2, ec);
if (UNLIKELY(ec)) {
setDOMException(state, ec);
return JSValue::encode(JSValue());
}
return JSValue::encode(asObject(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object))));
}
开发者ID:edcwconan,项目名称:webkit,代码行数:22,代码来源:JSTestInterface.cpp
注:本文中的createNotEnoughArgumentsError函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论