Title: [286747] trunk/Source/WebKit
Revision
286747
Author
bb...@apple.com
Date
2021-12-08 16:05:55 -0800 (Wed, 08 Dec 2021)

Log Message

Web Inspector: evaluateScriptForExtension() incorrectly unwraps internal errors, causing an ASSERT
https://bugs.webkit.org/show_bug.cgi?id=233961
<rdar://86123763>

Reviewed by Patrick Angle.

Standardize the unwrapping code based on the evaluateScriptInExtensionTab version, which
correctly handles the case where an internal error is returned by the evaluation.
This happens, for example, when NotImplemented is returned for unsupported evaluation
options.

This particular issue was caused by a lack of support for the 'frameURL' option.
The fix for that is tracked by https://webkit.org/b/222568/.

* WebProcess/Inspector/WebInspectorUIExtensionController.cpp:
(WebKit::WebInspectorUIExtensionController::evaluateScriptForExtension):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (286746 => 286747)


--- trunk/Source/WebKit/ChangeLog	2021-12-08 23:49:16 UTC (rev 286746)
+++ trunk/Source/WebKit/ChangeLog	2021-12-09 00:05:55 UTC (rev 286747)
@@ -1,3 +1,22 @@
+2021-12-08  BJ Burg  <bb...@apple.com>
+
+        Web Inspector: evaluateScriptForExtension() incorrectly unwraps internal errors, causing an ASSERT
+        https://bugs.webkit.org/show_bug.cgi?id=233961
+        <rdar://86123763>
+
+        Reviewed by Patrick Angle.
+
+        Standardize the unwrapping code based on the evaluateScriptInExtensionTab version, which
+        correctly handles the case where an internal error is returned by the evaluation.
+        This happens, for example, when NotImplemented is returned for unsupported evaluation
+        options.
+
+        This particular issue was caused by a lack of support for the 'frameURL' option.
+        The fix for that is tracked by https://webkit.org/b/222568/.
+
+        * WebProcess/Inspector/WebInspectorUIExtensionController.cpp:
+        (WebKit::WebInspectorUIExtensionController::evaluateScriptForExtension):
+
 2021-12-08  J Pascoe  <j_pas...@apple.com>
 
         [WebAuthn] Consider support for the displayName for FIDO authenticator

Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.cpp (286746 => 286747)


--- trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.cpp	2021-12-08 23:49:16 UTC (rev 286746)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.cpp	2021-12-09 00:05:55 UTC (rev 286747)
@@ -250,8 +250,12 @@
         JSC::JSLockHolder lock(frontendGlobalObject);
 
         if (auto parsedError = weakThis->parseExtensionErrorFromEvaluationResult(result)) {
-            auto exceptionDetails = result.value().error();
-            LOG(Inspector, "Internal error encountered while evaluating upon the frontend: at %s:%d:%d: %s", exceptionDetails.sourceURL.utf8().data(), exceptionDetails.lineNumber, exceptionDetails.columnNumber, exceptionDetails.message.utf8().data());
+            if (!result.value().has_value()) {
+                auto exceptionDetails = result.value().error();
+                LOG(Inspector, "Internal error encountered while evaluating upon the frontend at %s:%d:%d: %s", exceptionDetails.sourceURL.utf8().data(), exceptionDetails.lineNumber, exceptionDetails.columnNumber, exceptionDetails.message.utf8().data());
+            } else
+                LOG(Inspector, "Internal error encountered while evaluating upon the frontend: %s", extensionErrorToString(parsedError.value()).utf8().data());
+
             completionHandler({ }, std::nullopt, parsedError);
             return;
         }
@@ -259,7 +263,7 @@
         // Expected result is either an ErrorString or {result: <any>}.
         auto objectResult = weakThis->unwrapEvaluationResultAsObject(result);
         if (!objectResult) {
-            LOG(Inspector, "Unexpected non-object value returned from InspectorFrontendAPI.createTabForExtension().");
+            LOG(Inspector, "Unexpected non-object value returned from InspectorFrontendAPI.evaluateScriptForExtension().");
             completionHandler({ }, std::nullopt, Inspector::ExtensionError::InternalError);
             return;
         }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to