Changeset 268074 in webkit


Ignore:
Timestamp:
Oct 6, 2020 2:21:44 PM (4 years ago)
Author:
achristensen@apple.com
Message:

Use sendWithAsyncReply to evaluate JavaScript in a WebPage
https://bugs.webkit.org/show_bug.cgi?id=217351

Reviewed by Youenn Fablet.

No change in meaningful behavior, but complexity is removed.

  • UIProcess/API/C/WKPage.cpp:

(WKPageRunJavaScriptInMainFrame):

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _evaluateJavaScript:asAsyncFunction:withSourceURL:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]):
(-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::runJavaScriptInMainFrame):
(WebKit::WebPageProxy::runJavaScriptInFrameInScriptWorld):
(WebKit::WebPageProxy::scriptValueCallback): Deleted.

  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::runJavaScript):
(WebKit::WebPage::runJavaScriptInFrameInScriptWorld):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:
Location:
trunk/Source/WebKit
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r268072 r268074  
     12020-10-06  Alex Christensen  <achristensen@webkit.org>
     2
     3        Use sendWithAsyncReply to evaluate JavaScript in a WebPage
     4        https://bugs.webkit.org/show_bug.cgi?id=217351
     5
     6        Reviewed by Youenn Fablet.
     7
     8        No change in meaningful behavior, but complexity is removed.
     9
     10        * UIProcess/API/C/WKPage.cpp:
     11        (WKPageRunJavaScriptInMainFrame):
     12        * UIProcess/API/Cocoa/WKWebView.mm:
     13        (-[WKWebView _evaluateJavaScript:asAsyncFunction:withSourceURL:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]):
     14        (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
     15        * UIProcess/WebPageProxy.cpp:
     16        (WebKit::WebPageProxy::runJavaScriptInMainFrame):
     17        (WebKit::WebPageProxy::runJavaScriptInFrameInScriptWorld):
     18        (WebKit::WebPageProxy::scriptValueCallback): Deleted.
     19        * UIProcess/WebPageProxy.h:
     20        * UIProcess/WebPageProxy.messages.in:
     21        * WebProcess/WebPage/WebPage.cpp:
     22        (WebKit::WebPage::runJavaScript):
     23        (WebKit::WebPage::runJavaScriptInFrameInScriptWorld):
     24        * WebProcess/WebPage/WebPage.h:
     25        * WebProcess/WebPage/WebPage.messages.in:
     26
    1272020-10-06  Per Arne Vollan  <pvollan@apple.com>
    228
  • trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp

    r267966 r268074  
    24902490void WKPageRunJavaScriptInMainFrame(WKPageRef pageRef, WKStringRef scriptRef, void* context, WKPageRunJavaScriptFunction callback)
    24912491{
    2492     toImpl(pageRef)->runJavaScriptInMainFrame({ toImpl(scriptRef)->string(), URL { }, false, WTF::nullopt, true }, [context, callback](API::SerializedScriptValue* returnValue, Optional<WebCore::ExceptionDetails>, CallbackBase::Error error) {
    2493         callback(toAPI(returnValue), (error != CallbackBase::Error::None) ? toAPI(API::Error::create().ptr()) : 0, context);
     2492    toImpl(pageRef)->runJavaScriptInMainFrame({ toImpl(scriptRef)->string(), URL { }, false, WTF::nullopt, true }, [context, callback] (auto&& result) {
     2493        if (result.has_value())
     2494            callback(toAPI(result.value().get()), nullptr, context);
     2495        else
     2496            callback(nullptr, nullptr, context);
    24942497    });
    24952498}
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

    r267966 r268074  
    797797}
    798798
     799#if USE(APPKIT)
    799800static WKErrorCode callbackErrorCode(WebKit::CallbackBase::Error error)
    800801{
     
    814815    }
    815816}
     817#endif
    816818
    817819- (void)evaluateJavaScript:(NSString *)javaScriptString completionHandler:(void (^)(id, NSError *))completionHandler
     
    933935    }
    934936
    935     _page->runJavaScriptInFrameInScriptWorld({ javaScriptString, sourceURL, !!asAsyncFunction, WTFMove(argumentsMap), !!forceUserGesture }, frameID, *world->_contentWorld.get(), [handler](API::SerializedScriptValue* serializedScriptValue, Optional<WebCore::ExceptionDetails> details, WebKit::ScriptValueCallback::Error errorCode) {
     937    _page->runJavaScriptInFrameInScriptWorld({ javaScriptString, sourceURL, !!asAsyncFunction, WTFMove(argumentsMap), !!forceUserGesture }, frameID, *world->_contentWorld.get(), [handler] (auto&& result) {
    936938        if (!handler)
    937939            return;
    938940
    939         if (errorCode != WebKit::ScriptValueCallback::Error::None) {
    940             auto error = createNSError(callbackErrorCode(errorCode));
    941             if (errorCode == WebKit::ScriptValueCallback::Error::OwnerWasInvalidated) {
    942                 // The OwnerWasInvalidated callback is synchronous. We don't want to call the block from within it
    943                 // because that can trigger re-entrancy bugs in WebKit.
    944                 // FIXME: It would be even better if GenericCallback did this for us.
    945                 dispatch_async(dispatch_get_main_queue(), [handler, error] {
    946                     auto rawHandler = (void (^)(id, NSError *))handler.get();
    947                     rawHandler(nil, error.get());
    948                 });
    949                 return;
    950             }
    951 
    952             auto rawHandler = (void (^)(id, NSError *))handler.get();
    953             rawHandler(nil, error.get());
     941        auto rawHandler = (void (^)(id, NSError *))handler.get();
     942        if (!result.has_value()) {
     943            rawHandler(nil, nsErrorFromExceptionDetails(result.error()).get());
    954944            return;
    955945        }
    956946
    957         auto rawHandler = (void (^)(id, NSError *))handler.get();
    958         if (details) {
    959             ASSERT(!serializedScriptValue);
    960             rawHandler(nil, nsErrorFromExceptionDetails(*details).get());
    961             return;
    962         }
    963 
    964         if (!serializedScriptValue) {
     947        if (!result.value()) {
    965948            rawHandler(nil, createNSError(WKErrorJavaScriptResultTypeIsUnsupported).get());
    966949            return;
    967950        }
    968951
    969         id body = API::SerializedScriptValue::deserialize(serializedScriptValue->internalRepresentation(), 0);
     952        id body = API::SerializedScriptValue::deserialize(result.value()->internalRepresentation(), 0);
    970953        rawHandler(body, nil);
    971954    });
     
    997980    // in snapshotConfiguration.afterScreenUpdates at that time.
    998981    _page->takeSnapshot(WebCore::enclosingIntRect(rectInViewCoordinates), bitmapSize, WebKit::SnapshotOptionsInViewCoordinates, [handler, snapshotWidth, imageHeight](const WebKit::ShareableBitmap::Handle& imageHandle, WebKit::CallbackBase::Error errorCode) {
    999         if (errorCode != WebKit::ScriptValueCallback::Error::None) {
     982        if (errorCode != WebKit::CallbackBase::Error::None) {
    1000983            auto error = createNSError(callbackErrorCode(errorCode));
    1001984            handler(nil, error.get());
  • trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp

    r267763 r268074  
    37863786    GRefPtr<GTask> task = adoptGRef(g_task_new(webView, cancellable, callback, userData));
    37873787
    3788     getPage(webView).runJavaScriptInMainFrame(WTFMove(params), [task = WTFMove(task)](API::SerializedScriptValue* serializedScriptValue, Optional<ExceptionDetails> details, WebKit::CallbackBase::Error) {
     3788    getPage(webView).runJavaScriptInMainFrame(WTFMove(params), [task = WTFMove(task)] (auto&& result) {
     3789        RefPtr<API::SerializedScriptValue> serializedScriptValue;
    37893790        ExceptionDetails exceptionDetails;
    3790         if (details)
    3791             exceptionDetails = *details;
    3792         webkitWebViewRunJavaScriptCallback(serializedScriptValue, exceptionDetails, task.get());
     3791        if (result.has_value())
     3792            serializedScriptValue = WTFMove(result.value());
     3793        else
     3794            exceptionDetails = WTFMove(result.error());
     3795        webkitWebViewRunJavaScriptCallback(serializedScriptValue.get(), exceptionDetails, task.get());
    37933796    });
    37943797}
     
    39203923    GRefPtr<GTask> task = adoptGRef(g_task_new(webView, cancellable, callback, userData));
    39213924    auto world = API::ContentWorld::sharedWorldWithName(String::fromUTF8(worldName));
    3922     getPage(webView).runJavaScriptInFrameInScriptWorld({ String::fromUTF8(script), URL { }, false, WTF::nullopt, true }, WTF::nullopt, world.get(), [task = WTFMove(task)](API::SerializedScriptValue* serializedScriptValue, Optional<ExceptionDetails> details, WebKit::CallbackBase::Error) {
     3925    getPage(webView).runJavaScriptInFrameInScriptWorld({ String::fromUTF8(script), URL { }, false, WTF::nullopt, true }, WTF::nullopt, world.get(), [task = WTFMove(task)] (auto&& result) {
     3926        RefPtr<API::SerializedScriptValue> serializedScriptValue;
    39233927        ExceptionDetails exceptionDetails;
    3924         if (details)
    3925             exceptionDetails = *details;
    3926         webkitWebViewRunJavaScriptCallback(serializedScriptValue, exceptionDetails, task.get());
     3928        if (result.has_value())
     3929            serializedScriptValue = WTFMove(result.value());
     3930        else
     3931            exceptionDetails = WTFMove(result.error());
     3932        webkitWebViewRunJavaScriptCallback(serializedScriptValue.get(), exceptionDetails, task.get());
    39273933    });
    39283934}
     
    39633969    gpointer outputStreamData = g_memory_output_stream_get_data(G_MEMORY_OUTPUT_STREAM(object));
    39643970    getPage(webView).runJavaScriptInMainFrame({ String::fromUTF8(reinterpret_cast<const gchar*>(outputStreamData)), URL { }, false, WTF::nullopt, true },
    3965         [task](API::SerializedScriptValue* serializedScriptValue, Optional<ExceptionDetails> details, WebKit::CallbackBase::Error) {
     3971        [task] (auto&& result) {
     3972            RefPtr<API::SerializedScriptValue> serializedScriptValue;
    39663973            ExceptionDetails exceptionDetails;
    3967             if (details)
    3968                 exceptionDetails = *details;
    3969             webkitWebViewRunJavaScriptCallback(serializedScriptValue, exceptionDetails, task.get());
     3974            if (result.has_value())
     3975                serializedScriptValue = WTFMove(result.value());
     3976            else
     3977                exceptionDetails = WTFMove(result.error());
     3978            webkitWebViewRunJavaScriptCallback(serializedScriptValue.get(), exceptionDetails, task.get());
    39703979        });
    39713980}
  • trunk/Source/WebKit/UIProcess/Inspector/socket/RemoteInspectorProtocolHandler.cpp

    r262302 r268074  
    122122{
    123123    m_page.runJavaScriptInMainFrame({ script, URL { }, false, WTF::nullopt, false },
    124         [](API::SerializedScriptValue*, Optional<WebCore::ExceptionDetails> exceptionDetails, CallbackBase::Error) {
    125             if (exceptionDetails)
    126                 LOG_ERROR("Exception running script \"%s\"", exceptionDetails->message.utf8().data());
     124        [] (auto&& result) {
     125        if (!result.has_value())
     126            LOG_ERROR("Exception running script \"%s\"", result.error().message.utf8().data());
    127127    });
    128128}
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r268017 r268074  
    40824082}
    40834083
    4084 void WebPageProxy::runJavaScriptInMainFrame(RunJavaScriptParameters&& parameters, WTF::Function<void (API::SerializedScriptValue*, Optional<WebCore::ExceptionDetails>, CallbackBase::Error)>&& callbackFunction)
     4084void WebPageProxy::runJavaScriptInMainFrame(RunJavaScriptParameters&& parameters, CompletionHandler<void(Expected<RefPtr<API::SerializedScriptValue>, WebCore::ExceptionDetails>&&)>&& callbackFunction)
    40854085{
    40864086    runJavaScriptInFrameInScriptWorld(WTFMove(parameters), WTF::nullopt, API::ContentWorld::pageContentWorld(), WTFMove(callbackFunction));
    40874087}
    40884088
    4089 void WebPageProxy::runJavaScriptInFrameInScriptWorld(RunJavaScriptParameters&& parameters, Optional<WebCore::FrameIdentifier> frameID, API::ContentWorld& world, WTF::Function<void(API::SerializedScriptValue*, Optional<ExceptionDetails>, CallbackBase::Error)>&& callbackFunction)
     4089void WebPageProxy::runJavaScriptInFrameInScriptWorld(RunJavaScriptParameters&& parameters, Optional<WebCore::FrameIdentifier> frameID, API::ContentWorld& world, CompletionHandler<void(Expected<RefPtr<API::SerializedScriptValue>, WebCore::ExceptionDetails>&&)>&& callbackFunction)
    40904090{
    40914091    // For backward-compatibility support running script in a WebView which has not done any loads yets.
    40924092    launchInitialProcessIfNecessary();
    40934093
    4094     if (!hasRunningProcess()) {
    4095         callbackFunction(nullptr, { }, CallbackBase::Error::Unknown);
    4096         return;
    4097     }
     4094    if (!hasRunningProcess())
     4095        return callbackFunction({ nullptr });
    40984096
    40994097    ProcessThrottler::ActivityVariant activity;
     
    41014099    if (pageClient().canTakeForegroundAssertions())
    41024100        activity = m_process->throttler().foregroundActivity("WebPageProxy::runJavaScriptInFrameInScriptWorld"_s);
    4103     else
    4104 #endif
    4105         activity = m_process->throttler().backgroundActivity("WebPageProxy::runJavaScriptInFrameInScriptWorld"_s);
    4106 
    4107     auto callbackID = m_callbacks.put(WTFMove(callbackFunction), WTFMove(activity));
    4108     send(Messages::WebPage::RunJavaScriptInFrameInScriptWorld(parameters, frameID, world.worldData(), callbackID));
     4101#endif
     4102
     4103    sendWithAsyncReply(Messages::WebPage::RunJavaScriptInFrameInScriptWorld(parameters, frameID, world.worldData()), [activity = WTFMove(activity), callbackFunction = WTFMove(callbackFunction)] (const IPC::DataReference& dataReference, Optional<ExceptionDetails>&& details) mutable {
     4104        if (details)
     4105            return callbackFunction(makeUnexpected(WTFMove(*details)));
     4106        if (dataReference.isEmpty())
     4107            return callbackFunction({ nullptr });
     4108        Vector<uint8_t> data;
     4109        data.reserveInitialCapacity(dataReference.size());
     4110        data.append(dataReference.data(), dataReference.size());
     4111        callbackFunction({ API::SerializedScriptValue::adopt(WTFMove(data)).ptr() });
     4112    });
    41094113}
    41104114
     
    71597163
    71607164    callback->invalidate();
    7161 }
    7162 
    7163 void WebPageProxy::scriptValueCallback(const IPC::DataReference& dataReference, Optional<ExceptionDetails> details, CallbackID callbackID)
    7164 {
    7165     auto callback = m_callbacks.take<ScriptValueCallback>(callbackID);
    7166     if (!callback) {
    7167         // FIXME: Log error or assert.
    7168         return;
    7169     }
    7170 
    7171     if (dataReference.isEmpty()) {
    7172         callback->performCallbackWithReturnValue(nullptr, details);
    7173         return;
    7174     }
    7175 
    7176     Vector<uint8_t> data;
    7177     data.reserveInitialCapacity(dataReference.size());
    7178     data.append(dataReference.data(), dataReference.size());
    7179 
    7180     callback->performCallbackWithReturnValue(API::SerializedScriptValue::adopt(WTFMove(data)).ptr(), details);
    71817165}
    71827166
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r267899 r268074  
    366366typedef GenericCallback<uint64_t> UnsignedCallback;
    367367typedef GenericCallback<const String&> StringCallback;
    368 typedef GenericCallback<API::SerializedScriptValue*, Optional<WebCore::ExceptionDetails>> ScriptValueCallback;
    369368typedef GenericCallback<const WebCore::FontAttributes&> FontAttributesCallback;
    370369typedef GenericCallback<const String&, const String&, const String&> SelectionContextCallback;
     
    11411140    void getSourceForFrame(WebFrameProxy*, WTF::Function<void (const String&, CallbackBase::Error)>&&);
    11421141    void getWebArchiveOfFrame(WebFrameProxy*, Function<void (API::Data*, CallbackBase::Error)>&&);
    1143     void runJavaScriptInMainFrame(WebCore::RunJavaScriptParameters&&, WTF::Function<void (API::SerializedScriptValue*, Optional<WebCore::ExceptionDetails>, CallbackBase::Error)>&& callbackFunction);
    1144     void runJavaScriptInFrameInScriptWorld(WebCore::RunJavaScriptParameters&&, Optional<WebCore::FrameIdentifier>, API::ContentWorld&, Function<void(API::SerializedScriptValue*, Optional<WebCore::ExceptionDetails>, CallbackBase::Error)>&&);
     1142    void runJavaScriptInMainFrame(WebCore::RunJavaScriptParameters&&, CompletionHandler<void(Expected<RefPtr<API::SerializedScriptValue>, WebCore::ExceptionDetails>&&)>&&);
     1143    void runJavaScriptInFrameInScriptWorld(WebCore::RunJavaScriptParameters&&, Optional<WebCore::FrameIdentifier>, API::ContentWorld&, CompletionHandler<void(Expected<RefPtr<API::SerializedScriptValue>, WebCore::ExceptionDetails>&&)>&&);
    11451144    void forceRepaint(RefPtr<VoidCallback>&&);
    11461145
     
    21312130    void stringCallback(const String&, CallbackID);
    21322131    void invalidateStringCallback(CallbackID);
    2133     void scriptValueCallback(const IPC::DataReference&, Optional<WebCore::ExceptionDetails>, CallbackID);
    21342132    void computedPagesCallback(const Vector<WebCore::IntRect>&, double totalScaleFactorForPrinting, const WebCore::FloatBoxExtent& computedPageMargin, CallbackID);
    21352133    void validateCommandCallback(const String&, bool, int, CallbackID);
  • trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in

    r267885 r268074  
    168168    BoolCallback(bool result, WebKit::CallbackID callbackID)
    169169    InvalidateStringCallback(WebKit::CallbackID callbackID)
    170     ScriptValueCallback(IPC::DataReference resultData, Optional<WebCore::ExceptionDetails> details, WebKit::CallbackID callbackID)
    171170    ComputedPagesCallback(Vector<WebCore::IntRect> pageRects, double totalScaleFactorForPrinting, WebCore::RectEdges<float> computedPageMargin, WebKit::CallbackID callbackID)
    172171    ValidateCommandCallback(String command, bool isEnabled, int32_t state, WebKit::CallbackID callbackID)
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r268014 r268074  
    34643464}
    34653465
    3466 void WebPage::runJavaScript(WebFrame* frame, RunJavaScriptParameters&& parameters, ContentWorldIdentifier worldIdentifier, CallbackID callbackID)
     3466void WebPage::runJavaScript(WebFrame* frame, RunJavaScriptParameters&& parameters, ContentWorldIdentifier worldIdentifier, CompletionHandler<void(const IPC::DataReference&, const Optional<WebCore::ExceptionDetails>&)>&& completionHandler)
    34673467{
    34683468    // NOTE: We need to be careful when running scripts that the objects we depend on don't
     
    34703470
    34713471    if (!frame || !frame->coreFrame()) {
    3472         send(Messages::WebPageProxy::ScriptValueCallback({ }, ExceptionDetails { "Unable to execute JavaScript: Target frame could not be found in the page"_s, 0, 0, ExceptionDetails::Type::InvalidTargetFrame }, callbackID));
     3472        completionHandler({ }, ExceptionDetails { "Unable to execute JavaScript: Target frame could not be found in the page"_s, 0, 0, ExceptionDetails::Type::InvalidTargetFrame });
    34733473        return;
    34743474    }
     
    34763476    auto* world = m_userContentController->worldForIdentifier(worldIdentifier);
    34773477    if (!world) {
    3478         send(Messages::WebPageProxy::ScriptValueCallback({ }, ExceptionDetails { "Unable to execute JavaScript: Cannot find specified content world"_s }, callbackID));
    3479         return;
    3480     }
    3481 
    3482     auto resolveFunction = [protectedThis = makeRef(*this), this, world = makeRef(*world), frame = makeRef(*frame), callbackID](ValueOrException result) {
     3478        completionHandler({ }, ExceptionDetails { "Unable to execute JavaScript: Cannot find specified content world"_s });
     3479        return;
     3480    }
     3481
     3482#if ENABLE(APP_BOUND_DOMAINS)
     3483    if (frame->shouldEnableInAppBrowserPrivacyProtections()) {
     3484        completionHandler({ }, ExceptionDetails { "Unable to execute JavaScript in a frame that is not in an app-bound domain"_s, 0, 0, ExceptionDetails::Type::AppBoundDomain });
     3485        if (auto* document = m_page->mainFrame().document())
     3486            document->addConsoleMessage(MessageSource::Security, MessageLevel::Warning, "Ignoring user script injection for non-app bound domain.");
     3487        RELEASE_LOG_ERROR_IF_ALLOWED(Loading, "runJavaScript: Ignoring user script injection for non app-bound domain");
     3488        return;
     3489    }
     3490#endif
     3491
     3492    auto resolveFunction = [world = makeRef(*world), frame = makeRef(*frame), completionHandler = WTFMove(completionHandler)] (ValueOrException result) mutable {
    34833493        RefPtr<SerializedScriptValue> serializedResultValue;
    34843494        if (result) {
     
    34953505            details = result.error();
    34963506
    3497         send(Messages::WebPageProxy::ScriptValueCallback(dataReference, details, callbackID));
     3507        completionHandler(dataReference, details);
    34983508    };
    3499 #if ENABLE(APP_BOUND_DOMAINS)
    3500     if (frame->shouldEnableInAppBrowserPrivacyProtections()) {
    3501         send(Messages::WebPageProxy::ScriptValueCallback({ }, ExceptionDetails { "Unable to execute JavaScript in a frame that is not in an app-bound domain"_s, 0, 0, ExceptionDetails::Type::AppBoundDomain }, callbackID));
    3502         if (auto* document = m_page->mainFrame().document())
    3503             document->addConsoleMessage(MessageSource::Security, MessageLevel::Warning, "Ignoring user script injection for non-app bound domain.");
    3504         RELEASE_LOG_ERROR_IF_ALLOWED(Loading, "runJavaScript: Ignoring user script injection for non app-bound domain");
    3505         return;
    3506     }
    3507 #endif
    35083509    JSLockHolder lock(commonVM());
    35093510    frame->coreFrame()->script().executeAsynchronousUserAgentScriptInWorld(world->coreWorld(), WTFMove(parameters), WTFMove(resolveFunction));
    35103511}
    35113512
    3512 void WebPage::runJavaScriptInFrameInScriptWorld(RunJavaScriptParameters&& parameters, Optional<WebCore::FrameIdentifier> frameID, const std::pair<ContentWorldIdentifier, String>& worldData, CallbackID callbackID)
     3513void WebPage::runJavaScriptInFrameInScriptWorld(RunJavaScriptParameters&& parameters, Optional<WebCore::FrameIdentifier> frameID, const std::pair<ContentWorldIdentifier, String>& worldData, CompletionHandler<void(const IPC::DataReference&, const Optional<WebCore::ExceptionDetails>&)>&& completionHandler)
    35133514{
    35143515    auto* webFrame = frameID ? WebProcess::singleton().webFrame(*frameID) : &mainWebFrame();
     
    35203521    }
    35213522
    3522     runJavaScript(webFrame, WTFMove(parameters), worldData.first, callbackID);
     3523    runJavaScript(webFrame, WTFMove(parameters), worldData.first, WTFMove(completionHandler));
    35233524}
    35243525
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r268017 r268074  
    15491549    void getSourceForFrame(WebCore::FrameIdentifier, CallbackID);
    15501550    void getWebArchiveOfFrame(WebCore::FrameIdentifier, CallbackID);
    1551     void runJavaScript(WebFrame*, WebCore::RunJavaScriptParameters&&, ContentWorldIdentifier, CallbackID);
    1552     void runJavaScriptInFrameInScriptWorld(WebCore::RunJavaScriptParameters&&, Optional<WebCore::FrameIdentifier>, const std::pair<ContentWorldIdentifier, String>& worldData, CallbackID);
     1551    void runJavaScript(WebFrame*, WebCore::RunJavaScriptParameters&&, ContentWorldIdentifier, CompletionHandler<void(const IPC::DataReference&, const Optional<WebCore::ExceptionDetails>&)>&&);
     1552    void runJavaScriptInFrameInScriptWorld(WebCore::RunJavaScriptParameters&&, Optional<WebCore::FrameIdentifier>, const std::pair<ContentWorldIdentifier, String>& worldData, CompletionHandler<void(const IPC::DataReference&, const Optional<WebCore::ExceptionDetails>&)>&&);
    15531553    void forceRepaint(CallbackID);
    15541554    void takeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, CallbackID);
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in

    r267885 r268074  
    221221    GetWebArchiveOfFrame(WebCore::FrameIdentifier frameID, WebKit::CallbackID callbackID)
    222222
    223     // FIXME: This should use sendWithAsyncReply instead of callbackIDs
    224     RunJavaScriptInFrameInScriptWorld(struct WebCore::RunJavaScriptParameters parameters, Optional<WebCore::FrameIdentifier> frameID, std::pair<WebKit::ContentWorldIdentifier, String> world, WebKit::CallbackID callbackID)
     223    RunJavaScriptInFrameInScriptWorld(struct WebCore::RunJavaScriptParameters parameters, Optional<WebCore::FrameIdentifier> frameID, std::pair<WebKit::ContentWorldIdentifier, String> world) -> (IPC::DataReference resultData, Optional<WebCore::ExceptionDetails> details) Async
    225224
    226225    ForceRepaint(WebKit::CallbackID callbackID)
Note: See TracChangeset for help on using the changeset viewer.