Title: [278123] trunk/Source/WebKit
Revision
278123
Author
cdu...@apple.com
Date
2021-05-26 13:39:11 -0700 (Wed, 26 May 2021)

Log Message

Add release logging in WebPage::runJavaScriptInFrameInScriptWorld()
https://bugs.webkit.org/show_bug.cgi?id=226286

Reviewed by Geoffrey Garen.

Add release logging in WebPage::runJavaScriptInFrameInScriptWorld(). We have logging on UIProcess side but not on
WebProcess side. It makes it hard to determine if the WebProcess processed the request to run JS or not.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::runJavaScriptInFrameInScriptWorld):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (278122 => 278123)


--- trunk/Source/WebKit/ChangeLog	2021-05-26 20:35:34 UTC (rev 278122)
+++ trunk/Source/WebKit/ChangeLog	2021-05-26 20:39:11 UTC (rev 278123)
@@ -1,3 +1,16 @@
+2021-05-26  Chris Dumez  <cdu...@apple.com>
+
+        Add release logging in WebPage::runJavaScriptInFrameInScriptWorld()
+        https://bugs.webkit.org/show_bug.cgi?id=226286
+
+        Reviewed by Geoffrey Garen.
+
+        Add release logging in WebPage::runJavaScriptInFrameInScriptWorld(). We have logging on UIProcess side but not on
+        WebProcess side. It makes it hard to determine if the WebProcess processed the request to run JS or not.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::runJavaScriptInFrameInScriptWorld):
+
 2021-05-25  Lauro Moura  <lmo...@igalia.com>
 
         Unreviewed, another GCC8 build fix after r278035

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (278122 => 278123)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-05-26 20:35:34 UTC (rev 278122)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-05-26 20:39:11 UTC (rev 278123)
@@ -3717,6 +3717,7 @@
 
 void WebPage::runJavaScriptInFrameInScriptWorld(RunJavaScriptParameters&& parameters, Optional<WebCore::FrameIdentifier> frameID, const std::pair<ContentWorldIdentifier, String>& worldData, CompletionHandler<void(const IPC::DataReference&, const Optional<WebCore::ExceptionDetails>&)>&& completionHandler)
 {
+    RELEASE_LOG_IF_ALLOWED(Process, "runJavaScriptInFrameInScriptWorld: frameID=%" PRIu64, frameID.valueOr(WebCore::FrameIdentifier { }).toUInt64());
     auto webFrame = makeRefPtr(frameID ? WebProcess::singleton().webFrame(*frameID) : &mainWebFrame());
 
     if (auto* newWorld = m_userContentController->addContentWorld(worldData)) {
@@ -3725,7 +3726,13 @@
             frame->loader().client().dispatchGlobalObjectAvailable(coreWorld);
     }
 
-    runJavaScript(webFrame.get(), WTFMove(parameters), worldData.first, WTFMove(completionHandler));
+    runJavaScript(webFrame.get(), WTFMove(parameters), worldData.first, [this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)](const IPC::DataReference& result, const Optional<WebCore::ExceptionDetails>& exception) mutable {
+        if (exception)
+            RELEASE_LOG_ERROR_IF_ALLOWED(Process, "runJavaScriptInFrameInScriptWorld: Request to run _javascript_ failed with error %{private}s", exception->message.utf8().data());
+        else
+            RELEASE_LOG_IF_ALLOWED(Process, "runJavaScriptInFrameInScriptWorld: Request to run _javascript_ succeeded");
+        completionHandler(result, exception);
+    });
 }
 
 void WebPage::getContentsAsString(ContentAsStringIncludesChildFrames includeChildFrames, CompletionHandler<void(const String&)>&& callback)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to