haikuwebkit/Source/WebDriver/gtk/WebDriverServiceGtk.cpp

165 lines
5.9 KiB
C++
Raw Permalink Normal View History

Add initial implementation of WebDriver process to run the HTTP server https://bugs.webkit.org/show_bug.cgi?id=166682 Reviewed by Brian Burg. .: Enable WebDriver in the GTK port by default. * Source/CMakeLists.txt: * Source/cmake/OptionsGTK.cmake: * Source/cmake/WebKitFS.cmake: * Source/cmake/WebKitFeatures.cmake: Source/WebDriver: Add WebDriver process that runs the HTTP server and implements an initial set of commands. Most of the code is cross-platform, only the HTTP server implementation, the code to launch the browser and the communication with the remote inspector requires platform specific code. This patch includes the GTK port implementation, using libsoup for the HTTP server, and GLib for launching the browser and communicating with the remote inspector. This implementation follows the w3c spec (https://www.w3.org/TR/webdriver) as close as possible, but using the official selenium python tests as reference. * CMakeLists.txt: Added. * Capabilities.h: Added. * CommandResult.cpp: Added. * CommandResult.h: Added. * HTTPServer.cpp: Added. * HTTPServer.h: Added. * PlatformGTK.cmake: Added. * Session.cpp: Added. * Session.h: Added. * SessionHost.cpp: Added. * SessionHost.h: Added. * WebDriverMain.cpp: Added. * WebDriverService.cpp: Added. * WebDriverService.h: Added. * config.h: Added. * glib/SessionHostGlib.cpp: Added. * gtk/WebDriverServiceGtk.cpp: Added. * soup/HTTPServerSoup.cpp: Added. Canonical link: https://commits.webkit.org/191418@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219605 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-18 07:20:33 +00:00
/*
* Copyright (C) 2017 Igalia S.L.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "WebDriverService.h"
#include "Capabilities.h"
#include "CommandResult.h"
Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h https://bugs.webkit.org/show_bug.cgi?id=173793 Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2017-11-14 Source/JavaScriptCore: Reviewed by Joseph Pecoraro. Based on patch by Brian Burg. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bindings/ScriptValue.cpp: (Inspector::jsToInspectorValue): (Inspector::toInspectorValue): (Deprecated::ScriptValue::toInspectorValue const): * bindings/ScriptValue.h: * inspector/AsyncStackTrace.cpp: * inspector/ConsoleMessage.cpp: * inspector/ContentSearchUtilities.cpp: * inspector/DeprecatedInspectorValues.cpp: Added. * inspector/DeprecatedInspectorValues.h: Added. Keep the old symbols around in JavaScriptCore so that builds with the public iOS SDK continue to work. These older SDKs include a version of WebInspector.framework that expects to find InspectorArray and other symbols in JavaScriptCore.framework. * inspector/InjectedScript.cpp: (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::wrapTable const): (Inspector::InjectedScript::previewValue const): (Inspector::InjectedScript::setExceptionValue): (Inspector::InjectedScript::clearExceptionValue): (Inspector::InjectedScript::inspectObject): (Inspector::InjectedScript::releaseObject): * inspector/InjectedScriptBase.cpp: (Inspector::InjectedScriptBase::makeCall): (Inspector::InjectedScriptBase::makeEvalCall): * inspector/InjectedScriptBase.h: * inspector/InjectedScriptManager.cpp: (Inspector::InjectedScriptManager::injectedScriptForObjectId): * inspector/InspectorBackendDispatcher.cpp: (Inspector::BackendDispatcher::CallbackBase::sendSuccess): (Inspector::BackendDispatcher::dispatch): (Inspector::BackendDispatcher::sendResponse): (Inspector::BackendDispatcher::sendPendingErrors): (Inspector::BackendDispatcher::getPropertyValue): (Inspector::castToInteger): (Inspector::castToNumber): (Inspector::BackendDispatcher::getInteger): (Inspector::BackendDispatcher::getDouble): (Inspector::BackendDispatcher::getString): (Inspector::BackendDispatcher::getBoolean): (Inspector::BackendDispatcher::getObject): (Inspector::BackendDispatcher::getArray): (Inspector::BackendDispatcher::getValue): * inspector/InspectorBackendDispatcher.h: We need to keep around the sendResponse() variant with a parameter that has the InspectorObject type, as older WebInspector.framework versions expect this symbol to exist. Introduce a variant with arity 3 that can be used in TOT so as to avoid having two methods with the same name, arity, and different parameter types. When system WebInspector.framework is updated, we can remove the legacy method variant that uses the InspectorObject type. At that point, we can transition TOT to use the 2-arity variant, and delete the 3-arity variant when system WebInspector.framework is updated once more to use the 2-arity one. * inspector/InspectorProtocolTypes.h: (Inspector::Protocol::Array::openAccessors): (Inspector::Protocol::PrimitiveBindingTraits::assertValueHasExpectedType): (Inspector::Protocol::BindingTraits<Protocol::Array<T>>::runtimeCast): (Inspector::Protocol::BindingTraits<Protocol::Array<T>>::assertValueHasExpectedType): (Inspector::Protocol::BindingTraits<JSON::Value>::assertValueHasExpectedType): * inspector/ScriptCallFrame.cpp: * inspector/ScriptCallStack.cpp: * inspector/agents/InspectorAgent.cpp: (Inspector::InspectorAgent::inspect): * inspector/agents/InspectorAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::buildAssertPauseReason): (Inspector::buildCSPViolationPauseReason): (Inspector::InspectorDebuggerAgent::buildBreakpointPauseReason): (Inspector::InspectorDebuggerAgent::buildExceptionPauseReason): (Inspector::buildObjectForBreakpointCookie): (Inspector::InspectorDebuggerAgent::breakpointActionsFromProtocol): (Inspector::parseLocation): (Inspector::InspectorDebuggerAgent::setBreakpointByUrl): (Inspector::InspectorDebuggerAgent::setBreakpoint): (Inspector::InspectorDebuggerAgent::continueToLocation): (Inspector::InspectorDebuggerAgent::schedulePauseOnNextStatement): (Inspector::InspectorDebuggerAgent::didParseSource): (Inspector::InspectorDebuggerAgent::breakProgram): * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::callFunctionOn): (Inspector::InspectorRuntimeAgent::saveResult): (Inspector::InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets): * inspector/agents/InspectorRuntimeAgent.h: * inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py: (CppBackendDispatcherHeaderGenerator._generate_dispatcher_declaration_for_command): * inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py: (CppBackendDispatcherImplementationGenerator.generate_output): (CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command): * inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py: (CppFrontendDispatcherHeaderGenerator.generate_output): * inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py: (CppFrontendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_event): * inspector/scripts/codegen/generate_cpp_protocol_types_header.py: (_generate_unchecked_setter_for_member): * inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py: (CppProtocolTypesImplementationGenerator): * inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py: (ObjCBackendDispatcherImplementationGenerator.generate_output): (ObjCBackendDispatcherImplementationGenerator._generate_success_block_for_command): * inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py: (ObjCFrontendDispatcherImplementationGenerator.generate_output): (ObjCFrontendDispatcherImplementationGenerator._generate_event): (ObjCFrontendDispatcherImplementationGenerator._generate_event_out_parameters): * inspector/scripts/codegen/generate_objc_internal_header.py: (ObjCInternalHeaderGenerator.generate_output): * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator.generate_output): * inspector/scripts/codegen/generator.py: * inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result: * inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result: * inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result: * inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result: * inspector/scripts/tests/generic/expected/domain-availability.json-result: * inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result: * inspector/scripts/tests/generic/expected/enum-values.json-result: * inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result: * inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result: * inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result: * inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result: * inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result: * inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result: * inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result: * inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result: * inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result: * inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result: * inspector/scripts/tests/generic/expected/worker-supported-domains.json-result: * inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result: * inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result: Source/WebCore: Reviewed by Joseph Pecoraro. Based on patch by Brian Burg. * ForwardingHeaders/inspector/InspectorValues.h: Removed. * Modules/encryptedmedia/InitDataRegistry.cpp: (WebCore::extractKeyIDsKeyids): (WebCore::sanitizeKeyids): * html/parser/XSSAuditorDelegate.cpp: (WebCore::XSSAuditorDelegate::generateViolationReport): * inspector/CommandLineAPIHost.cpp: (WebCore::CommandLineAPIHost::inspect): * inspector/CommandLineAPIHost.h: * inspector/InspectorCanvas.cpp: (WebCore::InspectorCanvas::recordAction): (WebCore::InspectorCanvas::releaseData): (WebCore::InspectorCanvas::indexForData): (WebCore::buildArrayForVector): (WebCore::InspectorCanvas::buildInitialState): (WebCore::InspectorCanvas::buildAction): (WebCore::InspectorCanvas::buildArrayForCanvasGradient): (WebCore::InspectorCanvas::buildArrayForCanvasPattern): (WebCore::InspectorCanvas::buildArrayForImageData): (WebCore::InspectorCanvas::buildArrayForImageBitmap): * inspector/InspectorCanvas.h: * inspector/InspectorDatabaseResource.cpp: * inspector/InspectorOverlay.cpp: (WebCore::evaluateCommandInOverlay): (WebCore::InspectorOverlay::evaluateInOverlay): * inspector/InspectorOverlay.h: * inspector/InspectorShaderProgram.h: * inspector/InspectorStyleSheet.h: (WebCore::InspectorCSSId::InspectorCSSId): * inspector/TimelineRecordFactory.cpp: (WebCore::TimelineRecordFactory::createGenericRecord): (WebCore::TimelineRecordFactory::createFunctionCallData): (WebCore::TimelineRecordFactory::createConsoleProfileData): (WebCore::TimelineRecordFactory::createProbeSampleData): (WebCore::TimelineRecordFactory::createEventDispatchData): (WebCore::TimelineRecordFactory::createGenericTimerData): (WebCore::TimelineRecordFactory::createTimerInstallData): (WebCore::TimelineRecordFactory::createEvaluateScriptData): (WebCore::TimelineRecordFactory::createTimeStampData): (WebCore::TimelineRecordFactory::createAnimationFrameData): (WebCore::createQuad): (WebCore::TimelineRecordFactory::createPaintData): (WebCore::TimelineRecordFactory::appendLayoutRoot): * inspector/TimelineRecordFactory.h: * inspector/agents/InspectorApplicationCacheAgent.cpp: * inspector/agents/InspectorApplicationCacheAgent.h: * inspector/agents/InspectorCSSAgent.cpp: (WebCore::computePseudoClassMask): (WebCore::InspectorCSSAgent::setStyleText): (WebCore::InspectorCSSAgent::setRuleSelector): (WebCore::InspectorCSSAgent::forcePseudoState): * inspector/agents/InspectorCSSAgent.h: * inspector/agents/InspectorDOMAgent.cpp: (WebCore::parseColor): (WebCore::parseConfigColor): (WebCore::parseQuad): (WebCore::InspectorDOMAgent::performSearch): (WebCore::InspectorDOMAgent::setSearchingForNode): (WebCore::InspectorDOMAgent::highlightConfigFromInspectorObject): (WebCore::InspectorDOMAgent::setInspectModeEnabled): (WebCore::InspectorDOMAgent::highlightRect): (WebCore::InspectorDOMAgent::highlightQuad): (WebCore::InspectorDOMAgent::innerHighlightQuad): (WebCore::InspectorDOMAgent::highlightSelector): (WebCore::InspectorDOMAgent::highlightNode): (WebCore::InspectorDOMAgent::highlightNodeList): (WebCore::InspectorDOMAgent::highlightFrame): * inspector/agents/InspectorDOMAgent.h: * inspector/agents/InspectorDOMDebuggerAgent.cpp: (WebCore::InspectorDOMDebuggerAgent::didInvalidateStyleAttr): (WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode): (WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode): (WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr): (WebCore::InspectorDOMDebuggerAgent::descriptionForDOMEvent): (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded): (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest): * inspector/agents/InspectorDOMDebuggerAgent.h: * inspector/agents/InspectorDOMStorageAgent.cpp: (WebCore::InspectorDOMStorageAgent::getDOMStorageItems): (WebCore::InspectorDOMStorageAgent::setDOMStorageItem): (WebCore::InspectorDOMStorageAgent::removeDOMStorageItem): (WebCore::InspectorDOMStorageAgent::findStorageArea): * inspector/agents/InspectorDOMStorageAgent.h: * inspector/agents/InspectorDatabaseAgent.cpp: * inspector/agents/InspectorIndexedDBAgent.cpp: (WebCore::Inspector::idbKeyFromInspectorObject): (WebCore::Inspector::idbKeyRangeFromKeyRange): (WebCore::InspectorIndexedDBAgent::requestData): * inspector/agents/InspectorIndexedDBAgent.h: * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::buildObjectForHeaders): (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse): (WebCore::InspectorNetworkAgent::setExtraHTTPHeaders): * inspector/agents/InspectorNetworkAgent.h: * inspector/agents/InspectorPageAgent.cpp: * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::setInstruments): (WebCore::InspectorTimelineAgent::internalStart): (WebCore::InspectorTimelineAgent::didInvalidateLayout): (WebCore::InspectorTimelineAgent::willLayout): (WebCore::InspectorTimelineAgent::didScheduleStyleRecalculation): (WebCore::InspectorTimelineAgent::willRecalculateStyle): (WebCore::InspectorTimelineAgent::willComposite): (WebCore::InspectorTimelineAgent::willPaint): (WebCore::InspectorTimelineAgent::addRecordToTimeline): (WebCore::InspectorTimelineAgent::setFrameIdentifier): (WebCore::InspectorTimelineAgent::appendRecord): (WebCore::InspectorTimelineAgent::sendEvent): (WebCore::InspectorTimelineAgent::createRecordEntry): (WebCore::InspectorTimelineAgent::pushCurrentRecord): * inspector/agents/InspectorTimelineAgent.h: * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::reportViolation const): * platform/encryptedmedia/clearkey/CDMClearKey.cpp: (WebCore::parseJSONObject): (WebCore::parseLicenseFormat): (WebCore::parseLicenseReleaseAcknowledgementFormat): (WebCore::CDMInstanceClearKey::updateLicense): (WebCore::CDMInstanceClearKey::removeSessionData): * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp: (WebCore::extractSinfData): * testing/Internals.cpp: Source/WebDriver: Reviewed by Joseph Pecoraro. * CMakeLists.txt: * CommandResult.cpp: (WebDriver::CommandResult::CommandResult): * CommandResult.h: (WebDriver::CommandResult::success): (WebDriver::CommandResult::fail): (WebDriver::CommandResult::result const): (WebDriver::CommandResult::setAdditionalErrorData): (WebDriver::CommandResult::additionalErrorData const): * Session.cpp: (WebDriver::firstWindowHandleInResult): (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::switchToFrame): (WebDriver::Session::switchToParentFrame): (WebDriver::Session::getToplevelBrowsingContextRect): (WebDriver::Session::moveToplevelBrowsingContextWindow): (WebDriver::Session::resizeToplevelBrowsingContextWindow): (WebDriver::Session::createElement): (WebDriver::Session::extractElement): (WebDriver::Session::extractElementID): (WebDriver::Session::computeElementLayout): (WebDriver::Session::findElements): (WebDriver::Session::isElementSelected): (WebDriver::Session::getElementText): (WebDriver::Session::getElementTagName): (WebDriver::Session::getElementRect): (WebDriver::Session::isElementEnabled): (WebDriver::Session::isElementDisplayed): (WebDriver::Session::getElementAttribute): (WebDriver::Session::waitForNavigationToComplete): (WebDriver::Session::selectOptionElement): (WebDriver::Session::elementClick): (WebDriver::Session::elementClear): (WebDriver::Session::elementSendKeys): (WebDriver::Session::elementSubmit): (WebDriver::Session::handleScriptResult): (WebDriver::Session::executeScript): (WebDriver::Session::performMouseInteraction): (WebDriver::Session::performKeyboardInteractions): (WebDriver::parseAutomationCookie): (WebDriver::builtAutomationCookie): (WebDriver::serializeCookie): (WebDriver::Session::getAllCookies): (WebDriver::Session::getNamedCookie): (WebDriver::Session::addCookie): (WebDriver::Session::deleteCookie): (WebDriver::Session::deleteAllCookies): (WebDriver::Session::dismissAlert): (WebDriver::Session::acceptAlert): (WebDriver::Session::getAlertText): (WebDriver::Session::sendAlertText): (WebDriver::Session::takeScreenshot): * Session.h: * SessionHost.cpp: (WebDriver::SessionHost::sendCommandToBackend): (WebDriver::SessionHost::dispatchMessage): * SessionHost.h: * WebDriverService.cpp: (WebDriver::WebDriverService::handleRequest): (WebDriver::WebDriverService::sendResponse const): (WebDriver::deserializeTimeouts): (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::newSession): (WebDriver::WebDriverService::deleteSession): (WebDriver::WebDriverService::setTimeouts): (WebDriver::WebDriverService::go): (WebDriver::WebDriverService::getCurrentURL): (WebDriver::WebDriverService::back): (WebDriver::WebDriverService::forward): (WebDriver::WebDriverService::refresh): (WebDriver::WebDriverService::getTitle): (WebDriver::WebDriverService::getWindowHandle): (WebDriver::WebDriverService::getWindowRect): (WebDriver::valueAsNumberInRange): (WebDriver::WebDriverService::setWindowRect): (WebDriver::WebDriverService::closeWindow): (WebDriver::WebDriverService::switchToWindow): (WebDriver::WebDriverService::getWindowHandles): (WebDriver::WebDriverService::switchToFrame): (WebDriver::WebDriverService::switchToParentFrame): (WebDriver::findElementOrCompleteWithError): (WebDriver::findStrategyAndSelectorOrCompleteWithError): (WebDriver::WebDriverService::findElement): (WebDriver::WebDriverService::findElements): (WebDriver::WebDriverService::findElementFromElement): (WebDriver::WebDriverService::findElementsFromElement): (WebDriver::WebDriverService::isElementSelected): (WebDriver::WebDriverService::getElementAttribute): (WebDriver::WebDriverService::getElementText): (WebDriver::WebDriverService::getElementTagName): (WebDriver::WebDriverService::getElementRect): (WebDriver::WebDriverService::isElementEnabled): (WebDriver::WebDriverService::isElementDisplayed): (WebDriver::WebDriverService::elementClick): (WebDriver::WebDriverService::elementClear): (WebDriver::WebDriverService::elementSendKeys): (WebDriver::WebDriverService::elementSubmit): (WebDriver::findScriptAndArgumentsOrCompleteWithError): (WebDriver::WebDriverService::executeScript): (WebDriver::WebDriverService::executeAsyncScript): (WebDriver::WebDriverService::getAllCookies): (WebDriver::WebDriverService::getNamedCookie): (WebDriver::deserializeCookie): (WebDriver::WebDriverService::addCookie): (WebDriver::WebDriverService::deleteCookie): (WebDriver::WebDriverService::deleteAllCookies): (WebDriver::WebDriverService::dismissAlert): (WebDriver::WebDriverService::acceptAlert): (WebDriver::WebDriverService::getAlertText): (WebDriver::WebDriverService::sendAlertText): (WebDriver::WebDriverService::takeScreenshot): (WebDriver::WebDriverService::takeElementScreenshot): * WebDriverService.h: * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformValidateCapability const): (WebDriver::WebDriverService::platformMatchCapability const): (WebDriver::WebDriverService::platformParseCapabilities const): * wpe/WebDriverServiceWPE.cpp: (WebDriver::WebDriverService::platformValidateCapability const): (WebDriver::WebDriverService::platformMatchCapability const): (WebDriver::WebDriverService::platformParseCapabilities const): Source/WebKit: Reviewed by Joseph Pecocaro. Based on patch by Brian Burg. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::resizeWindowOfBrowsingContext): (WebKit::WebAutomationSession::moveWindowOfBrowsingContext): (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage): (WebKit::WebAutomationSession::waitForNavigationToCompleteOnFrame): (WebKit::WebAutomationSession::respondToPendingPageNavigationCallbacksWithTimeout): (WebKit::WebAutomationSession::respondToPendingFrameNavigationCallbacksWithTimeout): (WebKit::WebAutomationSession::navigationOccurredForFrame): (WebKit::WebAutomationSession::documentLoadedForFrame): (WebKit::WebAutomationSession::inspectorFrontendLoaded): (WebKit::WebAutomationSession::keyboardEventsFlushedForPage): (WebKit::WebAutomationSession::evaluateJavaScriptFunction): (WebKit::WebAutomationSession::setFilesToSelectForFileUpload): (WebKit::WebAutomationSession::addSingleCookie): (WebKit::WebAutomationSession::setSessionPermissions): (WebKit::WebAutomationSession::performMouseInteraction): (WebKit::WebAutomationSession::performKeyboardInteractions): * UIProcess/Automation/WebAutomationSession.h: Source/WTF: Reviewed by Joseph Pecoraro. Based on patch by Brian Burg. Move the implementation into WTF. Put the actual implementation inside namespace WTF::JSONImpl so that the symbols in libwtf start with the WTF prefix. Also provide a top-level JSON namespace so that clients can write JSON::Value. This is essentially a typedef for the entire WTF::JSONImpl namespace. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/JSONValues.cpp: Renamed from Source/JavaScriptCore/inspector/InspectorValues.cpp. (JSON::Value::null): (JSON::Value::create): (JSON::Value::asValue): (JSON::Value::asObject): (JSON::Value::asArray): (JSON::Value::parseJSON): (JSON::Value::toJSONString const): (JSON::Value::asBoolean const): (JSON::Value::asDouble const): (JSON::Value::asInteger const): (JSON::Value::asString const): (JSON::Value::writeJSON const): (JSON::Value::memoryCost const): (JSON::ObjectBase::~ObjectBase): (JSON::ObjectBase::asObject): (JSON::ObjectBase::openAccessors): (JSON::ObjectBase::memoryCost const): (JSON::ObjectBase::getBoolean const): (JSON::ObjectBase::getString const): (JSON::ObjectBase::getObject const): (JSON::ObjectBase::getArray const): (JSON::ObjectBase::getValue const): (JSON::ObjectBase::remove): (JSON::ObjectBase::writeJSON const): (JSON::ObjectBase::ObjectBase): (JSON::ArrayBase::~ArrayBase): (JSON::ArrayBase::asArray): (JSON::ArrayBase::writeJSON const): (JSON::ArrayBase::ArrayBase): (JSON::ArrayBase::get const): (JSON::Object::create): (JSON::Array::create): (JSON::ArrayBase::memoryCost const): * wtf/JSONValues.h: Renamed from Source/JavaScriptCore/inspector/InspectorValues.h. (JSON::ObjectBase::find): (JSON::ObjectBase::find const): (JSON::ObjectBase::setBoolean): (JSON::ObjectBase::setInteger): (JSON::ObjectBase::setDouble): (JSON::ObjectBase::setString): (JSON::ObjectBase::setValue): (JSON::ObjectBase::setObject): (JSON::ObjectBase::setArray): (JSON::ArrayBase::pushBoolean): (JSON::ArrayBase::pushInteger): (JSON::ArrayBase::pushDouble): (JSON::ArrayBase::pushString): (JSON::ArrayBase::pushValue): (JSON::ArrayBase::pushObject): (JSON::ArrayBase::pushArray): Tools: Reviewed by Joseph Pecoraro. * TestWebKitAPI/CMakeLists.txt: * TestWebKitAPI/PlatformGTK.cmake: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WTF/JSONValue.cpp: Renamed from Tools/TestWebKitAPI/Tests/JavaScriptCore/InspectorValue.cpp. (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/196092@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-11-28 19:58:16 +00:00
#include <wtf/JSONValues.h>
Add initial implementation of WebDriver process to run the HTTP server https://bugs.webkit.org/show_bug.cgi?id=166682 Reviewed by Brian Burg. .: Enable WebDriver in the GTK port by default. * Source/CMakeLists.txt: * Source/cmake/OptionsGTK.cmake: * Source/cmake/WebKitFS.cmake: * Source/cmake/WebKitFeatures.cmake: Source/WebDriver: Add WebDriver process that runs the HTTP server and implements an initial set of commands. Most of the code is cross-platform, only the HTTP server implementation, the code to launch the browser and the communication with the remote inspector requires platform specific code. This patch includes the GTK port implementation, using libsoup for the HTTP server, and GLib for launching the browser and communicating with the remote inspector. This implementation follows the w3c spec (https://www.w3.org/TR/webdriver) as close as possible, but using the official selenium python tests as reference. * CMakeLists.txt: Added. * Capabilities.h: Added. * CommandResult.cpp: Added. * CommandResult.h: Added. * HTTPServer.cpp: Added. * HTTPServer.h: Added. * PlatformGTK.cmake: Added. * Session.cpp: Added. * Session.h: Added. * SessionHost.cpp: Added. * SessionHost.h: Added. * WebDriverMain.cpp: Added. * WebDriverService.cpp: Added. * WebDriverService.h: Added. * config.h: Added. * glib/SessionHostGlib.cpp: Added. * gtk/WebDriverServiceGtk.cpp: Added. * soup/HTTPServerSoup.cpp: Added. Canonical link: https://commits.webkit.org/191418@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219605 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-18 07:20:33 +00:00
namespace WebDriver {
[PlayStation][WinCairo] Enable WebDriver target on PlayStation and client for WinCairo https://bugs.webkit.org/show_bug.cgi?id=216908 Reviewed by Don Olmstead. Source/JavaScriptCore: Implement automation session correctly for PlayStation and WinCairo. * inspector/remote/RemoteInspector.h: * inspector/remote/socket/RemoteInspectorConnectionClient.cpp: (Inspector::RemoteInspectorConnectionClient::parseTargetListJSON): * inspector/remote/socket/RemoteInspectorConnectionClient.h: * inspector/remote/socket/RemoteInspectorSocket.cpp: (Inspector::RemoteInspector::stopInternal): (Inspector::RemoteInspector::requestAutomationSession): (Inspector::RemoteInspector::startAutomationSession): Source/WebDriver: Extend WebDriver client binary to support connection to remote device for both PlayStation and WinCairo. We've implemented a simple web server to accept WebDriver request natively and bypass them to RemoteInspector. * Capabilities.h: * HTTPServer.h: * PlatformPlayStation.cmake: Added. * PlatformWin.cmake: * SessionHost.h: (WebDriver::SessionHost::setHostAddress): * WebDriverMain.cpp: (main): (dllLauncherEntryPoint): * WebDriverService.cpp: (WebDriver::printUsageStatement): (WebDriver::WebDriverService::run): (WebDriver::WebDriverService::connectToBrowser): * WebDriverService.h: * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformInit): * playstation/WebDriverServicePlayStation.cpp: Copied from Source\WebDriver\win\WebDriverServiceWin.cpp. (WebDriver::WebDriverService::platformInit): (WebDriver::WebDriverService::platformCapabilities): (WebDriver::WebDriverService::platformCompareBrowserVersions): (WebDriver::WebDriverService::platformValidateCapability const): (WebDriver::WebDriverService::platformMatchCapability const): (WebDriver::WebDriverService::platformParseCapabilities const): (WebDriver::WebDriverService::platformSupportProxyType const): * socket/CapabilitiesSocket.cpp: Copied from Source\WebDriver\socket\SessionHostSocket.cpp. (WebDriver::CapabilitiesSocket::parseCapabilities): * socket/CapabilitiesSocket.h: Copied from Source\WebDriver\socket\HTTPServerSocket.cpp. * socket/HTTPParser.cpp: Added. (WebDriver::HTTPParser::parse): (WebDriver::HTTPParser::handlePhase): (WebDriver::HTTPParser::abortProcess): (WebDriver::HTTPParser::parseFirstLine): (WebDriver::HTTPParser::readLine): (WebDriver::HTTPParser::expectedBodyLength const): * socket/HTTPParser.h: Copied from Source\WebDriver\HTTPServer.h. (WebDriver::HTTPParser::pullMessage): * socket/HTTPServerSocket.cpp: (WebDriver::HTTPServer::listen): (WebDriver::HTTPServer::disconnect): (WebDriver::HTTPServer::doAccept): (WebDriver::HTTPServer::didClose): (WebDriver::HTTPRequestHandler::connect): (WebDriver::HTTPRequestHandler::reset): (WebDriver::HTTPRequestHandler::didReceive): (WebDriver::HTTPRequestHandler::sendResponse): (WebDriver::HTTPRequestHandler::packHTTPMessage const): (WebDriver::HTTPRequestHandler::didClose): * socket/SessionHostSocket.cpp: (WebDriver::SessionHost::dispatchMap): (WebDriver::SessionHost::sendWebInspectorEvent): (WebDriver::SessionHost::connectToBrowser): (WebDriver::SessionHost::isConnected const): (WebDriver::SessionHost::didClose): (WebDriver::SessionHost::parseTargetList): (WebDriver::SessionHost::receivedSetTargetList): (WebDriver::SessionHost::receivedSendMessageToFrontend): (WebDriver::SessionHost::startAutomationSession): (WebDriver::SessionHost::setTargetList): (WebDriver::SessionHost::sendMessageToBackend): * win/WebDriverServiceWin.cpp: (WebDriver::WebDriverService::platformInit): (WebDriver::WebDriverService::platformParseCapabilities const): * wpe/WebDriverServiceWPE.cpp: (WebDriver::WebDriverService::platformInit): Canonical link: https://commits.webkit.org/229926@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267807 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-30 21:22:57 +00:00
void WebDriverService::platformInit()
{
}
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
Capabilities WebDriverService::platformCapabilities()
Add initial implementation of WebDriver process to run the HTTP server https://bugs.webkit.org/show_bug.cgi?id=166682 Reviewed by Brian Burg. .: Enable WebDriver in the GTK port by default. * Source/CMakeLists.txt: * Source/cmake/OptionsGTK.cmake: * Source/cmake/WebKitFS.cmake: * Source/cmake/WebKitFeatures.cmake: Source/WebDriver: Add WebDriver process that runs the HTTP server and implements an initial set of commands. Most of the code is cross-platform, only the HTTP server implementation, the code to launch the browser and the communication with the remote inspector requires platform specific code. This patch includes the GTK port implementation, using libsoup for the HTTP server, and GLib for launching the browser and communicating with the remote inspector. This implementation follows the w3c spec (https://www.w3.org/TR/webdriver) as close as possible, but using the official selenium python tests as reference. * CMakeLists.txt: Added. * Capabilities.h: Added. * CommandResult.cpp: Added. * CommandResult.h: Added. * HTTPServer.cpp: Added. * HTTPServer.h: Added. * PlatformGTK.cmake: Added. * Session.cpp: Added. * Session.h: Added. * SessionHost.cpp: Added. * SessionHost.h: Added. * WebDriverMain.cpp: Added. * WebDriverService.cpp: Added. * WebDriverService.h: Added. * config.h: Added. * glib/SessionHostGlib.cpp: Added. * gtk/WebDriverServiceGtk.cpp: Added. * soup/HTTPServerSoup.cpp: Added. Canonical link: https://commits.webkit.org/191418@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219605 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-18 07:20:33 +00:00
{
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
Capabilities capabilities;
capabilities.platformName = String("linux");
capabilities.setWindowRect = true;
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
return capabilities;
}
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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 of `Page.setForcedAppearance` must be marked `optional` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 of `Page.setForcedAppearance` must be marked `optional` 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 invoking `Page.setForcedAppearance` to instead not provide an `appearance` parameter at all when wanting to "unset" it. * UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createConsoleSettingsView): Now that all logging channels matching a `Console.ChannelSource` are returned instead of just the hardcoded list, check for a matching `WI.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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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` has `Page` and `Viewport` enum values, but `WebAutomationSession` checks for `"Page"` and `"LayoutViewport"`. Add a `LayoutViewport` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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. Use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`as*` so that values can be more easily manipulated and can be confidently assumed to exist. Remove unused overloads and allow subclasses to call `as*` instead of `openAccessors` 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: Canonical link: https://commits.webkit.org/229208@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-10 19:23:17 +00:00
bool WebDriverService::platformValidateCapability(const String& name, const Ref<JSON::Value>& value) const
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
{
if (name != "webkitgtk:browserOptions")
return true;
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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 of `Page.setForcedAppearance` must be marked `optional` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 of `Page.setForcedAppearance` must be marked `optional` 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 invoking `Page.setForcedAppearance` to instead not provide an `appearance` parameter at all when wanting to "unset" it. * UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createConsoleSettingsView): Now that all logging channels matching a `Console.ChannelSource` are returned instead of just the hardcoded list, check for a matching `WI.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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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` has `Page` and `Viewport` enum values, but `WebAutomationSession` checks for `"Page"` and `"LayoutViewport"`. Add a `LayoutViewport` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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. Use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`as*` so that values can be more easily manipulated and can be confidently assumed to exist. Remove unused overloads and allow subclasses to call `as*` instead of `openAccessors` 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: Canonical link: https://commits.webkit.org/229208@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-10 19:23:17 +00:00
auto browserOptions = value->asObject();
if (!browserOptions)
Add initial implementation of WebDriver process to run the HTTP server https://bugs.webkit.org/show_bug.cgi?id=166682 Reviewed by Brian Burg. .: Enable WebDriver in the GTK port by default. * Source/CMakeLists.txt: * Source/cmake/OptionsGTK.cmake: * Source/cmake/WebKitFS.cmake: * Source/cmake/WebKitFeatures.cmake: Source/WebDriver: Add WebDriver process that runs the HTTP server and implements an initial set of commands. Most of the code is cross-platform, only the HTTP server implementation, the code to launch the browser and the communication with the remote inspector requires platform specific code. This patch includes the GTK port implementation, using libsoup for the HTTP server, and GLib for launching the browser and communicating with the remote inspector. This implementation follows the w3c spec (https://www.w3.org/TR/webdriver) as close as possible, but using the official selenium python tests as reference. * CMakeLists.txt: Added. * Capabilities.h: Added. * CommandResult.cpp: Added. * CommandResult.h: Added. * HTTPServer.cpp: Added. * HTTPServer.h: Added. * PlatformGTK.cmake: Added. * Session.cpp: Added. * Session.h: Added. * SessionHost.cpp: Added. * SessionHost.h: Added. * WebDriverMain.cpp: Added. * WebDriverService.cpp: Added. * WebDriverService.h: Added. * config.h: Added. * glib/SessionHostGlib.cpp: Added. * gtk/WebDriverServiceGtk.cpp: Added. * soup/HTTPServerSoup.cpp: Added. Canonical link: https://commits.webkit.org/191418@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219605 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-18 07:20:33 +00:00
return false;
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
if (browserOptions->isNull())
Add initial implementation of WebDriver process to run the HTTP server https://bugs.webkit.org/show_bug.cgi?id=166682 Reviewed by Brian Burg. .: Enable WebDriver in the GTK port by default. * Source/CMakeLists.txt: * Source/cmake/OptionsGTK.cmake: * Source/cmake/WebKitFS.cmake: * Source/cmake/WebKitFeatures.cmake: Source/WebDriver: Add WebDriver process that runs the HTTP server and implements an initial set of commands. Most of the code is cross-platform, only the HTTP server implementation, the code to launch the browser and the communication with the remote inspector requires platform specific code. This patch includes the GTK port implementation, using libsoup for the HTTP server, and GLib for launching the browser and communicating with the remote inspector. This implementation follows the w3c spec (https://www.w3.org/TR/webdriver) as close as possible, but using the official selenium python tests as reference. * CMakeLists.txt: Added. * Capabilities.h: Added. * CommandResult.cpp: Added. * CommandResult.h: Added. * HTTPServer.cpp: Added. * HTTPServer.h: Added. * PlatformGTK.cmake: Added. * Session.cpp: Added. * Session.h: Added. * SessionHost.cpp: Added. * SessionHost.h: Added. * WebDriverMain.cpp: Added. * WebDriverService.cpp: Added. * WebDriverService.h: Added. * config.h: Added. * glib/SessionHostGlib.cpp: Added. * gtk/WebDriverServiceGtk.cpp: Added. * soup/HTTPServerSoup.cpp: Added. Canonical link: https://commits.webkit.org/191418@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219605 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-18 07:20:33 +00:00
return true;
REGRESSION(r266885): WebDriver is broken since r266885 https://bugs.webkit.org/show_bug.cgi?id=216477 Reviewed by Devin Rousso. There are several issues introduced in r266885, most of them related to JSValue::get methods now returning an optional. In some cases of boolean values, the optional is checked instead of the contained bool or the logic is inverted. JSONValue::getString() is problematic too because it doesn't use optional, when you call getString() and null is returned it could be because the property is not present in the object or because the property is not a string. In several cases we need to know that so we need to first get the value and then call asString(9 instead of calling getString() directly. * Session.cpp: (WebDriver::Session::handleUserPrompts): Check the value of isShowingJavaScriptDialog, not the optional. (WebDriver::parseAutomationCookie): Check also the value of the session optional bool, not only the optional. * SessionHost.cpp: (WebDriver::SessionHost::dispatchMessage): Only set the responseObject if the object is not empty. * WebDriverService.cpp: (WebDriver::WebDriverService::newWindow): Unknown values of type hint are not an error. (WebDriver::WebDriverService::deleteCookie): Fix indentation. (WebDriver::processKeyAction): Empty key value is an error, not the opposite. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformValidateCapability const): Only fail if optional values are wrong type, not if they are not present. * wpe/WebDriverServiceWPE.cpp: (WebDriver::WebDriverService::platformValidateCapability const): Ditto. Canonical link: https://commits.webkit.org/229360@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267078 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-15 06:25:04 +00:00
if (auto binaryValue = browserOptions->getValue("binary"_s)) {
if (!binaryValue->asString())
return false;
}
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
REGRESSION(r266885): WebDriver is broken since r266885 https://bugs.webkit.org/show_bug.cgi?id=216477 Reviewed by Devin Rousso. There are several issues introduced in r266885, most of them related to JSValue::get methods now returning an optional. In some cases of boolean values, the optional is checked instead of the contained bool or the logic is inverted. JSONValue::getString() is problematic too because it doesn't use optional, when you call getString() and null is returned it could be because the property is not present in the object or because the property is not a string. In several cases we need to know that so we need to first get the value and then call asString(9 instead of calling getString() directly. * Session.cpp: (WebDriver::Session::handleUserPrompts): Check the value of isShowingJavaScriptDialog, not the optional. (WebDriver::parseAutomationCookie): Check also the value of the session optional bool, not only the optional. * SessionHost.cpp: (WebDriver::SessionHost::dispatchMessage): Only set the responseObject if the object is not empty. * WebDriverService.cpp: (WebDriver::WebDriverService::newWindow): Unknown values of type hint are not an error. (WebDriver::WebDriverService::deleteCookie): Fix indentation. (WebDriver::processKeyAction): Empty key value is an error, not the opposite. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformValidateCapability const): Only fail if optional values are wrong type, not if they are not present. * wpe/WebDriverServiceWPE.cpp: (WebDriver::WebDriverService::platformValidateCapability const): Ditto. Canonical link: https://commits.webkit.org/229360@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267078 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-15 06:25:04 +00:00
if (auto useOverlayScrollbarsValue = browserOptions->getValue("useOverlayScrollbars"_s)) {
if (!useOverlayScrollbarsValue->asBoolean())
return false;
}
if (auto browserArgumentsValue = browserOptions->getValue("args"_s)) {
auto browserArguments = browserArgumentsValue->asArray();
if (!browserArguments)
return false;
Add initial implementation of WebDriver process to run the HTTP server https://bugs.webkit.org/show_bug.cgi?id=166682 Reviewed by Brian Burg. .: Enable WebDriver in the GTK port by default. * Source/CMakeLists.txt: * Source/cmake/OptionsGTK.cmake: * Source/cmake/WebKitFS.cmake: * Source/cmake/WebKitFeatures.cmake: Source/WebDriver: Add WebDriver process that runs the HTTP server and implements an initial set of commands. Most of the code is cross-platform, only the HTTP server implementation, the code to launch the browser and the communication with the remote inspector requires platform specific code. This patch includes the GTK port implementation, using libsoup for the HTTP server, and GLib for launching the browser and communicating with the remote inspector. This implementation follows the w3c spec (https://www.w3.org/TR/webdriver) as close as possible, but using the official selenium python tests as reference. * CMakeLists.txt: Added. * Capabilities.h: Added. * CommandResult.cpp: Added. * CommandResult.h: Added. * HTTPServer.cpp: Added. * HTTPServer.h: Added. * PlatformGTK.cmake: Added. * Session.cpp: Added. * Session.h: Added. * SessionHost.cpp: Added. * SessionHost.h: Added. * WebDriverMain.cpp: Added. * WebDriverService.cpp: Added. * WebDriverService.h: Added. * config.h: Added. * glib/SessionHostGlib.cpp: Added. * gtk/WebDriverServiceGtk.cpp: Added. * soup/HTTPServerSoup.cpp: Added. Canonical link: https://commits.webkit.org/191418@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219605 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-18 07:20:33 +00:00
unsigned browserArgumentsLength = browserArguments->length();
for (unsigned i = 0; i < browserArgumentsLength; ++i) {
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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 of `Page.setForcedAppearance` must be marked `optional` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 of `Page.setForcedAppearance` must be marked `optional` 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 invoking `Page.setForcedAppearance` to instead not provide an `appearance` parameter at all when wanting to "unset" it. * UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createConsoleSettingsView): Now that all logging channels matching a `Console.ChannelSource` are returned instead of just the hardcoded list, check for a matching `WI.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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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` has `Page` and `Viewport` enum values, but `WebAutomationSession` checks for `"Page"` and `"LayoutViewport"`. Add a `LayoutViewport` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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. Use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`as*` so that values can be more easily manipulated and can be confidently assumed to exist. Remove unused overloads and allow subclasses to call `as*` instead of `openAccessors` 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: Canonical link: https://commits.webkit.org/229208@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-10 19:23:17 +00:00
auto argument = browserArguments->get(i)->asString();
if (!argument)
return false;
}
Add initial implementation of WebDriver process to run the HTTP server https://bugs.webkit.org/show_bug.cgi?id=166682 Reviewed by Brian Burg. .: Enable WebDriver in the GTK port by default. * Source/CMakeLists.txt: * Source/cmake/OptionsGTK.cmake: * Source/cmake/WebKitFS.cmake: * Source/cmake/WebKitFeatures.cmake: Source/WebDriver: Add WebDriver process that runs the HTTP server and implements an initial set of commands. Most of the code is cross-platform, only the HTTP server implementation, the code to launch the browser and the communication with the remote inspector requires platform specific code. This patch includes the GTK port implementation, using libsoup for the HTTP server, and GLib for launching the browser and communicating with the remote inspector. This implementation follows the w3c spec (https://www.w3.org/TR/webdriver) as close as possible, but using the official selenium python tests as reference. * CMakeLists.txt: Added. * Capabilities.h: Added. * CommandResult.cpp: Added. * CommandResult.h: Added. * HTTPServer.cpp: Added. * HTTPServer.h: Added. * PlatformGTK.cmake: Added. * Session.cpp: Added. * Session.h: Added. * SessionHost.cpp: Added. * SessionHost.h: Added. * WebDriverMain.cpp: Added. * WebDriverService.cpp: Added. * WebDriverService.h: Added. * config.h: Added. * glib/SessionHostGlib.cpp: Added. * gtk/WebDriverServiceGtk.cpp: Added. * soup/HTTPServerSoup.cpp: Added. Canonical link: https://commits.webkit.org/191418@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219605 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-18 07:20:33 +00:00
}
REGRESSION(r266885): WebDriver is broken since r266885 https://bugs.webkit.org/show_bug.cgi?id=216477 Reviewed by Devin Rousso. There are several issues introduced in r266885, most of them related to JSValue::get methods now returning an optional. In some cases of boolean values, the optional is checked instead of the contained bool or the logic is inverted. JSONValue::getString() is problematic too because it doesn't use optional, when you call getString() and null is returned it could be because the property is not present in the object or because the property is not a string. In several cases we need to know that so we need to first get the value and then call asString(9 instead of calling getString() directly. * Session.cpp: (WebDriver::Session::handleUserPrompts): Check the value of isShowingJavaScriptDialog, not the optional. (WebDriver::parseAutomationCookie): Check also the value of the session optional bool, not only the optional. * SessionHost.cpp: (WebDriver::SessionHost::dispatchMessage): Only set the responseObject if the object is not empty. * WebDriverService.cpp: (WebDriver::WebDriverService::newWindow): Unknown values of type hint are not an error. (WebDriver::WebDriverService::deleteCookie): Fix indentation. (WebDriver::processKeyAction): Empty key value is an error, not the opposite. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformValidateCapability const): Only fail if optional values are wrong type, not if they are not present. * wpe/WebDriverServiceWPE.cpp: (WebDriver::WebDriverService::platformValidateCapability const): Ditto. Canonical link: https://commits.webkit.org/229360@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267078 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-15 06:25:04 +00:00
if (auto certificatesValue = browserOptions->getValue("certificates"_s)) {
auto certificates = certificatesValue->asArray();
if (!certificates)
return false;
[GTK] WebDriver: allow applying host-specific TLS certificates for automated sessions https://bugs.webkit.org/show_bug.cgi?id=186884 Reviewed by Carlos Garcia Campos. Source/JavaScriptCore: Add a tuple array input parameter to the StartAutomationSession DBus message, representing a list of host-and-certificate pairs that have to be allowed for a given session. This array is then unpacked and used to fill out the certificates Vector object in the SessionCapabilities struct. * inspector/remote/RemoteInspector.h: Add a GLib-specific Vector of String pairs representing hosts and the certificate file paths. * inspector/remote/glib/RemoteInspectorServer.cpp: Source/WebDriver: Start handling the 'certificates' capability for the GTK+ port. This is a list of host-certificate pairs that should be marked as allowed for a given automation session. This object should be positioned inside the 'webkitgtk:browserOptions' dictionary in the capabilities JSON. * Capabilities.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::startAutomationSession): Include any host-certificate pairs in the StartAutomationSession DBus message. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformValidateCapability const): Properly validate the 'certificates' value, if present. (WebDriver::WebDriverService::platformParseCapabilities const): Properly parse the 'certificates' value, if present, and extract the host-certificate pairs. Source/WebKit: * UIProcess/API/glib/WebKitAutomationSession.cpp: (webkitAutomationSessionCreate): Handle any host-certificate pair that's been set for this session, creating a GTlsCertificate object through loading from the specified certificate path and marking that certificate as allowed for the specified host through the webkit_web_context_allow_tls_certificate_for_host() API. Canonical link: https://commits.webkit.org/202135@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233035 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-21 11:03:58 +00:00
unsigned certificatesLength = certificates->length();
for (unsigned i = 0; i < certificatesLength; ++i) {
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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 of `Page.setForcedAppearance` must be marked `optional` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 of `Page.setForcedAppearance` must be marked `optional` 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 invoking `Page.setForcedAppearance` to instead not provide an `appearance` parameter at all when wanting to "unset" it. * UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createConsoleSettingsView): Now that all logging channels matching a `Console.ChannelSource` are returned instead of just the hardcoded list, check for a matching `WI.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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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` has `Page` and `Viewport` enum values, but `WebAutomationSession` checks for `"Page"` and `"LayoutViewport"`. Add a `LayoutViewport` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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. Use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`as*` so that values can be more easily manipulated and can be confidently assumed to exist. Remove unused overloads and allow subclasses to call `as*` instead of `openAccessors` 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: Canonical link: https://commits.webkit.org/229208@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-10 19:23:17 +00:00
auto certificate = certificates->get(i)->asObject();
if (!certificate)
[GTK] WebDriver: allow applying host-specific TLS certificates for automated sessions https://bugs.webkit.org/show_bug.cgi?id=186884 Reviewed by Carlos Garcia Campos. Source/JavaScriptCore: Add a tuple array input parameter to the StartAutomationSession DBus message, representing a list of host-and-certificate pairs that have to be allowed for a given session. This array is then unpacked and used to fill out the certificates Vector object in the SessionCapabilities struct. * inspector/remote/RemoteInspector.h: Add a GLib-specific Vector of String pairs representing hosts and the certificate file paths. * inspector/remote/glib/RemoteInspectorServer.cpp: Source/WebDriver: Start handling the 'certificates' capability for the GTK+ port. This is a list of host-certificate pairs that should be marked as allowed for a given automation session. This object should be positioned inside the 'webkitgtk:browserOptions' dictionary in the capabilities JSON. * Capabilities.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::startAutomationSession): Include any host-certificate pairs in the StartAutomationSession DBus message. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformValidateCapability const): Properly validate the 'certificates' value, if present. (WebDriver::WebDriverService::platformParseCapabilities const): Properly parse the 'certificates' value, if present, and extract the host-certificate pairs. Source/WebKit: * UIProcess/API/glib/WebKitAutomationSession.cpp: (webkitAutomationSessionCreate): Handle any host-certificate pair that's been set for this session, creating a GTlsCertificate object through loading from the specified certificate path and marking that certificate as allowed for the specified host through the webkit_web_context_allow_tls_certificate_for_host() API. Canonical link: https://commits.webkit.org/202135@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233035 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-21 11:03:58 +00:00
return false;
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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 of `Page.setForcedAppearance` must be marked `optional` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 of `Page.setForcedAppearance` must be marked `optional` 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 invoking `Page.setForcedAppearance` to instead not provide an `appearance` parameter at all when wanting to "unset" it. * UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createConsoleSettingsView): Now that all logging channels matching a `Console.ChannelSource` are returned instead of just the hardcoded list, check for a matching `WI.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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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` has `Page` and `Viewport` enum values, but `WebAutomationSession` checks for `"Page"` and `"LayoutViewport"`. Add a `LayoutViewport` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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. Use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`as*` so that values can be more easily manipulated and can be confidently assumed to exist. Remove unused overloads and allow subclasses to call `as*` instead of `openAccessors` 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: Canonical link: https://commits.webkit.org/229208@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-10 19:23:17 +00:00
auto host = certificate->getString("host"_s);
if (!host)
[GTK] WebDriver: allow applying host-specific TLS certificates for automated sessions https://bugs.webkit.org/show_bug.cgi?id=186884 Reviewed by Carlos Garcia Campos. Source/JavaScriptCore: Add a tuple array input parameter to the StartAutomationSession DBus message, representing a list of host-and-certificate pairs that have to be allowed for a given session. This array is then unpacked and used to fill out the certificates Vector object in the SessionCapabilities struct. * inspector/remote/RemoteInspector.h: Add a GLib-specific Vector of String pairs representing hosts and the certificate file paths. * inspector/remote/glib/RemoteInspectorServer.cpp: Source/WebDriver: Start handling the 'certificates' capability for the GTK+ port. This is a list of host-certificate pairs that should be marked as allowed for a given automation session. This object should be positioned inside the 'webkitgtk:browserOptions' dictionary in the capabilities JSON. * Capabilities.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::startAutomationSession): Include any host-certificate pairs in the StartAutomationSession DBus message. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformValidateCapability const): Properly validate the 'certificates' value, if present. (WebDriver::WebDriverService::platformParseCapabilities const): Properly parse the 'certificates' value, if present, and extract the host-certificate pairs. Source/WebKit: * UIProcess/API/glib/WebKitAutomationSession.cpp: (webkitAutomationSessionCreate): Handle any host-certificate pair that's been set for this session, creating a GTlsCertificate object through loading from the specified certificate path and marking that certificate as allowed for the specified host through the webkit_web_context_allow_tls_certificate_for_host() API. Canonical link: https://commits.webkit.org/202135@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233035 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-21 11:03:58 +00:00
return false;
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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 of `Page.setForcedAppearance` must be marked `optional` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 of `Page.setForcedAppearance` must be marked `optional` 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 invoking `Page.setForcedAppearance` to instead not provide an `appearance` parameter at all when wanting to "unset" it. * UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createConsoleSettingsView): Now that all logging channels matching a `Console.ChannelSource` are returned instead of just the hardcoded list, check for a matching `WI.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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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` has `Page` and `Viewport` enum values, but `WebAutomationSession` checks for `"Page"` and `"LayoutViewport"`. Add a `LayoutViewport` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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. Use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`as*` so that values can be more easily manipulated and can be confidently assumed to exist. Remove unused overloads and allow subclasses to call `as*` instead of `openAccessors` 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: Canonical link: https://commits.webkit.org/229208@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-10 19:23:17 +00:00
auto certificateFile = certificate->getString("certificateFile"_s);
if (!certificateFile)
[GTK] WebDriver: allow applying host-specific TLS certificates for automated sessions https://bugs.webkit.org/show_bug.cgi?id=186884 Reviewed by Carlos Garcia Campos. Source/JavaScriptCore: Add a tuple array input parameter to the StartAutomationSession DBus message, representing a list of host-and-certificate pairs that have to be allowed for a given session. This array is then unpacked and used to fill out the certificates Vector object in the SessionCapabilities struct. * inspector/remote/RemoteInspector.h: Add a GLib-specific Vector of String pairs representing hosts and the certificate file paths. * inspector/remote/glib/RemoteInspectorServer.cpp: Source/WebDriver: Start handling the 'certificates' capability for the GTK+ port. This is a list of host-certificate pairs that should be marked as allowed for a given automation session. This object should be positioned inside the 'webkitgtk:browserOptions' dictionary in the capabilities JSON. * Capabilities.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::startAutomationSession): Include any host-certificate pairs in the StartAutomationSession DBus message. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformValidateCapability const): Properly validate the 'certificates' value, if present. (WebDriver::WebDriverService::platformParseCapabilities const): Properly parse the 'certificates' value, if present, and extract the host-certificate pairs. Source/WebKit: * UIProcess/API/glib/WebKitAutomationSession.cpp: (webkitAutomationSessionCreate): Handle any host-certificate pair that's been set for this session, creating a GTlsCertificate object through loading from the specified certificate path and marking that certificate as allowed for the specified host through the webkit_web_context_allow_tls_certificate_for_host() API. Canonical link: https://commits.webkit.org/202135@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233035 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-21 11:03:58 +00:00
return false;
}
}
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
return true;
}
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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 of `Page.setForcedAppearance` must be marked `optional` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 of `Page.setForcedAppearance` must be marked `optional` 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 invoking `Page.setForcedAppearance` to instead not provide an `appearance` parameter at all when wanting to "unset" it. * UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createConsoleSettingsView): Now that all logging channels matching a `Console.ChannelSource` are returned instead of just the hardcoded list, check for a matching `WI.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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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` has `Page` and `Viewport` enum values, but `WebAutomationSession` checks for `"Page"` and `"LayoutViewport"`. Add a `LayoutViewport` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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. Use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`as*` so that values can be more easily manipulated and can be confidently assumed to exist. Remove unused overloads and allow subclasses to call `as*` instead of `openAccessors` 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: Canonical link: https://commits.webkit.org/229208@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-10 19:23:17 +00:00
bool WebDriverService::platformMatchCapability(const String&, const Ref<JSON::Value>&) const
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
{
WebDriver: test imported/w3c/webdriver/tests/sessions/new_session/merge.py::test_merge_browserName fails https://bugs.webkit.org/show_bug.cgi?id=181985 Reviewed by Carlos Alberto Lopez Perez. Source/WebDriver: The problem is that we are considering a failure when the browser name doesn't match the capabilities, instead of trying with the next merged capabilities. This is happening because when processing capabilities, we only match the ones that we know without having to launch the browser. Browser name and version are provided by the browser during the session initialization. This patch reworks the session creation to make it possible to try with the next merged capabilities when matching fails after the browser is launched. * Session.cpp: (WebDriver::Session::Session): Initialize timeouts from capabilities, because now we have the final capabilities here. (WebDriver::Session::id const): Return the session ID from the SessionHost, since it's now created there. (WebDriver::Session::createTopLevelBrowsingContext): Do not start the session, it has already been started a this point. (WebDriver::Session::createElement): Use id() instead of m_id. * Session.h: * SessionHost.h: (WebDriver::SessionHost::sessionID const): Return the session ID. * WebDriverService.cpp: (WebDriver::WebDriverService::matchCapabilities const): Remove the error handling, and return a boolean instead, since not mathing is not an error. (WebDriver::WebDriverService::processCapabilities const): Return a list of matched capabilities, instead of the JSON object corresponding to the first match. (WebDriver::WebDriverService::newSession): Use helper connectToBrowser(). (WebDriver::WebDriverService::connectToBrowser): Create a session host for the next merged capabilities and connect to the browser. (WebDriver::WebDriverService::createSession): Start a new automation session. If capabilities didn't match, start the process again calling connectToBrowser(), otherwise create the new session and top level. * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::matchBrowserOptions): Helper to check browser options. (WebDriver::SessionHost::matchCapabilities): Use matchBrowserOptions() and return true or false instead of an optional error message. (WebDriver::SessionHost::startAutomationSession): Create the session ID here and notify the caller in case capabilities didn't match. (WebDriver::SessionHost::setTargetList): Notify that capabilities did match. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformMatchCapability const): Make it return bool. * wpe/WebDriverServiceWPE.cpp: (WebDriver::WebDriverService::platformMatchCapability const): Ditto. WebDriverTests: Remove expectations for imported/w3c/webdriver/tests/sessions/new_session/merge.py::test_merge_browserName. * TestExpectations.json: Canonical link: https://commits.webkit.org/197938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227603 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-25 13:52:40 +00:00
return true;
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
}
Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h https://bugs.webkit.org/show_bug.cgi?id=173793 Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2017-11-14 Source/JavaScriptCore: Reviewed by Joseph Pecoraro. Based on patch by Brian Burg. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bindings/ScriptValue.cpp: (Inspector::jsToInspectorValue): (Inspector::toInspectorValue): (Deprecated::ScriptValue::toInspectorValue const): * bindings/ScriptValue.h: * inspector/AsyncStackTrace.cpp: * inspector/ConsoleMessage.cpp: * inspector/ContentSearchUtilities.cpp: * inspector/DeprecatedInspectorValues.cpp: Added. * inspector/DeprecatedInspectorValues.h: Added. Keep the old symbols around in JavaScriptCore so that builds with the public iOS SDK continue to work. These older SDKs include a version of WebInspector.framework that expects to find InspectorArray and other symbols in JavaScriptCore.framework. * inspector/InjectedScript.cpp: (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::wrapTable const): (Inspector::InjectedScript::previewValue const): (Inspector::InjectedScript::setExceptionValue): (Inspector::InjectedScript::clearExceptionValue): (Inspector::InjectedScript::inspectObject): (Inspector::InjectedScript::releaseObject): * inspector/InjectedScriptBase.cpp: (Inspector::InjectedScriptBase::makeCall): (Inspector::InjectedScriptBase::makeEvalCall): * inspector/InjectedScriptBase.h: * inspector/InjectedScriptManager.cpp: (Inspector::InjectedScriptManager::injectedScriptForObjectId): * inspector/InspectorBackendDispatcher.cpp: (Inspector::BackendDispatcher::CallbackBase::sendSuccess): (Inspector::BackendDispatcher::dispatch): (Inspector::BackendDispatcher::sendResponse): (Inspector::BackendDispatcher::sendPendingErrors): (Inspector::BackendDispatcher::getPropertyValue): (Inspector::castToInteger): (Inspector::castToNumber): (Inspector::BackendDispatcher::getInteger): (Inspector::BackendDispatcher::getDouble): (Inspector::BackendDispatcher::getString): (Inspector::BackendDispatcher::getBoolean): (Inspector::BackendDispatcher::getObject): (Inspector::BackendDispatcher::getArray): (Inspector::BackendDispatcher::getValue): * inspector/InspectorBackendDispatcher.h: We need to keep around the sendResponse() variant with a parameter that has the InspectorObject type, as older WebInspector.framework versions expect this symbol to exist. Introduce a variant with arity 3 that can be used in TOT so as to avoid having two methods with the same name, arity, and different parameter types. When system WebInspector.framework is updated, we can remove the legacy method variant that uses the InspectorObject type. At that point, we can transition TOT to use the 2-arity variant, and delete the 3-arity variant when system WebInspector.framework is updated once more to use the 2-arity one. * inspector/InspectorProtocolTypes.h: (Inspector::Protocol::Array::openAccessors): (Inspector::Protocol::PrimitiveBindingTraits::assertValueHasExpectedType): (Inspector::Protocol::BindingTraits<Protocol::Array<T>>::runtimeCast): (Inspector::Protocol::BindingTraits<Protocol::Array<T>>::assertValueHasExpectedType): (Inspector::Protocol::BindingTraits<JSON::Value>::assertValueHasExpectedType): * inspector/ScriptCallFrame.cpp: * inspector/ScriptCallStack.cpp: * inspector/agents/InspectorAgent.cpp: (Inspector::InspectorAgent::inspect): * inspector/agents/InspectorAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::buildAssertPauseReason): (Inspector::buildCSPViolationPauseReason): (Inspector::InspectorDebuggerAgent::buildBreakpointPauseReason): (Inspector::InspectorDebuggerAgent::buildExceptionPauseReason): (Inspector::buildObjectForBreakpointCookie): (Inspector::InspectorDebuggerAgent::breakpointActionsFromProtocol): (Inspector::parseLocation): (Inspector::InspectorDebuggerAgent::setBreakpointByUrl): (Inspector::InspectorDebuggerAgent::setBreakpoint): (Inspector::InspectorDebuggerAgent::continueToLocation): (Inspector::InspectorDebuggerAgent::schedulePauseOnNextStatement): (Inspector::InspectorDebuggerAgent::didParseSource): (Inspector::InspectorDebuggerAgent::breakProgram): * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::callFunctionOn): (Inspector::InspectorRuntimeAgent::saveResult): (Inspector::InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets): * inspector/agents/InspectorRuntimeAgent.h: * inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py: (CppBackendDispatcherHeaderGenerator._generate_dispatcher_declaration_for_command): * inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py: (CppBackendDispatcherImplementationGenerator.generate_output): (CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command): * inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py: (CppFrontendDispatcherHeaderGenerator.generate_output): * inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py: (CppFrontendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_event): * inspector/scripts/codegen/generate_cpp_protocol_types_header.py: (_generate_unchecked_setter_for_member): * inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py: (CppProtocolTypesImplementationGenerator): * inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py: (ObjCBackendDispatcherImplementationGenerator.generate_output): (ObjCBackendDispatcherImplementationGenerator._generate_success_block_for_command): * inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py: (ObjCFrontendDispatcherImplementationGenerator.generate_output): (ObjCFrontendDispatcherImplementationGenerator._generate_event): (ObjCFrontendDispatcherImplementationGenerator._generate_event_out_parameters): * inspector/scripts/codegen/generate_objc_internal_header.py: (ObjCInternalHeaderGenerator.generate_output): * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator.generate_output): * inspector/scripts/codegen/generator.py: * inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result: * inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result: * inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result: * inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result: * inspector/scripts/tests/generic/expected/domain-availability.json-result: * inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result: * inspector/scripts/tests/generic/expected/enum-values.json-result: * inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result: * inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result: * inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result: * inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result: * inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result: * inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result: * inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result: * inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result: * inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result: * inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result: * inspector/scripts/tests/generic/expected/worker-supported-domains.json-result: * inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result: * inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result: Source/WebCore: Reviewed by Joseph Pecoraro. Based on patch by Brian Burg. * ForwardingHeaders/inspector/InspectorValues.h: Removed. * Modules/encryptedmedia/InitDataRegistry.cpp: (WebCore::extractKeyIDsKeyids): (WebCore::sanitizeKeyids): * html/parser/XSSAuditorDelegate.cpp: (WebCore::XSSAuditorDelegate::generateViolationReport): * inspector/CommandLineAPIHost.cpp: (WebCore::CommandLineAPIHost::inspect): * inspector/CommandLineAPIHost.h: * inspector/InspectorCanvas.cpp: (WebCore::InspectorCanvas::recordAction): (WebCore::InspectorCanvas::releaseData): (WebCore::InspectorCanvas::indexForData): (WebCore::buildArrayForVector): (WebCore::InspectorCanvas::buildInitialState): (WebCore::InspectorCanvas::buildAction): (WebCore::InspectorCanvas::buildArrayForCanvasGradient): (WebCore::InspectorCanvas::buildArrayForCanvasPattern): (WebCore::InspectorCanvas::buildArrayForImageData): (WebCore::InspectorCanvas::buildArrayForImageBitmap): * inspector/InspectorCanvas.h: * inspector/InspectorDatabaseResource.cpp: * inspector/InspectorOverlay.cpp: (WebCore::evaluateCommandInOverlay): (WebCore::InspectorOverlay::evaluateInOverlay): * inspector/InspectorOverlay.h: * inspector/InspectorShaderProgram.h: * inspector/InspectorStyleSheet.h: (WebCore::InspectorCSSId::InspectorCSSId): * inspector/TimelineRecordFactory.cpp: (WebCore::TimelineRecordFactory::createGenericRecord): (WebCore::TimelineRecordFactory::createFunctionCallData): (WebCore::TimelineRecordFactory::createConsoleProfileData): (WebCore::TimelineRecordFactory::createProbeSampleData): (WebCore::TimelineRecordFactory::createEventDispatchData): (WebCore::TimelineRecordFactory::createGenericTimerData): (WebCore::TimelineRecordFactory::createTimerInstallData): (WebCore::TimelineRecordFactory::createEvaluateScriptData): (WebCore::TimelineRecordFactory::createTimeStampData): (WebCore::TimelineRecordFactory::createAnimationFrameData): (WebCore::createQuad): (WebCore::TimelineRecordFactory::createPaintData): (WebCore::TimelineRecordFactory::appendLayoutRoot): * inspector/TimelineRecordFactory.h: * inspector/agents/InspectorApplicationCacheAgent.cpp: * inspector/agents/InspectorApplicationCacheAgent.h: * inspector/agents/InspectorCSSAgent.cpp: (WebCore::computePseudoClassMask): (WebCore::InspectorCSSAgent::setStyleText): (WebCore::InspectorCSSAgent::setRuleSelector): (WebCore::InspectorCSSAgent::forcePseudoState): * inspector/agents/InspectorCSSAgent.h: * inspector/agents/InspectorDOMAgent.cpp: (WebCore::parseColor): (WebCore::parseConfigColor): (WebCore::parseQuad): (WebCore::InspectorDOMAgent::performSearch): (WebCore::InspectorDOMAgent::setSearchingForNode): (WebCore::InspectorDOMAgent::highlightConfigFromInspectorObject): (WebCore::InspectorDOMAgent::setInspectModeEnabled): (WebCore::InspectorDOMAgent::highlightRect): (WebCore::InspectorDOMAgent::highlightQuad): (WebCore::InspectorDOMAgent::innerHighlightQuad): (WebCore::InspectorDOMAgent::highlightSelector): (WebCore::InspectorDOMAgent::highlightNode): (WebCore::InspectorDOMAgent::highlightNodeList): (WebCore::InspectorDOMAgent::highlightFrame): * inspector/agents/InspectorDOMAgent.h: * inspector/agents/InspectorDOMDebuggerAgent.cpp: (WebCore::InspectorDOMDebuggerAgent::didInvalidateStyleAttr): (WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode): (WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode): (WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr): (WebCore::InspectorDOMDebuggerAgent::descriptionForDOMEvent): (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded): (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest): * inspector/agents/InspectorDOMDebuggerAgent.h: * inspector/agents/InspectorDOMStorageAgent.cpp: (WebCore::InspectorDOMStorageAgent::getDOMStorageItems): (WebCore::InspectorDOMStorageAgent::setDOMStorageItem): (WebCore::InspectorDOMStorageAgent::removeDOMStorageItem): (WebCore::InspectorDOMStorageAgent::findStorageArea): * inspector/agents/InspectorDOMStorageAgent.h: * inspector/agents/InspectorDatabaseAgent.cpp: * inspector/agents/InspectorIndexedDBAgent.cpp: (WebCore::Inspector::idbKeyFromInspectorObject): (WebCore::Inspector::idbKeyRangeFromKeyRange): (WebCore::InspectorIndexedDBAgent::requestData): * inspector/agents/InspectorIndexedDBAgent.h: * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::buildObjectForHeaders): (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse): (WebCore::InspectorNetworkAgent::setExtraHTTPHeaders): * inspector/agents/InspectorNetworkAgent.h: * inspector/agents/InspectorPageAgent.cpp: * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::setInstruments): (WebCore::InspectorTimelineAgent::internalStart): (WebCore::InspectorTimelineAgent::didInvalidateLayout): (WebCore::InspectorTimelineAgent::willLayout): (WebCore::InspectorTimelineAgent::didScheduleStyleRecalculation): (WebCore::InspectorTimelineAgent::willRecalculateStyle): (WebCore::InspectorTimelineAgent::willComposite): (WebCore::InspectorTimelineAgent::willPaint): (WebCore::InspectorTimelineAgent::addRecordToTimeline): (WebCore::InspectorTimelineAgent::setFrameIdentifier): (WebCore::InspectorTimelineAgent::appendRecord): (WebCore::InspectorTimelineAgent::sendEvent): (WebCore::InspectorTimelineAgent::createRecordEntry): (WebCore::InspectorTimelineAgent::pushCurrentRecord): * inspector/agents/InspectorTimelineAgent.h: * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::reportViolation const): * platform/encryptedmedia/clearkey/CDMClearKey.cpp: (WebCore::parseJSONObject): (WebCore::parseLicenseFormat): (WebCore::parseLicenseReleaseAcknowledgementFormat): (WebCore::CDMInstanceClearKey::updateLicense): (WebCore::CDMInstanceClearKey::removeSessionData): * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp: (WebCore::extractSinfData): * testing/Internals.cpp: Source/WebDriver: Reviewed by Joseph Pecoraro. * CMakeLists.txt: * CommandResult.cpp: (WebDriver::CommandResult::CommandResult): * CommandResult.h: (WebDriver::CommandResult::success): (WebDriver::CommandResult::fail): (WebDriver::CommandResult::result const): (WebDriver::CommandResult::setAdditionalErrorData): (WebDriver::CommandResult::additionalErrorData const): * Session.cpp: (WebDriver::firstWindowHandleInResult): (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::switchToFrame): (WebDriver::Session::switchToParentFrame): (WebDriver::Session::getToplevelBrowsingContextRect): (WebDriver::Session::moveToplevelBrowsingContextWindow): (WebDriver::Session::resizeToplevelBrowsingContextWindow): (WebDriver::Session::createElement): (WebDriver::Session::extractElement): (WebDriver::Session::extractElementID): (WebDriver::Session::computeElementLayout): (WebDriver::Session::findElements): (WebDriver::Session::isElementSelected): (WebDriver::Session::getElementText): (WebDriver::Session::getElementTagName): (WebDriver::Session::getElementRect): (WebDriver::Session::isElementEnabled): (WebDriver::Session::isElementDisplayed): (WebDriver::Session::getElementAttribute): (WebDriver::Session::waitForNavigationToComplete): (WebDriver::Session::selectOptionElement): (WebDriver::Session::elementClick): (WebDriver::Session::elementClear): (WebDriver::Session::elementSendKeys): (WebDriver::Session::elementSubmit): (WebDriver::Session::handleScriptResult): (WebDriver::Session::executeScript): (WebDriver::Session::performMouseInteraction): (WebDriver::Session::performKeyboardInteractions): (WebDriver::parseAutomationCookie): (WebDriver::builtAutomationCookie): (WebDriver::serializeCookie): (WebDriver::Session::getAllCookies): (WebDriver::Session::getNamedCookie): (WebDriver::Session::addCookie): (WebDriver::Session::deleteCookie): (WebDriver::Session::deleteAllCookies): (WebDriver::Session::dismissAlert): (WebDriver::Session::acceptAlert): (WebDriver::Session::getAlertText): (WebDriver::Session::sendAlertText): (WebDriver::Session::takeScreenshot): * Session.h: * SessionHost.cpp: (WebDriver::SessionHost::sendCommandToBackend): (WebDriver::SessionHost::dispatchMessage): * SessionHost.h: * WebDriverService.cpp: (WebDriver::WebDriverService::handleRequest): (WebDriver::WebDriverService::sendResponse const): (WebDriver::deserializeTimeouts): (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::newSession): (WebDriver::WebDriverService::deleteSession): (WebDriver::WebDriverService::setTimeouts): (WebDriver::WebDriverService::go): (WebDriver::WebDriverService::getCurrentURL): (WebDriver::WebDriverService::back): (WebDriver::WebDriverService::forward): (WebDriver::WebDriverService::refresh): (WebDriver::WebDriverService::getTitle): (WebDriver::WebDriverService::getWindowHandle): (WebDriver::WebDriverService::getWindowRect): (WebDriver::valueAsNumberInRange): (WebDriver::WebDriverService::setWindowRect): (WebDriver::WebDriverService::closeWindow): (WebDriver::WebDriverService::switchToWindow): (WebDriver::WebDriverService::getWindowHandles): (WebDriver::WebDriverService::switchToFrame): (WebDriver::WebDriverService::switchToParentFrame): (WebDriver::findElementOrCompleteWithError): (WebDriver::findStrategyAndSelectorOrCompleteWithError): (WebDriver::WebDriverService::findElement): (WebDriver::WebDriverService::findElements): (WebDriver::WebDriverService::findElementFromElement): (WebDriver::WebDriverService::findElementsFromElement): (WebDriver::WebDriverService::isElementSelected): (WebDriver::WebDriverService::getElementAttribute): (WebDriver::WebDriverService::getElementText): (WebDriver::WebDriverService::getElementTagName): (WebDriver::WebDriverService::getElementRect): (WebDriver::WebDriverService::isElementEnabled): (WebDriver::WebDriverService::isElementDisplayed): (WebDriver::WebDriverService::elementClick): (WebDriver::WebDriverService::elementClear): (WebDriver::WebDriverService::elementSendKeys): (WebDriver::WebDriverService::elementSubmit): (WebDriver::findScriptAndArgumentsOrCompleteWithError): (WebDriver::WebDriverService::executeScript): (WebDriver::WebDriverService::executeAsyncScript): (WebDriver::WebDriverService::getAllCookies): (WebDriver::WebDriverService::getNamedCookie): (WebDriver::deserializeCookie): (WebDriver::WebDriverService::addCookie): (WebDriver::WebDriverService::deleteCookie): (WebDriver::WebDriverService::deleteAllCookies): (WebDriver::WebDriverService::dismissAlert): (WebDriver::WebDriverService::acceptAlert): (WebDriver::WebDriverService::getAlertText): (WebDriver::WebDriverService::sendAlertText): (WebDriver::WebDriverService::takeScreenshot): (WebDriver::WebDriverService::takeElementScreenshot): * WebDriverService.h: * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformValidateCapability const): (WebDriver::WebDriverService::platformMatchCapability const): (WebDriver::WebDriverService::platformParseCapabilities const): * wpe/WebDriverServiceWPE.cpp: (WebDriver::WebDriverService::platformValidateCapability const): (WebDriver::WebDriverService::platformMatchCapability const): (WebDriver::WebDriverService::platformParseCapabilities const): Source/WebKit: Reviewed by Joseph Pecocaro. Based on patch by Brian Burg. * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::resizeWindowOfBrowsingContext): (WebKit::WebAutomationSession::moveWindowOfBrowsingContext): (WebKit::WebAutomationSession::waitForNavigationToCompleteOnPage): (WebKit::WebAutomationSession::waitForNavigationToCompleteOnFrame): (WebKit::WebAutomationSession::respondToPendingPageNavigationCallbacksWithTimeout): (WebKit::WebAutomationSession::respondToPendingFrameNavigationCallbacksWithTimeout): (WebKit::WebAutomationSession::navigationOccurredForFrame): (WebKit::WebAutomationSession::documentLoadedForFrame): (WebKit::WebAutomationSession::inspectorFrontendLoaded): (WebKit::WebAutomationSession::keyboardEventsFlushedForPage): (WebKit::WebAutomationSession::evaluateJavaScriptFunction): (WebKit::WebAutomationSession::setFilesToSelectForFileUpload): (WebKit::WebAutomationSession::addSingleCookie): (WebKit::WebAutomationSession::setSessionPermissions): (WebKit::WebAutomationSession::performMouseInteraction): (WebKit::WebAutomationSession::performKeyboardInteractions): * UIProcess/Automation/WebAutomationSession.h: Source/WTF: Reviewed by Joseph Pecoraro. Based on patch by Brian Burg. Move the implementation into WTF. Put the actual implementation inside namespace WTF::JSONImpl so that the symbols in libwtf start with the WTF prefix. Also provide a top-level JSON namespace so that clients can write JSON::Value. This is essentially a typedef for the entire WTF::JSONImpl namespace. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/JSONValues.cpp: Renamed from Source/JavaScriptCore/inspector/InspectorValues.cpp. (JSON::Value::null): (JSON::Value::create): (JSON::Value::asValue): (JSON::Value::asObject): (JSON::Value::asArray): (JSON::Value::parseJSON): (JSON::Value::toJSONString const): (JSON::Value::asBoolean const): (JSON::Value::asDouble const): (JSON::Value::asInteger const): (JSON::Value::asString const): (JSON::Value::writeJSON const): (JSON::Value::memoryCost const): (JSON::ObjectBase::~ObjectBase): (JSON::ObjectBase::asObject): (JSON::ObjectBase::openAccessors): (JSON::ObjectBase::memoryCost const): (JSON::ObjectBase::getBoolean const): (JSON::ObjectBase::getString const): (JSON::ObjectBase::getObject const): (JSON::ObjectBase::getArray const): (JSON::ObjectBase::getValue const): (JSON::ObjectBase::remove): (JSON::ObjectBase::writeJSON const): (JSON::ObjectBase::ObjectBase): (JSON::ArrayBase::~ArrayBase): (JSON::ArrayBase::asArray): (JSON::ArrayBase::writeJSON const): (JSON::ArrayBase::ArrayBase): (JSON::ArrayBase::get const): (JSON::Object::create): (JSON::Array::create): (JSON::ArrayBase::memoryCost const): * wtf/JSONValues.h: Renamed from Source/JavaScriptCore/inspector/InspectorValues.h. (JSON::ObjectBase::find): (JSON::ObjectBase::find const): (JSON::ObjectBase::setBoolean): (JSON::ObjectBase::setInteger): (JSON::ObjectBase::setDouble): (JSON::ObjectBase::setString): (JSON::ObjectBase::setValue): (JSON::ObjectBase::setObject): (JSON::ObjectBase::setArray): (JSON::ArrayBase::pushBoolean): (JSON::ArrayBase::pushInteger): (JSON::ArrayBase::pushDouble): (JSON::ArrayBase::pushString): (JSON::ArrayBase::pushValue): (JSON::ArrayBase::pushObject): (JSON::ArrayBase::pushArray): Tools: Reviewed by Joseph Pecoraro. * TestWebKitAPI/CMakeLists.txt: * TestWebKitAPI/PlatformGTK.cmake: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WTF/JSONValue.cpp: Renamed from Tools/TestWebKitAPI/Tests/JavaScriptCore/InspectorValue.cpp. (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/196092@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225231 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-11-28 19:58:16 +00:00
void WebDriverService::platformParseCapabilities(const JSON::Object& matchedCapabilities, Capabilities& capabilities) const
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
{
capabilities.browserBinary = String(LIBEXECDIR "/webkit2gtk-" WEBKITGTK_API_VERSION_STRING "/MiniBrowser");
[WTF] Add user-defined literal for ASCIILiteral https://bugs.webkit.org/show_bug.cgi?id=186839 Reviewed by Darin Adler. Source/JavaScriptCore: * API/JSCallbackObjectFunctions.h: (JSC::JSCallbackObject<Parent>::staticFunctionGetter): (JSC::JSCallbackObject<Parent>::callbackGetter): * API/JSObjectRef.cpp: (JSObjectMakeFunctionWithCallback): * API/JSTypedArray.cpp: (JSObjectGetArrayBufferBytesPtr): * API/JSValue.mm: (valueToArray): (valueToDictionary): * API/ObjCCallbackFunction.mm: (JSC::objCCallbackFunctionCallAsFunction): (JSC::objCCallbackFunctionCallAsConstructor): (JSC::ObjCCallbackFunctionImpl::call): * API/glib/JSCCallbackFunction.cpp: (JSC::JSCCallbackFunction::call): (JSC::JSCCallbackFunction::construct): * API/glib/JSCContext.cpp: (jscContextJSValueToGValue): * API/glib/JSCValue.cpp: (jsc_value_object_define_property_accessor): (jscValueFunctionCreate): * builtins/BuiltinUtils.h: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::nameForRegister): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitEnumeration): (JSC::BytecodeGenerator::emitIteratorNext): (JSC::BytecodeGenerator::emitIteratorClose): (JSC::BytecodeGenerator::emitDelegateYield): * bytecompiler/NodesCodegen.cpp: (JSC::FunctionCallValueNode::emitBytecode): (JSC::PostfixNode::emitBytecode): (JSC::PrefixNode::emitBytecode): (JSC::AssignErrorNode::emitBytecode): (JSC::ForInNode::emitBytecode): (JSC::ForOfNode::emitBytecode): (JSC::ClassExprNode::emitBytecode): (JSC::ObjectPatternNode::bindValue const): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): * dfg/DFGOperations.cpp: (JSC::DFG::newTypedArrayWithSize): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * inspector/ConsoleMessage.cpp: (Inspector::ConsoleMessage::addToFrontend): (Inspector::ConsoleMessage::clear): * inspector/ContentSearchUtilities.cpp: (Inspector::ContentSearchUtilities::findStylesheetSourceMapURL): * inspector/InjectedScript.cpp: (Inspector::InjectedScript::InjectedScript): (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::InjectedScript::setExceptionValue): (Inspector::InjectedScript::clearExceptionValue): (Inspector::InjectedScript::findObjectById const): (Inspector::InjectedScript::inspectObject): (Inspector::InjectedScript::releaseObject): (Inspector::InjectedScript::releaseObjectGroup): * inspector/InjectedScriptBase.cpp: (Inspector::InjectedScriptBase::makeEvalCall): * inspector/InjectedScriptManager.cpp: (Inspector::InjectedScriptManager::injectedScriptForObjectId): * inspector/InjectedScriptModule.cpp: (Inspector::InjectedScriptModule::ensureInjected): * inspector/InspectorBackendDispatcher.cpp: (Inspector::BackendDispatcher::dispatch): (Inspector::BackendDispatcher::sendResponse): (Inspector::BackendDispatcher::sendPendingErrors): * inspector/JSGlobalObjectConsoleClient.cpp: (Inspector::JSGlobalObjectConsoleClient::profile): (Inspector::JSGlobalObjectConsoleClient::profileEnd): (Inspector::JSGlobalObjectConsoleClient::timeStamp): * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::appendAPIBacktrace): * inspector/JSInjectedScriptHost.cpp: (Inspector::JSInjectedScriptHost::evaluateWithScopeExtension): (Inspector::JSInjectedScriptHost::subtype): (Inspector::JSInjectedScriptHost::getInternalProperties): * inspector/JSJavaScriptCallFrame.cpp: (Inspector::JSJavaScriptCallFrame::evaluateWithScopeExtension): (Inspector::JSJavaScriptCallFrame::type const): * inspector/ScriptArguments.cpp: (Inspector::ScriptArguments::getFirstArgumentAsString): * inspector/ScriptCallStackFactory.cpp: (Inspector::extractSourceInformationFromException): * inspector/agents/InspectorAgent.cpp: (Inspector::InspectorAgent::InspectorAgent): * inspector/agents/InspectorConsoleAgent.cpp: (Inspector::InspectorConsoleAgent::InspectorConsoleAgent): (Inspector::InspectorConsoleAgent::clearMessages): (Inspector::InspectorConsoleAgent::count): (Inspector::InspectorConsoleAgent::setLoggingChannelLevel): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::InspectorDebuggerAgent): (Inspector::InspectorDebuggerAgent::setAsyncStackTraceDepth): (Inspector::buildObjectForBreakpointCookie): (Inspector::InspectorDebuggerAgent::breakpointActionsFromProtocol): (Inspector::parseLocation): (Inspector::InspectorDebuggerAgent::setBreakpointByUrl): (Inspector::InspectorDebuggerAgent::setBreakpoint): (Inspector::InspectorDebuggerAgent::continueToLocation): (Inspector::InspectorDebuggerAgent::searchInContent): (Inspector::InspectorDebuggerAgent::getScriptSource): (Inspector::InspectorDebuggerAgent::getFunctionDetails): (Inspector::InspectorDebuggerAgent::resume): (Inspector::InspectorDebuggerAgent::setPauseOnExceptions): (Inspector::InspectorDebuggerAgent::evaluateOnCallFrame): (Inspector::InspectorDebuggerAgent::didParseSource): (Inspector::InspectorDebuggerAgent::assertPaused): * inspector/agents/InspectorHeapAgent.cpp: (Inspector::InspectorHeapAgent::InspectorHeapAgent): (Inspector::InspectorHeapAgent::nodeForHeapObjectIdentifier): (Inspector::InspectorHeapAgent::getPreview): (Inspector::InspectorHeapAgent::getRemoteObject): * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::InspectorRuntimeAgent::InspectorRuntimeAgent): (Inspector::InspectorRuntimeAgent::callFunctionOn): (Inspector::InspectorRuntimeAgent::getPreview): (Inspector::InspectorRuntimeAgent::getProperties): (Inspector::InspectorRuntimeAgent::getDisplayableProperties): (Inspector::InspectorRuntimeAgent::getCollectionEntries): (Inspector::InspectorRuntimeAgent::saveResult): (Inspector::InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets): (Inspector::InspectorRuntimeAgent::getBasicBlocks): * inspector/agents/InspectorScriptProfilerAgent.cpp: (Inspector::InspectorScriptProfilerAgent::InspectorScriptProfilerAgent): * inspector/agents/JSGlobalObjectDebuggerAgent.cpp: (Inspector::JSGlobalObjectDebuggerAgent::injectedScriptForEval): * inspector/agents/JSGlobalObjectRuntimeAgent.cpp: (Inspector::JSGlobalObjectRuntimeAgent::injectedScriptForEval): * inspector/scripts/codegen/cpp_generator_templates.py: * inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py: (CppBackendDispatcherImplementationGenerator._generate_async_dispatcher_class_for_domain): (CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command): * inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py: (CppFrontendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_event): * inspector/scripts/codegen/generate_cpp_protocol_types_header.py: * inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py: (CppProtocolTypesImplementationGenerator): * inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py: (ObjCBackendDispatcherImplementationGenerator._generate_success_block_for_command): (ObjCBackendDispatcherImplementationGenerator._generate_conversions_for_command): * inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py: (ObjCFrontendDispatcherImplementationGenerator._generate_event): (ObjCFrontendDispatcherImplementationGenerator._generate_event_out_parameters): * inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py: (ObjCProtocolTypeConversionsHeaderGenerator._generate_enum_objc_to_protocol_string): * inspector/scripts/codegen/objc_generator_templates.py: * inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result: * inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result: * inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result: * inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result: * inspector/scripts/tests/generic/expected/domain-availability.json-result: * inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result: * inspector/scripts/tests/generic/expected/enum-values.json-result: * inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result: * inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result: * inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result: * inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result: * inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result: * inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result: * inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result: * inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result: * inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result: * inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result: * inspector/scripts/tests/generic/expected/worker-supported-domains.json-result: * inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result: * inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result: * interpreter/CallFrame.cpp: (JSC::CallFrame::friendlyFunctionName): * interpreter/Interpreter.cpp: (JSC::Interpreter::execute): * interpreter/StackVisitor.cpp: (JSC::StackVisitor::Frame::functionName const): (JSC::StackVisitor::Frame::sourceURL const): * jit/JIT.cpp: (JSC::JIT::doMainThreadPreparationBeforeCompile): * jit/JITOperations.cpp: * jsc.cpp: (resolvePath): (GlobalObject::moduleLoaderImportModule): (GlobalObject::moduleLoaderResolve): (functionDescribeArray): (functionRun): (functionLoad): (functionCheckSyntax): (functionDollarEvalScript): (functionDollarAgentStart): (functionDollarAgentReceiveBroadcast): (functionDollarAgentBroadcast): (functionTransferArrayBuffer): (functionLoadModule): (functionSamplingProfilerStackTraces): (functionAsyncTestStart): (functionWebAssemblyMemoryMode): (runWithOptions): * parser/Lexer.cpp: (JSC::Lexer<T>::invalidCharacterMessage const): (JSC::Lexer<T>::parseString): (JSC::Lexer<T>::parseComplexEscape): (JSC::Lexer<T>::parseStringSlowCase): (JSC::Lexer<T>::parseTemplateLiteral): (JSC::Lexer<T>::lex): * parser/Parser.cpp: (JSC::Parser<LexerType>::parseInner): * parser/Parser.h: (JSC::Parser::setErrorMessage): * runtime/AbstractModuleRecord.cpp: (JSC::AbstractModuleRecord::finishCreation): * runtime/ArrayBuffer.cpp: (JSC::errorMesasgeForTransfer): * runtime/ArrayBufferSharingMode.h: (JSC::arrayBufferSharingModeName): * runtime/ArrayConstructor.cpp: (JSC::constructArrayWithSizeQuirk): (JSC::isArraySlowInline): * runtime/ArrayPrototype.cpp: (JSC::setLength): (JSC::shift): (JSC::unshift): (JSC::arrayProtoFuncPop): (JSC::arrayProtoFuncReverse): (JSC::arrayProtoFuncUnShift): * runtime/AtomicsObject.cpp: (JSC::atomicsFuncWait): (JSC::atomicsFuncWake): * runtime/BigIntConstructor.cpp: (JSC::BigIntConstructor::finishCreation): (JSC::toBigInt): (JSC::callBigIntConstructor): * runtime/BigIntObject.cpp: (JSC::BigIntObject::toStringName): * runtime/BigIntPrototype.cpp: (JSC::bigIntProtoFuncToString): (JSC::bigIntProtoFuncValueOf): * runtime/CommonSlowPaths.cpp: (JSC::SLOW_PATH_DECL): * runtime/ConsoleClient.cpp: (JSC::ConsoleClient::printConsoleMessageWithArguments): * runtime/ConsoleObject.cpp: (JSC::valueOrDefaultLabelString): (JSC::consoleProtoFuncTime): (JSC::consoleProtoFuncTimeEnd): * runtime/DatePrototype.cpp: (JSC::formatLocaleDate): (JSC::formateDateInstance): (JSC::DatePrototype::finishCreation): (JSC::dateProtoFuncToISOString): (JSC::dateProtoFuncToJSON): * runtime/Error.cpp: (JSC::createNotEnoughArgumentsError): (JSC::throwSyntaxError): (JSC::createTypeError): (JSC::createOutOfMemoryError): * runtime/Error.h: (JSC::throwVMError): * runtime/ErrorConstructor.cpp: (JSC::ErrorConstructor::finishCreation): * runtime/ErrorInstance.cpp: (JSC::ErrorInstance::sanitizedToString): * runtime/ErrorPrototype.cpp: (JSC::ErrorPrototype::finishCreation): (JSC::errorProtoFuncToString): * runtime/ExceptionFuzz.cpp: (JSC::doExceptionFuzzing): * runtime/ExceptionHelpers.cpp: (JSC::TerminatedExecutionError::defaultValue): (JSC::createStackOverflowError): (JSC::createNotAConstructorError): (JSC::createNotAFunctionError): (JSC::createNotAnObjectError): * runtime/GetterSetter.cpp: (JSC::callSetter): * runtime/IntlCollator.cpp: (JSC::sortLocaleData): (JSC::searchLocaleData): (JSC::IntlCollator::initializeCollator): (JSC::IntlCollator::compareStrings): (JSC::IntlCollator::usageString): (JSC::IntlCollator::sensitivityString): (JSC::IntlCollator::caseFirstString): (JSC::IntlCollator::resolvedOptions): * runtime/IntlCollator.h: * runtime/IntlCollatorConstructor.cpp: (JSC::IntlCollatorConstructor::finishCreation): * runtime/IntlCollatorPrototype.cpp: (JSC::IntlCollatorPrototypeGetterCompare): (JSC::IntlCollatorPrototypeFuncResolvedOptions): * runtime/IntlDateTimeFormat.cpp: (JSC::defaultTimeZone): (JSC::canonicalizeTimeZoneName): (JSC::IntlDTFInternal::localeData): (JSC::IntlDTFInternal::toDateTimeOptionsAnyDate): (JSC::IntlDateTimeFormat::initializeDateTimeFormat): (JSC::IntlDateTimeFormat::weekdayString): (JSC::IntlDateTimeFormat::eraString): (JSC::IntlDateTimeFormat::yearString): (JSC::IntlDateTimeFormat::monthString): (JSC::IntlDateTimeFormat::dayString): (JSC::IntlDateTimeFormat::hourString): (JSC::IntlDateTimeFormat::minuteString): (JSC::IntlDateTimeFormat::secondString): (JSC::IntlDateTimeFormat::timeZoneNameString): (JSC::IntlDateTimeFormat::resolvedOptions): (JSC::IntlDateTimeFormat::format): (JSC::IntlDateTimeFormat::partTypeString): (JSC::IntlDateTimeFormat::formatToParts): * runtime/IntlDateTimeFormat.h: * runtime/IntlDateTimeFormatConstructor.cpp: (JSC::IntlDateTimeFormatConstructor::finishCreation): * runtime/IntlDateTimeFormatPrototype.cpp: (JSC::IntlDateTimeFormatPrototypeGetterFormat): (JSC::IntlDateTimeFormatPrototypeFuncFormatToParts): (JSC::IntlDateTimeFormatPrototypeFuncResolvedOptions): * runtime/IntlNumberFormat.cpp: (JSC::IntlNumberFormat::initializeNumberFormat): (JSC::IntlNumberFormat::formatNumber): (JSC::IntlNumberFormat::styleString): (JSC::IntlNumberFormat::currencyDisplayString): (JSC::IntlNumberFormat::resolvedOptions): (JSC::IntlNumberFormat::partTypeString): (JSC::IntlNumberFormat::formatToParts): * runtime/IntlNumberFormat.h: * runtime/IntlNumberFormatConstructor.cpp: (JSC::IntlNumberFormatConstructor::finishCreation): * runtime/IntlNumberFormatPrototype.cpp: (JSC::IntlNumberFormatPrototypeGetterFormat): (JSC::IntlNumberFormatPrototypeFuncFormatToParts): (JSC::IntlNumberFormatPrototypeFuncResolvedOptions): * runtime/IntlObject.cpp: (JSC::grandfatheredLangTag): (JSC::canonicalizeLocaleList): (JSC::resolveLocale): (JSC::supportedLocales): * runtime/IntlPluralRules.cpp: (JSC::IntlPluralRules::initializePluralRules): (JSC::IntlPluralRules::resolvedOptions): (JSC::IntlPluralRules::select): * runtime/IntlPluralRulesConstructor.cpp: (JSC::IntlPluralRulesConstructor::finishCreation): * runtime/IntlPluralRulesPrototype.cpp: (JSC::IntlPluralRulesPrototypeFuncSelect): (JSC::IntlPluralRulesPrototypeFuncResolvedOptions): * runtime/IteratorOperations.cpp: (JSC::iteratorNext): (JSC::iteratorClose): (JSC::hasIteratorMethod): (JSC::iteratorMethod): * runtime/JSArray.cpp: (JSC::JSArray::tryCreateUninitializedRestricted): (JSC::JSArray::defineOwnProperty): (JSC::JSArray::put): (JSC::JSArray::setLengthWithArrayStorage): (JSC::JSArray::appendMemcpy): (JSC::JSArray::pop): * runtime/JSArray.h: * runtime/JSArrayBufferConstructor.cpp: (JSC::JSArrayBufferConstructor::finishCreation): * runtime/JSArrayBufferPrototype.cpp: (JSC::arrayBufferProtoFuncSlice): (JSC::arrayBufferProtoGetterFuncByteLength): (JSC::sharedArrayBufferProtoGetterFuncByteLength): * runtime/JSArrayBufferView.cpp: (JSC::JSArrayBufferView::toStringName): * runtime/JSArrayInlines.h: (JSC::JSArray::pushInline): * runtime/JSBigInt.cpp: (JSC::JSBigInt::divide): (JSC::JSBigInt::remainder): (JSC::JSBigInt::toNumber const): * runtime/JSCJSValue.cpp: (JSC::JSValue::putToPrimitive): (JSC::JSValue::putToPrimitiveByIndex): (JSC::JSValue::toStringSlowCase const): * runtime/JSCJSValueInlines.h: (JSC::toPreferredPrimitiveType): * runtime/JSDataView.cpp: (JSC::JSDataView::create): (JSC::JSDataView::put): (JSC::JSDataView::defineOwnProperty): * runtime/JSDataViewPrototype.cpp: (JSC::getData): (JSC::setData): * runtime/JSFunction.cpp: (JSC::JSFunction::callerGetter): (JSC::JSFunction::put): (JSC::JSFunction::defineOwnProperty): * runtime/JSGenericTypedArrayView.h: * runtime/JSGenericTypedArrayViewConstructorInlines.h: (JSC::constructGenericTypedArrayViewWithArguments): (JSC::constructGenericTypedArrayView): * runtime/JSGenericTypedArrayViewInlines.h: (JSC::JSGenericTypedArrayView<Adaptor>::deleteProperty): * runtime/JSGenericTypedArrayViewPrototypeFunctions.h: (JSC::speciesConstruct): (JSC::genericTypedArrayViewProtoFuncSet): (JSC::genericTypedArrayViewProtoFuncIndexOf): (JSC::genericTypedArrayViewProtoFuncLastIndexOf): (JSC::genericTypedArrayViewPrivateFuncSubarrayCreate): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/JSGlobalObjectDebuggable.cpp: (JSC::JSGlobalObjectDebuggable::name const): * runtime/JSGlobalObjectFunctions.cpp: (JSC::encode): (JSC::decode): (JSC::globalFuncProtoSetter): * runtime/JSGlobalObjectFunctions.h: * runtime/JSMap.cpp: (JSC::JSMap::toStringName): * runtime/JSModuleEnvironment.cpp: (JSC::JSModuleEnvironment::put): * runtime/JSModuleNamespaceObject.cpp: (JSC::JSModuleNamespaceObject::put): (JSC::JSModuleNamespaceObject::putByIndex): (JSC::JSModuleNamespaceObject::defineOwnProperty): * runtime/JSONObject.cpp: (JSC::Stringifier::appendStringifiedValue): (JSC::JSONProtoFuncParse): (JSC::JSONProtoFuncStringify): * runtime/JSObject.cpp: (JSC::getClassPropertyNames): (JSC::JSObject::calculatedClassName): (JSC::ordinarySetSlow): (JSC::JSObject::putInlineSlow): (JSC::JSObject::setPrototypeWithCycleCheck): (JSC::callToPrimitiveFunction): (JSC::JSObject::ordinaryToPrimitive const): (JSC::JSObject::defaultHasInstance): (JSC::JSObject::defineOwnIndexedProperty): (JSC::JSObject::putByIndexBeyondVectorLengthWithArrayStorage): (JSC::JSObject::putDirectIndexBeyondVectorLengthWithArrayStorage): (JSC::validateAndApplyPropertyDescriptor): * runtime/JSObject.h: * runtime/JSObjectInlines.h: (JSC::JSObject::putInlineForJSObject): * runtime/JSPromiseConstructor.cpp: (JSC::JSPromiseConstructor::finishCreation): * runtime/JSSet.cpp: (JSC::JSSet::toStringName): * runtime/JSSymbolTableObject.h: (JSC::symbolTablePut): * runtime/JSTypedArrayViewConstructor.cpp: (JSC::constructTypedArrayView): * runtime/JSTypedArrayViewPrototype.cpp: (JSC::typedArrayViewPrivateFuncLength): (JSC::typedArrayViewProtoFuncSet): (JSC::typedArrayViewProtoFuncCopyWithin): (JSC::typedArrayViewProtoFuncLastIndexOf): (JSC::typedArrayViewProtoFuncIndexOf): (JSC::typedArrayViewProtoFuncJoin): (JSC::typedArrayViewProtoGetterFuncBuffer): (JSC::typedArrayViewProtoGetterFuncLength): (JSC::typedArrayViewProtoGetterFuncByteLength): (JSC::typedArrayViewProtoGetterFuncByteOffset): (JSC::typedArrayViewProtoFuncReverse): (JSC::typedArrayViewPrivateFuncSubarrayCreate): (JSC::typedArrayViewProtoFuncSlice): (JSC::JSTypedArrayViewPrototype::finishCreation): * runtime/JSWeakMap.cpp: (JSC::JSWeakMap::toStringName): * runtime/JSWeakSet.cpp: (JSC::JSWeakSet::toStringName): * runtime/LiteralParser.cpp: (JSC::LiteralParser<CharType>::Lexer::lex): (JSC::LiteralParser<CharType>::Lexer::lexStringSlow): (JSC::LiteralParser<CharType>::Lexer::lexNumber): (JSC::LiteralParser<CharType>::parse): * runtime/LiteralParser.h: (JSC::LiteralParser::getErrorMessage): * runtime/Lookup.cpp: (JSC::reifyStaticAccessor): * runtime/Lookup.h: (JSC::putEntry): * runtime/MapPrototype.cpp: (JSC::getMap): * runtime/NullSetterFunction.cpp: (JSC::NullSetterFunctionInternal::callReturnUndefined): * runtime/NumberPrototype.cpp: (JSC::numberProtoFuncToExponential): (JSC::numberProtoFuncToFixed): (JSC::numberProtoFuncToPrecision): (JSC::extractToStringRadixArgument): * runtime/ObjectConstructor.cpp: (JSC::objectConstructorSetPrototypeOf): (JSC::objectConstructorAssign): (JSC::objectConstructorValues): (JSC::toPropertyDescriptor): (JSC::objectConstructorDefineProperty): (JSC::objectConstructorDefineProperties): (JSC::objectConstructorCreate): (JSC::objectConstructorSeal): (JSC::objectConstructorFreeze): * runtime/ObjectPrototype.cpp: (JSC::objectProtoFuncDefineGetter): (JSC::objectProtoFuncDefineSetter): * runtime/Operations.cpp: (JSC::jsAddSlowCase): * runtime/Operations.h: (JSC::jsSub): (JSC::jsMul): * runtime/ProgramExecutable.cpp: (JSC::ProgramExecutable::initializeGlobalProperties): * runtime/ProxyConstructor.cpp: (JSC::makeRevocableProxy): (JSC::proxyRevocableConstructorThrowError): (JSC::ProxyConstructor::finishCreation): (JSC::constructProxyObject): * runtime/ProxyObject.cpp: (JSC::ProxyObject::toStringName): (JSC::ProxyObject::finishCreation): (JSC::performProxyGet): (JSC::ProxyObject::performInternalMethodGetOwnProperty): (JSC::ProxyObject::performHasProperty): (JSC::ProxyObject::performPut): (JSC::performProxyCall): (JSC::performProxyConstruct): (JSC::ProxyObject::performDelete): (JSC::ProxyObject::performPreventExtensions): (JSC::ProxyObject::performIsExtensible): (JSC::ProxyObject::performDefineOwnProperty): (JSC::ProxyObject::performGetOwnPropertyNames): (JSC::ProxyObject::performSetPrototype): (JSC::ProxyObject::performGetPrototype): * runtime/ReflectObject.cpp: (JSC::reflectObjectConstruct): (JSC::reflectObjectDefineProperty): (JSC::reflectObjectGet): (JSC::reflectObjectGetOwnPropertyDescriptor): (JSC::reflectObjectGetPrototypeOf): (JSC::reflectObjectIsExtensible): (JSC::reflectObjectOwnKeys): (JSC::reflectObjectPreventExtensions): (JSC::reflectObjectSet): (JSC::reflectObjectSetPrototypeOf): * runtime/RegExpConstructor.cpp: (JSC::RegExpConstructor::finishCreation): (JSC::toFlags): * runtime/RegExpObject.cpp: (JSC::RegExpObject::defineOwnProperty): * runtime/RegExpObject.h: * runtime/RegExpPrototype.cpp: (JSC::regExpProtoFuncCompile): (JSC::regExpProtoGetterGlobal): (JSC::regExpProtoGetterIgnoreCase): (JSC::regExpProtoGetterMultiline): (JSC::regExpProtoGetterDotAll): (JSC::regExpProtoGetterSticky): (JSC::regExpProtoGetterUnicode): (JSC::regExpProtoGetterFlags): (JSC::regExpProtoGetterSourceInternal): (JSC::regExpProtoGetterSource): * runtime/RuntimeType.cpp: (JSC::runtimeTypeAsString): * runtime/SamplingProfiler.cpp: (JSC::SamplingProfiler::StackFrame::displayName): (JSC::SamplingProfiler::StackFrame::displayNameForJSONTests): * runtime/ScriptExecutable.cpp: (JSC::ScriptExecutable::prepareForExecutionImpl): * runtime/SetPrototype.cpp: (JSC::getSet): * runtime/SparseArrayValueMap.cpp: (JSC::SparseArrayValueMap::putEntry): (JSC::SparseArrayValueMap::putDirect): (JSC::SparseArrayEntry::put): * runtime/StackFrame.cpp: (JSC::StackFrame::sourceURL const): (JSC::StackFrame::functionName const): * runtime/StringConstructor.cpp: (JSC::stringFromCodePoint): * runtime/StringObject.cpp: (JSC::StringObject::put): (JSC::StringObject::putByIndex): * runtime/StringPrototype.cpp: (JSC::StringPrototype::finishCreation): (JSC::toLocaleCase): (JSC::stringProtoFuncNormalize): * runtime/Symbol.cpp: (JSC::Symbol::toNumber const): * runtime/SymbolConstructor.cpp: (JSC::symbolConstructorKeyFor): * runtime/SymbolObject.cpp: (JSC::SymbolObject::toStringName): * runtime/SymbolPrototype.cpp: (JSC::SymbolPrototype::finishCreation): * runtime/TypeSet.cpp: (JSC::TypeSet::dumpTypes const): (JSC::TypeSet::displayName const): (JSC::StructureShape::leastCommonAncestor): * runtime/TypeSet.h: (JSC::StructureShape::setConstructorName): * runtime/VM.cpp: (JSC::VM::dumpTypeProfilerData): * runtime/WeakMapPrototype.cpp: (JSC::getWeakMap): (JSC::protoFuncWeakMapSet): * runtime/WeakSetPrototype.cpp: (JSC::getWeakSet): (JSC::protoFuncWeakSetAdd): * tools/JSDollarVM.cpp: (WTF::DOMJITGetterComplex::DOMJITAttribute::slowCall): (WTF::DOMJITGetterComplex::customGetter): (JSC::functionSetImpureGetterDelegate): (JSC::functionCreateElement): (JSC::functionGetHiddenValue): (JSC::functionSetHiddenValue): (JSC::functionFindTypeForExpression): (JSC::functionReturnTypeFor): (JSC::functionLoadGetterFromGetterSetter): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::fail const): * wasm/WasmIndexOrName.cpp: (JSC::Wasm::makeString): * wasm/WasmParser.h: (JSC::Wasm::FailureHelper::makeString): (JSC::Wasm::Parser::fail const): * wasm/WasmPlan.cpp: (JSC::Wasm::Plan::tryRemoveContextAndCancelIfLast): * wasm/WasmValidate.cpp: (JSC::Wasm::Validate::fail const): * wasm/js/JSWebAssemblyCodeBlock.cpp: (JSC::JSWebAssemblyCodeBlock::JSWebAssemblyCodeBlock): * wasm/js/JSWebAssemblyHelpers.h: (JSC::toNonWrappingUint32): (JSC::getWasmBufferFromValue): * wasm/js/JSWebAssemblyInstance.cpp: (JSC::JSWebAssemblyInstance::create): * wasm/js/JSWebAssemblyMemory.cpp: (JSC::JSWebAssemblyMemory::grow): * wasm/js/WasmToJS.cpp: (JSC::Wasm::handleBadI64Use): * wasm/js/WebAssemblyCompileErrorConstructor.cpp: (JSC::WebAssemblyCompileErrorConstructor::finishCreation): * wasm/js/WebAssemblyInstanceConstructor.cpp: (JSC::constructJSWebAssemblyInstance): (JSC::WebAssemblyInstanceConstructor::finishCreation): * wasm/js/WebAssemblyInstancePrototype.cpp: (JSC::getInstance): * wasm/js/WebAssemblyLinkErrorConstructor.cpp: (JSC::WebAssemblyLinkErrorConstructor::finishCreation): * wasm/js/WebAssemblyMemoryConstructor.cpp: (JSC::constructJSWebAssemblyMemory): (JSC::WebAssemblyMemoryConstructor::finishCreation): * wasm/js/WebAssemblyMemoryPrototype.cpp: (JSC::getMemory): * wasm/js/WebAssemblyModuleConstructor.cpp: (JSC::webAssemblyModuleCustomSections): (JSC::webAssemblyModuleImports): (JSC::webAssemblyModuleExports): (JSC::WebAssemblyModuleConstructor::finishCreation): * wasm/js/WebAssemblyModuleRecord.cpp: (JSC::WebAssemblyModuleRecord::link): (JSC::dataSegmentFail): (JSC::WebAssemblyModuleRecord::evaluate): * wasm/js/WebAssemblyPrototype.cpp: (JSC::resolve): (JSC::webAssemblyInstantiateFunc): (JSC::webAssemblyInstantiateStreamingInternal): * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp: (JSC::WebAssemblyRuntimeErrorConstructor::finishCreation): * wasm/js/WebAssemblyTableConstructor.cpp: (JSC::constructJSWebAssemblyTable): (JSC::WebAssemblyTableConstructor::finishCreation): * wasm/js/WebAssemblyTablePrototype.cpp: (JSC::getTable): (JSC::webAssemblyTableProtoFuncGrow): (JSC::webAssemblyTableProtoFuncGet): (JSC::webAssemblyTableProtoFuncSet): Source/WebCore: No behavior change. * Modules/applicationmanifest/ApplicationManifestParser.cpp: (WebCore::ApplicationManifestParser::parseManifest): (WebCore::ApplicationManifestParser::logManifestPropertyNotAString): (WebCore::ApplicationManifestParser::logManifestPropertyInvalidURL): (WebCore::ApplicationManifestParser::logDeveloperWarning): (WebCore::ApplicationManifestParser::parseStartURL): (WebCore::ApplicationManifestParser::parseDisplay): (WebCore::ApplicationManifestParser::parseName): (WebCore::ApplicationManifestParser::parseDescription): (WebCore::ApplicationManifestParser::parseShortName): (WebCore::ApplicationManifestParser::parseScope): * Modules/beacon/NavigatorBeacon.cpp: (WebCore::NavigatorBeacon::logError): (WebCore::NavigatorBeacon::sendBeacon): * Modules/cache/DOMCache.cpp: (WebCore::DOMCache::requestFromInfo): (WebCore::DOMCache::addAll): (WebCore::DOMCache::put): * Modules/cache/DOMCacheEngine.cpp: (WebCore::DOMCacheEngine::errorToException): * Modules/credentialmanagement/BasicCredential.cpp: (WebCore::BasicCredential::type const): * Modules/credentialmanagement/CredentialsContainer.cpp: (WebCore::CredentialsContainer::get): (WebCore::CredentialsContainer::store): (WebCore::CredentialsContainer::isCreate): (WebCore::CredentialsContainer::preventSilentAccess const): * Modules/entriesapi/DOMFileSystem.cpp: (WebCore::DOMFileSystem::root): (WebCore::validatePathIsExpectedType): (WebCore::resolveRelativeVirtualPath): (WebCore::DOMFileSystem::getEntry): * Modules/entriesapi/FileSystemDirectoryEntry.cpp: (WebCore::FileSystemDirectoryEntry::getEntry): * Modules/entriesapi/FileSystemDirectoryReader.cpp: (WebCore::FileSystemDirectoryReader::readEntries): * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::consumeAsStream): * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::FetchBodyConsumer::loadingFailed): * Modules/fetch/FetchBodyOwner.cpp: (WebCore::FetchBodyOwner::arrayBuffer): (WebCore::FetchBodyOwner::blob): (WebCore::FetchBodyOwner::consumeOnceLoadingFinished): (WebCore::FetchBodyOwner::formData): (WebCore::FetchBodyOwner::json): (WebCore::FetchBodyOwner::text): (WebCore::FetchBodyOwner::blobLoadingFailed): (WebCore::FetchBodyOwner::consumeBodyAsStream): * Modules/fetch/FetchHeaders.cpp: (WebCore::canWriteHeader): * Modules/fetch/FetchLoader.cpp: (WebCore::FetchLoader::startLoadingBlobURL): (WebCore::FetchLoader::start): * Modules/fetch/FetchRequest.cpp: (WebCore::setMethod): (WebCore::computeReferrer): (WebCore::buildOptions): (WebCore::FetchRequest::initializeOptions): (WebCore::FetchRequest::initializeWith): (WebCore::FetchRequest::setBody): (WebCore::FetchRequest::referrer const): (WebCore::FetchRequest::clone): * Modules/fetch/FetchResponse.cpp: (WebCore::FetchResponse::create): (WebCore::FetchResponse::redirect): (WebCore::FetchResponse::clone): (WebCore::FetchResponse::BodyLoader::didFail): * Modules/fetch/FetchResponse.h: * Modules/geolocation/GeoNotifier.cpp: (WebCore::GeoNotifier::timerFired): * Modules/geolocation/Geolocation.cpp: (WebCore::Geolocation::startRequest): (WebCore::Geolocation::requestUsesCachedPosition): (WebCore::Geolocation::makeCachedPositionCallbacks): (WebCore::Geolocation::setIsAllowed): (WebCore::Geolocation::cancelRequests): (WebCore::Geolocation::handlePendingPermissionNotifiers): * Modules/indexeddb/IDBCursor.cpp: (WebCore::IDBCursor::update): (WebCore::IDBCursor::advance): (WebCore::IDBCursor::continuePrimaryKey): (WebCore::IDBCursor::continueFunction): (WebCore::IDBCursor::deleteFunction): * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::createObjectStore): (WebCore::IDBDatabase::transaction): (WebCore::IDBDatabase::deleteObjectStore): * Modules/indexeddb/IDBFactory.cpp: (WebCore::IDBFactory::open): (WebCore::IDBFactory::openInternal): (WebCore::IDBFactory::deleteDatabase): (WebCore::IDBFactory::cmp): * Modules/indexeddb/IDBIndex.cpp: (WebCore::IDBIndex::setName): (WebCore::IDBIndex::openCursor): (WebCore::IDBIndex::openKeyCursor): (WebCore::IDBIndex::count): (WebCore::IDBIndex::doCount): (WebCore::IDBIndex::get): (WebCore::IDBIndex::doGet): (WebCore::IDBIndex::getKey): (WebCore::IDBIndex::doGetKey): (WebCore::IDBIndex::getAll): (WebCore::IDBIndex::getAllKeys): * Modules/indexeddb/IDBKeyData.cpp: (WebCore::IDBKeyData::loggingString const): * Modules/indexeddb/IDBKeyRangeData.cpp: (WebCore::IDBKeyRangeData::loggingString const): * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::setName): (WebCore::IDBObjectStore::openCursor): (WebCore::IDBObjectStore::openKeyCursor): (WebCore::IDBObjectStore::get): (WebCore::IDBObjectStore::getKey): (WebCore::IDBObjectStore::putOrAdd): (WebCore::IDBObjectStore::doDelete): (WebCore::IDBObjectStore::deleteFunction): (WebCore::IDBObjectStore::clear): (WebCore::IDBObjectStore::createIndex): (WebCore::IDBObjectStore::index): (WebCore::IDBObjectStore::deleteIndex): (WebCore::IDBObjectStore::count): (WebCore::IDBObjectStore::doCount): (WebCore::IDBObjectStore::getAll): (WebCore::IDBObjectStore::getAllKeys): * Modules/indexeddb/IDBRequest.cpp: (WebCore::IDBRequest::result const): (WebCore:: const): (WebCore::IDBRequest::uncaughtExceptionInEventHandler): * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::objectStore): (WebCore::IDBTransaction::abort): (WebCore::IDBTransaction::putOrAddOnServer): * Modules/indexeddb/server/IDBServer.cpp: (WebCore::IDBServer::IDBServer::performGetAllDatabaseNames): * Modules/indexeddb/server/MemoryIDBBackingStore.cpp: (WebCore::IDBServer::MemoryIDBBackingStore::deleteRange): (WebCore::IDBServer::MemoryIDBBackingStore::addRecord): (WebCore::IDBServer::MemoryIDBBackingStore::getRecord): (WebCore::IDBServer::MemoryIDBBackingStore::getAllRecords): (WebCore::IDBServer::MemoryIDBBackingStore::getIndexRecord): (WebCore::IDBServer::MemoryIDBBackingStore::getCount): (WebCore::IDBServer::MemoryIDBBackingStore::openCursor): (WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor): * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::createAndPopulateInitialDatabaseInfo): (WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo): (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameFromEncodedFilename): (WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo): (WebCore::IDBServer::SQLiteIDBBackingStore::beginTransaction): (WebCore::IDBServer::SQLiteIDBBackingStore::abortTransaction): (WebCore::IDBServer::SQLiteIDBBackingStore::commitTransaction): (WebCore::IDBServer::SQLiteIDBBackingStore::createObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::clearObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedHasIndexRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex): (WebCore::IDBServer::SQLiteIDBBackingStore::keyExistsInObjectStore): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteUnusedBlobFileRecords): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRange): (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::getBlobRecordsForObjectStoreRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::getRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords): (WebCore::IDBServer::SQLiteIDBBackingStore::getAllIndexRecords): (WebCore::IDBServer::SQLiteIDBBackingStore::getIndexRecord): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey): (WebCore::IDBServer::SQLiteIDBBackingStore::getCount): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetKeyGeneratorValue): (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedSetKeyGeneratorValue): (WebCore::IDBServer::SQLiteIDBBackingStore::generateKeyNumber): (WebCore::IDBServer::SQLiteIDBBackingStore::revertGeneratedKeyNumber): (WebCore::IDBServer::SQLiteIDBBackingStore::maybeUpdateKeyGeneratorNumber): (WebCore::IDBServer::SQLiteIDBBackingStore::openCursor): (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor): (WebCore::IDBServer::SQLiteIDBBackingStore::deleteBackingStore): * Modules/indexeddb/server/SQLiteIDBTransaction.cpp: (WebCore::IDBServer::SQLiteIDBTransaction::begin): (WebCore::IDBServer::SQLiteIDBTransaction::commit): (WebCore::IDBServer::SQLiteIDBTransaction::abort): * Modules/indexeddb/server/UniqueIDBDatabase.cpp: (WebCore::IDBServer::UniqueIDBDatabase::deleteObjectStore): (WebCore::IDBServer::UniqueIDBDatabase::renameObjectStore): (WebCore::IDBServer::UniqueIDBDatabase::deleteIndex): (WebCore::IDBServer::UniqueIDBDatabase::renameIndex): (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd): (WebCore::IDBServer::UniqueIDBDatabase::commitTransaction): (WebCore::IDBServer::UniqueIDBDatabase::abortTransaction): * Modules/indexeddb/shared/IDBError.h: (WebCore::IDBError::userDeleteError): * Modules/indexeddb/shared/IDBTransactionInfo.cpp: (WebCore::IDBTransactionInfo::loggingString const): * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp: (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged): * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::addIceCandidate): * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::deny): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate): * Modules/paymentrequest/PaymentRequest.cpp: (WebCore::checkAndCanonicalizeTotal): (WebCore::PaymentRequest::create): * Modules/quota/DOMWindowQuota.cpp: (WebCore::DOMWindowQuota::webkitStorageInfo const): * Modules/webaudio/AudioBufferSourceNode.cpp: (WebCore::AudioBufferSourceNode::looping): (WebCore::AudioBufferSourceNode::setLooping): * Modules/webaudio/AudioNode.cpp: (WebCore::AudioNode::channelCountMode): (WebCore::AudioNode::channelInterpretation): * Modules/webaudio/MediaStreamAudioSource.cpp: (WebCore::MediaStreamAudioSource::MediaStreamAudioSource): * Modules/webauthn/AuthenticatorManager.cpp: (WebCore::AuthenticatorManagerInternal::produceClientDataJson): (WebCore::AuthenticatorManagerInternal::initTimeoutTimer): (WebCore::AuthenticatorManager::create const): (WebCore::AuthenticatorManager::discoverFromExternalSource const): (WebCore::AuthenticatorManager::isUserVerifyingPlatformAuthenticatorAvailable const): * Modules/webauthn/cocoa/LocalAuthenticator.mm: (WebCore::LocalAuthenticator::makeCredential): (WebCore::LocalAuthenticator::getAssertion): * Modules/webdatabase/DatabaseTracker.cpp: (WebCore::DatabaseTracker::usage): * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::connect): (WebCore::WebSocket::close): (WebCore::WebSocket::binaryType const): * Modules/websockets/WebSocketHandshake.cpp: (WebCore::WebSocketHandshake::readStatusLine): (WebCore::WebSocketHandshake::readHTTPHeaders): (WebCore::WebSocketHandshake::checkResponseHeaders): * Modules/webvr/VRDisplay.cpp: (WebCore::VRDisplay::requestPresent): (WebCore::VRDisplay::exitPresent): * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::defaultLiveRegionStatusForRole): (WebCore::AccessibilityObject::invalidStatus const): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::textUnderElement const): * bindings/js/JSCustomElementInterface.cpp: (WebCore::constructCustomElementSynchronously): * bindings/js/JSCustomElementRegistryCustom.cpp: (WebCore::getCustomElementCallback): (WebCore::validateCustomElementNameAndThrowIfNeeded): (WebCore::JSCustomElementRegistry::define): * bindings/js/JSCustomXPathNSResolver.cpp: (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI): * bindings/js/JSDOMConstructorBase.cpp: (WebCore::callThrowTypeError): * bindings/js/JSDOMConstructorBase.h: (WebCore::JSDOMConstructorBase::className): * bindings/js/JSDOMConstructorNotConstructable.h: (WebCore::JSDOMConstructorNotConstructable::callThrowTypeError): * bindings/js/JSDOMExceptionHandling.cpp: (WebCore::createDOMException): (WebCore::throwSequenceTypeError): (WebCore::throwNonFiniteTypeError): * bindings/js/JSDOMIterator.h: (WebCore::iteratorForEach): (WebCore::IteratorTraits>::next): * bindings/js/JSDOMWindowBase.cpp: (WebCore::isResponseCorrect): (WebCore::handleResponseOnStreamingAction): (WebCore::JSDOMWindowBase::compileStreaming): (WebCore::JSDOMWindowBase::instantiateStreaming): * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::preventExtensions): (WebCore::JSDOMWindow::toStringName): * bindings/js/JSHTMLElementCustom.cpp: (WebCore::constructJSHTMLElement): * bindings/js/JSLocationCustom.cpp: (WebCore::JSLocation::preventExtensions): (WebCore::JSLocation::toStringName): * bindings/js/JSReadableStreamPrivateConstructors.cpp: (WebCore::constructJSReadableStreamDefaultController): (WebCore::constructJSReadableByteStreamController): (WebCore::constructJSReadableStreamBYOBRequest): * bindings/js/JSRemoteDOMWindowCustom.cpp: (WebCore::JSRemoteDOMWindow::preventExtensions): (WebCore::JSRemoteDOMWindow::toStringName): * bindings/js/ReadableStreamDefaultController.cpp: (WebCore::ReadableStreamDefaultController::invoke): * bindings/js/ScriptModuleLoader.cpp: (WebCore::resolveModuleSpecifier): (WebCore::ScriptModuleLoader::resolve): (WebCore::ScriptModuleLoader::fetch): (WebCore::ScriptModuleLoader::evaluate): (WebCore::ScriptModuleLoader::importModule): (WebCore::ScriptModuleLoader::notifyFinished): * bindings/js/SerializedScriptValue.cpp: (WebCore::maybeThrowExceptionIfSerializationFailed): * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::evaluate): * bindings/scripts/CodeGeneratorJS.pm: (GenerateDefaultValue): (GenerateConstructorHelperMethods): (GenerateCallTracer): * bindings/scripts/test/JS/JSInterfaceName.cpp: (WebCore::JSInterfaceNameConstructor::initializeProperties): * bindings/scripts/test/JS/JSMapLike.cpp: (WebCore::JSMapLikeConstructor::initializeProperties): * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: (WebCore::JSReadOnlyMapLikeConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: (WebCore::JSTestActiveDOMObjectConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestCEReactions.cpp: (WebCore::JSTestCEReactionsConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: (WebCore::JSTestCEReactionsStringifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestCallTracer.cpp: (WebCore::JSTestCallTracerConstructor::initializeProperties): (WebCore::jsTestCallTracerTestAttributeInterfaceGetter): (WebCore::setJSTestCallTracerTestAttributeInterfaceSetter): (WebCore::jsTestCallTracerTestAttributeSpecifiedGetter): (WebCore::setJSTestCallTracerTestAttributeSpecifiedSetter): (WebCore::jsTestCallTracerTestAttributeWithVariantGetter): (WebCore::setJSTestCallTracerTestAttributeWithVariantSetter): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationInterfaceBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationSpecifiedBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithArgumentsBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableArgumentBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithVariantArgumentBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableVariantArgumentBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithOptionalVariantArgumentBody): (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithDefaultVariantArgumentBody): * bindings/scripts/test/JS/JSTestCallbackInterface.cpp: (WebCore::JSTestCallbackInterfaceConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: (WebCore::JSTestClassWithJSBuiltinConstructorConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: (WebCore::JSTestCustomConstructorWithNoInterfaceObjectConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestDOMJIT.cpp: (WebCore::JSTestDOMJITConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: (WebCore::JSTestEnabledBySettingConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestEventConstructor.cpp: (WebCore::JSTestEventConstructorConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestEventTarget.cpp: (WebCore::JSTestEventTargetConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestException.cpp: (WebCore::JSTestExceptionConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: (WebCore::JSTestGenerateIsReachableConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestGlobalObject.cpp: (WebCore::JSTestGlobalObjectConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: (WebCore::JSTestIndexedSetterNoIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: (WebCore::JSTestIndexedSetterThrowingExceptionConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: (WebCore::JSTestIndexedSetterWithIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::JSTestInterfaceConstructor::construct): (WebCore::JSTestInterfaceConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: (WebCore::JSTestInterfaceLeadingUnderscoreConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestIterable.cpp: (WebCore::JSTestIterableConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: (WebCore::JSTestJSBuiltinConstructorConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: (WebCore::JSTestMediaQueryListListenerConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: (WebCore::JSTestNamedAndIndexedSetterNoIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: (WebCore::JSTestNamedAndIndexedSetterThrowingExceptionConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: (WebCore::JSTestNamedAndIndexedSetterWithIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: (WebCore::JSTestNamedConstructorConstructor::initializeProperties): (WebCore::JSTestNamedConstructorNamedConstructor::construct): (WebCore::JSTestNamedConstructorNamedConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: (WebCore::JSTestNamedDeleterNoIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: (WebCore::JSTestNamedDeleterThrowingExceptionConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: (WebCore::JSTestNamedDeleterWithIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: (WebCore::JSTestNamedDeleterWithIndexedGetterConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: (WebCore::JSTestNamedGetterCallWithConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp: (WebCore::JSTestNamedGetterNoIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: (WebCore::JSTestNamedGetterWithIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: (WebCore::JSTestNamedSetterNoIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: (WebCore::JSTestNamedSetterThrowingExceptionConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: (WebCore::JSTestNamedSetterWithIdentifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: (WebCore::JSTestNamedSetterWithIndexedGetterConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: (WebCore::JSTestNamedSetterWithIndexedGetterAndSetterConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp: (WebCore::JSTestNamedSetterWithOverrideBuiltinsConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: (WebCore::JSTestNamedSetterWithUnforgablePropertiesConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: (WebCore::JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNode.cpp: (WebCore::JSTestNodeConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::convertDictionary<TestObj::Dictionary>): (WebCore::JSTestObjConstructor::initializeProperties): (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValueBody): * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: (WebCore::JSTestOverloadedConstructorsConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: (WebCore::JSTestOverloadedConstructorsWithSequenceConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: (WebCore::JSTestOverrideBuiltinsConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestPluginInterface.cpp: (WebCore::JSTestPluginInterfaceConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: (WebCore::JSTestPromiseRejectionEventConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestSerialization.cpp: (WebCore::JSTestSerializationConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp: (WebCore::JSTestSerializationIndirectInheritanceConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: (WebCore::JSTestSerializationInheritConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: (WebCore::JSTestSerializationInheritFinalConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: (WebCore::JSTestSerializedScriptValueInterfaceConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestStringifier.cpp: (WebCore::JSTestStringifierConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: (WebCore::JSTestStringifierAnonymousOperationConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: (WebCore::JSTestStringifierNamedOperationConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: (WebCore::JSTestStringifierOperationImplementedAsConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: (WebCore::JSTestStringifierOperationNamedToStringConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: (WebCore::JSTestStringifierReadOnlyAttributeConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: (WebCore::JSTestStringifierReadWriteAttributeConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestTypedefs.cpp: (WebCore::JSTestTypedefsConstructor::initializeProperties): * bridge/c/c_instance.cpp: (JSC::Bindings::CInstance::invokeMethod): (JSC::Bindings::CInstance::invokeDefaultMethod): (JSC::Bindings::CInstance::invokeConstruct): (JSC::Bindings::CInstance::stringValue const): (JSC::Bindings::CInstance::toJSPrimitive const): * bridge/objc/objc_instance.mm: (ObjcInstance::invokeMethod): * bridge/objc/objc_runtime.mm: (JSC::Bindings::ObjcArray::setValueAt const): * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad): * crypto/SubtleCrypto.cpp: (WebCore::rejectWithException): (WebCore::SubtleCrypto::encrypt): (WebCore::SubtleCrypto::decrypt): (WebCore::SubtleCrypto::sign): (WebCore::SubtleCrypto::verify): (WebCore::SubtleCrypto::deriveKey): (WebCore::SubtleCrypto::deriveBits): (WebCore::SubtleCrypto::exportKey): (WebCore::SubtleCrypto::wrapKey): (WebCore::SubtleCrypto::unwrapKey): * crypto/keys/CryptoKeyEC.cpp: (WebCore::CryptoKeyEC::algorithm const): * css/CSSInheritedValue.cpp: (WebCore::CSSInheritedValue::customCSSText const): * css/CSSInitialValue.cpp: (WebCore::CSSInitialValue::customCSSText const): * css/CSSKeyframesRule.cpp: (WebCore::CSSKeyframesRule::insertRule): * css/CSSRevertValue.cpp: (WebCore::CSSRevertValue::customCSSText const): * css/CSSStyleSheet.h: * css/CSSUnsetValue.cpp: (WebCore::CSSUnsetValue::customCSSText const): * css/CSSValueList.cpp: (WebCore::CSSValueList::customCSSText const): * css/DOMMatrixReadOnly.cpp: (WebCore::DOMMatrixReadOnly::validateAndFixup): (WebCore::DOMMatrixReadOnly::toFloat32Array const): (WebCore::DOMMatrixReadOnly::toFloat64Array const): (WebCore::DOMMatrixReadOnly::toString const): * css/DeprecatedCSSOMValueList.cpp: (WebCore::DeprecatedCSSOMValueList::cssText const): * css/FontFace.cpp: (WebCore::FontFace::create): (WebCore::FontFace::unicodeRange const): (WebCore::FontFace::featureSettings const): * css/MediaQuery.cpp: (WebCore::MediaQuery::serialize const): * css/PropertySetCSSStyleDeclaration.cpp: (WebCore::PropertySetCSSStyleDeclaration::getPropertyPriority): * css/WebKitCSSMatrix.cpp: (WebCore::WebKitCSSMatrix::toString const): * css/parser/MediaQueryParser.cpp: (WebCore::MediaQueryParser::commitMediaQuery): * dom/CDATASection.cpp: (WebCore::CDATASection::nodeName const): * dom/Comment.cpp: (WebCore::Comment::nodeName const): * dom/DOMException.cpp: (WebCore::DOMException::description const): (WebCore::DOMException::create): * dom/DOMException.h: (WebCore::DOMException::name): (WebCore::DOMException::message): * dom/DOMImplementation.cpp: (WebCore::DOMImplementation::createHTMLDocument): * dom/DataTransfer.cpp: (WebCore::DataTransfer::DataTransfer): (WebCore::DataTransfer::types const): (WebCore::DataTransfer::createForInputEvent): (WebCore::DataTransfer::dropEffect const): (WebCore::DataTransfer::effectAllowed const): * dom/DataTransferItem.cpp: (WebCore::DataTransferItem::kind const): * dom/Document.cpp: (WebCore::Document::suggestedMIMEType const): (WebCore::Document::contentType const): (WebCore::Document::nodeName const): (WebCore::Document::writeln): (WebCore::Document::canNavigate): (WebCore::Document::designMode const): (WebCore::Document::requestFullScreenForElement): * dom/DocumentFragment.cpp: (WebCore::DocumentFragment::nodeName const): * dom/InlineStyleSheetOwner.cpp: (WebCore::InlineStyleSheetOwner::createSheet): * dom/MouseEvent.cpp: (WebCore::MouseEvent::initMouseEventQuirk): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): * dom/ScriptElementCachedScriptFetcher.cpp: (WebCore::ScriptElementCachedScriptFetcher::requestModuleScript const): * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::dispatchErrorEvent): * dom/ScriptedAnimationController.cpp: (WebCore::throttlingReasonsToString): * dom/Text.cpp: (WebCore::Text::nodeName const): * dom/TextEncoder.cpp: (WebCore::TextEncoder::encoding const): * dom/Traversal.cpp: (WebCore::NodeIteratorBase::acceptNode): * editing/EditCommand.cpp: (WebCore::inputTypeNameForEditingAction): * editing/Editing.cpp: (WebCore::createTabSpanElement): * editing/Editor.cpp: (WebCore::createDataTransferForClipboardEvent): * editing/EditorCommand.cpp: (WebCore::executeInsertBacktab): (WebCore::executeInsertLineBreak): (WebCore::executeInsertNewline): (WebCore::executeInsertTab): (WebCore::executeJustifyCenter): (WebCore::executeJustifyFull): (WebCore::executeJustifyLeft): (WebCore::executeJustifyRight): (WebCore::executeStrikethrough): (WebCore::executeSubscript): (WebCore::executeSuperscript): (WebCore::executeToggleBold): (WebCore::executeToggleItalic): (WebCore::executeUnderline): (WebCore::executeUnscript): (WebCore::stateBold): (WebCore::stateItalic): (WebCore::stateStrikethrough): (WebCore::stateSubscript): (WebCore::stateSuperscript): (WebCore::stateUnderline): (WebCore::stateJustifyCenter): (WebCore::stateJustifyFull): (WebCore::stateJustifyLeft): (WebCore::stateJustifyRight): (WebCore::Editor::Command::value const): * editing/SmartReplace.cpp: (WebCore::getSmartSet): * fileapi/FileCocoa.mm: (WebCore::File::computeNameAndContentTypeForReplacedFile): * html/BaseCheckableInputType.cpp: (WebCore::BaseCheckableInputType::saveFormControlState const): * html/BaseChooserOnlyDateAndTimeInputType.cpp: (WebCore::BaseChooserOnlyDateAndTimeInputType::updateInnerTextValue): * html/ColorInputType.cpp: (WebCore::ColorInputType::fallbackValue const): * html/DOMFormData.cpp: (WebCore::DOMFormData::createFileEntry): * html/FTPDirectoryDocument.cpp: (WebCore::processFilesizeString): (WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate): * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::relList const): (WebCore::HTMLAnchorElement::isSystemPreviewLink const): * html/HTMLAppletElement.cpp: (WebCore::HTMLAppletElement::HTMLAppletElement): (WebCore::HTMLAppletElement::updateWidget): * html/HTMLCanvasElement.cpp: (WebCore::toEncodingMimeType): (WebCore::HTMLCanvasElement::toDataURL): (WebCore::HTMLCanvasElement::captureStream): * html/HTMLElement.cpp: (WebCore::HTMLElement::contentEditable const): * html/HTMLFormControlElement.cpp: (WebCore::shouldAutofocus): * html/HTMLHtmlElement.cpp: (WebCore::HTMLHtmlElement::insertedByParser): * html/HTMLKeygenElement.cpp: (WebCore::HTMLKeygenElement::keytype const): * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::canPlayType const): (WebCore::stringForNetworkState): (WebCore::HTMLMediaElement::preload const): (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript): * html/HTMLObjectElement.cpp: (WebCore::mapDataParamToSrc): * html/HTMLPlugInElement.cpp: (WebCore::HTMLPlugInElement::setReplacement): * html/ImageData.cpp: (WebCore::ImageData::create): * html/ImageDocument.cpp: (WebCore::ImageDocument::createDocumentStructure): * html/ImageInputType.cpp: (WebCore::ImageInputType::appendFormData const): * html/PluginDocument.cpp: (WebCore::PluginDocumentParser::createDocumentStructure): * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::getExtension): (WebCore::WebGL2RenderingContext::getSupportedExtensions): (WebCore::WebGL2RenderingContext::getParameter): * html/canvas/WebGLCompressedTextureASTC.cpp: (WebCore::WebGLCompressedTextureASTC::WebGLCompressedTextureASTC): (WebCore::WebGLCompressedTextureASTC::getSupportedProfiles): (WebCore::WebGLCompressedTextureASTC::supported): (WebCore::m_isLDRSupported): Deleted. * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::getExtension): (WebCore::WebGLRenderingContext::getSupportedExtensions): (WebCore::WebGLRenderingContext::getParameter): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::create): (WebCore::WebGLRenderingContextBase::enableSupportedExtension): * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGPUEnums.cpp: (WebCore::web3DCompareFunctionName): * html/parser/HTMLParserIdioms.cpp: (WebCore::parseCORSSettingsAttribute): * html/parser/HTMLPreloadScanner.cpp: (WebCore::TokenPreloadScanner::initiatorFor): * html/parser/HTMLResourcePreloader.cpp: (WebCore::PreloadRequest::resourceRequest): * html/parser/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::insertPhoneNumberLink): * html/track/DataCue.cpp: (WebCore::DataCue::toJSONString const): * html/track/InbandGenericTextTrack.cpp: (WebCore::InbandGenericTextTrack::updateCueFromCueData): * html/track/TextTrackCue.cpp: (WebCore::TextTrackCue::toJSON const): * html/track/TextTrackCueGeneric.cpp: (WebCore::TextTrackCueGeneric::toJSONString const): * html/track/TrackBase.cpp: (WebCore::TrackBase::setLanguage): * html/track/VTTCue.cpp: (WebCore::VTTCue::toJSON const): * inspector/CommandLineAPIModule.cpp: (WebCore::CommandLineAPIModule::CommandLineAPIModule): * inspector/InspectorCanvas.cpp: (WebCore::InspectorCanvas::getCanvasContentAsDataURL): (WebCore::InspectorCanvas::indexForData): (WebCore::InspectorCanvas::buildInitialState): (WebCore::InspectorCanvas::buildArrayForCanvasGradient): (WebCore::InspectorCanvas::buildArrayForCanvasPattern): * inspector/InspectorFrontendClient.h: (WebCore::InspectorFrontendClient::debuggableType): * inspector/InspectorFrontendClientLocal.cpp: (WebCore::InspectorFrontendClientLocal::openInNewTab): * inspector/InspectorFrontendHost.cpp: (WebCore::InspectorFrontendHost::userInterfaceLayoutDirection): (WebCore::InspectorFrontendHost::platform): (WebCore::InspectorFrontendHost::port): * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::setIndicating): (WebCore::InspectorOverlay::drawPaintRects): (WebCore::InspectorOverlay::drawRulers): (WebCore::appendPathSegment): * inspector/InspectorStyleSheet.h: (WebCore::InspectorCSSId::InspectorCSSId): * inspector/TimelineRecordFactory.cpp: (WebCore::TimelineRecordFactory::createGenericRecord): (WebCore::TimelineRecordFactory::createFunctionCallData): (WebCore::TimelineRecordFactory::createConsoleProfileData): (WebCore::TimelineRecordFactory::createProbeSampleData): (WebCore::TimelineRecordFactory::createEventDispatchData): (WebCore::TimelineRecordFactory::createGenericTimerData): (WebCore::TimelineRecordFactory::createTimerInstallData): (WebCore::TimelineRecordFactory::createEvaluateScriptData): (WebCore::TimelineRecordFactory::createTimeStampData): (WebCore::TimelineRecordFactory::createAnimationFrameData): (WebCore::TimelineRecordFactory::createPaintData): (WebCore::TimelineRecordFactory::appendLayoutRoot): * inspector/WebInjectedScriptHost.cpp: (WebCore::WebInjectedScriptHost::subtype): (WebCore::jsStringForPaymentRequestState): (WebCore::WebInjectedScriptHost::getInternalProperties): * inspector/agents/InspectorApplicationCacheAgent.cpp: (WebCore::InspectorApplicationCacheAgent::InspectorApplicationCacheAgent): * inspector/agents/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::InspectorCSSAgent): (WebCore::InspectorCSSAgent::getMatchedStylesForNode): (WebCore::InspectorCSSAgent::createStyleSheet): (WebCore::InspectorCSSAgent::addRule): (WebCore::InspectorCSSAgent::elementForId): (WebCore::InspectorCSSAgent::assertStyleSheetForId): * inspector/agents/InspectorCanvasAgent.cpp: (WebCore::InspectorCanvasAgent::InspectorCanvasAgent): (WebCore::InspectorCanvasAgent::requestNode): (WebCore::InspectorCanvasAgent::requestContent): (WebCore::InspectorCanvasAgent::resolveCanvasContext): (WebCore::InspectorCanvasAgent::startRecording): (WebCore::InspectorCanvasAgent::stopRecording): (WebCore::InspectorCanvasAgent::requestShaderSource): (WebCore::InspectorCanvasAgent::updateShader): (WebCore::InspectorCanvasAgent::setShaderProgramDisabled): (WebCore::InspectorCanvasAgent::setShaderProgramHighlighted): (WebCore::InspectorCanvasAgent::assertInspectorCanvas): (WebCore::InspectorCanvasAgent::assertInspectorProgram): * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::InspectorDOMAgent): (WebCore::InspectorDOMAgent::assertNode): (WebCore::InspectorDOMAgent::assertDocument): (WebCore::InspectorDOMAgent::assertElement): (WebCore::InspectorDOMAgent::assertEditableNode): (WebCore::InspectorDOMAgent::assertEditableElement): (WebCore::InspectorDOMAgent::getDocument): (WebCore::InspectorDOMAgent::pushNodeToFrontend): (WebCore::InspectorDOMAgent::requestChildNodes): (WebCore::InspectorDOMAgent::querySelector): (WebCore::InspectorDOMAgent::querySelectorAll): (WebCore::InspectorDOMAgent::releaseBackendNodeIds): (WebCore::InspectorDOMAgent::setAttributesAsText): (WebCore::InspectorDOMAgent::removeNode): (WebCore::InspectorDOMAgent::setOuterHTML): (WebCore::InspectorDOMAgent::insertAdjacentHTML): (WebCore::InspectorDOMAgent::setNodeValue): (WebCore::InspectorDOMAgent::setEventListenerDisabled): (WebCore::InspectorDOMAgent::performSearch): (WebCore::InspectorDOMAgent::getSearchResults): (WebCore::InspectorDOMAgent::highlightConfigFromInspectorObject): (WebCore::InspectorDOMAgent::highlightQuad): (WebCore::InspectorDOMAgent::highlightSelector): (WebCore::InspectorDOMAgent::highlightNode): (WebCore::InspectorDOMAgent::highlightNodeList): (WebCore::InspectorDOMAgent::moveTo): (WebCore::InspectorDOMAgent::focus): (WebCore::InspectorDOMAgent::setInspectedNode): (WebCore::InspectorDOMAgent::resolveNode): (WebCore::InspectorDOMAgent::pushNodeByPathToFrontend): (WebCore::InspectorDOMAgent::pushNodeByBackendIdToFrontend): * inspector/agents/InspectorDOMDebuggerAgent.cpp: (WebCore::InspectorDOMDebuggerAgent::InspectorDOMDebuggerAgent): (WebCore::InspectorDOMDebuggerAgent::setBreakpoint): (WebCore::InspectorDOMDebuggerAgent::removeBreakpoint): (WebCore::domTypeName): (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded): * inspector/agents/InspectorDOMStorageAgent.cpp: (WebCore::InspectorDOMStorageAgent::InspectorDOMStorageAgent): (WebCore::InspectorDOMStorageAgent::getDOMStorageItems): (WebCore::InspectorDOMStorageAgent::setDOMStorageItem): (WebCore::InspectorDOMStorageAgent::removeDOMStorageItem): (WebCore::InspectorDOMStorageAgent::findStorageArea): * inspector/agents/InspectorDatabaseAgent.cpp: (WebCore::InspectorDatabaseAgent::InspectorDatabaseAgent): (WebCore::InspectorDatabaseAgent::getDatabaseTableNames): * inspector/agents/InspectorIndexedDBAgent.cpp: (WebCore::Inspector::idbKeyRangeFromKeyRange): (WebCore::InspectorIndexedDBAgent::InspectorIndexedDBAgent): (WebCore::InspectorIndexedDBAgent::requestData): * inspector/agents/InspectorLayerTreeAgent.cpp: (WebCore::InspectorLayerTreeAgent::InspectorLayerTreeAgent): (WebCore::InspectorLayerTreeAgent::layersForNode): (WebCore::InspectorLayerTreeAgent::reasonsForCompositingLayer): * inspector/agents/InspectorMemoryAgent.cpp: (WebCore::InspectorMemoryAgent::InspectorMemoryAgent): * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::InspectorNetworkAgent): (WebCore::InspectorNetworkAgent::getResponseBody): (WebCore::InspectorNetworkAgent::loadResource): (WebCore::InspectorNetworkAgent::resolveWebSocket): (WebCore::InspectorNetworkAgent::createTextDecoder): (WebCore::InspectorNetworkAgent::searchInRequest): * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::resourceContent): (WebCore::InspectorPageAgent::InspectorPageAgent): (WebCore::InspectorPageAgent::navigate): (WebCore::InspectorPageAgent::assertFrame): (WebCore::InspectorPageAgent::assertDocumentLoader): (WebCore::InspectorPageAgent::snapshotNode): (WebCore::InspectorPageAgent::snapshotRect): (WebCore::InspectorPageAgent::archive): * inspector/agents/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::InspectorTimelineAgent): (WebCore::InspectorTimelineAgent::setInstruments): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::stopFromConsole): (WebCore::InspectorTimelineAgent::didCompleteRecordEntry): * inspector/agents/InspectorWorkerAgent.cpp: (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::initialized): (WebCore::InspectorWorkerAgent::sendMessageToWorker): * inspector/agents/WebConsoleAgent.cpp: (WebCore::WebConsoleAgent::setLoggingChannelLevel): * inspector/agents/page/PageDebuggerAgent.cpp: (WebCore::PageDebuggerAgent::injectedScriptForEval): * inspector/agents/page/PageNetworkAgent.cpp: (WebCore::PageNetworkAgent::scriptExecutionContext): * inspector/agents/page/PageRuntimeAgent.cpp: (WebCore::PageRuntimeAgent::injectedScriptForEval): * inspector/agents/worker/ServiceWorkerAgent.cpp: (WebCore::ServiceWorkerAgent::ServiceWorkerAgent): * inspector/agents/worker/WorkerDebuggerAgent.cpp: (WebCore::WorkerDebuggerAgent::injectedScriptForEval): * inspector/agents/worker/WorkerRuntimeAgent.cpp: (WebCore::WorkerRuntimeAgent::injectedScriptForEval): * loader/ContentFilter.cpp: (WebCore::ContentFilter::handleProvisionalLoadFailure): * loader/CrossOriginAccessControl.cpp: (WebCore::passesAccessControlCheck): (WebCore::validatePreflightResponse): * loader/CrossOriginPreflightChecker.cpp: (WebCore::CrossOriginPreflightChecker::notifyFinished): (WebCore::CrossOriginPreflightChecker::doPreflight): * loader/DocumentLoader.cpp: (WebCore::isRemoteWebArchive): (WebCore::DocumentLoader::startIconLoading): * loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::reportRedirectionWithBadScheme): (WebCore::DocumentThreadableLoader::reportContentSecurityPolicyError): (WebCore::DocumentThreadableLoader::reportCrossOriginResourceSharingError): (WebCore::DocumentThreadableLoader::reportIntegrityMetadataError): * loader/FormSubmission.cpp: (WebCore::FormSubmission::Attributes::parseEncodingType): * loader/FormSubmission.h: (WebCore::FormSubmission::Attributes::methodString): * loader/FrameLoader.cpp: (WebCore::FrameLoader::initForSynthesizedDocument): (WebCore::FrameLoader::loadURLIntoChildFrame): (WebCore::FrameLoader::defaultSubstituteDataForURL): (WebCore::FrameLoader::addHTTPUpgradeInsecureRequestsIfNeeded): (WebCore::FrameLoader::dispatchBeforeUnloadEvent): * loader/LinkLoader.cpp: (WebCore::LinkLoader::preconnectIfNeeded): * loader/NavigationScheduler.cpp: (WebCore::NavigationScheduler::scheduleLocationChange): * loader/PingLoader.cpp: (WebCore::PingLoader::sendViolationReport): * loader/ResourceLoadStatistics.cpp: (WebCore::ResourceLoadStatistics::primaryDomain): (WebCore::ResourceLoadStatistics::areDomainsAssociated): * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::loadDataURL): (WebCore::ResourceLoader::didBlockAuthenticationChallenge): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::willSendRequestInternal): (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl): * loader/ThreadableLoader.cpp: (WebCore::ThreadableLoader::logError): * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::abort): (WebCore::ApplicationCacheGroup::didFinishLoadingEntry): (WebCore::ApplicationCacheGroup::didFinishLoadingManifest): (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete): * loader/appcache/ApplicationCacheHost.cpp: (WebCore::ApplicationCacheHost::createFileURL): * loader/appcache/ManifestParser.cpp: (WebCore::parseManifest): * loader/archive/ArchiveFactory.cpp: (WebCore::createArchiveMIMETypesMap): * loader/cache/CachedResource.cpp: (WebCore::CachedResource::load): * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::canRequest): (WebCore::CachedResourceLoader::requestResource): * loader/cache/CachedResourceRequest.cpp: (WebCore::acceptHeaderValueFromType): (WebCore::CachedResourceRequest::updateAcceptEncodingHeader): * loader/cache/CachedScript.cpp: (WebCore::CachedScript::CachedScript): * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::getOriginsWithCache): * loader/soup/ResourceLoaderSoup.cpp: (WebCore::ResourceLoader::loadGResource): * page/DOMSelection.cpp: (WebCore::DOMSelection::type const): * page/DOMWindow.cpp: (WebCore::DOMWindow::close): (WebCore::DOMWindow::addEventListener): (WebCore::DOMWindow::createWindow): * page/DebugPageOverlays.cpp: (WebCore::touchEventRegionColors): * page/DiagnosticLoggingKeys.cpp: (WebCore::DiagnosticLoggingKeys::mediaLoadedKey): (WebCore::DiagnosticLoggingKeys::mediaLoadingFailedKey): (WebCore::DiagnosticLoggingKeys::memoryCacheEntryDecisionKey): (WebCore::DiagnosticLoggingKeys::memoryCacheUsageKey): (WebCore::DiagnosticLoggingKeys::missingValidatorFieldsKey): (WebCore::DiagnosticLoggingKeys::pluginLoadedKey): (WebCore::DiagnosticLoggingKeys::pluginLoadingFailedKey): (WebCore::DiagnosticLoggingKeys::postPageBackgroundingCPUUsageKey): (WebCore::DiagnosticLoggingKeys::postPageBackgroundingMemoryUsageKey): (WebCore::DiagnosticLoggingKeys::pageHandlesWebGLContextLossKey): (WebCore::DiagnosticLoggingKeys::postPageLoadCPUUsageKey): (WebCore::DiagnosticLoggingKeys::postPageLoadMemoryUsageKey): (WebCore::DiagnosticLoggingKeys::provisionalLoadKey): (WebCore::DiagnosticLoggingKeys::pageContainsPluginKey): (WebCore::DiagnosticLoggingKeys::pageContainsAtLeastOnePluginKey): (WebCore::DiagnosticLoggingKeys::pageContainsMediaEngineKey): (WebCore::DiagnosticLoggingKeys::pageContainsAtLeastOneMediaEngineKey): (WebCore::DiagnosticLoggingKeys::pageLoadedKey): (WebCore::DiagnosticLoggingKeys::playedKey): (WebCore::DiagnosticLoggingKeys::engineFailedToLoadKey): (WebCore::DiagnosticLoggingKeys::entryRightlyNotWarmedUpKey): (WebCore::DiagnosticLoggingKeys::entryWronglyNotWarmedUpKey): (WebCore::DiagnosticLoggingKeys::navigationKey): (WebCore::DiagnosticLoggingKeys::needsRevalidationKey): (WebCore::DiagnosticLoggingKeys::networkCacheKey): (WebCore::DiagnosticLoggingKeys::networkCacheFailureReasonKey): (WebCore::DiagnosticLoggingKeys::networkCacheUnusedReasonKey): (WebCore::DiagnosticLoggingKeys::networkCacheReuseFailureKey): (WebCore::DiagnosticLoggingKeys::networkKey): (WebCore::DiagnosticLoggingKeys::networkProcessCrashedKey): (WebCore::DiagnosticLoggingKeys::neverSeenBeforeKey): (WebCore::DiagnosticLoggingKeys::noKey): (WebCore::DiagnosticLoggingKeys::noCacheKey): (WebCore::DiagnosticLoggingKeys::noStoreKey): (WebCore::DiagnosticLoggingKeys::nonVisibleStateKey): (WebCore::DiagnosticLoggingKeys::notInMemoryCacheKey): (WebCore::DiagnosticLoggingKeys::pageCacheKey): (WebCore::DiagnosticLoggingKeys::pageCacheFailureKey): (WebCore::DiagnosticLoggingKeys::noDocumentLoaderKey): (WebCore::DiagnosticLoggingKeys::noLongerInCacheKey): (WebCore::DiagnosticLoggingKeys::otherKey): (WebCore::DiagnosticLoggingKeys::mainDocumentErrorKey): (WebCore::DiagnosticLoggingKeys::mainResourceKey): (WebCore::DiagnosticLoggingKeys::isErrorPageKey): (WebCore::DiagnosticLoggingKeys::isExpiredKey): (WebCore::DiagnosticLoggingKeys::isReloadIgnoringCacheDataKey): (WebCore::DiagnosticLoggingKeys::loadingKey): (WebCore::DiagnosticLoggingKeys::hasPluginsKey): (WebCore::DiagnosticLoggingKeys::httpsNoStoreKey): (WebCore::DiagnosticLoggingKeys::imageKey): (WebCore::DiagnosticLoggingKeys::inMemoryCacheKey): (WebCore::DiagnosticLoggingKeys::inactiveKey): (WebCore::DiagnosticLoggingKeys::internalErrorKey): (WebCore::DiagnosticLoggingKeys::invalidSessionIDKey): (WebCore::DiagnosticLoggingKeys::isAttachmentKey): (WebCore::DiagnosticLoggingKeys::isConditionalRequestKey): (WebCore::DiagnosticLoggingKeys::isDisabledKey): (WebCore::DiagnosticLoggingKeys::noCurrentHistoryItemKey): (WebCore::DiagnosticLoggingKeys::quirkRedirectComingKey): (WebCore::DiagnosticLoggingKeys::rawKey): (WebCore::DiagnosticLoggingKeys::redirectKey): (WebCore::DiagnosticLoggingKeys::isLoadingKey): (WebCore::DiagnosticLoggingKeys::documentLoaderStoppingKey): (WebCore::DiagnosticLoggingKeys::domainCausingCrashKey): (WebCore::DiagnosticLoggingKeys::domainCausingEnergyDrainKey): (WebCore::DiagnosticLoggingKeys::domainCausingJetsamKey): (WebCore::DiagnosticLoggingKeys::simulatedPageCrashKey): (WebCore::DiagnosticLoggingKeys::exceededActiveMemoryLimitKey): (WebCore::DiagnosticLoggingKeys::exceededInactiveMemoryLimitKey): (WebCore::DiagnosticLoggingKeys::exceededBackgroundCPULimitKey): (WebCore::DiagnosticLoggingKeys::domainVisitedKey): (WebCore::DiagnosticLoggingKeys::cannotSuspendActiveDOMObjectsKey): (WebCore::DiagnosticLoggingKeys::cpuUsageKey): (WebCore::DiagnosticLoggingKeys::createSharedBufferFailedKey): (WebCore::DiagnosticLoggingKeys::activeInForegroundTabKey): (WebCore::DiagnosticLoggingKeys::activeInBackgroundTabOnlyKey): (WebCore::DiagnosticLoggingKeys::applicationCacheKey): (WebCore::DiagnosticLoggingKeys::applicationManifestKey): (WebCore::DiagnosticLoggingKeys::audioKey): (WebCore::DiagnosticLoggingKeys::backNavigationDeltaKey): (WebCore::DiagnosticLoggingKeys::canCacheKey): (WebCore::DiagnosticLoggingKeys::cacheControlNoStoreKey): (WebCore::DiagnosticLoggingKeys::cachedResourceRevalidationKey): (WebCore::DiagnosticLoggingKeys::cachedResourceRevalidationReasonKey): (WebCore::DiagnosticLoggingKeys::deniedByClientKey): (WebCore::DiagnosticLoggingKeys::deviceMotionKey): (WebCore::DiagnosticLoggingKeys::deviceOrientationKey): (WebCore::DiagnosticLoggingKeys::diskCacheKey): (WebCore::DiagnosticLoggingKeys::diskCacheAfterValidationKey): (WebCore::DiagnosticLoggingKeys::reloadKey): (WebCore::DiagnosticLoggingKeys::replaceKey): (WebCore::DiagnosticLoggingKeys::retrievalRequestKey): (WebCore::DiagnosticLoggingKeys::resourceLoadedKey): (WebCore::DiagnosticLoggingKeys::resourceResponseSourceKey): (WebCore::DiagnosticLoggingKeys::retrievalKey): (WebCore::DiagnosticLoggingKeys::revalidatingKey): (WebCore::DiagnosticLoggingKeys::reloadFromOriginKey): (WebCore::DiagnosticLoggingKeys::reloadRevalidatingExpiredKey): (WebCore::DiagnosticLoggingKeys::sameLoadKey): (WebCore::DiagnosticLoggingKeys::scriptKey): (WebCore::DiagnosticLoggingKeys::serviceWorkerKey): (WebCore::DiagnosticLoggingKeys::streamingMedia): (WebCore::DiagnosticLoggingKeys::styleSheetKey): (WebCore::DiagnosticLoggingKeys::successfulSpeculativeWarmupWithRevalidationKey): (WebCore::DiagnosticLoggingKeys::successfulSpeculativeWarmupWithoutRevalidationKey): (WebCore::DiagnosticLoggingKeys::svgDocumentKey): (WebCore::DiagnosticLoggingKeys::synchronousMessageFailedKey): (WebCore::DiagnosticLoggingKeys::telemetryPageLoadKey): (WebCore::DiagnosticLoggingKeys::timedOutKey): (WebCore::DiagnosticLoggingKeys::canceledLessThan2SecondsKey): (WebCore::DiagnosticLoggingKeys::canceledLessThan5SecondsKey): (WebCore::DiagnosticLoggingKeys::canceledLessThan20SecondsKey): (WebCore::DiagnosticLoggingKeys::canceledMoreThan20SecondsKey): (WebCore::DiagnosticLoggingKeys::failedLessThan2SecondsKey): (WebCore::DiagnosticLoggingKeys::failedLessThan5SecondsKey): (WebCore::DiagnosticLoggingKeys::failedLessThan20SecondsKey): (WebCore::DiagnosticLoggingKeys::failedMoreThan20SecondsKey): (WebCore::DiagnosticLoggingKeys::occurredKey): (WebCore::DiagnosticLoggingKeys::succeededLessThan2SecondsKey): (WebCore::DiagnosticLoggingKeys::succeededLessThan5SecondsKey): (WebCore::DiagnosticLoggingKeys::succeededLessThan20SecondsKey): (WebCore::DiagnosticLoggingKeys::succeededMoreThan20SecondsKey): (WebCore::DiagnosticLoggingKeys::uncacheableStatusCodeKey): (WebCore::DiagnosticLoggingKeys::underMemoryPressureKey): (WebCore::DiagnosticLoggingKeys::unknownEntryRequestKey): (WebCore::DiagnosticLoggingKeys::unlikelyToReuseKey): (WebCore::DiagnosticLoggingKeys::unsupportedHTTPMethodKey): (WebCore::DiagnosticLoggingKeys::unsuspendableDOMObjectKey): (WebCore::DiagnosticLoggingKeys::unusedKey): (WebCore::DiagnosticLoggingKeys::unusedReasonCredentialSettingsKey): (WebCore::DiagnosticLoggingKeys::unusedReasonErrorKey): (WebCore::DiagnosticLoggingKeys::unusedReasonMustRevalidateNoValidatorKey): (WebCore::DiagnosticLoggingKeys::unusedReasonNoStoreKey): (WebCore::DiagnosticLoggingKeys::unusedReasonRedirectChainKey): (WebCore::DiagnosticLoggingKeys::unusedReasonReloadKey): (WebCore::DiagnosticLoggingKeys::unusedReasonTypeMismatchKey): (WebCore::DiagnosticLoggingKeys::usedKey): (WebCore::DiagnosticLoggingKeys::userZoomActionKey): (WebCore::DiagnosticLoggingKeys::varyingHeaderMismatchKey): (WebCore::DiagnosticLoggingKeys::videoKey): (WebCore::DiagnosticLoggingKeys::visibleNonActiveStateKey): (WebCore::DiagnosticLoggingKeys::visibleAndActiveStateKey): (WebCore::DiagnosticLoggingKeys::wastedSpeculativeWarmupWithRevalidationKey): (WebCore::DiagnosticLoggingKeys::wastedSpeculativeWarmupWithoutRevalidationKey): (WebCore::DiagnosticLoggingKeys::webViewKey): (WebCore::DiagnosticLoggingKeys::yesKey): (WebCore::DiagnosticLoggingKeys::expiredKey): (WebCore::DiagnosticLoggingKeys::fontKey): (WebCore::DiagnosticLoggingKeys::prunedDueToMemoryPressureKey): (WebCore::DiagnosticLoggingKeys::prunedDueToMaxSizeReached): (WebCore::DiagnosticLoggingKeys::prunedDueToProcessSuspended): (WebCore::WebCore::DiagnosticLoggingKeys::notHTTPFamilyKey): (WebCore::WebCore::DiagnosticLoggingKeys::webGLStateKey): (WebCore::DiagnosticLoggingKeys::memoryUsageToDiagnosticLoggingKey): (WebCore::DiagnosticLoggingKeys::foregroundCPUUsageToDiagnosticLoggingKey): (WebCore::DiagnosticLoggingKeys::backgroundCPUUsageToDiagnosticLoggingKey): (WebCore::DiagnosticLoggingKeys::resourceLoadStatisticsTelemetryKey): * page/DisabledAdaptations.cpp: (WebCore::watchAdaptationName): * page/EventHandler.cpp: (WebCore::EventHandler::handlePasteGlobalSelection): (WebCore::convertDragOperationToDropZoneOperation): * page/EventSource.cpp: (WebCore::EventSource::EventSource): * page/History.cpp: (WebCore::History::stateObjectAdded): * page/NavigatorBase.cpp: (WebCore::NavigatorBase::appName): (WebCore::NavigatorBase::appCodeName): * page/Page.cpp: (WebCore::Page::logNavigation): * page/PageDebuggable.cpp: (WebCore::PageDebuggable::url const): * page/PageSerializer.cpp: (WebCore::PageSerializer::serializeCSSStyleSheet): * page/PerformanceMark.h: * page/PerformanceMeasure.h: * page/PerformanceObserver.cpp: (WebCore::PerformanceObserver::observe): * page/PerformanceResourceTiming.cpp: (WebCore::PerformanceResourceTiming::PerformanceResourceTiming): * page/PerformanceUserTiming.cpp: (WebCore::restrictedMarkFunction): * page/PointerLockController.cpp: (WebCore::PointerLockController::requestPointerLock): * page/PrintContext.cpp: (WebCore::PrintContext::pageProperty): * page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::toString const): * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::toString const): (WebCore::SecurityOriginData::databaseIdentifier const): * page/cocoa/ResourceUsageOverlayCocoa.mm: (WebCore::gcTimerString): * page/csp/ContentSecurityPolicy.cpp: (WebCore::ContentSecurityPolicy::reportViolation const): (WebCore::ContentSecurityPolicy::reportUnsupportedDirective const): * page/linux/ResourceUsageOverlayLinux.cpp: (WebCore::cpuUsageString): (WebCore::gcTimerString): * platform/ContentType.cpp: (WebCore::ContentType::codecsParameter): (WebCore::ContentType::profilesParameter): * platform/Decimal.cpp: (WebCore::Decimal::toString const): * platform/MIMETypeRegistry.cpp: (WebCore::initializeSupportedImageMIMETypes): (WebCore::typesForCommonExtension): (WebCore::initializeUnsupportedTextMIMETypes): (WebCore::MIMETypeRegistry::getNormalizedMIMEType): * platform/SchemeRegistry.cpp: (WebCore::SchemeRegistry::canServiceWorkersHandleURLScheme): * platform/URL.cpp: (WebCore::mimeTypeFromDataURL): * platform/UserAgentQuirks.cpp: (WebCore::UserAgentQuirks::stringForQuirk): * platform/cocoa/KeyEventCocoa.mm: (WebCore::keyForCharCode): * platform/cocoa/NetworkExtensionContentFilter.mm: (WebCore::NetworkExtensionContentFilter::unblockHandler const): * platform/cocoa/ParentalControlsContentFilter.mm: (WebCore::ParentalControlsContentFilter::unblockHandler const): * platform/cocoa/PasteboardCocoa.mm: (WebCore::Pasteboard::fileContentState): * platform/cocoa/RuntimeApplicationChecksCocoa.mm: (WebCore::MacApplication::isSafari): (WebCore::MacApplication::isAppleMail): (WebCore::MacApplication::isIBooks): (WebCore::MacApplication::isITunes): (WebCore::MacApplication::isMicrosoftMessenger): (WebCore::MacApplication::isAdobeInstaller): (WebCore::MacApplication::isAOLInstantMessenger): (WebCore::MacApplication::isMicrosoftMyDay): (WebCore::MacApplication::isMicrosoftOutlook): (WebCore::MacApplication::isQuickenEssentials): (WebCore::MacApplication::isAperture): (WebCore::MacApplication::isVersions): (WebCore::MacApplication::isHRBlock): (WebCore::MacApplication::isIAdProducer): (WebCore::MacApplication::isSolidStateNetworksDownloader): (WebCore::IOSApplication::isMobileMail): (WebCore::IOSApplication::isMobileSafari): (WebCore::IOSApplication::isWebBookmarksD): (WebCore::IOSApplication::isDumpRenderTree): (WebCore::IOSApplication::isMobileStore): (WebCore::IOSApplication::isSpringBoard): (WebCore::IOSApplication::isWebApp): (WebCore::IOSApplication::isIBooks): (WebCore::IOSApplication::isIBooksStorytime): (WebCore::IOSApplication::isTheSecretSocietyHiddenMystery): (WebCore::IOSApplication::isCardiogram): (WebCore::IOSApplication::isNike): * platform/cocoa/UserAgentCocoa.mm: (WebCore::userAgentBundleVersion): * platform/gamepad/cocoa/GameControllerGamepad.mm: (WebCore::GameControllerGamepad::setupAsExtendedGamepad): (WebCore::GameControllerGamepad::setupAsGamepad): * platform/graphics/InbandTextTrackPrivateClient.h: (WebCore::GenericCueData::toJSONString const): * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp: (WebCore::CDMFactoryFairPlayStreaming::supportsKeySystem): * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (WebCore::isEqual): (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense): (WebCore::CDMInstanceFairPlayStreamingAVFObjC::keySystem const): * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: (WebCore::CDMSessionAVContentKeySession::generateKeyRequest): * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: (WebCore::CDMSessionAVStreamSession::generateKeyRequest): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::propertyIdToString): * platform/graphics/ca/TileController.cpp: (WebCore::TileController::tileGridContainerLayerName): (WebCore::TileController::zoomedOutTileGridContainerLayerName): * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::ImageBuffer::toDataURL const): (WebCore::dataURL): * platform/graphics/cv/VideoTextureCopierCV.cpp: (WebCore::VideoTextureCopierCV::initializeContextObjects): (WebCore::VideoTextureCopierCV::initializeUVContextObjects): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage): (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered): * platform/graphics/iso/ISOVTTCue.cpp: (WebCore::ISOWebVTTCue::toJSONString const): * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp: (Nicosia::PaintingEngineThreaded::PaintingEngineThreaded): * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp: (WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions): * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::getUnmangledInfoLog): * platform/graphics/texmap/TextureMapperContextAttributes.cpp: (WebCore::TextureMapperContextAttributes::get): * platform/graphics/win/ImageBufferDirect2D.cpp: (WebCore::ImageBuffer::toDataURL const): (WebCore::ImageDataToDataURL): * platform/gtk/PasteboardGtk.cpp: (WebCore::Pasteboard::typesForLegacyUnsafeBindings): * platform/gtk/PasteboardHelper.cpp: * platform/gtk/PlatformKeyboardEventGtk.cpp: (WebCore::PlatformKeyboardEvent::keyValueForGdkKeyCode): (WebCore::PlatformKeyboardEvent::keyCodeForHardwareKeyCode): * platform/image-decoders/bmp/BMPImageDecoder.h: * platform/image-decoders/gif/GIFImageDecoder.h: * platform/image-decoders/ico/ICOImageDecoder.h: * platform/image-decoders/jpeg/JPEGImageDecoder.h: * platform/image-decoders/png/PNGImageDecoder.h: * platform/image-decoders/webp/WEBPImageDecoder.h: * platform/ios/Device.cpp: (WebCore::deviceName): * platform/ios/PasteboardIOS.mm: (WebCore::Pasteboard::addHTMLClipboardTypesForCocoaType): * platform/ios/PlatformEventFactoryIOS.mm: (WebCore::keyForKeyEvent): (WebCore::codeForKeyEvent): * platform/ios/PlatformPasteboardIOS.mm: (WebCore::safeTypeForDOMToReadAndWriteForPlatformType): * platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::read): (WebCore::Pasteboard::addHTMLClipboardTypesForCocoaType): * platform/mac/PlatformEventFactoryMac.mm: (WebCore::keyForKeyEvent): (WebCore::codeForKeyEvent): * platform/mac/PlatformPasteboardMac.mm: (WebCore::safeTypeForDOMToReadAndWriteForPlatformType): * platform/mediastream/MediaConstraints.cpp: (WebCore::addDefaultVideoConstraints): * platform/mediastream/PeerMediaDescription.h: * platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::applyConstraints): * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp: (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID): * platform/mock/MockRealtimeMediaSource.cpp: (WebCore::deviceMap): (WebCore::MockRealtimeMediaSource::audioDevices): (WebCore::MockRealtimeMediaSource::videoDevices): (WebCore::MockRealtimeMediaSource::displayDevices): * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::drawText): * platform/network/BlobRegistryImpl.cpp: (WebCore::BlobRegistryImpl::writeBlobsToTemporaryFiles): * platform/network/DataURLDecoder.cpp: (WebCore::DataURLDecoder::parseMediaType): * platform/network/FormData.cpp: (WebCore::FormData::appendMultiPartFileValue): * platform/network/HTTPParsers.cpp: (WebCore::parseHTTPRequestLine): (WebCore::parseHTTPHeader): (WebCore::normalizeHTTPMethod): * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::redirectedRequest const): * platform/network/ResourceRequestBase.h: (WebCore::ResourceRequestBase::ResourceRequestBase): * platform/network/curl/ResourceHandleCurl.cpp: (WebCore::ResourceHandle::handleDataURL): * platform/network/curl/SynchronousLoaderClientCurl.cpp: (WebCore::SynchronousLoaderClient::platformBadResponseError): * platform/network/win/DownloadBundleWin.cpp: (WebCore::DownloadBundle::fileExtension): * platform/sql/SQLiteDatabase.cpp: (WebCore::SQLiteDatabase::open): (WebCore::SQLiteDatabase::setFullsync): (WebCore::SQLiteDatabase::maximumSize): (WebCore::SQLiteDatabase::pageSize): (WebCore::SQLiteDatabase::freeSpaceSize): (WebCore::SQLiteDatabase::totalSize): (WebCore::SQLiteDatabase::clearAllTables): (WebCore::SQLiteDatabase::runVacuumCommand): (WebCore::SQLiteDatabase::runIncrementalVacuumCommand): (WebCore::SQLiteDatabase::turnOnIncrementalAutoVacuum): * platform/sql/SQLiteFileSystem.cpp: (WebCore::SQLiteFileSystem::deleteDatabaseFile): * platform/text/LocaleICU.cpp: (WebCore::LocaleICU::dateFormat): (WebCore::getFormatForSkeleton): * platform/text/LocaleNone.cpp: (WebCore::LocaleNone::dateFormat): (WebCore::LocaleNone::monthFormat): (WebCore::LocaleNone::shortMonthFormat): (WebCore::LocaleNone::timeFormat): (WebCore::LocaleNone::shortTimeFormat): (WebCore::LocaleNone::dateTimeFormatWithSeconds): (WebCore::LocaleNone::dateTimeFormatWithoutSeconds): * platform/text/LocaleToScriptMappingDefault.cpp: (WebCore::scriptNameToCode): (WebCore::localeToScriptCodeForFontSelection): * platform/text/TextEncodingRegistry.cpp: (WebCore::defaultTextEncodingNameForSystemLanguage): * platform/win/FileSystemWin.cpp: (WebCore::FileSystem::bundleName): * platform/wpe/RenderThemeWPE.cpp: (WebCore::RenderThemeWPE::mediaControlsStyleSheet): * rendering/RenderMenuList.cpp: (RenderMenuList::setText): * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::extraDefaultStyleSheet): * svg/SVGComponentTransferFunctionElement.h: (WebCore::SVGPropertyTraits<ComponentTransferType>::toString): * svg/SVGFEColorMatrixElement.h: (WebCore::SVGPropertyTraits<ColorMatrixType>::toString): * svg/SVGFECompositeElement.h: (WebCore::SVGPropertyTraits<CompositeOperationType>::toString): * svg/SVGFEConvolveMatrixElement.h: (WebCore::SVGPropertyTraits<EdgeModeType>::toString): * svg/SVGFEDisplacementMapElement.h: (WebCore::SVGPropertyTraits<ChannelSelectorType>::toString): * svg/SVGFEMorphologyElement.h: (WebCore::SVGPropertyTraits<MorphologyOperatorType>::toString): * svg/SVGFETurbulenceElement.h: (WebCore::SVGPropertyTraits<SVGStitchOptions>::toString): (WebCore::SVGPropertyTraits<TurbulenceType>::toString): * svg/SVGGradientElement.h: (WebCore::SVGPropertyTraits<SVGSpreadMethodType>::toString): * svg/SVGLocatable.cpp: (WebCore::SVGLocatable::getTransformToElement): * svg/SVGMarkerTypes.h: (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString): * svg/SVGMatrixValue.h: * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::SVGSVGElement): (WebCore::SVGSVGElement::parseAttribute): * svg/SVGTextContentElement.h: (WebCore::SVGPropertyTraits<SVGLengthAdjustType>::toString): * svg/SVGTextPathElement.h: (WebCore::SVGPropertyTraits<SVGTextPathMethodType>::toString): (WebCore::SVGPropertyTraits<SVGTextPathSpacingType>::toString): * svg/SVGToOTFFontConversion.cpp: (WebCore::SVGToOTFFontConverter::appendCFFTable): * svg/SVGUnitTypes.h: (WebCore::SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::toString): * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::toClipPath): * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::filenameExtension const): * testing/InternalSettings.cpp: (WebCore::InternalSettings::userInterfaceDirectionPolicy): (WebCore::InternalSettings::systemLayoutDirection): * testing/Internals.cpp: (WebCore::Internals::areSVGAnimationsPaused const): (WebCore::Internals::accessKeyModifiers const): (WebCore::Internals::setMediaDeviceState): (WebCore::Internals::audioSessionCategory const): (WebCore::Internals::systemPreviewRelType): * testing/MockCDMFactory.cpp: (WebCore::MockCDM::sanitizeResponse const): (WebCore::MockCDMInstance::updateLicense): * testing/MockContentFilter.cpp: (WebCore::MockContentFilter::unblockRequestDeniedScript const): * testing/MockCredentialsMessenger.cpp: (WebCore::MockCredentialsMessenger::~MockCredentialsMessenger): (WebCore::MockCredentialsMessenger::makeCredential): (WebCore::MockCredentialsMessenger::getAssertion): * testing/MockPaymentCoordinator.cpp: (WebCore::MockPaymentCoordinator::showPaymentUI): * workers/WorkerRunLoop.cpp: (WebCore::WorkerRunLoop::debuggerMode): * workers/WorkerScriptLoader.cpp: (WebCore::WorkerScriptLoader::loadSynchronously): (WebCore::WorkerScriptLoader::createResourceRequest): (WebCore::WorkerScriptLoader::didReceiveData): * workers/service/ExtendableEvent.cpp: (WebCore::ExtendableEvent::waitUntil): * workers/service/FetchEvent.cpp: (WebCore::FetchEvent::~FetchEvent): (WebCore::FetchEvent::respondWith): (WebCore::FetchEvent::promiseIsSettled): * workers/service/SWClientConnection.cpp: (WebCore::SWClientConnection::clearPendingJobs): * workers/service/ServiceWorker.cpp: (WebCore::ServiceWorker::postMessage): * workers/service/ServiceWorkerClients.cpp: (WebCore::ServiceWorkerClients::openWindow): (WebCore::ServiceWorkerClients::claim): * workers/service/ServiceWorkerContainer.cpp: (WebCore::ServiceWorkerContainer::addRegistration): (WebCore::ServiceWorkerContainer::getRegistration): (WebCore::ServiceWorkerContainer::startScriptFetchForJob): * workers/service/ServiceWorkerJob.cpp: (WebCore::ServiceWorkerJob::fetchScriptWithContext): (WebCore::ServiceWorkerJob::didReceiveResponse): * workers/service/ServiceWorkerRegistration.cpp: (WebCore::ServiceWorkerRegistration::update): * workers/service/ServiceWorkerWindowClient.cpp: (WebCore::ServiceWorkerWindowClient::focus): (WebCore::ServiceWorkerWindowClient::navigate): * workers/service/context/ServiceWorkerDebuggable.h: * workers/service/context/ServiceWorkerFetch.cpp: (WebCore::ServiceWorkerFetch::dispatchFetchEvent): * workers/service/server/RegistrationDatabase.cpp: (WebCore::RegistrationDatabase::doPushChanges): (WebCore::RegistrationDatabase::importRecords): * workers/service/server/SWServerJobQueue.cpp: (WebCore::SWServerJobQueue::runRegisterJob): (WebCore::SWServerJobQueue::runUnregisterJob): (WebCore::SWServerJobQueue::runUpdateJob): * xml/XMLErrors.cpp: (WebCore::createXHTMLParserErrorHeader): (WebCore::XMLErrors::insertErrorMessageBlock): * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::send): (WebCore::XMLHttpRequest::responseMIMEType const): * xml/XMLTreeViewer.cpp: (WebCore::XMLTreeViewer::transformDocumentToTreeView): * xml/XPathPredicate.cpp: (WebCore::XPath::evaluatePredicate): * xml/XPathValue.cpp: (WebCore::XPath::Value::toString const): * xml/parser/CharacterReferenceParserInlines.h: (WebCore::consumeCharacterReference): Source/WebCore/PAL: * pal/unix/LoggingUnix.cpp: (PAL::logLevelString): Source/WebDriver: * CommandResult.cpp: (WebDriver::CommandResult::errorString const): * Session.cpp: (WebDriver::Session::webElementIdentifier): (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::switchToFrame): (WebDriver::Session::switchToParentFrame): (WebDriver::Session::getToplevelBrowsingContextRect): (WebDriver::Session::setWindowRect): (WebDriver::Session::maximizeWindow): (WebDriver::Session::minimizeWindow): (WebDriver::Session::fullscreenWindow): (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::selectOptionElement): (WebDriver::Session::elementClear): (WebDriver::Session::virtualKeyForKeySequence): (WebDriver::Session::elementSendKeys): (WebDriver::Session::executeScript): (WebDriver::mouseButtonForAutomation): (WebDriver::Session::performMouseInteraction): (WebDriver::Session::performKeyboardInteractions): (WebDriver::parseAutomationCookie): (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.cpp: (WebDriver::WebDriverService::sendResponse const): (WebDriver::WebDriverService::parseCapabilities const): (WebDriver::WebDriverService::findSessionOrCompleteWithError): (WebDriver::WebDriverService::matchCapabilities const): (WebDriver::WebDriverService::processCapabilities const): (WebDriver::WebDriverService::createSession): (WebDriver::WebDriverService::deleteSession): (WebDriver::WebDriverService::status): (WebDriver::WebDriverService::go): (WebDriver::WebDriverService::setWindowRect): (WebDriver::WebDriverService::switchToWindow): (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::WebDriverService::takeElementScreenshot): * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::sendMessageToBackend): * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformValidateCapability const): (WebDriver::WebDriverService::platformParseCapabilities const): * wpe/WebDriverServiceWPE.cpp: (WebDriver::WebDriverService::platformValidateCapability const): (WebDriver::WebDriverService::platformParseCapabilities const): Source/WebKit: * NetworkProcess/NetworkCORSPreflightChecker.cpp: (WebKit::NetworkCORSPreflightChecker::willPerformHTTPRedirection): (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge): (WebKit::NetworkCORSPreflightChecker::wasBlocked): (WebKit::NetworkCORSPreflightChecker::cannotShowURL): * NetworkProcess/NetworkDataTaskBlob.cpp: (WebKit::NetworkDataTaskBlob::suggestedFilename const): * NetworkProcess/NetworkLoadChecker.cpp: (WebKit::NetworkLoadChecker::checkRedirection): (WebKit::NetworkLoadChecker::checkRequest): * NetworkProcess/NetworkResourceLoader.cpp: (WebKit::NetworkResourceLoader::continueWillSendRequest): * NetworkProcess/PingLoad.cpp: (WebKit::PingLoad::willPerformHTTPRedirection): (WebKit::PingLoad::didReceiveChallenge): (WebKit::PingLoad::timeoutTimerFired): * NetworkProcess/PreconnectTask.cpp: (WebKit::PreconnectTask::PreconnectTask): * NetworkProcess/cache/CacheStorageEngine.cpp: (WebKit::CacheStorage::Engine::initialize): * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::Cache::toRecordInformation): * NetworkProcess/cache/CacheStorageEngineCaches.cpp: (WebKit::CacheStorage::cachesListFilename): (WebKit::CacheStorage::cachesOriginFilename): * NetworkProcess/cache/NetworkCacheStatistics.cpp: (WebKit::NetworkCache::Statistics::initialize): (WebKit::NetworkCache::Statistics::bootstrapFromNetworkCache): (WebKit::NetworkCache::Statistics::queryWasEverRequested): (WebKit::NetworkCache::Statistics::clear): (WebKit::NetworkCache::Statistics::addHashesToDatabase): (WebKit::NetworkCache::Statistics::addStoreDecisionsToDatabase): * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h: (WebKit::XPCServiceInitializer): * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm: (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData): * Shared/Plugins/Netscape/PluginInformation.cpp: (WebKit::pluginInformationBundleIdentifierKey): (WebKit::pluginInformationBundleVersionKey): (WebKit::pluginInformationBundleShortVersionKey): (WebKit::pluginInformationPathKey): (WebKit::pluginInformationDisplayNameKey): (WebKit::pluginInformationDefaultLoadPolicyKey): (WebKit::pluginInformationUpdatePastLastBlockedVersionIsKnownAvailableKey): (WebKit::pluginInformationHasSandboxProfileKey): (WebKit::pluginInformationFrameURLKey): (WebKit::pluginInformationMIMETypeKey): (WebKit::pluginInformationPageURLKey): (WebKit::pluginInformationPluginspageAttributeURLKey): (WebKit::pluginInformationPluginURLKey): (WebKit::plugInInformationReplacementObscuredKey): * Shared/ios/WebIOSEventFactory.mm: (WebIOSEventFactory::createWebKeyboardEvent): * Shared/linux/WebMemorySamplerLinux.cpp: (WebKit::WebMemorySampler::sampleWebKit const): * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm: (debuggableTypeString): * UIProcess/API/glib/WebKitWebContext.cpp: (webkit_web_context_set_preferred_languages): * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext): (WebKit::WebAutomationSession::addSingleCookie): (WebKit::WebAutomationSession::setSessionPermissions): (WebKit::WebAutomationSession::performMouseInteraction): (WebKit::WebAutomationSession::performKeyboardInteractions): (WebKit::WebAutomationSession::performInteractionSequence): * UIProcess/Automation/WebAutomationSession.h: * UIProcess/ChildProcessProxy.cpp: (WebKit::ChildProcessProxy::getLaunchOptions): * UIProcess/Cocoa/DownloadClient.mm: (WebKit::DownloadClient::didStart): * UIProcess/Cocoa/WebViewImpl.mm: (WebKit::selectorExceptionMap): * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.cpp: (WebKit::WebCredentialsMessengerProxy::makeCredential): (WebKit::WebCredentialsMessengerProxy::getAssertion): * UIProcess/Plugins/mac/PluginInfoStoreMac.mm: (WebKit::PluginInfoStore::pluginsDirectories): * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp: (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk): * UIProcess/ServiceWorkerProcessProxy.cpp: (WebKit::ServiceWorkerProcessProxy::getLaunchOptions): (WebKit::ServiceWorkerProcessProxy::didReceiveAuthenticationChallenge): * UIProcess/UserMediaProcessManager.cpp: (WebKit::UserMediaProcessManager::willCreateMediaStream): (WebKit::UserMediaProcessManager::endedCaptureSession): * UIProcess/WebBackForwardList.cpp: (WebKit::WebBackForwardList::goToItem): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::loadFile): (WebKit::WebPageProxy::loadHTMLString): (WebKit::WebPageProxy::loadPlainTextString): (WebKit::WebPageProxy::loadWebArchiveData): (WebKit::WebPageProxy::savePDFToFileInDownloadsFolder): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::getLaunchOptions): * UIProcess/WebResourceLoadStatisticsStore.cpp: (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData): * UIProcess/WebResourceLoadStatisticsTelemetry.cpp: (WebKit::notifyPages): (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit): * UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView copyForWebView:]): (-[WKContentView cutForWebView:]): (-[WKContentView pasteForWebView:]): (-[WKContentView selectAllForWebView:]): (-[WKContentView deleteBackward]): (-[WKContentView _interpretKeyEvent:isCharEvent:]): * UIProcess/ios/WKLegacyPDFView.mm: (-[WKLegacyPDFView _URLForLinkAnnotation:]): * WebProcess/Automation/WebAutomationSessionProxy.cpp: (WebKit::WebAutomationSessionProxy::elementForNodeHandle): (WebKit::WebAutomationSessionProxy::didClearWindowObjectForFrame): (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp: (WebKit::WebIDBConnectionToServer::connectionToServerLost): * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp: (webkit_dom_document_get_ready_state): * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp: (WebKit::uniqueWorldName): * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp: (WebKit::WebMediaKeyStorageManager::getMediaKeyOrigins): * WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::pluginInfo): * WebProcess/Storage/ServiceWorkerClientFetch.cpp: (WebKit::ServiceWorkerClientFetch::validateResponse): (WebKit::ServiceWorkerClientFetch::didReceiveResponse): * WebProcess/WebCoreSupport/WebContextMenuClient.cpp: (WebKit::WebContextMenuClient::searchWithGoogle): * WebProcess/WebCoreSupport/WebInspectorClient.cpp: (WebKit::WebInspectorClient::showPaintRect): * WebProcess/WebPage/RemoteWebInspectorUI.cpp: (WebKit::RemoteWebInspectorUI::initialize): (WebKit::RemoteWebInspectorUI::didSave): (WebKit::RemoteWebInspectorUI::didAppend): (WebKit::RemoteWebInspectorUI::frontendLoaded): * WebProcess/WebPage/WebInspector.cpp: (WebKit::WebInspector::openInNewTab): * WebProcess/WebPage/WebInspectorUI.cpp: (WebKit::WebInspectorUI::setDockSide): (WebKit::WebInspectorUI::setDockingUnavailable): (WebKit::WebInspectorUI::setIsVisible): (WebKit::WebInspectorUI::showConsole): (WebKit::WebInspectorUI::showResources): (WebKit::WebInspectorUI::showTimelines): (WebKit::WebInspectorUI::showMainResourceForFrame): (WebKit::WebInspectorUI::startPageProfiling): (WebKit::WebInspectorUI::stopPageProfiling): (WebKit::WebInspectorUI::startElementSelection): (WebKit::WebInspectorUI::stopElementSelection): (WebKit::WebInspectorUI::didSave): (WebKit::WebInspectorUI::didAppend): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::loadStringImpl): (WebKit::WebPage::loadAlternateHTMLString): * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::computeAutocorrectionContext): * WebProcess/WebProcess.cpp: (WebKit::getWebCoreMemoryCacheStatistics): (WebKit::WebProcess::getWebCoreStatistics): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::initializeProcessName): Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::syncFileSystemAndTrackerDatabase): * WebCoreSupport/PingHandle.h: Source/WebKitLegacy/mac: * DOM/ExceptionHandlers.mm: (raiseDOMErrorException): * Plugins/Hosted/ProxyInstance.mm: (WebKit::ProxyInstance::invokeMethod): * Storage/WebDatabaseProvider.mm: (WebDatabaseProvider::indexedDatabaseDirectoryPath): Source/WebKitLegacy/win: * Plugins/PluginStream.cpp: (WebCore::PluginStream::startStream): * WebCoreSupport/WebContextMenuClient.cpp: (WebContextMenuClient::searchWithGoogle): Source/WTF: This patch adds user-defined literal for ASCIILiteral. We can create ASCIILiteral in the form of `"Hello World"_s`. And we remove public ASCIILiteral constructor. This change ensures that ASCIILiteral is created from literal. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Indenter.h: (WTF::Indenter::Indenter): * wtf/Logger.h: (WTF::LogArgument::toString): * wtf/MediaTime.cpp: (WTF::toJSONStringInternal): (WTF::MediaTimeRange::toJSONString const): * wtf/linux/MemoryFootprintLinux.cpp: (WTF::memoryFootprint): * wtf/text/ASCIILiteral.cpp: Copied from Source/WebCore/css/CSSUnsetValue.cpp. (WTF::ASCIILiteral::dump const): * wtf/text/ASCIILiteral.h: Copied from Source/WTF/wtf/Indenter.h. (WTF::ASCIILiteral::operator const char* const): (WTF::ASCIILiteral::fromLiteralUnsafe): (WTF::ASCIILiteral::null): (WTF::ASCIILiteral::characters const): (WTF::ASCIILiteral::ASCIILiteral): (WTF::StringLiterals::operator _s): * wtf/text/WTFString.cpp: (asciiDebug): * wtf/text/WTFString.h: (WTF::operator==): (WTF::operator!=): (WTF::ASCIILiteral::ASCIILiteral): Deleted. (WTF::ASCIILiteral::operator const char*): Deleted. * wtf/unix/LanguageUnix.cpp: (WTF::platformLanguage): Tools: * TestWebKitAPI/Tests/WTF/StringOperators.cpp: (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WTF/WTFString.cpp: (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WTF/WorkerPool.cpp: (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebCore/ApplicationManifestParser.cpp: (TEST_F): * TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp: (TestWebKitAPI::TEST_F): * TestWebKitAPI/Tests/WebCore/URL.cpp: (TestWebKitAPI::TEST_F): * TestWebKitAPI/Tests/WebCore/ios/PreviewLoader.cpp: (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebCore/mac/GPUCommandQueue.mm: (TestWebKitAPI::TEST_F): * TestWebKitAPI/Tests/WebCore/mac/GPUTest.h: * TestWebKitAPI/Tests/WebKitCocoa/ContentFilteringPlugIn.mm: (-[MockContentFilterEnabler initWithCoder:]): * TestWebKitAPI/Tests/mac/ContentFiltering.mm: (TestWebKitAPI::loadAlternateTest): Canonical link: https://commits.webkit.org/202214@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233122 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-23 08:39:34 +00:00
capabilities.browserArguments = Vector<String> { "--automation"_s };
capabilities.useOverlayScrollbars = true;
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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 of `Page.setForcedAppearance` must be marked `optional` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 of `Page.setForcedAppearance` must be marked `optional` 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 invoking `Page.setForcedAppearance` to instead not provide an `appearance` parameter at all when wanting to "unset" it. * UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createConsoleSettingsView): Now that all logging channels matching a `Console.ChannelSource` are returned instead of just the hardcoded list, check for a matching `WI.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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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` has `Page` and `Viewport` enum values, but `WebAutomationSession` checks for `"Page"` and `"LayoutViewport"`. Add a `LayoutViewport` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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. Use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`as*` so that values can be more easily manipulated and can be confidently assumed to exist. Remove unused overloads and allow subclasses to call `as*` instead of `openAccessors` 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: Canonical link: https://commits.webkit.org/229208@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-10 19:23:17 +00:00
auto browserOptions = matchedCapabilities.getObject("webkitgtk:browserOptions"_s);
if (!browserOptions)
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
return;
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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 of `Page.setForcedAppearance` must be marked `optional` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 of `Page.setForcedAppearance` must be marked `optional` 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 invoking `Page.setForcedAppearance` to instead not provide an `appearance` parameter at all when wanting to "unset" it. * UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createConsoleSettingsView): Now that all logging channels matching a `Console.ChannelSource` are returned instead of just the hardcoded list, check for a matching `WI.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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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` has `Page` and `Viewport` enum values, but `WebAutomationSession` checks for `"Page"` and `"LayoutViewport"`. Add a `LayoutViewport` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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. Use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`as*` so that values can be more easily manipulated and can be confidently assumed to exist. Remove unused overloads and allow subclasses to call `as*` instead of `openAccessors` 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: Canonical link: https://commits.webkit.org/229208@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-10 19:23:17 +00:00
auto browserBinary = browserOptions->getString("binary"_s);
if (!!browserBinary) {
capabilities.browserBinary = browserBinary;
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
capabilities.browserArguments = std::nullopt;
}
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 of `Page.setForcedAppearance` must be marked `optional` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 of `Page.setForcedAppearance` must be marked `optional` 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 invoking `Page.setForcedAppearance` to instead not provide an `appearance` parameter at all when wanting to "unset" it. * UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createConsoleSettingsView): Now that all logging channels matching a `Console.ChannelSource` are returned instead of just the hardcoded list, check for a matching `WI.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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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` has `Page` and `Viewport` enum values, but `WebAutomationSession` checks for `"Page"` and `"LayoutViewport"`. Add a `LayoutViewport` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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. Use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`as*` so that values can be more easily manipulated and can be confidently assumed to exist. Remove unused overloads and allow subclasses to call `as*` instead of `openAccessors` 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: Canonical link: https://commits.webkit.org/229208@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-10 19:23:17 +00:00
auto browserArguments = browserOptions->getArray("args"_s);
if (browserArguments && browserArguments->length()) {
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
unsigned browserArgumentsLength = browserArguments->length();
capabilities.browserArguments = Vector<String>();
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
capabilities.browserArguments->reserveInitialCapacity(browserArgumentsLength);
for (unsigned i = 0; i < browserArgumentsLength; ++i) {
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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 of `Page.setForcedAppearance` must be marked `optional` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 of `Page.setForcedAppearance` must be marked `optional` 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 invoking `Page.setForcedAppearance` to instead not provide an `appearance` parameter at all when wanting to "unset" it. * UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createConsoleSettingsView): Now that all logging channels matching a `Console.ChannelSource` are returned instead of just the hardcoded list, check for a matching `WI.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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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` has `Page` and `Viewport` enum values, but `WebAutomationSession` checks for `"Page"` and `"LayoutViewport"`. Add a `LayoutViewport` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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. Use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`as*` so that values can be more easily manipulated and can be confidently assumed to exist. Remove unused overloads and allow subclasses to call `as*` instead of `openAccessors` 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: Canonical link: https://commits.webkit.org/229208@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-10 19:23:17 +00:00
auto argument = browserArguments->get(i)->asString();
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
ASSERT(!argument.isNull());
capabilities.browserArguments->uncheckedAppend(WTFMove(argument));
}
}
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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 of `Page.setForcedAppearance` must be marked `optional` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 of `Page.setForcedAppearance` must be marked `optional` 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 invoking `Page.setForcedAppearance` to instead not provide an `appearance` parameter at all when wanting to "unset" it. * UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createConsoleSettingsView): Now that all logging channels matching a `Console.ChannelSource` are returned instead of just the hardcoded list, check for a matching `WI.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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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` has `Page` and `Viewport` enum values, but `WebAutomationSession` checks for `"Page"` and `"LayoutViewport"`. Add a `LayoutViewport` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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. Use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`as*` so that values can be more easily manipulated and can be confidently assumed to exist. Remove unused overloads and allow subclasses to call `as*` instead of `openAccessors` 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: Canonical link: https://commits.webkit.org/229208@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-10 19:23:17 +00:00
if (auto useOverlayScrollbars = browserOptions->getBoolean("useOverlayScrollbars"_s))
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
capabilities.useOverlayScrollbars = useOverlayScrollbars;
else
capabilities.useOverlayScrollbars = true;
[GTK] WebDriver: allow applying host-specific TLS certificates for automated sessions https://bugs.webkit.org/show_bug.cgi?id=186884 Reviewed by Carlos Garcia Campos. Source/JavaScriptCore: Add a tuple array input parameter to the StartAutomationSession DBus message, representing a list of host-and-certificate pairs that have to be allowed for a given session. This array is then unpacked and used to fill out the certificates Vector object in the SessionCapabilities struct. * inspector/remote/RemoteInspector.h: Add a GLib-specific Vector of String pairs representing hosts and the certificate file paths. * inspector/remote/glib/RemoteInspectorServer.cpp: Source/WebDriver: Start handling the 'certificates' capability for the GTK+ port. This is a list of host-certificate pairs that should be marked as allowed for a given automation session. This object should be positioned inside the 'webkitgtk:browserOptions' dictionary in the capabilities JSON. * Capabilities.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::startAutomationSession): Include any host-certificate pairs in the StartAutomationSession DBus message. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformValidateCapability const): Properly validate the 'certificates' value, if present. (WebDriver::WebDriverService::platformParseCapabilities const): Properly parse the 'certificates' value, if present, and extract the host-certificate pairs. Source/WebKit: * UIProcess/API/glib/WebKitAutomationSession.cpp: (webkitAutomationSessionCreate): Handle any host-certificate pair that's been set for this session, creating a GTlsCertificate object through loading from the specified certificate path and marking that certificate as allowed for the specified host through the webkit_web_context_allow_tls_certificate_for_host() API. Canonical link: https://commits.webkit.org/202135@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233035 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-21 11:03:58 +00:00
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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 of `Page.setForcedAppearance` must be marked `optional` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 of `Page.setForcedAppearance` must be marked `optional` 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 invoking `Page.setForcedAppearance` to instead not provide an `appearance` parameter at all when wanting to "unset" it. * UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createConsoleSettingsView): Now that all logging channels matching a `Console.ChannelSource` are returned instead of just the hardcoded list, check for a matching `WI.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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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` has `Page` and `Viewport` enum values, but `WebAutomationSession` checks for `"Page"` and `"LayoutViewport"`. Add a `LayoutViewport` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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. Use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`as*` so that values can be more easily manipulated and can be confidently assumed to exist. Remove unused overloads and allow subclasses to call `as*` instead of `openAccessors` 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: Canonical link: https://commits.webkit.org/229208@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-10 19:23:17 +00:00
auto certificates = browserOptions->getArray("certificates"_s);
if (certificates && certificates->length()) {
[GTK] WebDriver: allow applying host-specific TLS certificates for automated sessions https://bugs.webkit.org/show_bug.cgi?id=186884 Reviewed by Carlos Garcia Campos. Source/JavaScriptCore: Add a tuple array input parameter to the StartAutomationSession DBus message, representing a list of host-and-certificate pairs that have to be allowed for a given session. This array is then unpacked and used to fill out the certificates Vector object in the SessionCapabilities struct. * inspector/remote/RemoteInspector.h: Add a GLib-specific Vector of String pairs representing hosts and the certificate file paths. * inspector/remote/glib/RemoteInspectorServer.cpp: Source/WebDriver: Start handling the 'certificates' capability for the GTK+ port. This is a list of host-certificate pairs that should be marked as allowed for a given automation session. This object should be positioned inside the 'webkitgtk:browserOptions' dictionary in the capabilities JSON. * Capabilities.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::startAutomationSession): Include any host-certificate pairs in the StartAutomationSession DBus message. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformValidateCapability const): Properly validate the 'certificates' value, if present. (WebDriver::WebDriverService::platformParseCapabilities const): Properly parse the 'certificates' value, if present, and extract the host-certificate pairs. Source/WebKit: * UIProcess/API/glib/WebKitAutomationSession.cpp: (webkitAutomationSessionCreate): Handle any host-certificate pair that's been set for this session, creating a GTlsCertificate object through loading from the specified certificate path and marking that certificate as allowed for the specified host through the webkit_web_context_allow_tls_certificate_for_host() API. Canonical link: https://commits.webkit.org/202135@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233035 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-21 11:03:58 +00:00
unsigned certificatesLength = certificates->length();
capabilities.certificates = Vector<std::pair<String, String>>();
capabilities.certificates->reserveInitialCapacity(certificatesLength);
for (unsigned i = 0; i < certificatesLength; ++i) {
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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 of `Page.setForcedAppearance` must be marked `optional` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 of `Page.setForcedAppearance` must be marked `optional` 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 invoking `Page.setForcedAppearance` to instead not provide an `appearance` parameter at all when wanting to "unset" it. * UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createConsoleSettingsView): Now that all logging channels matching a `Console.ChannelSource` are returned instead of just the hardcoded list, check for a matching `WI.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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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` has `Page` and `Viewport` enum values, but `WebAutomationSession` checks for `"Page"` and `"LayoutViewport"`. Add a `LayoutViewport` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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. Use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`as*` so that values can be more easily manipulated and can be confidently assumed to exist. Remove unused overloads and allow subclasses to call `as*` instead of `openAccessors` 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: Canonical link: https://commits.webkit.org/229208@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-10 19:23:17 +00:00
auto certificate = certificates->get(i)->asObject();
[GTK] WebDriver: allow applying host-specific TLS certificates for automated sessions https://bugs.webkit.org/show_bug.cgi?id=186884 Reviewed by Carlos Garcia Campos. Source/JavaScriptCore: Add a tuple array input parameter to the StartAutomationSession DBus message, representing a list of host-and-certificate pairs that have to be allowed for a given session. This array is then unpacked and used to fill out the certificates Vector object in the SessionCapabilities struct. * inspector/remote/RemoteInspector.h: Add a GLib-specific Vector of String pairs representing hosts and the certificate file paths. * inspector/remote/glib/RemoteInspectorServer.cpp: Source/WebDriver: Start handling the 'certificates' capability for the GTK+ port. This is a list of host-certificate pairs that should be marked as allowed for a given automation session. This object should be positioned inside the 'webkitgtk:browserOptions' dictionary in the capabilities JSON. * Capabilities.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::startAutomationSession): Include any host-certificate pairs in the StartAutomationSession DBus message. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformValidateCapability const): Properly validate the 'certificates' value, if present. (WebDriver::WebDriverService::platformParseCapabilities const): Properly parse the 'certificates' value, if present, and extract the host-certificate pairs. Source/WebKit: * UIProcess/API/glib/WebKitAutomationSession.cpp: (webkitAutomationSessionCreate): Handle any host-certificate pair that's been set for this session, creating a GTlsCertificate object through loading from the specified certificate path and marking that certificate as allowed for the specified host through the webkit_web_context_allow_tls_certificate_for_host() API. Canonical link: https://commits.webkit.org/202135@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233035 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-21 11:03:58 +00:00
ASSERT(certificate);
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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 of `Page.setForcedAppearance` must be marked `optional` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 of `Page.setForcedAppearance` must be marked `optional` 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 invoking `Page.setForcedAppearance` to instead not provide an `appearance` parameter at all when wanting to "unset" it. * UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createConsoleSettingsView): Now that all logging channels matching a `Console.ChannelSource` are returned instead of just the hardcoded list, check for a matching `WI.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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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` has `Page` and `Viewport` enum values, but `WebAutomationSession` checks for `"Page"` and `"LayoutViewport"`. Add a `LayoutViewport` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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. Use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`as*` so that values can be more easily manipulated and can be confidently assumed to exist. Remove unused overloads and allow subclasses to call `as*` instead of `openAccessors` 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: Canonical link: https://commits.webkit.org/229208@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-10 19:23:17 +00:00
auto host = certificate->getString("host"_s);
[GTK] WebDriver: allow applying host-specific TLS certificates for automated sessions https://bugs.webkit.org/show_bug.cgi?id=186884 Reviewed by Carlos Garcia Campos. Source/JavaScriptCore: Add a tuple array input parameter to the StartAutomationSession DBus message, representing a list of host-and-certificate pairs that have to be allowed for a given session. This array is then unpacked and used to fill out the certificates Vector object in the SessionCapabilities struct. * inspector/remote/RemoteInspector.h: Add a GLib-specific Vector of String pairs representing hosts and the certificate file paths. * inspector/remote/glib/RemoteInspectorServer.cpp: Source/WebDriver: Start handling the 'certificates' capability for the GTK+ port. This is a list of host-certificate pairs that should be marked as allowed for a given automation session. This object should be positioned inside the 'webkitgtk:browserOptions' dictionary in the capabilities JSON. * Capabilities.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::startAutomationSession): Include any host-certificate pairs in the StartAutomationSession DBus message. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformValidateCapability const): Properly validate the 'certificates' value, if present. (WebDriver::WebDriverService::platformParseCapabilities const): Properly parse the 'certificates' value, if present, and extract the host-certificate pairs. Source/WebKit: * UIProcess/API/glib/WebKitAutomationSession.cpp: (webkitAutomationSessionCreate): Handle any host-certificate pair that's been set for this session, creating a GTlsCertificate object through loading from the specified certificate path and marking that certificate as allowed for the specified host through the webkit_web_context_allow_tls_certificate_for_host() API. Canonical link: https://commits.webkit.org/202135@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233035 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-21 11:03:58 +00:00
ASSERT(!host.isNull());
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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 of `Page.setForcedAppearance` must be marked `optional` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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 of `Page.setForcedAppearance` must be marked `optional` 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 invoking `Page.setForcedAppearance` to instead not provide an `appearance` parameter at all when wanting to "unset" it. * UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createConsoleSettingsView): Now that all logging channels matching a `Console.ChannelSource` are returned instead of just the hardcoded list, check for a matching `WI.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` or `const 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` or `Ref<T>&&` - optional parameters are `Optional<T>&&` or `RefPtr<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 where `X` is either a single return or a `std::tuple` of multiple returns The one exception to the above is `String`, which is already a tri-state of `nullString()`, `emptyString()`, and something set, so there's no need to use `Optional<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` has `Page` and `Viewport` enum values, but `WebAutomationSession` checks for `"Page"` and `"LayoutViewport"`. Add a `LayoutViewport` 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 use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`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. Use `Ref&&` wherever possible and `Optional` instead of an out parameter for `get*`/`as*` so that values can be more easily manipulated and can be confidently assumed to exist. Remove unused overloads and allow subclasses to call `as*` instead of `openAccessors` 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: Canonical link: https://commits.webkit.org/229208@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-10 19:23:17 +00:00
auto certificateFile = certificate->getString("certificateFile"_s);
[GTK] WebDriver: allow applying host-specific TLS certificates for automated sessions https://bugs.webkit.org/show_bug.cgi?id=186884 Reviewed by Carlos Garcia Campos. Source/JavaScriptCore: Add a tuple array input parameter to the StartAutomationSession DBus message, representing a list of host-and-certificate pairs that have to be allowed for a given session. This array is then unpacked and used to fill out the certificates Vector object in the SessionCapabilities struct. * inspector/remote/RemoteInspector.h: Add a GLib-specific Vector of String pairs representing hosts and the certificate file paths. * inspector/remote/glib/RemoteInspectorServer.cpp: Source/WebDriver: Start handling the 'certificates' capability for the GTK+ port. This is a list of host-certificate pairs that should be marked as allowed for a given automation session. This object should be positioned inside the 'webkitgtk:browserOptions' dictionary in the capabilities JSON. * Capabilities.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::startAutomationSession): Include any host-certificate pairs in the StartAutomationSession DBus message. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformValidateCapability const): Properly validate the 'certificates' value, if present. (WebDriver::WebDriverService::platformParseCapabilities const): Properly parse the 'certificates' value, if present, and extract the host-certificate pairs. Source/WebKit: * UIProcess/API/glib/WebKitAutomationSession.cpp: (webkitAutomationSessionCreate): Handle any host-certificate pair that's been set for this session, creating a GTlsCertificate object through loading from the specified certificate path and marking that certificate as allowed for the specified host through the webkit_web_context_allow_tls_certificate_for_host() API. Canonical link: https://commits.webkit.org/202135@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233035 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-21 11:03:58 +00:00
ASSERT(!certificateFile.isNull());
capabilities.certificates->uncheckedAppend({ WTFMove(host), WTFMove(certificateFile) });
}
}
WebDriver: properly handle capabilities and process firstMatch too https://bugs.webkit.org/show_bug.cgi?id=174618 Reviewed by Brian Burg. Implement processing of capabilities following the spec. This patch adds validation, merging and matching of capabilities. 7.2 Processing Capabilities. https://w3c.github.io/webdriver/webdriver-spec.html#processing-capabilities * Capabilities.h: Make all capabilities optional and move Timeouts struct here. * Session.h: * WebDriverService.cpp: (WebDriver::deserializeTimeouts): Helper to extract timeouts from JSON object. (WebDriver::WebDriverService::parseCapabilities const): At this point capabilities have already been validated, so we just need to get them without checking the value type. (WebDriver::WebDriverService::validatedCapabilities const): Validate the given capabilities, ensuring types of values are the expected one. (WebDriver::WebDriverService::mergeCapabilities const): Merge the alwaysMatch and firstMatch capabilities into a single object ensuring that the same capability is not in both. (WebDriver::WebDriverService::matchCapabilities const): Try to match the merged capabilities againt the platform expected capabilities. (WebDriver::WebDriverService::processCapabilities const): Validate, merge and match the capabilities. (WebDriver::WebDriverService::newSession): Use processCapabilities(). Also initialize the timeouts from capabilities and add all capabilities to the command result. (WebDriver::WebDriverService::setTimeouts): Use deserializeTimeouts(). * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::launchBrowser): Updated to properly access the capabilities that are now optional. (WebDriver::SessionHost::startAutomationSession): Add FIXME. * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformCapabilities): Return the Capabilities with the known required ones filled. (WebDriver::WebDriverService::platformValidateCapability const): Validate webkitgtk:browserOptions. (WebDriver::WebDriverService::platformMatchCapability const): This does nothing for now. (WebDriver::WebDriverService::platformCompareBrowserVersions): Compare the given browser versions. (WebDriver::WebDriverService::platformParseCapabilities const): Updated now that capabilites have already been validated before. Canonical link: https://commits.webkit.org/191971@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-05 09:27:15 +00:00
}
Add initial implementation of WebDriver process to run the HTTP server https://bugs.webkit.org/show_bug.cgi?id=166682 Reviewed by Brian Burg. .: Enable WebDriver in the GTK port by default. * Source/CMakeLists.txt: * Source/cmake/OptionsGTK.cmake: * Source/cmake/WebKitFS.cmake: * Source/cmake/WebKitFeatures.cmake: Source/WebDriver: Add WebDriver process that runs the HTTP server and implements an initial set of commands. Most of the code is cross-platform, only the HTTP server implementation, the code to launch the browser and the communication with the remote inspector requires platform specific code. This patch includes the GTK port implementation, using libsoup for the HTTP server, and GLib for launching the browser and communicating with the remote inspector. This implementation follows the w3c spec (https://www.w3.org/TR/webdriver) as close as possible, but using the official selenium python tests as reference. * CMakeLists.txt: Added. * Capabilities.h: Added. * CommandResult.cpp: Added. * CommandResult.h: Added. * HTTPServer.cpp: Added. * HTTPServer.h: Added. * PlatformGTK.cmake: Added. * Session.cpp: Added. * Session.h: Added. * SessionHost.cpp: Added. * SessionHost.h: Added. * WebDriverMain.cpp: Added. * WebDriverService.cpp: Added. * WebDriverService.h: Added. * config.h: Added. * glib/SessionHostGlib.cpp: Added. * gtk/WebDriverServiceGtk.cpp: Added. * soup/HTTPServerSoup.cpp: Added. Canonical link: https://commits.webkit.org/191418@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219605 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-18 07:20:33 +00:00
} // namespace WebDriver