haikuwebkit/Source/WebDriver/SessionHost.h

133 lines
4.7 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 "Capabilities.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
#if USE(GLIB)
#include <wtf/glib/GRefPtr.h>
[GTK][WPE] RemoteInspector: use sockets instead of DBus https://bugs.webkit.org/show_bug.cgi?id=204503 Reviewed by Žan Doberšek. Source/JavaScriptCore: It turns out DBus is event slower than expected. Using GSockets API we can simplify the code and make it a lot more efficient. This will drastically reduce the time to run WebDriver tests in the bots. * inspector/remote/RemoteInspector.h: * inspector/remote/glib/RemoteInspectorGlib.cpp: (Inspector::RemoteInspector::start): (Inspector::RemoteInspector::stopInternal): (Inspector::RemoteInspector::setupConnection): (Inspector::RemoteInspector::pushListingsNow): (Inspector::RemoteInspector::pushListingsSoon): (Inspector::RemoteInspector::sendAutomaticInspectionCandidateMessage): (Inspector::RemoteInspector::sendMessageToRemote): * inspector/remote/glib/RemoteInspectorServer.cpp: (Inspector::RemoteInspectorServer::~RemoteInspectorServer): (Inspector::RemoteInspectorServer::start): (Inspector::RemoteInspectorServer::incomingConnectionCallback): (Inspector::RemoteInspectorServer::incomingConnection): (Inspector::RemoteInspectorServer::setTargetList): (Inspector::RemoteInspectorServer::setupInspectorClient): (Inspector::RemoteInspectorServer::setup): (Inspector::RemoteInspectorServer::close): (Inspector::RemoteInspectorServer::connectionDidClose): (Inspector::RemoteInspectorServer::sendMessageToBackend): (Inspector::RemoteInspectorServer::sendMessageToFrontend): (Inspector::RemoteInspectorServer::startAutomationSession): * inspector/remote/glib/RemoteInspectorServer.h: (Inspector::RemoteInspectorServer::isRunning const): Source/WebDriver: Use GSockets API instead of DBus. * SessionHost.cpp: (WebDriver::SessionHost::sendCommandToBackend): * SessionHost.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::~SessionHost): (WebDriver::SessionHost::isConnected const): (WebDriver::ConnectToBrowserAsyncData::ConnectToBrowserAsyncData): (WebDriver::SessionHost::launchBrowser): (WebDriver::SessionHost::connectToBrowser): (WebDriver::SessionHost::connectionDidClose): (WebDriver::SessionHost::setupConnection): (WebDriver::SessionHost::startAutomationSession): (WebDriver::SessionHost::didStartAutomationSession): (WebDriver::SessionHost::setTargetList): (WebDriver::SessionHost::sendMessageToBackend): * socket/SessionHostSocket.cpp: (WebDriver::SessionHost::sendMessageToBackend): Source/WebKit: Use GSockets API instead of DBus. * Platform/IPC/Connection.h: * SourcesGTK.txt: Remove GSocketMonitor that has been moved to WTF. * SourcesWPE.txt: Ditto. * UIProcess/glib/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorClient::RemoteInspectorClient): (WebKit::RemoteInspectorClient::~RemoteInspectorClient): (WebKit::RemoteInspectorClient::setupConnection): (WebKit::RemoteInspectorClient::connectionDidClose): (WebKit::RemoteInspectorClient::inspect): (WebKit::RemoteInspectorClient::sendMessageToBackend): (WebKit::RemoteInspectorClient::closeFromFrontend): * UIProcess/glib/RemoteInspectorClient.h: Source/WTF: Add SocketConnection class. * wtf/PlatformGTK.cmake: * wtf/PlatformWPE.cmake: * wtf/glib/GSocketMonitor.cpp: Renamed from Source/WebKit/Platform/IPC/glib/GSocketMonitor.cpp. (WTF::GSocketMonitor::start): * wtf/glib/GSocketMonitor.h: Renamed from Source/WebKit/Platform/IPC/glib/GSocketMonitor.h. (WTF::GSocketMonitor::isActive const): * wtf/glib/GTypedefs.h: * wtf/glib/GUniquePtr.h: * wtf/glib/SocketConnection.cpp: Added. (WTF::SocketConnection::SocketConnection): (WTF::SocketConnection::~SocketConnection): (WTF::SocketConnection::read): (WTF::SocketConnection::readMessage): (WTF::SocketConnection::sendMessage): (WTF::SocketConnection::write): (WTF::SocketConnection::waitForSocketWritability): (WTF::SocketConnection::close): (WTF::SocketConnection::didClose): * wtf/glib/SocketConnection.h: Added. (WTF::SocketConnection::create): (WTF::SocketConnection::isClosed const): Tools: Update the unit tests to not use DBus. * TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp: Canonical link: https://commits.webkit.org/217749@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252770 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-22 14:22:34 +00:00
#include <wtf/glib/SocketConnection.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
typedef struct _GSubprocess GSubprocess;
[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
#elif USE(INSPECTOR_SOCKET_SERVER)
#include <JavaScriptCore/RemoteInspectorConnectionClient.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.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
#endif
namespace WebDriver {
struct ConnectToBrowserAsyncData;
[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
class SessionHost
#if USE(INSPECTOR_SOCKET_SERVER)
: public Inspector::RemoteInspectorConnectionClient
#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
WTF_MAKE_FAST_ALLOCATED(SessionHost);
public:
explicit SessionHost(Capabilities&& capabilities)
: m_capabilities(WTFMove(capabilities))
{
}
~SessionHost();
[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)
void setHostAddress(const String& ip, uint16_t port) { m_targetIp = ip; m_targetPort = port; }
#endif
WebDriver: fix return value of close window command https://bugs.webkit.org/show_bug.cgi?id=174861 Reviewed by Brian Burg. We are currently returning null, but we should return the list of window handles, and try to close the session if there aren't more window handles. 10.2 Close Window https://w3c.github.io/webdriver/webdriver-spec.html#close-window 3. If there are no more open top-level browsing contexts, then try to close the session. 4. Return the result of running the remote end steps for the Get Window Handles command. * Session.cpp: (WebDriver::Session::closeAllToplevelBrowsingContexts): Helper function to close the given toplevel browsing context and the next one if there are more. (WebDriver::Session::close): Call closeAllToplevelBrowsingContexts() to delete all toplevel browsing contexts of the session. (WebDriver::Session::closeTopLevelBrowsingContext): Close the given toplevel browsing context and call getWindowHandles() when done. (WebDriver::Session::closeWindow): Call closeTopLevelBrowsingContext() passing the current toplevel browsing context. (WebDriver::Session::getWindowHandles): Remove the early return, this command doesn't depend on a current toplevel browsing context. * Session.h: * SessionHost.h: * WebDriverService.cpp: (WebDriver::WebDriverService::run): Disconnect the server when main loop quits. (WebDriver::WebDriverService::deleteSession): Do not fail if the given session is not active. (WebDriver::WebDriverService::closeWindow): Remove the session if the closed window was the last one. * WebDriverService.h: Remove unused quit() method. * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::isConnected): Return whether host is connected to a browser instance. (WebDriver::SessionHost::dbusConnectionClosedCallback): Delete m_browser. Canonical link: https://commits.webkit.org/192294@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220794 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-16 11:38:22 +00:00
bool isConnected() 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
const String& sessionID() const { return m_sessionID; }
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
const Capabilities& capabilities() const { return m_capabilities; }
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
void connectToBrowser(Function<void (std::optional<String> error)>&&);
void startAutomationSession(Function<void (bool, std::optional<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
struct CommandResponse {
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> responseObject;
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
bool isError { false };
};
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
long sendCommandToBackend(const String&, RefPtr<JSON::Object>&& parameters, Function<void (CommandResponse&&)>&&);
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:
struct Target {
uint64_t id { 0 };
CString name;
bool paired { false };
};
void inspectorDisconnected();
[GTK][WPE] RemoteInspector: use sockets instead of DBus https://bugs.webkit.org/show_bug.cgi?id=204503 Reviewed by Žan Doberšek. Source/JavaScriptCore: It turns out DBus is event slower than expected. Using GSockets API we can simplify the code and make it a lot more efficient. This will drastically reduce the time to run WebDriver tests in the bots. * inspector/remote/RemoteInspector.h: * inspector/remote/glib/RemoteInspectorGlib.cpp: (Inspector::RemoteInspector::start): (Inspector::RemoteInspector::stopInternal): (Inspector::RemoteInspector::setupConnection): (Inspector::RemoteInspector::pushListingsNow): (Inspector::RemoteInspector::pushListingsSoon): (Inspector::RemoteInspector::sendAutomaticInspectionCandidateMessage): (Inspector::RemoteInspector::sendMessageToRemote): * inspector/remote/glib/RemoteInspectorServer.cpp: (Inspector::RemoteInspectorServer::~RemoteInspectorServer): (Inspector::RemoteInspectorServer::start): (Inspector::RemoteInspectorServer::incomingConnectionCallback): (Inspector::RemoteInspectorServer::incomingConnection): (Inspector::RemoteInspectorServer::setTargetList): (Inspector::RemoteInspectorServer::setupInspectorClient): (Inspector::RemoteInspectorServer::setup): (Inspector::RemoteInspectorServer::close): (Inspector::RemoteInspectorServer::connectionDidClose): (Inspector::RemoteInspectorServer::sendMessageToBackend): (Inspector::RemoteInspectorServer::sendMessageToFrontend): (Inspector::RemoteInspectorServer::startAutomationSession): * inspector/remote/glib/RemoteInspectorServer.h: (Inspector::RemoteInspectorServer::isRunning const): Source/WebDriver: Use GSockets API instead of DBus. * SessionHost.cpp: (WebDriver::SessionHost::sendCommandToBackend): * SessionHost.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::~SessionHost): (WebDriver::SessionHost::isConnected const): (WebDriver::ConnectToBrowserAsyncData::ConnectToBrowserAsyncData): (WebDriver::SessionHost::launchBrowser): (WebDriver::SessionHost::connectToBrowser): (WebDriver::SessionHost::connectionDidClose): (WebDriver::SessionHost::setupConnection): (WebDriver::SessionHost::startAutomationSession): (WebDriver::SessionHost::didStartAutomationSession): (WebDriver::SessionHost::setTargetList): (WebDriver::SessionHost::sendMessageToBackend): * socket/SessionHostSocket.cpp: (WebDriver::SessionHost::sendMessageToBackend): Source/WebKit: Use GSockets API instead of DBus. * Platform/IPC/Connection.h: * SourcesGTK.txt: Remove GSocketMonitor that has been moved to WTF. * SourcesWPE.txt: Ditto. * UIProcess/glib/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorClient::RemoteInspectorClient): (WebKit::RemoteInspectorClient::~RemoteInspectorClient): (WebKit::RemoteInspectorClient::setupConnection): (WebKit::RemoteInspectorClient::connectionDidClose): (WebKit::RemoteInspectorClient::inspect): (WebKit::RemoteInspectorClient::sendMessageToBackend): (WebKit::RemoteInspectorClient::closeFromFrontend): * UIProcess/glib/RemoteInspectorClient.h: Source/WTF: Add SocketConnection class. * wtf/PlatformGTK.cmake: * wtf/PlatformWPE.cmake: * wtf/glib/GSocketMonitor.cpp: Renamed from Source/WebKit/Platform/IPC/glib/GSocketMonitor.cpp. (WTF::GSocketMonitor::start): * wtf/glib/GSocketMonitor.h: Renamed from Source/WebKit/Platform/IPC/glib/GSocketMonitor.h. (WTF::GSocketMonitor::isActive const): * wtf/glib/GTypedefs.h: * wtf/glib/GUniquePtr.h: * wtf/glib/SocketConnection.cpp: Added. (WTF::SocketConnection::SocketConnection): (WTF::SocketConnection::~SocketConnection): (WTF::SocketConnection::read): (WTF::SocketConnection::readMessage): (WTF::SocketConnection::sendMessage): (WTF::SocketConnection::write): (WTF::SocketConnection::waitForSocketWritability): (WTF::SocketConnection::close): (WTF::SocketConnection::didClose): * wtf/glib/SocketConnection.h: Added. (WTF::SocketConnection::create): (WTF::SocketConnection::isClosed const): Tools: Update the unit tests to not use DBus. * TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp: Canonical link: https://commits.webkit.org/217749@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252770 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-22 14:22:34 +00:00
void sendMessageToBackend(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
void dispatchMessage(const String&);
#if USE(GLIB)
static const SocketConnection::MessageHandlers& messageHandlers();
[GTK][WPE] RemoteInspector: use sockets instead of DBus https://bugs.webkit.org/show_bug.cgi?id=204503 Reviewed by Žan Doberšek. Source/JavaScriptCore: It turns out DBus is event slower than expected. Using GSockets API we can simplify the code and make it a lot more efficient. This will drastically reduce the time to run WebDriver tests in the bots. * inspector/remote/RemoteInspector.h: * inspector/remote/glib/RemoteInspectorGlib.cpp: (Inspector::RemoteInspector::start): (Inspector::RemoteInspector::stopInternal): (Inspector::RemoteInspector::setupConnection): (Inspector::RemoteInspector::pushListingsNow): (Inspector::RemoteInspector::pushListingsSoon): (Inspector::RemoteInspector::sendAutomaticInspectionCandidateMessage): (Inspector::RemoteInspector::sendMessageToRemote): * inspector/remote/glib/RemoteInspectorServer.cpp: (Inspector::RemoteInspectorServer::~RemoteInspectorServer): (Inspector::RemoteInspectorServer::start): (Inspector::RemoteInspectorServer::incomingConnectionCallback): (Inspector::RemoteInspectorServer::incomingConnection): (Inspector::RemoteInspectorServer::setTargetList): (Inspector::RemoteInspectorServer::setupInspectorClient): (Inspector::RemoteInspectorServer::setup): (Inspector::RemoteInspectorServer::close): (Inspector::RemoteInspectorServer::connectionDidClose): (Inspector::RemoteInspectorServer::sendMessageToBackend): (Inspector::RemoteInspectorServer::sendMessageToFrontend): (Inspector::RemoteInspectorServer::startAutomationSession): * inspector/remote/glib/RemoteInspectorServer.h: (Inspector::RemoteInspectorServer::isRunning const): Source/WebDriver: Use GSockets API instead of DBus. * SessionHost.cpp: (WebDriver::SessionHost::sendCommandToBackend): * SessionHost.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::~SessionHost): (WebDriver::SessionHost::isConnected const): (WebDriver::ConnectToBrowserAsyncData::ConnectToBrowserAsyncData): (WebDriver::SessionHost::launchBrowser): (WebDriver::SessionHost::connectToBrowser): (WebDriver::SessionHost::connectionDidClose): (WebDriver::SessionHost::setupConnection): (WebDriver::SessionHost::startAutomationSession): (WebDriver::SessionHost::didStartAutomationSession): (WebDriver::SessionHost::setTargetList): (WebDriver::SessionHost::sendMessageToBackend): * socket/SessionHostSocket.cpp: (WebDriver::SessionHost::sendMessageToBackend): Source/WebKit: Use GSockets API instead of DBus. * Platform/IPC/Connection.h: * SourcesGTK.txt: Remove GSocketMonitor that has been moved to WTF. * SourcesWPE.txt: Ditto. * UIProcess/glib/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorClient::RemoteInspectorClient): (WebKit::RemoteInspectorClient::~RemoteInspectorClient): (WebKit::RemoteInspectorClient::setupConnection): (WebKit::RemoteInspectorClient::connectionDidClose): (WebKit::RemoteInspectorClient::inspect): (WebKit::RemoteInspectorClient::sendMessageToBackend): (WebKit::RemoteInspectorClient::closeFromFrontend): * UIProcess/glib/RemoteInspectorClient.h: Source/WTF: Add SocketConnection class. * wtf/PlatformGTK.cmake: * wtf/PlatformWPE.cmake: * wtf/glib/GSocketMonitor.cpp: Renamed from Source/WebKit/Platform/IPC/glib/GSocketMonitor.cpp. (WTF::GSocketMonitor::start): * wtf/glib/GSocketMonitor.h: Renamed from Source/WebKit/Platform/IPC/glib/GSocketMonitor.h. (WTF::GSocketMonitor::isActive const): * wtf/glib/GTypedefs.h: * wtf/glib/GUniquePtr.h: * wtf/glib/SocketConnection.cpp: Added. (WTF::SocketConnection::SocketConnection): (WTF::SocketConnection::~SocketConnection): (WTF::SocketConnection::read): (WTF::SocketConnection::readMessage): (WTF::SocketConnection::sendMessage): (WTF::SocketConnection::write): (WTF::SocketConnection::waitForSocketWritability): (WTF::SocketConnection::close): (WTF::SocketConnection::didClose): * wtf/glib/SocketConnection.h: Added. (WTF::SocketConnection::create): (WTF::SocketConnection::isClosed const): Tools: Update the unit tests to not use DBus. * TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp: Canonical link: https://commits.webkit.org/217749@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252770 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-22 14:22:34 +00:00
void connectionDidClose();
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
void launchBrowser(Function<void (std::optional<String> error)>&&);
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 connectToBrowser(std::unique_ptr<ConnectToBrowserAsyncData>&&);
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
bool matchCapabilities(GVariant*);
bool buildSessionCapabilities(GVariantBuilder*) const;
[GTK][WPE] RemoteInspector: use sockets instead of DBus https://bugs.webkit.org/show_bug.cgi?id=204503 Reviewed by Žan Doberšek. Source/JavaScriptCore: It turns out DBus is event slower than expected. Using GSockets API we can simplify the code and make it a lot more efficient. This will drastically reduce the time to run WebDriver tests in the bots. * inspector/remote/RemoteInspector.h: * inspector/remote/glib/RemoteInspectorGlib.cpp: (Inspector::RemoteInspector::start): (Inspector::RemoteInspector::stopInternal): (Inspector::RemoteInspector::setupConnection): (Inspector::RemoteInspector::pushListingsNow): (Inspector::RemoteInspector::pushListingsSoon): (Inspector::RemoteInspector::sendAutomaticInspectionCandidateMessage): (Inspector::RemoteInspector::sendMessageToRemote): * inspector/remote/glib/RemoteInspectorServer.cpp: (Inspector::RemoteInspectorServer::~RemoteInspectorServer): (Inspector::RemoteInspectorServer::start): (Inspector::RemoteInspectorServer::incomingConnectionCallback): (Inspector::RemoteInspectorServer::incomingConnection): (Inspector::RemoteInspectorServer::setTargetList): (Inspector::RemoteInspectorServer::setupInspectorClient): (Inspector::RemoteInspectorServer::setup): (Inspector::RemoteInspectorServer::close): (Inspector::RemoteInspectorServer::connectionDidClose): (Inspector::RemoteInspectorServer::sendMessageToBackend): (Inspector::RemoteInspectorServer::sendMessageToFrontend): (Inspector::RemoteInspectorServer::startAutomationSession): * inspector/remote/glib/RemoteInspectorServer.h: (Inspector::RemoteInspectorServer::isRunning const): Source/WebDriver: Use GSockets API instead of DBus. * SessionHost.cpp: (WebDriver::SessionHost::sendCommandToBackend): * SessionHost.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::~SessionHost): (WebDriver::SessionHost::isConnected const): (WebDriver::ConnectToBrowserAsyncData::ConnectToBrowserAsyncData): (WebDriver::SessionHost::launchBrowser): (WebDriver::SessionHost::connectToBrowser): (WebDriver::SessionHost::connectionDidClose): (WebDriver::SessionHost::setupConnection): (WebDriver::SessionHost::startAutomationSession): (WebDriver::SessionHost::didStartAutomationSession): (WebDriver::SessionHost::setTargetList): (WebDriver::SessionHost::sendMessageToBackend): * socket/SessionHostSocket.cpp: (WebDriver::SessionHost::sendMessageToBackend): Source/WebKit: Use GSockets API instead of DBus. * Platform/IPC/Connection.h: * SourcesGTK.txt: Remove GSocketMonitor that has been moved to WTF. * SourcesWPE.txt: Ditto. * UIProcess/glib/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorClient::RemoteInspectorClient): (WebKit::RemoteInspectorClient::~RemoteInspectorClient): (WebKit::RemoteInspectorClient::setupConnection): (WebKit::RemoteInspectorClient::connectionDidClose): (WebKit::RemoteInspectorClient::inspect): (WebKit::RemoteInspectorClient::sendMessageToBackend): (WebKit::RemoteInspectorClient::closeFromFrontend): * UIProcess/glib/RemoteInspectorClient.h: Source/WTF: Add SocketConnection class. * wtf/PlatformGTK.cmake: * wtf/PlatformWPE.cmake: * wtf/glib/GSocketMonitor.cpp: Renamed from Source/WebKit/Platform/IPC/glib/GSocketMonitor.cpp. (WTF::GSocketMonitor::start): * wtf/glib/GSocketMonitor.h: Renamed from Source/WebKit/Platform/IPC/glib/GSocketMonitor.h. (WTF::GSocketMonitor::isActive const): * wtf/glib/GTypedefs.h: * wtf/glib/GUniquePtr.h: * wtf/glib/SocketConnection.cpp: Added. (WTF::SocketConnection::SocketConnection): (WTF::SocketConnection::~SocketConnection): (WTF::SocketConnection::read): (WTF::SocketConnection::readMessage): (WTF::SocketConnection::sendMessage): (WTF::SocketConnection::write): (WTF::SocketConnection::waitForSocketWritability): (WTF::SocketConnection::close): (WTF::SocketConnection::didClose): * wtf/glib/SocketConnection.h: Added. (WTF::SocketConnection::create): (WTF::SocketConnection::isClosed const): Tools: Update the unit tests to not use DBus. * TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp: Canonical link: https://commits.webkit.org/217749@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252770 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-22 14:22:34 +00:00
void setupConnection(Ref<SocketConnection>&&);
void didStartAutomationSession(GVariant*);
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 setTargetList(uint64_t connectionID, Vector<Target>&&);
void sendMessageToFrontend(uint64_t connectionID, uint64_t targetID, const char* message);
[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
#elif USE(INSPECTOR_SOCKET_SERVER)
HashMap<String, CallHandler>& dispatchMap() override;
void didClose(Inspector::RemoteInspectorSocketEndpoint&, Inspector::ConnectionID) final;
void sendWebInspectorEvent(const String&);
void receivedSetTargetList(const struct Event&);
void receivedSendMessageToFrontend(const struct Event&);
void receivedStartAutomationSessionReturn(const struct Event&);
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
std::optional<Vector<Target>> parseTargetList(const struct Event&);
[PlayStation][WinCairo] Enable WebDriver target on PlayStation and client for WinCairo https://bugs.webkit.org/show_bug.cgi?id=216908 Reviewed by Don Olmstead. Source/JavaScriptCore: Implement automation session correctly for PlayStation and WinCairo. * inspector/remote/RemoteInspector.h: * inspector/remote/socket/RemoteInspectorConnectionClient.cpp: (Inspector::RemoteInspectorConnectionClient::parseTargetListJSON): * inspector/remote/socket/RemoteInspectorConnectionClient.h: * inspector/remote/socket/RemoteInspectorSocket.cpp: (Inspector::RemoteInspector::stopInternal): (Inspector::RemoteInspector::requestAutomationSession): (Inspector::RemoteInspector::startAutomationSession): Source/WebDriver: Extend WebDriver client binary to support connection to remote device for both PlayStation and WinCairo. We've implemented a simple web server to accept WebDriver request natively and bypass them to RemoteInspector. * Capabilities.h: * HTTPServer.h: * PlatformPlayStation.cmake: Added. * PlatformWin.cmake: * SessionHost.h: (WebDriver::SessionHost::setHostAddress): * WebDriverMain.cpp: (main): (dllLauncherEntryPoint): * WebDriverService.cpp: (WebDriver::printUsageStatement): (WebDriver::WebDriverService::run): (WebDriver::WebDriverService::connectToBrowser): * WebDriverService.h: * gtk/WebDriverServiceGtk.cpp: (WebDriver::WebDriverService::platformInit): * playstation/WebDriverServicePlayStation.cpp: Copied from Source\WebDriver\win\WebDriverServiceWin.cpp. (WebDriver::WebDriverService::platformInit): (WebDriver::WebDriverService::platformCapabilities): (WebDriver::WebDriverService::platformCompareBrowserVersions): (WebDriver::WebDriverService::platformValidateCapability const): (WebDriver::WebDriverService::platformMatchCapability const): (WebDriver::WebDriverService::platformParseCapabilities const): (WebDriver::WebDriverService::platformSupportProxyType const): * socket/CapabilitiesSocket.cpp: Copied from Source\WebDriver\socket\SessionHostSocket.cpp. (WebDriver::CapabilitiesSocket::parseCapabilities): * socket/CapabilitiesSocket.h: Copied from Source\WebDriver\socket\HTTPServerSocket.cpp. * socket/HTTPParser.cpp: Added. (WebDriver::HTTPParser::parse): (WebDriver::HTTPParser::handlePhase): (WebDriver::HTTPParser::abortProcess): (WebDriver::HTTPParser::parseFirstLine): (WebDriver::HTTPParser::readLine): (WebDriver::HTTPParser::expectedBodyLength const): * socket/HTTPParser.h: Copied from Source\WebDriver\HTTPServer.h. (WebDriver::HTTPParser::pullMessage): * socket/HTTPServerSocket.cpp: (WebDriver::HTTPServer::listen): (WebDriver::HTTPServer::disconnect): (WebDriver::HTTPServer::doAccept): (WebDriver::HTTPServer::didClose): (WebDriver::HTTPRequestHandler::connect): (WebDriver::HTTPRequestHandler::reset): (WebDriver::HTTPRequestHandler::didReceive): (WebDriver::HTTPRequestHandler::sendResponse): (WebDriver::HTTPRequestHandler::packHTTPMessage const): (WebDriver::HTTPRequestHandler::didClose): * socket/SessionHostSocket.cpp: (WebDriver::SessionHost::dispatchMap): (WebDriver::SessionHost::sendWebInspectorEvent): (WebDriver::SessionHost::connectToBrowser): (WebDriver::SessionHost::isConnected const): (WebDriver::SessionHost::didClose): (WebDriver::SessionHost::parseTargetList): (WebDriver::SessionHost::receivedSetTargetList): (WebDriver::SessionHost::receivedSendMessageToFrontend): (WebDriver::SessionHost::startAutomationSession): (WebDriver::SessionHost::setTargetList): (WebDriver::SessionHost::sendMessageToBackend): * win/WebDriverServiceWin.cpp: (WebDriver::WebDriverService::platformInit): (WebDriver::WebDriverService::platformParseCapabilities const): * wpe/WebDriverServiceWPE.cpp: (WebDriver::WebDriverService::platformInit): Canonical link: https://commits.webkit.org/229926@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267807 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-30 21:22:57 +00:00
void setTargetList(uint64_t connectionID, Vector<Target>&&);
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
#endif
Capabilities m_capabilities;
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
String m_sessionID;
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
uint64_t m_connectionID { 0 };
Target m_target;
HashMap<long, Function<void (CommandResponse&&)>> m_commandRequests;
#if USE(GLIB)
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
Function<void (bool, std::optional<String>)> m_startSessionCompletionHandler;
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
GRefPtr<GSubprocess> m_browser;
[GTK][WPE] RemoteInspector: use sockets instead of DBus https://bugs.webkit.org/show_bug.cgi?id=204503 Reviewed by Žan Doberšek. Source/JavaScriptCore: It turns out DBus is event slower than expected. Using GSockets API we can simplify the code and make it a lot more efficient. This will drastically reduce the time to run WebDriver tests in the bots. * inspector/remote/RemoteInspector.h: * inspector/remote/glib/RemoteInspectorGlib.cpp: (Inspector::RemoteInspector::start): (Inspector::RemoteInspector::stopInternal): (Inspector::RemoteInspector::setupConnection): (Inspector::RemoteInspector::pushListingsNow): (Inspector::RemoteInspector::pushListingsSoon): (Inspector::RemoteInspector::sendAutomaticInspectionCandidateMessage): (Inspector::RemoteInspector::sendMessageToRemote): * inspector/remote/glib/RemoteInspectorServer.cpp: (Inspector::RemoteInspectorServer::~RemoteInspectorServer): (Inspector::RemoteInspectorServer::start): (Inspector::RemoteInspectorServer::incomingConnectionCallback): (Inspector::RemoteInspectorServer::incomingConnection): (Inspector::RemoteInspectorServer::setTargetList): (Inspector::RemoteInspectorServer::setupInspectorClient): (Inspector::RemoteInspectorServer::setup): (Inspector::RemoteInspectorServer::close): (Inspector::RemoteInspectorServer::connectionDidClose): (Inspector::RemoteInspectorServer::sendMessageToBackend): (Inspector::RemoteInspectorServer::sendMessageToFrontend): (Inspector::RemoteInspectorServer::startAutomationSession): * inspector/remote/glib/RemoteInspectorServer.h: (Inspector::RemoteInspectorServer::isRunning const): Source/WebDriver: Use GSockets API instead of DBus. * SessionHost.cpp: (WebDriver::SessionHost::sendCommandToBackend): * SessionHost.h: * glib/SessionHostGlib.cpp: (WebDriver::SessionHost::~SessionHost): (WebDriver::SessionHost::isConnected const): (WebDriver::ConnectToBrowserAsyncData::ConnectToBrowserAsyncData): (WebDriver::SessionHost::launchBrowser): (WebDriver::SessionHost::connectToBrowser): (WebDriver::SessionHost::connectionDidClose): (WebDriver::SessionHost::setupConnection): (WebDriver::SessionHost::startAutomationSession): (WebDriver::SessionHost::didStartAutomationSession): (WebDriver::SessionHost::setTargetList): (WebDriver::SessionHost::sendMessageToBackend): * socket/SessionHostSocket.cpp: (WebDriver::SessionHost::sendMessageToBackend): Source/WebKit: Use GSockets API instead of DBus. * Platform/IPC/Connection.h: * SourcesGTK.txt: Remove GSocketMonitor that has been moved to WTF. * SourcesWPE.txt: Ditto. * UIProcess/glib/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorClient::RemoteInspectorClient): (WebKit::RemoteInspectorClient::~RemoteInspectorClient): (WebKit::RemoteInspectorClient::setupConnection): (WebKit::RemoteInspectorClient::connectionDidClose): (WebKit::RemoteInspectorClient::inspect): (WebKit::RemoteInspectorClient::sendMessageToBackend): (WebKit::RemoteInspectorClient::closeFromFrontend): * UIProcess/glib/RemoteInspectorClient.h: Source/WTF: Add SocketConnection class. * wtf/PlatformGTK.cmake: * wtf/PlatformWPE.cmake: * wtf/glib/GSocketMonitor.cpp: Renamed from Source/WebKit/Platform/IPC/glib/GSocketMonitor.cpp. (WTF::GSocketMonitor::start): * wtf/glib/GSocketMonitor.h: Renamed from Source/WebKit/Platform/IPC/glib/GSocketMonitor.h. (WTF::GSocketMonitor::isActive const): * wtf/glib/GTypedefs.h: * wtf/glib/GUniquePtr.h: * wtf/glib/SocketConnection.cpp: Added. (WTF::SocketConnection::SocketConnection): (WTF::SocketConnection::~SocketConnection): (WTF::SocketConnection::read): (WTF::SocketConnection::readMessage): (WTF::SocketConnection::sendMessage): (WTF::SocketConnection::write): (WTF::SocketConnection::waitForSocketWritability): (WTF::SocketConnection::close): (WTF::SocketConnection::didClose): * wtf/glib/SocketConnection.h: Added. (WTF::SocketConnection::create): (WTF::SocketConnection::isClosed const): Tools: Update the unit tests to not use DBus. * TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp: Canonical link: https://commits.webkit.org/217749@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252770 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-22 14:22:34 +00:00
RefPtr<SocketConnection> m_socketConnection;
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
GRefPtr<GCancellable> m_cancellable;
[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
#elif USE(INSPECTOR_SOCKET_SERVER)
String m_targetIp;
uint16_t m_targetPort { 0 };
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
Function<void(bool, std::optional<String>)> m_startSessionCompletionHandler;
std::optional<Inspector::ConnectionID> m_clientID;
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
#endif
};
} // namespace WebDriver