⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 286747 in webkit


Ignore:
Timestamp:
Dec 8, 2021, 4:05:55 PM (5 years ago)
Author:
BJ Burg
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):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r286746 r286747  
     12021-12-08  BJ Burg  <bburg@apple.com>
     2
     3        Web Inspector: evaluateScriptForExtension() incorrectly unwraps internal errors, causing an ASSERT
     4        https://bugs.webkit.org/show_bug.cgi?id=233961
     5        <rdar://86123763>
     6
     7        Reviewed by Patrick Angle.
     8
     9        Standardize the unwrapping code based on the evaluateScriptInExtensionTab version, which
     10        correctly handles the case where an internal error is returned by the evaluation.
     11        This happens, for example, when NotImplemented is returned for unsupported evaluation
     12        options.
     13
     14        This particular issue was caused by a lack of support for the 'frameURL' option.
     15        The fix for that is tracked by https://webkit.org/b/222568/.
     16
     17        * WebProcess/Inspector/WebInspectorUIExtensionController.cpp:
     18        (WebKit::WebInspectorUIExtensionController::evaluateScriptForExtension):
     19
    1202021-12-08  J Pascoe  <j_pascoe@apple.com>
    221
  • trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUIExtensionController.cpp

    r286329 r286747  
    251251
    252252        if (auto parsedError = weakThis->parseExtensionErrorFromEvaluationResult(result)) {
    253             auto exceptionDetails = result.value().error();
    254             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());
     253            if (!result.value().has_value()) {
     254                auto exceptionDetails = result.value().error();
     255                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());
     256            } else
     257                LOG(Inspector, "Internal error encountered while evaluating upon the frontend: %s", extensionErrorToString(parsedError.value()).utf8().data());
     258
    255259            completionHandler({ }, std::nullopt, parsedError);
    256260            return;
     
    260264        auto objectResult = weakThis->unwrapEvaluationResultAsObject(result);
    261265        if (!objectResult) {
    262             LOG(Inspector, "Unexpected non-object value returned from InspectorFrontendAPI.createTabForExtension().");
     266            LOG(Inspector, "Unexpected non-object value returned from InspectorFrontendAPI.evaluateScriptForExtension().");
    263267            completionHandler({ }, std::nullopt, Inspector::ExtensionError::InternalError);
    264268            return;
Note: See TracChangeset for help on using the changeset viewer.