Skip to content
Permalink
Browse files
Web Inspector: evaluateScriptForExtension() incorrectly unwraps inter…
…nal 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):



Canonical link: https://commits.webkit.org/244992@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@286747 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
burg committed Dec 9, 2021
1 parent c1cc8b0 commit 0c5b252e46be3a62d9d4bfb218f4ff5ae1f9c18e
Showing 2 changed files with 26 additions and 3 deletions.
@@ -1,3 +1,22 @@
2021-12-08 BJ Burg <bburg@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_pascoe@apple.com>

[WebAuthn] Consider support for the displayName for FIDO authenticator
@@ -250,16 +250,20 @@ void WebInspectorUIExtensionController::evaluateScriptForExtension(const Inspect
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;
}

// 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;
}

0 comments on commit 0c5b252

Please sign in to comment.