Web Inspector: InspectorFrontendAPIDispatcher should not ignore all exceptions
https://bugs.webkit.org/show_bug.cgi?id=219378
Reviewed by Devin Rousso.
Source/WebCore:
Covered by existing Web Inspector layout tests.
* bindings/js/ScriptController.h: Make evaluateInWorld public and exported.
* inspector/InspectorFrontendAPIDispatcher.h:
* inspector/InspectorFrontendAPIDispatcher.cpp:
(WebCore::InspectorFrontendAPIDispatcher::evaluateOrQueueExpression):
(WebCore::InspectorFrontendAPIDispatcher::evaluateExpression):
Evaluate and pass along the result whether it's a value or exception.
* inspector/InspectorFrontendClientLocal.h:
* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::evaluationResultToBoolean):
(WebCore::InspectorFrontendClientLocal::isDebuggingEnabled):
(WebCore::InspectorFrontendClientLocal::isTimelineProfilingEnabled):
(WebCore::InspectorFrontendClientLocal::isProfilingJavaScript):
Refactor the common code to take an EvaluationResult and figure out if the value is true or falsy.
* platform/Logging.h: Add an Inspector logging channel, for logging errors.
Source/WebKit:
The underlying method used for frontend expression evaluations is
ScriptController::evaluateIgnoringExceptions. This method calls
evaluateInWorld and returns nullopt if an exception happens.
Switch to using evaluateInWorld directly and using the existing ValueOrException
type from in WebCore. Change our EvaluationResult type to use ValueOrException
in place of JSC::JSValue. ValueOrException is Expected<JSC::JSValue, ExceptionDetails>
so this is exposing more error information in addition to the JSC::JSValue.
* Platform/Logging.h: Add 'Inspector' log channel for WebKit.framework.
* WebProcess/Inspector/WebInspectorUIExtensionController.cpp:
(WebKit::WebInspectorUIExtensionController::WebInspectorUIExtensionController):
(WebKit::WebInspectorUIExtensionController::~WebInspectorUIExtensionController):
Remove unnecessary debugging code that was accidentally left in/commented out.
* WebProcess/Inspector/WebInspectorUIExtensionController.h:
(WebKit::WebInspectorUIExtensionController::parseInspectorExtensionErrorFromResult): Deleted.
(WebKit::WebInspectorUIExtensionController::parseInspectorExtensionErrorFromEvaluationResult): Added.
(WebKit::WebInspectorUIExtensionController::registerExtension):
(WebKit::WebInspectorUIExtensionController::unregisterExtension):
Adapt to using the new result type. Use the InspectorExtensionID type where possible.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270453
268f45cc-cd09-0410-ab3c-
d52691b4dbfc