DispatchResponse::Status DispatcherImpl::callFunctionOn()

in lib/Debugger.Protocol/Generated/protocol/Runtime.cpp [1408:1465]


DispatchResponse::Status DispatcherImpl::callFunctionOn(int callId, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
{
    // Prepare input parameters.
    protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    errors->push();
    protocol::Value* objectIdValue = object ? object->get("objectId") : nullptr;
    errors->setName("objectId");
    String in_objectId = ValueConversions<String>::fromValue(objectIdValue, errors);
    protocol::Value* functionDeclarationValue = object ? object->get("functionDeclaration") : nullptr;
    errors->setName("functionDeclaration");
    String in_functionDeclaration = ValueConversions<String>::fromValue(functionDeclarationValue, errors);
    protocol::Value* argumentsValue = object ? object->get("arguments") : nullptr;
    Maybe<protocol::Array<protocol::Runtime::CallArgument>> in_arguments;
    if (argumentsValue) {
        errors->setName("arguments");
        in_arguments = ValueConversions<protocol::Array<protocol::Runtime::CallArgument>>::fromValue(argumentsValue, errors);
    }
    protocol::Value* silentValue = object ? object->get("silent") : nullptr;
    Maybe<bool> in_silent;
    if (silentValue) {
        errors->setName("silent");
        in_silent = ValueConversions<bool>::fromValue(silentValue, errors);
    }
    protocol::Value* returnByValueValue = object ? object->get("returnByValue") : nullptr;
    Maybe<bool> in_returnByValue;
    if (returnByValueValue) {
        errors->setName("returnByValue");
        in_returnByValue = ValueConversions<bool>::fromValue(returnByValueValue, errors);
    }
    protocol::Value* generatePreviewValue = object ? object->get("generatePreview") : nullptr;
    Maybe<bool> in_generatePreview;
    if (generatePreviewValue) {
        errors->setName("generatePreview");
        in_generatePreview = ValueConversions<bool>::fromValue(generatePreviewValue, errors);
    }
    protocol::Value* userGestureValue = object ? object->get("userGesture") : nullptr;
    Maybe<bool> in_userGesture;
    if (userGestureValue) {
        errors->setName("userGesture");
        in_userGesture = ValueConversions<bool>::fromValue(userGestureValue, errors);
    }
    protocol::Value* awaitPromiseValue = object ? object->get("awaitPromise") : nullptr;
    Maybe<bool> in_awaitPromise;
    if (awaitPromiseValue) {
        errors->setName("awaitPromise");
        in_awaitPromise = ValueConversions<bool>::fromValue(awaitPromiseValue, errors);
    }
    errors->pop();
    if (errors->hasErrors()) {
        reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
        return DispatchResponse::kError;
    }

    std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    std::unique_ptr<CallFunctionOnCallbackImpl> callback(new CallFunctionOnCallbackImpl(weakPtr(), callId, nextCallbackId()));
    m_backend->callFunctionOn(in_objectId, in_functionDeclaration, std::move(in_arguments), std::move(in_silent), std::move(in_returnByValue), std::move(in_generatePreview), std::move(in_userGesture), std::move(in_awaitPromise), std::move(callback));
    return (weak->get() && weak->get()->lastCallbackFallThrough()) ? DispatchResponse::kFallThrough : DispatchResponse::kAsync;
}