Changeset 266885 in webkit for trunk/Source/JavaScriptCore/bindings
- Timestamp:
- Sep 10, 2020, 12:23:17 PM (5 years ago)
- Author:
- Devin Rousso
- Message:
-
Web Inspector: modernize generated backend protocol code
https://bugs.webkit.org/show_bug.cgi?id=216302
<rdar://problem/68547649>
Reviewed by Brian Burg.
Source/JavaScriptCore:
Previously, the inspector protocol was expressed in code in a somewhat confusing way:
- the error string was the first argument
- required parameters were
T
orconst T&
- optional parameters were
const T*
- enum parameters were the underlying type requiring the backend dispatcher handler to process it instead of it being preprocessed
- required returns were
T&
- optional returns were
T*
This doesn't really make for easy/obvious reading of code since the order of arguments is
not weird (e.g. error string first), and that there are references/pointers to primitive
types.
This patch cleans up the generated inspector protocol code to be:
- required parameters are
T
orRef<T>&&
- optional parameters are
Optional<T>&&
orRefPtr<T>&&
- enum parameters are preprocessed and passed to the backend dispatcher handler if valid
- synchronous commands return
Expected<X, ErrorString>
using the same types/rules above whereX
is either a single return or astd::tuple
of multiple returns
The one exception to the above is
String
, which is already a tri-state ofnullString()
,
emptyString()
, and something set, so there's no need to useOptional<String>
.
Also use
Protocol
objects/typedefs
wherever possible to further relate the protocol
JSON and the actual backend dispatcher handler implementation.
- inspector/scripts/codegen/generator.py:
(Generator.generate_includes_from_entries):
- inspector/scripts/codegen/cpp_generator_templates.py:
- inspector/scripts/codegen/cpp_generator.py:
(CppGenerator.helpers_namespace):
(CppGenerator.cpp_getter_method_for_type):
(CppGenerator.cpp_setter_method_for_type):
(CppGenerator.cpp_protocol_type_for_type):
(CppGenerator.cpp_type_for_type_member_argument): Added.
(CppGenerator.cpp_type_for_command_parameter): Added.
(CppGenerator.cpp_type_for_command_return_declaration): Added.
(CppGenerator.cpp_type_for_command_return_argument): Added.
(CppGenerator.cpp_type_for_event_parameter): Added.
(CppGenerator.cpp_type_for_enum): Added.
(CppGenerator.should_move_argument): Added.
(CppGenerator.should_release_argument): Added.
(CppGenerator.should_dereference_argument): Added.
(CppGenerator.cpp_protocol_type_for_type_member): Deleted.
(CppGenerator.cpp_type_for_unchecked_formal_in_parameter): Deleted.
(CppGenerator.cpp_type_for_checked_formal_event_parameter): Deleted.
(CppGenerator.cpp_type_for_type_member): Deleted.
(CppGenerator.cpp_type_for_type_with_name): Deleted.
(CppGenerator.cpp_type_for_formal_out_parameter): Deleted.
(CppGenerator.cpp_type_for_formal_async_parameter): Deleted.
(CppGenerator.cpp_type_for_stack_in_parameter): Deleted.
(CppGenerator.cpp_type_for_stack_out_parameter): Deleted.
(CppGenerator.cpp_assertion_method_for_type_member): Deleted.
(CppGenerator.cpp_assertion_method_for_type_member.assertion_method_for_type): Deleted.
(CppGenerator.should_use_wrapper_for_return_type): Deleted.
(CppGenerator.should_use_references_for_type): Deleted.
(CppGenerator.should_pass_by_copy_for_return_type): Deleted.
- inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py:
(CppAlternateBackendDispatcherHeaderGenerator._generate_secondary_header_includes):
(CppAlternateBackendDispatcherHeaderGenerator._generate_handler_declaration_for_command):
- inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py:
(CppBackendDispatcherHeaderGenerator.generate_output):
(CppBackendDispatcherHeaderGenerator._generate_secondary_header_includes):
(CppBackendDispatcherHeaderGenerator._generate_handler_declarations_for_domain):
(CppBackendDispatcherHeaderGenerator._generate_handler_declaration_for_command):
(CppBackendDispatcherHeaderGenerator._generate_async_handler_declaration_for_command):
(CppBackendDispatcherHeaderGenerator._generate_dispatcher_declaration_for_command):
(CppBackendDispatcherHeaderGenerator._generate_anonymous_enum_for_parameter): Deleted.
- inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py:
(CppBackendDispatcherImplementationGenerator._generate_secondary_header_includes):
(CppBackendDispatcherImplementationGenerator._generate_small_dispatcher_switch_implementation_for_domain):
(CppBackendDispatcherImplementationGenerator._generate_async_dispatcher_class_for_domain):
(CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command):
- inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py:
(CppFrontendDispatcherHeaderGenerator._generate_secondary_header_includes):
(CppFrontendDispatcherHeaderGenerator._generate_dispatcher_declaration_for_event):
- inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py:
(CppFrontendDispatcherImplementationGenerator._generate_secondary_header_includes):
(CppFrontendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_event):
- inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
(CppProtocolTypesHeaderGenerator._generate_secondary_header_includes):
- inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py:
(CppProtocolTypesImplementationGenerator._generate_secondary_header_includes):
(CppProtocolTypesImplementationGenerator._generate_enum_conversion_methods_for_domain):
(CppProtocolTypesImplementationGenerator._generate_open_field_names):
(CppProtocolTypesImplementationGenerator._generate_assertion_for_enum):
- inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py:
(ObjCBackendDispatcherHeaderGenerator._generate_objc_handler_declaration_for_command):
- inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py:
(ObjCBackendDispatcherImplementationGenerator._generate_handler_implementation_for_command):
(ObjCBackendDispatcherImplementationGenerator._generate_success_block_for_command):
(ObjCBackendDispatcherImplementationGenerator._generate_success_block_for_command.and):
(ObjCBackendDispatcherImplementationGenerator._generate_conversions_for_command.in_param_expression):
(ObjCBackendDispatcherImplementationGenerator._generate_conversions_for_command):
(ObjCBackendDispatcherImplementationGenerator._generate_invocation_for_command):
- inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py:
(ObjCFrontendDispatcherImplementationGenerator._generate_event):
(ObjCFrontendDispatcherImplementationGenerator._generate_event_out_parameters):
- inspector/scripts/codegen/objc_generator_templates.py:
- inspector/scripts/codegen/objc_generator.py:
(ObjCGenerator.protocol_type_for_type):
(ObjCGenerator.objc_type_for_param_internal):
(ObjCGenerator.objc_protocol_import_expression_for_parameter):
- inspector/protocol/Page.json:
Now that enums are processed before being passed to backend dispacher handlers, the
appearance
parameter ofPage.setForcedAppearance
must be markedoptional
as
there's no way for it to accept an empty string, as that's not possible for an enum.
- inspector/agents/InspectorAgent.h:
- inspector/agents/InspectorAgent.cpp:
- inspector/agents/InspectorAuditAgent.h:
- inspector/agents/InspectorAuditAgent.cpp:
- inspector/agents/InspectorConsoleAgent.h:
- inspector/agents/InspectorConsoleAgent.cpp:
- inspector/agents/InspectorDebuggerAgent.h:
- inspector/agents/InspectorDebuggerAgent.cpp:
- inspector/agents/InspectorHeapAgent.h:
- inspector/agents/InspectorHeapAgent.cpp:
- inspector/agents/InspectorRuntimeAgent.h:
- inspector/agents/InspectorRuntimeAgent.cpp:
- inspector/agents/InspectorScriptProfilerAgent.h:
- inspector/agents/InspectorScriptProfilerAgent.cpp:
- inspector/agents/InspectorTargetAgent.h:
- inspector/agents/InspectorTargetAgent.cpp:
- inspector/agents/JSGlobalObjectAuditAgent.h:
- inspector/agents/JSGlobalObjectAuditAgent.cpp:
- inspector/agents/JSGlobalObjectDebuggerAgent.h:
- inspector/agents/JSGlobalObjectDebuggerAgent.cpp:
- inspector/agents/JSGlobalObjectRuntimeAgent.h:
- inspector/agents/JSGlobalObjectRuntimeAgent.cpp:
- inspector/JSGlobalObjectConsoleClient.cpp:
- inspector/JSGlobalObjectInspectorController.cpp:
Elided backend dispatcher handler changes describe above.
- bindings/ScriptValue.cpp:
(Inspector::jsToInspectorValue):
- inspector/AsyncStackTrace.h:
- inspector/AsyncStackTrace.cpp:
(Inspector::AsyncStackTrace::buildInspectorObject const):
- inspector/ConsoleMessage.cpp:
(Inspector::ConsoleMessage::addToFrontend):
- inspector/InjectedScriptBase.h:
- inspector/InjectedScriptBase.cpp:
(Inspector::InjectedScriptBase::makeEvalCall):
(Inspector::InjectedScriptBase::checkCallResult):
(Inspector::InjectedScriptBase::checkAsyncCallResult):
- inspector/InjectedScript.h:
- inspector/InjectedScript.cpp:
(Inspector::InjectedScript::execute):
(Inspector::InjectedScript::evaluate):
(Inspector::InjectedScript::callFunctionOn):
(Inspector::InjectedScript::evaluateOnCallFrame):
(Inspector::InjectedScript::getFunctionDetails):
(Inspector::InjectedScript::functionDetails):
(Inspector::InjectedScript::getPreview):
(Inspector::InjectedScript::getProperties):
(Inspector::InjectedScript::getDisplayableProperties):
(Inspector::InjectedScript::getInternalProperties):
(Inspector::InjectedScript::getCollectionEntries):
(Inspector::InjectedScript::saveResult):
(Inspector::InjectedScript::wrapCallFrames const):
(Inspector::InjectedScript::wrapObject const):
(Inspector::InjectedScript::wrapJSONString const):
(Inspector::InjectedScript::wrapTable const):
(Inspector::InjectedScript::previewValue const):
- inspector/InjectedScriptManager.cpp:
(Inspector::InjectedScriptManager::injectedScriptForObjectId):
- inspector/InspectorBackendDispatcher.h:
- inspector/InspectorBackendDispatcher.cpp:
(Inspector::BackendDispatcher::CallbackBase::sendSuccess):
(Inspector::BackendDispatcher::dispatch):
(Inspector::BackendDispatcher::sendResponse):
(Inspector::BackendDispatcher::getPropertyValue):
(Inspector::BackendDispatcher::getBoolean):
(Inspector::BackendDispatcher::getInteger):
(Inspector::BackendDispatcher::getDouble):
(Inspector::BackendDispatcher::getString):
(Inspector::BackendDispatcher::getValue):
(Inspector::BackendDispatcher::getObject):
(Inspector::BackendDispatcher::getArray):
(Inspector::castToInteger): Deleted.
(Inspector::castToNumber): Deleted.
- inspector/InspectorProtocolTypes.h:
(Inspector::Protocol::BindingTraits<JSON::ArrayOf<T>>::runtimeCast):
(Inspector::Protocol::BindingTraits<JSON::ArrayOf<T>>::assertValueHasExpectedType):
- inspector/remote/socket/RemoteInspectorConnectionClient.cpp:
(Inspector::RemoteInspectorConnectionClient::extractEvent):
- inspector/remote/socket/RemoteInspectorSocket.cpp:
(Inspector::RemoteInspector::pushListingsNow):
- runtime/TypeSet.cpp:
(JSC::StructureShape::inspectorRepresentation):
JSON
classes now useRef&&
wherever possible andOptional
instead of an out parameter
forget*
/as*
so that values can be more easily manipulated and can be confidently known
to exist.
- inspector/scripts/tests/enum-values.json:
- inspector/scripts/tests/expected/command-targetType-matching-domain-debuggableType.json-result:
- inspector/scripts/tests/expected/commands-with-async-attribute.json-result:
- inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result:
- inspector/scripts/tests/expected/definitions-with-mac-platform.json-result:
- inspector/scripts/tests/expected/domain-debuggableTypes.json-result:
- inspector/scripts/tests/expected/domain-targetType-matching-domain-debuggableType.json-result:
- inspector/scripts/tests/expected/domain-targetTypes.json-result:
- inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result:
- inspector/scripts/tests/expected/enum-values.json-result:
- inspector/scripts/tests/expected/event-targetType-matching-domain-debuggableType.json-result:
- inspector/scripts/tests/expected/events-with-optional-parameters.json-result:
- inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result:
- inspector/scripts/tests/expected/same-type-id-different-domain.json-result:
- inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result:
- inspector/scripts/tests/expected/should-strip-comments.json-result:
- inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result:
- inspector/scripts/tests/expected/type-declaration-array-type.json-result:
- inspector/scripts/tests/expected/type-declaration-enum-type.json-result:
- inspector/scripts/tests/expected/type-declaration-object-type.json-result:
- inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result:
- inspector/scripts/tests/expected/type-with-open-parameters.json-result:
- inspector/scripts/tests/expected/version.json-result:
Source/WebCore:
Previously, the inspector protocol was expressed in code in a somewhat confusing way:
- the error string was the first argument
- required parameters were
T
orconst T&
- optional parameters were
const T*
- enum parameters were the underlying type requiring the backend dispatcher handler to process it instead of it being preprocessed
- required returns were
T&
- optional returns were
T*
This doesn't really make for easy/obvious reading of code since the order of arguments is
not weird (e.g. error string first), and that there are references/pointers to primitive
types.
This patch cleans up the generated inspector protocol code to be:
- required parameters are
T
orRef<T>&&
- optional parameters are
Optional<T>&&
orRefPtr<T>&&
- enum parameters are preprocessed and passed to the backend dispatcher handler if valid
- synchronous commands return
Expected<X, ErrorString>
using the same types/rules above whereX
is either a single return or astd::tuple
of multiple returns
The one exception to the above is
String
, which is already a tri-state ofnullString()
,
emptyString()
, and something set, so there's no need to useOptional<String>
.
Also use
Protocol
objects/typedefs
wherever possible to further relate the protocol
JSON and the actual backend dispatcher handler implementation.
- inspector/InspectorAuditResourcesObject.cpp:
- inspector/InspectorCanvas.h:
- inspector/InspectorCanvas.cpp:
- inspector/InspectorController.cpp:
- inspector/InspectorStyleSheet.h:
- inspector/InspectorStyleSheet.cpp:
- inspector/agents/InspectorAnimationAgent.h:
- inspector/agents/InspectorAnimationAgent.cpp:
- inspector/agents/InspectorApplicationCacheAgent.h:
- inspector/agents/InspectorApplicationCacheAgent.cpp:
- inspector/agents/InspectorCPUProfilerAgent.h:
- inspector/agents/InspectorCPUProfilerAgent.cpp:
- inspector/agents/InspectorCSSAgent.h:
- inspector/agents/InspectorCSSAgent.cpp:
- inspector/agents/InspectorCanvasAgent.h:
- inspector/agents/InspectorCanvasAgent.cpp:
- inspector/agents/InspectorDOMAgent.h:
- inspector/agents/InspectorDOMAgent.cpp:
- inspector/agents/InspectorDOMDebuggerAgent.h:
- inspector/agents/InspectorDOMDebuggerAgent.cpp:
- inspector/agents/InspectorDOMStorageAgent.h:
- inspector/agents/InspectorDOMStorageAgent.cpp:
- inspector/agents/InspectorDatabaseAgent.h:
- inspector/agents/InspectorDatabaseAgent.cpp:
- inspector/agents/InspectorIndexedDBAgent.h:
- inspector/agents/InspectorIndexedDBAgent.cpp:
- inspector/agents/InspectorLayerTreeAgent.h:
- inspector/agents/InspectorLayerTreeAgent.cpp:
- inspector/agents/InspectorMemoryAgent.h:
- inspector/agents/InspectorMemoryAgent.cpp:
- inspector/agents/InspectorNetworkAgent.h:
- inspector/agents/InspectorNetworkAgent.cpp:
- inspector/agents/InspectorPageAgent.h:
- inspector/agents/InspectorPageAgent.cpp:
- inspector/agents/InspectorTimelineAgent.h:
- inspector/agents/InspectorTimelineAgent.cpp:
- inspector/agents/InspectorWorkerAgent.h:
- inspector/agents/InspectorWorkerAgent.cpp:
- inspector/agents/WebConsoleAgent.h:
- inspector/agents/WebDebuggerAgent.h:
- inspector/agents/WebDebuggerAgent.cpp:
- inspector/agents/WebHeapAgent.h:
- inspector/agents/WebHeapAgent.cpp:
- inspector/agents/page/PageAuditAgent.h:
- inspector/agents/page/PageAuditAgent.cpp:
- inspector/agents/page/PageConsoleAgent.h:
- inspector/agents/page/PageConsoleAgent.cpp:
- inspector/agents/page/PageDOMDebuggerAgent.h:
- inspector/agents/page/PageDOMDebuggerAgent.cpp:
- inspector/agents/page/PageDebuggerAgent.h:
- inspector/agents/page/PageDebuggerAgent.cpp:
- inspector/agents/page/PageHeapAgent.h:
- inspector/agents/page/PageHeapAgent.cpp:
- inspector/agents/page/PageNetworkAgent.h:
- inspector/agents/page/PageNetworkAgent.cpp:
- inspector/agents/page/PageRuntimeAgent.h:
- inspector/agents/page/PageRuntimeAgent.cpp:
- inspector/agents/worker/ServiceWorkerAgent.h:
- inspector/agents/worker/ServiceWorkerAgent.cpp:
- inspector/agents/worker/WorkerAuditAgent.h:
- inspector/agents/worker/WorkerConsoleAgent.h:
- inspector/agents/worker/WorkerAuditAgent.cpp:
- inspector/agents/worker/WorkerDOMDebuggerAgent.h:
- inspector/agents/worker/WorkerDOMDebuggerAgent.cpp:
- inspector/agents/worker/WorkerDebuggerAgent.h:
- inspector/agents/worker/WorkerDebuggerAgent.cpp:
- inspector/agents/worker/WorkerNetworkAgent.h:
- inspector/agents/worker/WorkerNetworkAgent.cpp:
- inspector/agents/worker/WorkerRuntimeAgent.h:
- inspector/agents/worker/WorkerRuntimeAgent.cpp:
Elided backend dispatcher handler changes describe above.
- inspector/CommandLineAPIHost.cpp:
(WebCore::CommandLineAPIHost::inspect):
(WebCore::CommandLineAPIHost::clearConsoleMessages):
- inspector/InspectorFrontendHost.cpp:
(WebCore::valuePayloadFromJSONValue):
(WebCore::InspectorFrontendHost::logDiagnosticEvent):
- inspector/TimelineRecordFactory.h:
- inspector/TimelineRecordFactory.cpp:
(WebCore::TimelineRecordFactory::appendLayoutRoot):
- Modules/applicationmanifest/ApplicationManifestParser.cpp:
(WebCore::ApplicationManifestParser::parseManifest):
(WebCore::ApplicationManifestParser::parseStartURL):
(WebCore::ApplicationManifestParser::parseDisplay):
(WebCore::ApplicationManifestParser::parseScope):
(WebCore::ApplicationManifestParser::parseGenericString):
- Modules/encryptedmedia/InitDataRegistry.cpp:
(WebCore::extractKeyIDsKeyids):
- platform/encryptedmedia/CDMUtilities.cpp:
(WebCore::CDMUtilities::parseJSONObject):
- platform/encryptedmedia/clearkey/CDMClearKey.cpp:
(WebCore::parseLicenseFormat):
(WebCore::parseLicenseReleaseAcknowledgementFormat):
- platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
(WebCore::extractSinfData):
- platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
(WebCore::parseJSONValue):
(WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense):
JSON
classes now useRef&&
wherever possible andOptional
instead of an out parameter
forget*
/as*
so that values can be more easily manipulated and can be confidently known
to exist.
Source/WebDriver:
- CommandResult.cpp:
(WebDriver::CommandResult::CommandResult):
- Session.cpp:
(WebDriver::firstWindowHandleInResult):
(WebDriver::Session::getTimeouts):
(WebDriver::Session::createTopLevelBrowsingContext):
(WebDriver::Session::handleUserPrompts):
(WebDriver::Session::reportUnexpectedAlertOpen):
(WebDriver::Session::go):
(WebDriver::Session::getCurrentURL):
(WebDriver::Session::back):
(WebDriver::Session::forward):
(WebDriver::Session::refresh):
(WebDriver::Session::getTitle):
(WebDriver::Session::getWindowHandle):
(WebDriver::Session::closeTopLevelBrowsingContext):
(WebDriver::Session::switchToWindow):
(WebDriver::Session::getWindowHandles):
(WebDriver::Session::newWindow):
(WebDriver::Session::switchToFrame):
(WebDriver::Session::switchToParentFrame):
(WebDriver::Session::getToplevelBrowsingContextRect):
(WebDriver::Session::setWindowRect):
(WebDriver::Session::maximizeWindow):
(WebDriver::Session::minimizeWindow):
(WebDriver::Session::fullscreenWindow):
(WebDriver::Session::createElement):
(WebDriver::Session::extractElementID):
(WebDriver::Session::computeElementLayout):
(WebDriver::Session::findElements):
(WebDriver::Session::getActiveElement):
(WebDriver::Session::isElementSelected):
(WebDriver::Session::getElementText):
(WebDriver::Session::getElementTagName):
(WebDriver::Session::getElementRect):
(WebDriver::Session::isElementEnabled):
(WebDriver::Session::isElementDisplayed):
(WebDriver::Session::getElementAttribute):
(WebDriver::Session::getElementProperty):
(WebDriver::Session::getElementCSSValue):
(WebDriver::Session::waitForNavigationToComplete):
(WebDriver::Session::elementIsFileUpload):
(WebDriver::Session::parseElementIsFileUploadResult):
(WebDriver::Session::selectOptionElement):
(WebDriver::Session::elementClick):
(WebDriver::Session::elementIsEditable):
(WebDriver::Session::elementClear):
(WebDriver::Session::setInputFileUploadFiles):
(WebDriver::Session::elementSendKeys):
(WebDriver::Session::getPageSource):
(WebDriver::Session::handleScriptResult):
(WebDriver::Session::executeScript):
(WebDriver::Session::performMouseInteraction):
(WebDriver::Session::performKeyboardInteractions):
(WebDriver::builtAutomationCookie):
(WebDriver::serializeCookie):
(WebDriver::Session::getAllCookies):
(WebDriver::Session::getNamedCookie):
(WebDriver::Session::addCookie):
(WebDriver::Session::deleteCookie):
(WebDriver::Session::deleteAllCookies):
(WebDriver::Session::performActions):
(WebDriver::Session::releaseActions):
(WebDriver::Session::dismissAlert):
(WebDriver::Session::acceptAlert):
(WebDriver::Session::getAlertText):
(WebDriver::Session::sendAlertText):
(WebDriver::Session::takeScreenshot):
- SessionHost.cpp:
(WebDriver::SessionHost::dispatchMessage):
- WebDriverService.h:
- WebDriverService.cpp:
(WebDriver::WebDriverService::handleRequest):
(WebDriver::WebDriverService::sendResponse const):
(WebDriver::valueAsNumberInRange):
(WebDriver::deserializeTimeouts):
(WebDriver::deserializeProxy):
(WebDriver::WebDriverService::parseCapabilities const):
(WebDriver::WebDriverService::findSessionOrCompleteWithError):
(WebDriver::WebDriverService::validatedCapabilities const):
(WebDriver::WebDriverService::mergeCapabilities const):
(WebDriver::WebDriverService::matchCapabilities const):
(WebDriver::WebDriverService::processCapabilities const):
(WebDriver::WebDriverService::createSession):
(WebDriver::WebDriverService::deleteSession):
(WebDriver::WebDriverService::go):
(WebDriver::WebDriverService::setWindowRect):
(WebDriver::WebDriverService::closeWindow):
(WebDriver::WebDriverService::switchToWindow):
(WebDriver::WebDriverService::newWindow):
(WebDriver::WebDriverService::switchToFrame):
(WebDriver::findElementOrCompleteWithError):
(WebDriver::findStrategyAndSelectorOrCompleteWithError):
(WebDriver::WebDriverService::getElementAttribute):
(WebDriver::WebDriverService::getElementProperty):
(WebDriver::WebDriverService::getElementCSSValue):
(WebDriver::WebDriverService::elementSendKeys):
(WebDriver::findScriptAndArgumentsOrCompleteWithError):
(WebDriver::WebDriverService::getNamedCookie):
(WebDriver::deserializeCookie):
(WebDriver::WebDriverService::addCookie):
(WebDriver::WebDriverService::deleteCookie):
(WebDriver::processPauseAction):
(WebDriver::processNullAction):
(WebDriver::processKeyAction):
(WebDriver::processPointerAction):
(WebDriver::processPointerParameters):
(WebDriver::processInputActionSequence):
(WebDriver::WebDriverService::performActions):
(WebDriver::WebDriverService::sendAlertText):
- WebDriver/gtk/WebDriverServiceGtk.cpp:
(WebDriver::WebDriverService::platformMatchCapability):
(WebDriver::WebDriverService::platformValidateCapability):
(WebDriver::WebDriverService::platformParseCapabilities):
- WebDriver/win/WebDriverServiceWin.cpp:
(WebDriver::WebDriverService::platformMatchCapability):
(WebDriver::WebDriverService::platformValidateCapability):
(WebDriver::WebDriverService::platformParseCapabilities):
- WebDriver/wpe/WebDriverServiceWPE.cpp:
(WebDriver::WebDriverService::platformMatchCapability):
(WebDriver::WebDriverService::platformValidateCapability):
(WebDriver::WebDriverService::platformParseCapabilities):
JSON
classes now useRef&&
wherever possible andOptional
instead of an out parameter
forget*
/as*
so that values can be more easily manipulated and can be confidently known
to exist.
Source/WebInspectorUI:
- UserInterface/Controllers/CSSManager.js:
(WI.CSSManager.prototype.set forcedAppearance):
Now that enums are processed before being passed to backend dispacher handlers, the
appearance
parameter ofPage.setForcedAppearance
must be markedoptional
as
there's no way for it to accept an empty string, as that's not possible for an enum.
As such, rework the frontend logic for invokingPage.setForcedAppearance
to instead
not provide anappearance
parameter at all when wanting to "unset" it.
- UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createConsoleSettingsView):
Now that all logging channels matching aConsole.ChannelSource
are returned instead of
just the hardcoded list, check for a matchingWI.UIString
before showing a<select>
.
Source/WebKit:
Previously, the inspector protocol was expressed in code in a somewhat confusing way:
- the error string was the first argument
- required parameters were
T
orconst T&
- optional parameters were
const T*
- enum parameters were the underlying type requiring the backend dispatcher handler to process it instead of it being preprocessed
- required returns were
T&
- optional returns were
T*
This doesn't really make for easy/obvious reading of code since the order of arguments is
not weird (e.g. error string first), and that there are references/pointers to primitive
types.
This patch cleans up the generated inspector protocol code to be:
- required parameters are
T
orRef<T>&&
- optional parameters are
Optional<T>&&
orRefPtr<T>&&
- enum parameters are preprocessed and passed to the backend dispatcher handler if valid
- synchronous commands return
Expected<X, ErrorString>
using the same types/rules above whereX
is either a single return or astd::tuple
of multiple returns
The one exception to the above is
String
, which is already a tri-state ofnullString()
,
emptyString()
, and something set, so there's no need to useOptional<String>
.
Also use
Protocol
objects/typedefs
wherever possible to further relate the protocol
JSON and the actual backend dispatcher handler implementation.
- UIProcess/Automation/Automation.json:
CoordinateSystem
hasPage
andViewport
enum values, butWebAutomationSession
checks
for"Page"
and"LayoutViewport"
. Add aLayoutViewport
enum value now that enums are
processed before being passed to backend dispacher handlers to preserve functionality.
- UIProcess/Inspector/Agents/InspectorBrowserAgent.h:
- UIProcess/Inspector/Agents/InspectorBrowserAgent.cpp:
- UIProcess/Automation/WebAutomationSessionMacros.h:
- UIProcess/Automation/WebAutomationSession.h:
- UIProcess/Automation/WebAutomationSession.cpp:
- UIProcess/Automation/mac/WebAutomationSessionMac.mm:
Elided backend dispatcher handler changes describe above.
- UIProcess/Inspector/socket/RemoteInspectorClient.cpp:
(WebKit::RemoteInspectorClient::setTargetList):
JSON
classes now useRef&&
wherever possible andOptional
instead of an out parameter
forget*
/as*
so that values can be more easily manipulated and can be confidently known
to exist.
Source/WTF:
- wtf/JSONValues.h:
(WTF::JSONImpl::ObjectBase::setValue):
(WTF::JSONImpl::ObjectBase::setObject):
(WTF::JSONImpl::ObjectBase::setArray):
(WTF::JSONImpl::ArrayBase::pushValue):
(WTF::JSONImpl::ArrayBase::pushObject):
(WTF::JSONImpl::ArrayBase::pushArray):
(WTF::JSONImpl::ArrayOf::ArrayOf): Deleted.
(WTF::JSONImpl::ArrayOf::castedArray): Deleted.
(WTF::JSONImpl::ArrayOf::addItem): Deleted.
(WTF::JSONImpl::ArrayOf::create): Deleted.
- wtf/JSONValues.cpp:
(WTF::JSONImpl::Value::asValue):
(WTF::JSONImpl::Value::asObject):
(WTF::JSONImpl::Value::asArray):
(WTF::JSONImpl::Value::parseJSON):
(WTF::JSONImpl::Value::asBoolean const):
(WTF::JSONImpl::Value::asDouble const):
(WTF::JSONImpl::Value::asInteger const):
(WTF::JSONImpl::Value::asString const):
(WTF::JSONImpl::ObjectBase::asObject):
(WTF::JSONImpl::ObjectBase::memoryCost const):
(WTF::JSONImpl::ObjectBase::getBoolean const):
(WTF::JSONImpl::ObjectBase::getDouble const):
(WTF::JSONImpl::ObjectBase::getInteger const):
(WTF::JSONImpl::ObjectBase::getString const):
(WTF::JSONImpl::ObjectBase::getObject const):
(WTF::JSONImpl::ObjectBase::getArray const):
(WTF::JSONImpl::ObjectBase::getValue const):
(WTF::JSONImpl::ObjectBase::ObjectBase):
(WTF::JSONImpl::ArrayBase::asArray):
(WTF::JSONImpl::ArrayBase::writeJSON const):
(WTF::JSONImpl::ArrayBase::ArrayBase):
(WTF::JSONImpl::ArrayBase::get const):
(WTF::JSONImpl::ArrayBase::memoryCost const):
(WTF::JSONImpl::ObjectBase::openAccessors): Deleted.
UseRef&&
wherever possible andOptional
instead of an out parameter forget*
/as*
so that values can be more easily manipulated and can be confidently assumed to exist.
Remove unused overloads and allow subclasses to callas*
instead ofopenAccessors
as
they're effectively the same thing.
Tools:
- TestWebKitAPI/Tests/WTF/JSONValue.cpp:
LayoutTests:
- inspector/canvas/requestShaderSource-expected.txt:
- inspector/canvas/updateShader-expected.txt:
- inspector/console/webcore-logging-expected.txt:
- inspector/dom/highlightQuad-expected.txt:
- inspector/worker/dom-debugger-dom-breakpoints-expected.txt:
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bindings/ScriptValue.cpp
r261895 r266885 70 70 if (!elementValue) 71 71 return nullptr; 72 inspectorArray->pushValue( WTFMove(elementValue));72 inspectorArray->pushValue(elementValue.releaseNonNull()); 73 73 } 74 74 return inspectorArray; … … 83 83 if (!inspectorValue) 84 84 return nullptr; 85 inspectorObject->setValue(name.string(), WTFMove(inspectorValue));85 inspectorObject->setValue(name.string(), inspectorValue.releaseNonNull()); 86 86 } 87 87 return inspectorObject;