haikuwebkit/Source/WebDriver/WebDriverService.h

148 lines
8.4 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.
*/
#pragma once
#include "HTTPServer.h"
#include "Session.h"
#include <wtf/Forward.h>
#include <wtf/HashMap.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
#include <wtf/text/StringHash.h>
namespace WebDriver {
struct Capabilities;
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
class CommandResult;
class Session;
class WebDriverService final : public HTTPRequestHandler {
public:
WebDriverService();
~WebDriverService() = default;
int run(int argc, char** argv);
[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
static void 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
static bool platformCompareBrowserVersions(const String&, const String&);
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
private:
enum class HTTPMethod { Get, Post, Delete };
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
typedef void (WebDriverService::*CommandHandler)(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
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
struct Command {
HTTPMethod method;
const char* uriTemplate;
CommandHandler handler;
};
static const Command s_commands[];
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
static std::optional<HTTPMethod> toCommandHTTPMethod(const String& method);
static bool findCommand(HTTPMethod, const String& path, CommandHandler*, HashMap<String, String>& parameters);
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
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 newSession(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void deleteSession(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void status(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void getTimeouts(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
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 setTimeouts(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void go(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void getCurrentURL(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void back(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void forward(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void refresh(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void getTitle(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void getWindowHandle(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void closeWindow(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void switchToWindow(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void getWindowHandles(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
[GTK] WebDriver: implement new window command https://bugs.webkit.org/show_bug.cgi?id=203994 Reviewed by Carlos Alberto Lopez Perez. Source/WebDriver: * Session.cpp: (WebDriver::Session::newWindow): * Session.h: * WebDriverService.cpp: (WebDriver::WebDriverService::newWindow): * WebDriverService.h: Source/WebKit: Add new API to support new window command. The WebKitAutomationSession::create-web-view signal can now receive a detail that can be "window" or "tab". Applications can use that to decide whether to add the new webview to a new window or tab. WebKitWebView has a new construct only property automation-presentation-type, which is an enum that can be either window or tab value. Appplications should use the new property when creating the web view for automation to indicate whether the web view was added to a new window or tab. * UIProcess/API/glib/WebKitAutomationSession.cpp: (webkit_automation_session_class_init): * UIProcess/API/glib/WebKitWebView.cpp: (webkitWebViewSetProperty): (webkitWebViewGetProperty): (webkit_web_view_class_init): (webkit_web_view_get_automation_presentation_type): * UIProcess/API/gtk/WebKitAutomationSession.h: * UIProcess/API/gtk/WebKitWebView.h: * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: * UIProcess/API/wpe/WebKitWebView.h: * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: Tools: Add support for new window command to MiniBrowser and a test case to check the new API to unit tests. * MiniBrowser/gtk/BrowserWindow.c: (findActiveWindow): (browser_window_get_or_create_web_view_for_automation): (browser_window_create_web_view_in_new_tab_for_automation): * MiniBrowser/gtk/BrowserWindow.h: * MiniBrowser/gtk/main.c: (createWebViewForAutomationInWindowCallback): (createWebViewForAutomationInTabCallback): (automationStartedCallback): (createWebViewForAutomationCallback): Deleted. * TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp: (testAutomationSessionRequestSession): Canonical link: https://commits.webkit.org/217411@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252356 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-12 08:12:40 +00:00
void newWindow(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
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 switchToFrame(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void switchToParentFrame(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void getWindowRect(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void setWindowRect(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
WebDriver: implement maximize, minimize and fullscreen window commands https://bugs.webkit.org/show_bug.cgi?id=180398 Reviewed by Brian Burg. Source/WebDriver: * CMakeLists.txt: Add EnterFullscreen.js to the build. * Session.cpp: (WebDriver::Session::maximizeWindow): (WebDriver::Session::minimizeWindow): (WebDriver::Session::fullscreenWindow): * Session.h: * WebDriverService.cpp: (WebDriver::WebDriverService::maximizeWindow): (WebDriver::WebDriverService::minimizeWindow): (WebDriver::WebDriverService::fullscreenWindow): * WebDriverService.h: Source/WebKit: * UIProcess/API/APIAutomationSessionClient.h: (API::AutomationSessionClient::requestMaximizeWindowOfPage): Added to allow clients maximize the window. * UIProcess/API/glib/WebKitAutomationSession.cpp: * UIProcess/API/glib/WebKitWebViewPrivate.h: * UIProcess/API/gtk/WebKitWebViewGtk.cpp: (WindowStateEvent::WindowStateEvent): Struct to handle window state events. (WindowStateEvent::~WindowStateEvent): Complete the event. (WindowStateEvent::complete): Call the completion handler is not called already. (windowStateEventCallback): Handle window state event changes. (webkitWebViewMaximizeWindow): Try to maximize the window and wait for the event. (webkitWebViewMinimizeWindow): Try to minimize the window and wait for the event. (webkitWebViewRestoreWindow): Try to unmaximize or unminimize the window and wait for the event. * UIProcess/API/wpe/WebKitWebViewWPE.cpp: (webkitWebViewMaximizeWindow): (webkitWebViewMinimizeWindow): (webkitWebViewRestoreWindow): * UIProcess/Automation/Automation.json: * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::maximizeWindowOfBrowsingContext): Exit fullscreen, restore the window and then maximize it. (WebKit::WebAutomationSession::maximizeWindowForPage): Ask the client to maximize the window of page. * UIProcess/Automation/WebAutomationSession.h: * UIProcess/Automation/atoms/EnterFullscreen.js: (enterFullscreen): Return early if fullscreen is disabled or if window is already in fullscreen. Tools: * Scripts/webkitpy/port/xvfbdriver.py: (XvfbDriver._setup_environ_for_test): Set UNDER_XVFB environment variable when running under Xvfb. WebDriverTests: Remove expectations for tests that are passing now. * TestExpectations.json: Canonical link: https://commits.webkit.org/201384@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232150 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-24 08:54:37 +00:00
void maximizeWindow(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void minimizeWindow(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void fullscreenWindow(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
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 findElement(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void findElements(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void findElementFromElement(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void findElementsFromElement(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void getActiveElement(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void isElementSelected(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void getElementAttribute(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void getElementProperty(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void getElementCSSValue(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
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 getElementText(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void getElementTagName(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void getElementRect(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void isElementEnabled(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void isElementDisplayed(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void elementClick(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void elementClear(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void elementSendKeys(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void getPageSource(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
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 executeScript(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void executeAsyncScript(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void getAllCookies(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void getNamedCookie(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void addCookie(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void deleteCookie(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void deleteAllCookies(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
WebDriver: implement advance user interactions https://bugs.webkit.org/show_bug.cgi?id=174616 Reviewed by Brian Burg. Source/WebDriver: Add initial implementation of action commands. * Actions.h: Added. (WebDriver::Action::Action): * CommandResult.cpp: (WebDriver::CommandResult::CommandResult): Handle MoveTargetOutOfBounds error. (WebDriver::CommandResult::httpStatusCode const): Ditto. (WebDriver::CommandResult::errorString const): Ditto. * CommandResult.h: * Session.cpp: (WebDriver::Session::webElementIdentifier): Helper to return the web element id. (WebDriver::Session::createElement): Use webElementIdentifier(). (WebDriver::Session::extractElementID): Ditto. (WebDriver::Session::virtualKeyForKeySequence): Add more kay codes includes in the spec. (WebDriver::mouseButtonForAutomation): Helper to get the mouse button string to pass to automation. (WebDriver::Session::performMouseInteraction): Use mouseButtonForAutomation(). (WebDriver::Session::getOrCreateInputSource): Ensure an input source for given id and add it to the active input sources. (WebDriver::Session::inputSourceState): Return the current input source state for the given id. (WebDriver::Session::computeInViewCenterPointOfElements): Get the in view center point for the list of elements given. (WebDriver::automationSourceType): Helper to get the input source type to pass to automation. (WebDriver::Session::performActions): Process the list of action by tick and generate a list of states to pass to automation. (WebDriver::Session::releaseActions): Reset input sources and state table and send a message to automation. * Session.h: * WebDriverService.cpp: (WebDriver::processPauseAction): (WebDriver::processNullAction): (WebDriver::processKeyAction): (WebDriver::actionMouseButton): (WebDriver::processPointerAction): (WebDriver::processPointerParameters): (WebDriver::processInputActionSequence): (WebDriver::WebDriverService::performActions): (WebDriver::WebDriverService::releaseActions): * WebDriverService.h: Source/WebKit: Handle origin in case of mouse move transitions. * UIProcess/Automation/Automation.json: Add MouseMoveOrigin enum and pass it as parameter of InputSourceState together with optional node handle. Also pass the frame handle to performInteractionSequence command to find the node in the current browsing context. * UIProcess/Automation/SimulatedInputDispatcher.cpp: (WebKit::SimulatedInputKeyFrame::keyFrameToResetInputSources): Ensure we reset the location. (WebKit::SimulatedInputDispatcher::resolveLocation): Helper to resolve destination location based on current location and mouse move origin. (WebKit::SimulatedInputDispatcher::transitionInputSourceToState): Use resolveLocation() in mouse transitions. (WebKit::SimulatedInputDispatcher::run): Receive and save the frame ID. (WebKit::SimulatedInputDispatcher::finishDispatching): Reset the frame ID. * UIProcess/Automation/SimulatedInputDispatcher.h: * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::WebAutomationSession::computeElementLayout): Use even numbers for the callback ID to not conflict with viewportInViewCenterPointOfElement() callbacks. (WebKit::WebAutomationSession::didComputeElementLayout): Handle computeElementLayout() or viewportInViewCenterPointOfElement() requests by calling the right callback depending on whether the ID is odd or even number. (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement): Send ComputeElementLayout message to the WebProcess using odd numbers for the callback ID to not conflict with computeElementLayout() callbacks. (WebKit::WebAutomationSession::performInteractionSequence): Handle the mouse origin and element handle. (WebKit::WebAutomationSession::cancelInteractionSequence): Pass the frame ID to the input dispatcher. * UIProcess/Automation/WebAutomationSession.h: * UIProcess/Automation/WebAutomationSessionMacros.h: WebDriverTests: Update test expectations. * TestExpectations.json: Canonical link: https://commits.webkit.org/200988@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231632 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-10 06:52:31 +00:00
void performActions(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void releaseActions(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
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 dismissAlert(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void acceptAlert(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void getAlertText(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void sendAlertText(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void takeScreenshot(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
void takeElementScreenshot(RefPtr<JSON::Object>&&, Function<void (CommandResult&&)>&&);
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
static Capabilities platformCapabilities();
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
Vector<Capabilities> processCapabilities(const JSON::Object&, Function<void (CommandResult&&)>&) const;
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
RefPtr<JSON::Object> validatedCapabilities(const JSON::Object&) const;
RefPtr<JSON::Object> mergeCapabilities(const JSON::Object&, const JSON::Object&) const;
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
RefPtr<JSON::Object> matchCapabilities(const JSON::Object&) const;
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 platformValidateCapability(const String&, const Ref<JSON::Value>&) const;
bool platformMatchCapability(const String&, const Ref<JSON::Value>&) const;
WebDriver: implement proxy support https://bugs.webkit.org/show_bug.cgi?id=180408 Reviewed by Carlos Alberto Lopez Perez. Source/JavaScriptCore: Add optional Proxy struct to session capabilities. * inspector/remote/RemoteInspector.h: * inspector/remote/glib/RemoteInspectorServer.cpp: (Inspector::processSessionCapabilities): Source/WebDriver: Handle proxy object in capabilities. * Capabilities.h: Add Proxy struct. * WebDriverService.cpp: (WebDriver::deserializeProxy): Deserialize the proxy from capabilities. (WebDriver::WebDriverService::parseCapabilities const): Get the deserialized proxy. (WebDriver::WebDriverService::validatedCapabilities const): Ensure proxy object is valid. (WebDriver::WebDriverService::matchCapabilities const): Check proxy type is supported by the platform. (WebDriver::WebDriverService::createSession): Only set an empty proxy object in capabilities if we don't have a deserialized proxy. * WebDriverService.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::buildSessionCapabilities const): Send the proxy settings to the browser. * glib/WebDriverServiceGLib.cpp: (WebDriver::WebDriverService::platformSupportProxyType const): Return false if proxy type is "pac". Source/WebKit: * UIProcess/API/glib/WebKitAutomationSession.cpp: (parseProxyCapabilities): Parse the proxy settings from capabilities. (webkitAutomationSessionCreate): Set the proxy settings received from capabilities. WebDriverTests: Unskip the tests that are now passing. * TestExpectations.json: Canonical link: https://commits.webkit.org/217382@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252323 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-11 15:16:16 +00:00
bool platformSupportProxyType(const String&) const;
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 parseCapabilities(const JSON::Object& desiredCapabilities, Capabilities&) const;
void platformParseCapabilities(const JSON::Object& desiredCapabilities, Capabilities&) const;
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
void connectToBrowser(Vector<Capabilities>&&, Function<void (CommandResult&&)>&&);
void createSession(Vector<Capabilities>&&, std::unique_ptr<SessionHost>&&, Function<void (CommandResult&&)>&&);
WebDriver: end point nodes are only allowed to have one session https://bugs.webkit.org/show_bug.cgi?id=180131 Reviewed by Brian Burg. We are currently keeping a map of sessions, but our service is always and end point node, so only one session can exist at a time. Make findSessionOrCompleteWithError() return a boolean instead, failing in case the sessionID parameter is not found or it doesn't match the current session. Replace the session map and active session pointer with a single session member and return SessionNotCreated error when new session command is received and there's an active session. 8. Sessions A remote end has an associated maximum active sessions (an integer) that defines the number of active sessions that are supported. This may be “unlimited” for intermediary nodes, but must be exactly one for a remote end that is an endpoint node. https://w3c.github.io/webdriver/webdriver-spec.html#dfn-maximum-active-sessions Fixes: imported/w3c/webdriver/tests/sessions/new_session/default_values.py::test_repeat_new_session * WebDriverService.cpp: (WebDriver::WebDriverService::findSessionOrCompleteWithError): (WebDriver::WebDriverService::newSession): (WebDriver::WebDriverService::deleteSession): (WebDriver::WebDriverService::status): (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::setWindowRect): (WebDriver::WebDriverService::closeWindow): (WebDriver::WebDriverService::switchToWindow): (WebDriver::WebDriverService::getWindowHandles): (WebDriver::WebDriverService::switchToFrame): (WebDriver::WebDriverService::switchToParentFrame): (WebDriver::findStrategyAndSelectorOrCompleteWithError): (WebDriver::WebDriverService::findElement): (WebDriver::WebDriverService::findElements): (WebDriver::WebDriverService::findElementFromElement): (WebDriver::WebDriverService::findElementsFromElement): (WebDriver::WebDriverService::getActiveElement): (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::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: Canonical link: https://commits.webkit.org/196235@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225386 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-01 09:47:15 +00:00
bool findSessionOrCompleteWithError(JSON::Object&, Function<void (CommandResult&&)>&);
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
void handleRequest(HTTPRequestHandler::Request&&, Function<void (HTTPRequestHandler::Response&&)>&& replyHandler) override;
void sendResponse(Function<void (HTTPRequestHandler::Response&&)>&& replyHandler, CommandResult&&) const;
HTTPServer m_server;
WebDriver: end point nodes are only allowed to have one session https://bugs.webkit.org/show_bug.cgi?id=180131 Reviewed by Brian Burg. We are currently keeping a map of sessions, but our service is always and end point node, so only one session can exist at a time. Make findSessionOrCompleteWithError() return a boolean instead, failing in case the sessionID parameter is not found or it doesn't match the current session. Replace the session map and active session pointer with a single session member and return SessionNotCreated error when new session command is received and there's an active session. 8. Sessions A remote end has an associated maximum active sessions (an integer) that defines the number of active sessions that are supported. This may be “unlimited” for intermediary nodes, but must be exactly one for a remote end that is an endpoint node. https://w3c.github.io/webdriver/webdriver-spec.html#dfn-maximum-active-sessions Fixes: imported/w3c/webdriver/tests/sessions/new_session/default_values.py::test_repeat_new_session * WebDriverService.cpp: (WebDriver::WebDriverService::findSessionOrCompleteWithError): (WebDriver::WebDriverService::newSession): (WebDriver::WebDriverService::deleteSession): (WebDriver::WebDriverService::status): (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::setWindowRect): (WebDriver::WebDriverService::closeWindow): (WebDriver::WebDriverService::switchToWindow): (WebDriver::WebDriverService::getWindowHandles): (WebDriver::WebDriverService::switchToFrame): (WebDriver::WebDriverService::switchToParentFrame): (WebDriver::findStrategyAndSelectorOrCompleteWithError): (WebDriver::WebDriverService::findElement): (WebDriver::WebDriverService::findElements): (WebDriver::WebDriverService::findElementFromElement): (WebDriver::WebDriverService::findElementsFromElement): (WebDriver::WebDriverService::getActiveElement): (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::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: Canonical link: https://commits.webkit.org/196235@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225386 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-01 09:47:15 +00:00
RefPtr<Session> m_session;
[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
#if USE(INSPECTOR_SOCKET_SERVER)
String m_targetAddress;
uint16_t m_targetPort { 0 };
#endif
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