haikuwebkit/Source/WebDriver/socket/HTTPParser.cpp

158 lines
4.5 KiB
C++
Raw Permalink Normal View History

[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
/*
* Copyright (C) 2020 Sony Interactive Entertainment Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "HTTPParser.h"
Remove all remaining uses of the String::toInt family of functions https://bugs.webkit.org/show_bug.cgi?id=225580 Reviewed by Sam Weinig. Source/WebCore: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo): Use parseInteger<uint64_t> instead of String::toUInt64Strict. (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameAndVersionFromFile): Ditto. * Modules/websockets/WebSocketDeflateFramer.cpp: (WebCore::WebSocketExtensionDeflateFrame::WebSocketExtensionDeflateFrame): Use a reference instead of a pointer. (WebCore::WebSocketExtensionDeflateFrame::processResponse): Use ASCIILiteral. Use parseIntegerAllowingTrailingJunk<int> instead of String::toInt. Use auto. Use references instead of pointers. (WebCore::DeflateResultHolder::DeflateResultHolder): Use a reference. (WebCore::DeflateResultHolder::~DeflateResultHolder): Ditto. (WebCore::InflateResultHolder::InflateResultHolder): Ditto. (WebCore::InflateResultHolder::~InflateResultHolder): Ditto. (WebCore::WebSocketDeflateFramer::WebSocketDeflateFramer): Deleted. (WebCore::WebSocketDeflateFramer::createExtensionProcessor): Pass a reference. (WebCore::WebSocketDeflateFramer::deflate): Ditto. (WebCore::WebSocketDeflateFramer::inflate): Ditto. * Modules/websockets/WebSocketDeflateFramer.h: Use forward declarations instead of includes, references instead of pointers, initialize data members in the class definition, and remove an unnecessary explicit default constructor. * Modules/websockets/WebSocketHandshake.cpp: (WebCore::headerHasValidHTTPVersion): Use parseInteger<int> instead of StringView::toIntStrict. (WebCore::WebSocketHandshake::readStatusLine): Ditto. * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::headingLevel const): Use getIntegralAttribute instead of AtomString::toInt. (WebCore::AccessibilityNodeObject::hierarchicalLevel const): Ditto. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::getIntegralAttribute const): Added. Since AccessibilityObject has its own getAttribute function, we need to re-implement Element::getIntegralAttribute here. (WebCore::AccessibilityObject::setSize const): Use getIntegralAttribute instead of AtomString::toInt. (WebCore::AccessibilityObject::posInSet const): Ditto. * accessibility/AccessibilityObject.h: Added getIntegralAttribute. * accessibility/AccessibilityTable.cpp: (WebCore::AccessibilityTable::isDataTable const):Use getIntegralAttribute instead of AtomString::toInt. (WebCore::AccessibilityTable::axColumnCount const): Ditto. (WebCore::AccessibilityTable::axRowCount const): Ditto. * accessibility/AccessibilityTableCell.cpp: (WebCore::AccessibilityTableCell::axColumnIndex const): Ditto. (WebCore::AccessibilityTableCell::axRowIndex const): Ditto. (WebCore::AccessibilityTableCell::axColumnSpan const): Ditto. (WebCore::AccessibilityTableCell::axRowSpan const): Ditto. * accessibility/AccessibilityTableRow.cpp: (WebCore::AccessibilityTableRow::axColumnIndex const): Ditto. (WebCore::AccessibilityTableRow::axRowIndex const): Ditto. * css/parser/CSSSelectorParser.cpp: (WebCore::consumeANPlusB): Use parseInteger<int> instead of String::toIntStrict * css/parser/CSSTokenizer.cpp: (WebCore::CSSTokenizer::consumeEscape): Use parseInteger<uint32_t> instead of String::toUIntStrict. * editing/cocoa/DataDetection.mm: (WebCore::DataDetection::canPresentDataDetectorsUIForElement): Use parseIntegerAllowingTrailingJunk<int> instead of String::toInt. Also use StringView instead of String. (WebCore::dataDetectorStringForPath): Use makeString instead of StringBuilder. * editing/cocoa/HTMLConverter.mm: (HTMLConverter::computedAttributesForElement): Use parseIntegerAllowingTrailingJunk<int> instead of String::toInt. * html/HTMLFrameElement.cpp: (WebCore::HTMLFrameElement::parseAttribute): Use parseHTMLInteger instead of parseIntegerAllowingTrailingJunk<int>. * html/HTMLFrameSetElement.cpp: (WebCore::HTMLFrameSetElement::parseAttribute): Ditto. * html/HTMLHRElement.cpp: (WebCore::HTMLHRElement::collectStyleForPresentationAttribute): Ditto. * html/HTMLIFrameElement.cpp: (WebCore::HTMLIFrameElement::collectStyleForPresentationAttribute): Ditto. * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::parseAttribute): Ditto. * html/HTMLLIElement.cpp: (WebCore::HTMLLIElement::parseValue): Ditto. * html/HTMLMarqueeElement.cpp: (WebCore::HTMLMarqueeElement::loop const): Use getIntegralAttribute instead of parseIntegerAllowingTrailingJunk<int>. * html/HTMLTableCellElement.cpp: (WebCore::HTMLTableCellElement::collectStyleForPresentationAttribute): Use parseHTMLInteger instead of parseIntegerAllowingTrailingJunk<int>. * html/HTMLTableColElement.cpp: (WebCore::HTMLTableColElement::parseAttribute): Ditto. * html/HTMLTableElement.cpp: (WebCore::HTMLTableElement::parseAttribute): Ditto. * inspector/InspectorFrontendClientLocal.cpp: (WebCore::InspectorFrontendClientLocal::restoreAttachedWindowHeight): Use parseIntegerAllowingTrailingJunk<unsigned> instead of String::toUInt. * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::nodeForPath): Use parseIntegerAllowingTrailingJunk<unsigned> instead of String::toUInt. * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::TreeBuilder::createLayoutBox): Use parseHTMLInteger instead of AtomString::toInt. * loader/CrossOriginPreflightResultCache.cpp: (WebCore::parseAccessControlMaxAge): Use parseInteger<uint64_t> instead of String::toUIntStrict. * loader/FTPDirectoryParser.cpp: (WebCore::parseOneFTPLine): Use parseIntegerAllowingTrailingJunk<unsigned> instead of String::toUInt. * loader/PrivateClickMeasurement.cpp: (WebCore::PrivateClickMeasurement::parseAttributionRequest): Use parseInteger<uint64_t> instead of String::toUInt64Strict. * mathml/MathMLSelectElement.cpp: (WebCore::MathMLSelectElement::getSelectedActionChildAndIndex): Use getIntegralAttribute instead of parseIntegerAllowingTrailingJunk<int>. * page/EventSource.cpp: (WebCore::EventSource::parseEventStreamLine): Use parseIntegerAllowingTrailingJunk<uint64_t> instead of charactersToUInt64. * page/Location.cpp: (WebCore::Location::setPort): Use parseInteger<uint16_t> instead of parseUInt16. * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::fromDatabaseIdentifier): Use parseIntegerAllowingTrailingJunk<uint16_t> instead of String::toInt, which allows us to remove some range checking and type conversion. * page/WindowFeatures.cpp: (WebCore::setWindowFeature): Use parseIntegerAllowingTrailingJunk<int> instead of StringView::toInt. * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::ContentSecurityPolicySourceList::parsePort): Use parseInteger<uint16_t> instead of charactersToIntStrict. * page/linux/ResourceUsageThreadLinux.cpp: (WebCore::collectCPUUsage): Use parseInteger<pid_t> instead of String::toIntStrict. Also removed unneeded special cases for "." and ".." since both will fail to parse as an integer, and this no longer need to put d_name into a WTF::String. * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (CachedResourceStreamingClient::responseReceived): Use parseIntegerAllowingTrailingJunk<int> instead of String::toInt. * platform/graphics/gstreamer/eme/CDMThunder.cpp: (WebCore::ParsedResponseMessage::ParsedResponseMessage): Use parseInteger<int> instead of String::toInt to parse a single-digit. Probably should write this another way. * platform/network/curl/CookieUtil.cpp: (WebCore::CookieUtil::parseCookieAttributes): Use parseIntegerAllowingTrailingJunk<int64_t> instead of String::toInt64. * platform/network/curl/CurlCacheEntry.cpp: (WebCore::CurlCacheEntry::setResponseFromCachedHeaders): Use parseIntegerAllowingTrailingJunk<long long> instead of String::toInt64. * svg/SVGToOTFFontConversion.cpp: (WebCore::SVGToOTFFontConverter::appendOS2Table): Use parseHTMLInteger instead of parseIntegerAllowingTrailingJunk<int>. Might be even better to refactor to use getIntegralAttribute later. (WebCore::SVGToOTFFontConverter::appendVORGTable): Ditto. * testing/Internals.cpp: (WebCore::Internals::setSFrameCounter): Use parseInteger<uint64_t> instead of StringView::toUInt64Strict. Source/WebDriver: * WebDriverService.cpp: (WebDriver::WebDriverService::run): Use parseIntegerAllowingTrailingJunk<uint16_t> instead of String::toUInt. * glib/WebDriverServiceGLib.cpp: (WebDriver::parseVersion): Use parseIntegerAllowingTrailingJunk<uint64_t> instead of String::toInt64, and then assigning into a uint64_t. * socket/HTTPParser.cpp: (WebDriver::HTTPParser::expectedBodyLength const): Use parseIntegerAllowingTrailingJunk<size_t> instead of String::toInt. Also use StringView instead of String::substringSharingImpl and dropped an unneeded call to String::stripWhiteSpace. Source/WebKitLegacy/win: * Plugins/PluginDatabaseWin.cpp: (WebCore::parseVersionString): Use parseIntegerAllowinTrailingJunk<int> isnstead of String::toInt. * Plugins/PluginView.cpp: (WebCore::PluginView::handlePost): Use parseIntegerAllowingTrailingJunk<unsigned> instead of String::toInt, and then assigning to an unsigned. Tools: * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (WTR::AccessibilityUIElement::numberAttributeValue): Use parseIntegerAllowingTrailingJunk<int> instead of String::toInt. (WTR::AccessibilityUIElement::hierarchicalLevel const): Ditto. Canonical link: https://commits.webkit.org/237536@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277269 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-10 16:57:02 +00:00
#include <wtf/text/StringToIntegerConversion.h>
[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
namespace WebDriver {
HTTPParser::Phase HTTPParser::parse(Vector<uint8_t>&& data)
{
if (!data.isEmpty()) {
m_buffer.appendVector(WTFMove(data));
while (true) {
if (handlePhase() == Process::Suspend)
break;
}
}
return m_phase;
}
HTTPParser::Process HTTPParser::handlePhase()
{
switch (m_phase) {
case Phase::Idle: {
String line;
if (!readLine(line))
return Process::Suspend;
if (!parseFirstLine(WTFMove(line)))
return abortProcess("Client error: invalid request line.");
ASSERT(!m_message.method.isEmpty());
ASSERT(!m_message.path.isEmpty());
ASSERT(!m_message.version.isEmpty());
m_phase = Phase::Header;
return Process::Continue;
}
case Phase::Header: {
String line;
if (!readLine(line))
return Process::Suspend;
if (!line.isEmpty())
m_message.requestHeaders.append(WTFMove(line));
else {
m_bodyLength = expectedBodyLength();
m_phase = Phase::Body;
}
return Process::Continue;
}
case Phase::Body:
if (m_buffer.size() > m_bodyLength)
return abortProcess("Client error: don't send data after request and before response.");
if (m_buffer.size() < m_bodyLength)
return Process::Suspend;
m_message.requestBody = WTFMove(m_buffer);
m_phase = Phase::Complete;
return Process::Suspend;
case Phase::Complete:
return abortProcess("Client error: don't send data after request and before response.");
case Phase::Error:
return abortProcess();
}
}
HTTPParser::Process HTTPParser::abortProcess(const char* message)
{
if (message)
LOG_ERROR(message);
m_phase = Phase::Error;
if (!m_buffer.isEmpty())
m_buffer.resize(0);
return Process::Suspend;
}
bool HTTPParser::parseFirstLine(String&& line)
{
auto components = line.split(' ');
if (components.size() != 3)
return false;
m_message.method = WTFMove(components[0]);
m_message.path = WTFMove(components[1]);
m_message.version = WTFMove(components[2]);
return true;
}
bool HTTPParser::readLine(String& line)
{
auto length = m_buffer.size();
auto position = m_buffer.find(0x0d);
if (position == notFound || position + 1 == length || m_buffer[position + 1] != 0x0a)
return false;
Reduce use of reinterpret_cast<> in the codebase https://bugs.webkit.org/show_bug.cgi?id=226743 Reviewed by Darin Adler. Source/WebCore: * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp: (WebCore::CDMSessionClearKey::generateKeyRequest): * Modules/fetch/FetchBody.cpp: (WebCore::FetchBody::take): * Modules/fetch/FetchBodyConsumer.cpp: (WebCore::FetchBodyConsumer::resolve): (WebCore::FetchBodyConsumer::takeAsBlob): (WebCore::FetchBodyConsumer::takeAsText): * Modules/mediastream/RTCDataChannelRemoteHandler.cpp: (WebCore::RTCDataChannelRemoteHandler::readyToSend): (WebCore::RTCDataChannelRemoteHandler::sendStringData): (WebCore::RTCDataChannelRemoteHandler::sendRawData): * Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp: (WebCore::copyBusData): * Modules/webauthn/AuthenticatorResponseData.h: (WebCore::encodeArrayBuffer): (WebCore::decodeArrayBuffer): * Modules/websockets/WebSocketChannel.cpp: (WebCore::WebSocketChannel::startClosingHandshake): (WebCore::WebSocketChannel::processOutgoingFrameQueue): * Modules/websockets/WebSocketHandshake.cpp: (WebCore::WebSocketHandshake::getExpectedWebSocketAccept): (WebCore::headerHasValidHTTPVersion): * bindings/js/ScriptBufferSourceProvider.h: * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readString): * contentextensions/SerializedNFA.cpp: (WebCore::ContentExtensions::SerializedNFA::pointerAtOffsetInFile const): * dom/Node.cpp: (WebCore::hashPointer): * dom/TextEncoder.cpp: (WebCore::TextEncoder::encode const): * dom/TextEncoderStreamEncoder.cpp: (WebCore::TextEncoderStreamEncoder::flush): * editing/cocoa/WebContentReaderCocoa.mm: (WebCore::sanitizeMarkupWithArchive): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::texImageArrayBufferViewHelper): * inspector/DOMPatchSupport.cpp: (WebCore::addStringToSHA1): * loader/TextResourceDecoder.cpp: (WebCore::TextResourceDecoder::textFromUTF8): * loader/cache/CachedScript.cpp: (WebCore::CachedScript::script): * page/cocoa/ResourceUsageOverlayCocoa.mm: (WebCore::showText): * platform/SharedBufferChunkReader.cpp: (WebCore::SharedBufferChunkReader::nextChunk): * platform/cf/SharedBufferCF.cpp: (WebCore::SharedBuffer::createCFData const): * platform/generic/KeyedEncoderGeneric.cpp: (WebCore::KeyedEncoderGeneric::encodeString): * platform/graphics/GraphicsContextGL.cpp: (WebCore::GraphicsContextGL::packImageData): * platform/graphics/ImageBufferBackend.cpp: (WebCore::ImageBufferBackend::getPixelBuffer const): (WebCore::ImageBufferBackend::putPixelBuffer): * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: (WebCore::InbandTextTrackPrivateAVF::processNativeSamples): * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp: (WebCore::CDMSessionAVFoundationCF::generateKeyRequest): (WebCore::CDMSessionAVFoundationCF::update): * platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp: (WebCore::InbandTextTrackPrivateAVCF::readNativeSampleBuffer): * platform/graphics/displaylists/DisplayListItemBuffer.cpp: (WebCore::DisplayList::ItemBuffer::createItemBuffer): * platform/graphics/displaylists/DisplayListIterator.cpp: (WebCore::DisplayList::DisplayList::Iterator::updateCurrentItem): * platform/image-decoders/gif/GIFImageReader.h: (GIFImageReader::data const): * platform/mac/SSLKeyGeneratorMac.mm: (WebCore::signedPublicKeyAndChallengeString): * platform/mediastream/RealtimeMediaSourceCenter.cpp: (WebCore::addStringToSHA1): * platform/network/FormDataBuilder.cpp: (WebCore::FormDataBuilder::encodeStringAsFormData): * platform/network/SocketStreamHandle.cpp: (WebCore::SocketStreamHandle::sendHandshake): * platform/network/cf/ResourceRequestCFNet.cpp: (WebCore::ResourceRequest::doUpdatePlatformRequest): * platform/network/cf/ResourceRequestCFNet.h: (WebCore::httpHeaderValueUsingSuitableEncoding): * platform/network/cf/SocketStreamHandleImplCFNet.cpp: (WebCore::SocketStreamHandleImpl::platformSendInternal): * platform/network/curl/CurlCacheEntry.cpp: (WebCore::CurlCacheEntry::generateBaseFilename): * platform/sql/SQLiteStatement.cpp: (WebCore::SQLiteStatement::columnBlobView): * testing/MockCDMFactory.cpp: (WebCore::MockCDM::sanitizeResponse const): Source/WebDriver: * socket/HTTPParser.cpp: (WebDriver::HTTPParser::readLine): * socket/SessionHostSocket.cpp: (WebDriver::SessionHost::sendWebInspectorEvent): Source/WebKit: * GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::mediaPlayerInitializationDataEncountered): * GPUProcess/media/RemoteTextTrackProxy.cpp: (WebKit::RemoteTextTrackProxy::addDataCue): * GPUProcess/webrtc/RemoteMediaRecorder.cpp: (WebKit::RemoteMediaRecorder::fetchData): * NetworkProcess/cache/NetworkCacheDataCurl.cpp: (WebKit::NetworkCache::Data::apply const): * NetworkProcess/cache/NetworkCacheKey.cpp: (WebKit::NetworkCache::hashString): * NetworkProcess/soup/WebKitDirectoryInputStream.cpp: (webkitDirectoryInputStreamRead): * Platform/IPC/ArgumentCoders.cpp: (IPC::ArgumentCoder<CString>::encode): (IPC::ArgumentCoder<String>::encode): * Shared/API/c/cf/WKStringCF.mm: (WKStringCopyCFString): * Shared/API/c/cf/WKURLCF.mm: (WKURLCopyCFURL): * Shared/ShareableResource.cpp: (WebKit::ShareableResource::wrapInSharedBuffer): * Shared/SharedDisplayListHandle.h: (WebKit::SharedDisplayListHandle::data const): * Shared/WebCompiledContentRuleList.cpp: (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const): * UIProcess/API/APIWebAuthenticationAssertionResponse.cpp: (API::WebAuthenticationAssertionResponse::userHandle const): * UIProcess/API/C/WKPage.cpp: (dataFrom): * UIProcess/Cocoa/SOAuthorization/RedirectSOAuthorizationSession.mm: (WebKit::RedirectSOAuthorizationSession::completeInternal): * UIProcess/Inspector/socket/RemoteInspectorClient.cpp: (WebKit::RemoteInspectorClient::sendWebInspectorEvent): * WebProcess/Network/WebSocketChannel.cpp: (WebKit::WebSocketChannel::createMessageQueue): (WebKit::WebSocketChannel::didReceiveText): * WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp: (WebKit::RTCDataChannelRemoteManager::sendData): (WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didReceiveStringData): * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: (WebKit::NetscapePluginStream::sendJavaScriptStream): Source/WTF: * wtf/CryptographicallyRandomNumber.cpp: * wtf/FastMalloc.h: (WTF::FastAllocator::allocate): * wtf/SHA1.h: (WTF::SHA1::addBytes): * wtf/StackCheck.h: (WTF::StackCheck::Scope::Scope): (WTF::StackCheck::StackCheck): * wtf/URLHelpers.cpp: (WTF::URLHelpers::userVisibleURL): * wtf/URLParser.cpp: (WTF::URLParser::formURLDecode): * wtf/cf/URLCF.cpp: (WTF::URL::createCFURL const): * wtf/cocoa/URLCocoa.mm: (WTF::URL::createCFURL const): * wtf/persistence/PersistentCoders.cpp: (WTF::Persistence::Coder<CString>::encode): (WTF::Persistence::Coder<String>::encode): * wtf/text/CString.h: * wtf/text/WTFString.cpp: (WTF::String::latin1 const): * wtf/text/cf/StringImplCF.cpp: (WTF::StringImpl::createCFString): Canonical link: https://commits.webkit.org/238604@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278619 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-08 17:35:15 +00:00
line = String::fromUTF8(m_buffer.data(), position);
[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 (line.isNull())
LOG_ERROR("Client error: invalid encoding in HTTP header.");
m_buffer.remove(0, position + 2);
return true;
}
size_t HTTPParser::expectedBodyLength() const
{
if (m_message.method == "HEAD")
return 0;
const char* name = "content-length:";
const size_t nameLength = std::strlen(name);
for (const auto& header : m_message.requestHeaders) {
Remove all remaining uses of the String::toInt family of functions https://bugs.webkit.org/show_bug.cgi?id=225580 Reviewed by Sam Weinig. Source/WebCore: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: (WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo): Use parseInteger<uint64_t> instead of String::toUInt64Strict. (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameAndVersionFromFile): Ditto. * Modules/websockets/WebSocketDeflateFramer.cpp: (WebCore::WebSocketExtensionDeflateFrame::WebSocketExtensionDeflateFrame): Use a reference instead of a pointer. (WebCore::WebSocketExtensionDeflateFrame::processResponse): Use ASCIILiteral. Use parseIntegerAllowingTrailingJunk<int> instead of String::toInt. Use auto. Use references instead of pointers. (WebCore::DeflateResultHolder::DeflateResultHolder): Use a reference. (WebCore::DeflateResultHolder::~DeflateResultHolder): Ditto. (WebCore::InflateResultHolder::InflateResultHolder): Ditto. (WebCore::InflateResultHolder::~InflateResultHolder): Ditto. (WebCore::WebSocketDeflateFramer::WebSocketDeflateFramer): Deleted. (WebCore::WebSocketDeflateFramer::createExtensionProcessor): Pass a reference. (WebCore::WebSocketDeflateFramer::deflate): Ditto. (WebCore::WebSocketDeflateFramer::inflate): Ditto. * Modules/websockets/WebSocketDeflateFramer.h: Use forward declarations instead of includes, references instead of pointers, initialize data members in the class definition, and remove an unnecessary explicit default constructor. * Modules/websockets/WebSocketHandshake.cpp: (WebCore::headerHasValidHTTPVersion): Use parseInteger<int> instead of StringView::toIntStrict. (WebCore::WebSocketHandshake::readStatusLine): Ditto. * accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::headingLevel const): Use getIntegralAttribute instead of AtomString::toInt. (WebCore::AccessibilityNodeObject::hierarchicalLevel const): Ditto. * accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::getIntegralAttribute const): Added. Since AccessibilityObject has its own getAttribute function, we need to re-implement Element::getIntegralAttribute here. (WebCore::AccessibilityObject::setSize const): Use getIntegralAttribute instead of AtomString::toInt. (WebCore::AccessibilityObject::posInSet const): Ditto. * accessibility/AccessibilityObject.h: Added getIntegralAttribute. * accessibility/AccessibilityTable.cpp: (WebCore::AccessibilityTable::isDataTable const):Use getIntegralAttribute instead of AtomString::toInt. (WebCore::AccessibilityTable::axColumnCount const): Ditto. (WebCore::AccessibilityTable::axRowCount const): Ditto. * accessibility/AccessibilityTableCell.cpp: (WebCore::AccessibilityTableCell::axColumnIndex const): Ditto. (WebCore::AccessibilityTableCell::axRowIndex const): Ditto. (WebCore::AccessibilityTableCell::axColumnSpan const): Ditto. (WebCore::AccessibilityTableCell::axRowSpan const): Ditto. * accessibility/AccessibilityTableRow.cpp: (WebCore::AccessibilityTableRow::axColumnIndex const): Ditto. (WebCore::AccessibilityTableRow::axRowIndex const): Ditto. * css/parser/CSSSelectorParser.cpp: (WebCore::consumeANPlusB): Use parseInteger<int> instead of String::toIntStrict * css/parser/CSSTokenizer.cpp: (WebCore::CSSTokenizer::consumeEscape): Use parseInteger<uint32_t> instead of String::toUIntStrict. * editing/cocoa/DataDetection.mm: (WebCore::DataDetection::canPresentDataDetectorsUIForElement): Use parseIntegerAllowingTrailingJunk<int> instead of String::toInt. Also use StringView instead of String. (WebCore::dataDetectorStringForPath): Use makeString instead of StringBuilder. * editing/cocoa/HTMLConverter.mm: (HTMLConverter::computedAttributesForElement): Use parseIntegerAllowingTrailingJunk<int> instead of String::toInt. * html/HTMLFrameElement.cpp: (WebCore::HTMLFrameElement::parseAttribute): Use parseHTMLInteger instead of parseIntegerAllowingTrailingJunk<int>. * html/HTMLFrameSetElement.cpp: (WebCore::HTMLFrameSetElement::parseAttribute): Ditto. * html/HTMLHRElement.cpp: (WebCore::HTMLHRElement::collectStyleForPresentationAttribute): Ditto. * html/HTMLIFrameElement.cpp: (WebCore::HTMLIFrameElement::collectStyleForPresentationAttribute): Ditto. * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::parseAttribute): Ditto. * html/HTMLLIElement.cpp: (WebCore::HTMLLIElement::parseValue): Ditto. * html/HTMLMarqueeElement.cpp: (WebCore::HTMLMarqueeElement::loop const): Use getIntegralAttribute instead of parseIntegerAllowingTrailingJunk<int>. * html/HTMLTableCellElement.cpp: (WebCore::HTMLTableCellElement::collectStyleForPresentationAttribute): Use parseHTMLInteger instead of parseIntegerAllowingTrailingJunk<int>. * html/HTMLTableColElement.cpp: (WebCore::HTMLTableColElement::parseAttribute): Ditto. * html/HTMLTableElement.cpp: (WebCore::HTMLTableElement::parseAttribute): Ditto. * inspector/InspectorFrontendClientLocal.cpp: (WebCore::InspectorFrontendClientLocal::restoreAttachedWindowHeight): Use parseIntegerAllowingTrailingJunk<unsigned> instead of String::toUInt. * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::nodeForPath): Use parseIntegerAllowingTrailingJunk<unsigned> instead of String::toUInt. * layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::TreeBuilder::createLayoutBox): Use parseHTMLInteger instead of AtomString::toInt. * loader/CrossOriginPreflightResultCache.cpp: (WebCore::parseAccessControlMaxAge): Use parseInteger<uint64_t> instead of String::toUIntStrict. * loader/FTPDirectoryParser.cpp: (WebCore::parseOneFTPLine): Use parseIntegerAllowingTrailingJunk<unsigned> instead of String::toUInt. * loader/PrivateClickMeasurement.cpp: (WebCore::PrivateClickMeasurement::parseAttributionRequest): Use parseInteger<uint64_t> instead of String::toUInt64Strict. * mathml/MathMLSelectElement.cpp: (WebCore::MathMLSelectElement::getSelectedActionChildAndIndex): Use getIntegralAttribute instead of parseIntegerAllowingTrailingJunk<int>. * page/EventSource.cpp: (WebCore::EventSource::parseEventStreamLine): Use parseIntegerAllowingTrailingJunk<uint64_t> instead of charactersToUInt64. * page/Location.cpp: (WebCore::Location::setPort): Use parseInteger<uint16_t> instead of parseUInt16. * page/SecurityOriginData.cpp: (WebCore::SecurityOriginData::fromDatabaseIdentifier): Use parseIntegerAllowingTrailingJunk<uint16_t> instead of String::toInt, which allows us to remove some range checking and type conversion. * page/WindowFeatures.cpp: (WebCore::setWindowFeature): Use parseIntegerAllowingTrailingJunk<int> instead of StringView::toInt. * page/csp/ContentSecurityPolicySourceList.cpp: (WebCore::ContentSecurityPolicySourceList::parsePort): Use parseInteger<uint16_t> instead of charactersToIntStrict. * page/linux/ResourceUsageThreadLinux.cpp: (WebCore::collectCPUUsage): Use parseInteger<pid_t> instead of String::toIntStrict. Also removed unneeded special cases for "." and ".." since both will fail to parse as an integer, and this no longer need to put d_name into a WTF::String. * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: (CachedResourceStreamingClient::responseReceived): Use parseIntegerAllowingTrailingJunk<int> instead of String::toInt. * platform/graphics/gstreamer/eme/CDMThunder.cpp: (WebCore::ParsedResponseMessage::ParsedResponseMessage): Use parseInteger<int> instead of String::toInt to parse a single-digit. Probably should write this another way. * platform/network/curl/CookieUtil.cpp: (WebCore::CookieUtil::parseCookieAttributes): Use parseIntegerAllowingTrailingJunk<int64_t> instead of String::toInt64. * platform/network/curl/CurlCacheEntry.cpp: (WebCore::CurlCacheEntry::setResponseFromCachedHeaders): Use parseIntegerAllowingTrailingJunk<long long> instead of String::toInt64. * svg/SVGToOTFFontConversion.cpp: (WebCore::SVGToOTFFontConverter::appendOS2Table): Use parseHTMLInteger instead of parseIntegerAllowingTrailingJunk<int>. Might be even better to refactor to use getIntegralAttribute later. (WebCore::SVGToOTFFontConverter::appendVORGTable): Ditto. * testing/Internals.cpp: (WebCore::Internals::setSFrameCounter): Use parseInteger<uint64_t> instead of StringView::toUInt64Strict. Source/WebDriver: * WebDriverService.cpp: (WebDriver::WebDriverService::run): Use parseIntegerAllowingTrailingJunk<uint16_t> instead of String::toUInt. * glib/WebDriverServiceGLib.cpp: (WebDriver::parseVersion): Use parseIntegerAllowingTrailingJunk<uint64_t> instead of String::toInt64, and then assigning into a uint64_t. * socket/HTTPParser.cpp: (WebDriver::HTTPParser::expectedBodyLength const): Use parseIntegerAllowingTrailingJunk<size_t> instead of String::toInt. Also use StringView instead of String::substringSharingImpl and dropped an unneeded call to String::stripWhiteSpace. Source/WebKitLegacy/win: * Plugins/PluginDatabaseWin.cpp: (WebCore::parseVersionString): Use parseIntegerAllowinTrailingJunk<int> isnstead of String::toInt. * Plugins/PluginView.cpp: (WebCore::PluginView::handlePost): Use parseIntegerAllowingTrailingJunk<unsigned> instead of String::toInt, and then assigning to an unsigned. Tools: * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (WTR::AccessibilityUIElement::numberAttributeValue): Use parseIntegerAllowingTrailingJunk<int> instead of String::toInt. (WTR::AccessibilityUIElement::hierarchicalLevel const): Ditto. Canonical link: https://commits.webkit.org/237536@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277269 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-10 16:57:02 +00:00
if (header.startsWithIgnoringASCIICase(name))
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
return parseIntegerAllowingTrailingJunk<size_t>(StringView { header }.substring(nameLength)).value_or(0);
[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
}
return 0;
}
} // namespace WebDriver