Skip to content

Commit ea1129b

Browse files
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 <[email protected]> on 2017-11-14 Reviewed by Brian Burg. Source/JavaScriptCore: 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/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: * 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: 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: * 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): Source/WebKit: 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: * 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: * 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): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@224863 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 23abbdd commit ea1129b

File tree

117 files changed

+1865
-1412
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+1865
-1412
lines changed

Source/JavaScriptCore/ChangeLog

+135
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,138 @@
1+
2017-11-14 Carlos Garcia Campos <[email protected]>
2+
3+
Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
4+
https://bugs.webkit.org/show_bug.cgi?id=173793
5+
6+
Reviewed by Brian Burg.
7+
8+
Based on patch by Brian Burg.
9+
10+
* JavaScriptCore.xcodeproj/project.pbxproj:
11+
* Sources.txt:
12+
* bindings/ScriptValue.cpp:
13+
(Inspector::jsToInspectorValue):
14+
(Inspector::toInspectorValue):
15+
(Deprecated::ScriptValue::toInspectorValue const):
16+
* bindings/ScriptValue.h:
17+
* inspector/AsyncStackTrace.cpp:
18+
* inspector/ConsoleMessage.cpp:
19+
* inspector/ContentSearchUtilities.cpp:
20+
* inspector/InjectedScript.cpp:
21+
(Inspector::InjectedScript::getFunctionDetails):
22+
(Inspector::InjectedScript::functionDetails):
23+
(Inspector::InjectedScript::getPreview):
24+
(Inspector::InjectedScript::getProperties):
25+
(Inspector::InjectedScript::getDisplayableProperties):
26+
(Inspector::InjectedScript::getInternalProperties):
27+
(Inspector::InjectedScript::getCollectionEntries):
28+
(Inspector::InjectedScript::saveResult):
29+
(Inspector::InjectedScript::wrapCallFrames const):
30+
(Inspector::InjectedScript::wrapObject const):
31+
(Inspector::InjectedScript::wrapTable const):
32+
(Inspector::InjectedScript::previewValue const):
33+
(Inspector::InjectedScript::setExceptionValue):
34+
(Inspector::InjectedScript::clearExceptionValue):
35+
(Inspector::InjectedScript::inspectObject):
36+
(Inspector::InjectedScript::releaseObject):
37+
* inspector/InjectedScriptBase.cpp:
38+
(Inspector::InjectedScriptBase::makeCall):
39+
(Inspector::InjectedScriptBase::makeEvalCall):
40+
* inspector/InjectedScriptBase.h:
41+
* inspector/InjectedScriptManager.cpp:
42+
(Inspector::InjectedScriptManager::injectedScriptForObjectId):
43+
* inspector/InspectorBackendDispatcher.cpp:
44+
(Inspector::BackendDispatcher::CallbackBase::sendSuccess):
45+
(Inspector::BackendDispatcher::dispatch):
46+
(Inspector::BackendDispatcher::sendResponse):
47+
(Inspector::BackendDispatcher::sendPendingErrors):
48+
(Inspector::BackendDispatcher::getPropertyValue):
49+
(Inspector::castToInteger):
50+
(Inspector::castToNumber):
51+
(Inspector::BackendDispatcher::getInteger):
52+
(Inspector::BackendDispatcher::getDouble):
53+
(Inspector::BackendDispatcher::getString):
54+
(Inspector::BackendDispatcher::getBoolean):
55+
(Inspector::BackendDispatcher::getObject):
56+
(Inspector::BackendDispatcher::getArray):
57+
(Inspector::BackendDispatcher::getValue):
58+
* inspector/InspectorBackendDispatcher.h:
59+
* inspector/InspectorProtocolTypes.h:
60+
(Inspector::Protocol::Array::openAccessors):
61+
(Inspector::Protocol::PrimitiveBindingTraits::assertValueHasExpectedType):
62+
(Inspector::Protocol::BindingTraits<Protocol::Array<T>>::runtimeCast):
63+
(Inspector::Protocol::BindingTraits<Protocol::Array<T>>::assertValueHasExpectedType):
64+
(Inspector::Protocol::BindingTraits<JSON::Value>::assertValueHasExpectedType):
65+
* inspector/ScriptCallFrame.cpp:
66+
* inspector/ScriptCallStack.cpp:
67+
* inspector/agents/InspectorAgent.cpp:
68+
(Inspector::InspectorAgent::inspect):
69+
* inspector/agents/InspectorAgent.h:
70+
* inspector/agents/InspectorDebuggerAgent.cpp:
71+
(Inspector::buildAssertPauseReason):
72+
(Inspector::buildCSPViolationPauseReason):
73+
(Inspector::InspectorDebuggerAgent::buildBreakpointPauseReason):
74+
(Inspector::InspectorDebuggerAgent::buildExceptionPauseReason):
75+
(Inspector::buildObjectForBreakpointCookie):
76+
(Inspector::InspectorDebuggerAgent::breakpointActionsFromProtocol):
77+
(Inspector::parseLocation):
78+
(Inspector::InspectorDebuggerAgent::setBreakpointByUrl):
79+
(Inspector::InspectorDebuggerAgent::setBreakpoint):
80+
(Inspector::InspectorDebuggerAgent::continueToLocation):
81+
(Inspector::InspectorDebuggerAgent::schedulePauseOnNextStatement):
82+
(Inspector::InspectorDebuggerAgent::didParseSource):
83+
(Inspector::InspectorDebuggerAgent::breakProgram):
84+
* inspector/agents/InspectorDebuggerAgent.h:
85+
* inspector/agents/InspectorRuntimeAgent.cpp:
86+
(Inspector::InspectorRuntimeAgent::callFunctionOn):
87+
(Inspector::InspectorRuntimeAgent::saveResult):
88+
(Inspector::InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets):
89+
* inspector/agents/InspectorRuntimeAgent.h:
90+
* inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py:
91+
(CppBackendDispatcherHeaderGenerator._generate_dispatcher_declaration_for_command):
92+
* inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py:
93+
(CppBackendDispatcherImplementationGenerator.generate_output):
94+
(CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command):
95+
* inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py:
96+
(CppFrontendDispatcherHeaderGenerator.generate_output):
97+
* inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py:
98+
(CppFrontendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_event):
99+
* inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
100+
(_generate_unchecked_setter_for_member):
101+
* inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py:
102+
(CppProtocolTypesImplementationGenerator):
103+
* inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py:
104+
(ObjCBackendDispatcherImplementationGenerator.generate_output):
105+
(ObjCBackendDispatcherImplementationGenerator._generate_success_block_for_command):
106+
* inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py:
107+
(ObjCFrontendDispatcherImplementationGenerator.generate_output):
108+
(ObjCFrontendDispatcherImplementationGenerator._generate_event):
109+
(ObjCFrontendDispatcherImplementationGenerator._generate_event_out_parameters):
110+
* inspector/scripts/codegen/generate_objc_internal_header.py:
111+
(ObjCInternalHeaderGenerator.generate_output):
112+
* inspector/scripts/codegen/generate_objc_protocol_types_implementation.py:
113+
(ObjCProtocolTypesImplementationGenerator.generate_output):
114+
* inspector/scripts/codegen/generator.py:
115+
* inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result:
116+
* inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result:
117+
* inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result:
118+
* inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result:
119+
* inspector/scripts/tests/generic/expected/domain-availability.json-result:
120+
* inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result:
121+
* inspector/scripts/tests/generic/expected/enum-values.json-result:
122+
* inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result:
123+
* inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result:
124+
* inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result:
125+
* inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result:
126+
* inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result:
127+
* inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result:
128+
* inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result:
129+
* inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result:
130+
* inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result:
131+
* inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result:
132+
* inspector/scripts/tests/generic/expected/worker-supported-domains.json-result:
133+
* inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result:
134+
* inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result:
135+
1136
2017-11-14 Mark Lam <[email protected]>
2137

3138
Fix a bit-rotted Interpreter::dumpRegisters() and make it more robust.

Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

-6
Original file line numberDiff line numberDiff line change
@@ -1304,7 +1304,6 @@
13041304
A58C024218E4A41A00032BC5 /* JSContextPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = A58C024118E4A41A00032BC5 /* JSContextPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
13051305
A593CF7D1840360300BFCE27 /* InspectorBackendDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = A593CF7B1840360300BFCE27 /* InspectorBackendDispatcher.h */; settings = {ATTRIBUTES = (Private, ); }; };
13061306
A593CF7F1840362C00BFCE27 /* InspectorAgentBase.h in Headers */ = {isa = PBXBuildFile; fileRef = A593CF7E1840362C00BFCE27 /* InspectorAgentBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
1307-
A593CF831840377100BFCE27 /* InspectorValues.h in Headers */ = {isa = PBXBuildFile; fileRef = A593CF811840377100BFCE27 /* InspectorValues.h */; settings = {ATTRIBUTES = (Private, ); }; };
13081307
A593CF87184038CA00BFCE27 /* InspectorAgentRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = A593CF85184038CA00BFCE27 /* InspectorAgentRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
13091308
A59455931824744700CC3843 /* JSGlobalObjectDebuggable.h in Headers */ = {isa = PBXBuildFile; fileRef = A59455911824744700CC3843 /* JSGlobalObjectDebuggable.h */; };
13101309
A5945595182479EB00CC3843 /* InspectorFrontendChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = A5945594182479EB00CC3843 /* InspectorFrontendChannel.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -3928,8 +3927,6 @@
39283927
A593CF7A1840360300BFCE27 /* InspectorBackendDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorBackendDispatcher.cpp; sourceTree = "<group>"; };
39293928
A593CF7B1840360300BFCE27 /* InspectorBackendDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorBackendDispatcher.h; sourceTree = "<group>"; };
39303929
A593CF7E1840362C00BFCE27 /* InspectorAgentBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorAgentBase.h; sourceTree = "<group>"; };
3931-
A593CF801840377100BFCE27 /* InspectorValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorValues.cpp; sourceTree = "<group>"; };
3932-
A593CF811840377100BFCE27 /* InspectorValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorValues.h; sourceTree = "<group>"; };
39333930
A593CF84184038CA00BFCE27 /* InspectorAgentRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorAgentRegistry.cpp; sourceTree = "<group>"; };
39343931
A593CF85184038CA00BFCE27 /* InspectorAgentRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorAgentRegistry.h; sourceTree = "<group>"; };
39353932
A594558E18245EDE00CC3843 /* RemoteInspectionTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteInspectionTarget.cpp; sourceTree = "<group>"; };
@@ -7667,8 +7664,6 @@
76677664
99F1A6FC1B8E6D9400463B26 /* InspectorFrontendRouter.cpp */,
76687665
99F1A7001B98FBEC00463B26 /* InspectorFrontendRouter.h */,
76697666
A55D93AB18514F7900400DED /* InspectorProtocolTypes.h */,
7670-
A593CF801840377100BFCE27 /* InspectorValues.cpp */,
7671-
A593CF811840377100BFCE27 /* InspectorValues.h */,
76727667
A503FA13188E0FAF00110F14 /* JavaScriptCallFrame.cpp */,
76737668
A503FA14188E0FAF00110F14 /* JavaScriptCallFrame.h */,
76747669
A5C3A1A318C0490200C9593A /* JSGlobalObjectConsoleClient.cpp */,
@@ -8670,7 +8665,6 @@
86708665
A55D93AC18514F7900400DED /* InspectorProtocolTypes.h in Headers */,
86718666
A50E4B6218809DD50068A46D /* InspectorRuntimeAgent.h in Headers */,
86728667
A55165D31BDF0B9E003B75C1 /* InspectorScriptProfilerAgent.h in Headers */,
8673-
A593CF831840377100BFCE27 /* InspectorValues.h in Headers */,
86748668
969A07990ED1D3AE00F1F681 /* Instruction.h in Headers */,
86758669
A7A8AF3B17ADB5F3005AB174 /* Int16Array.h in Headers */,
86768670
A7A8AF3C17ADB5F3005AB174 /* Int32Array.h in Headers */,

Source/JavaScriptCore/Sources.txt

-1
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,6 @@ inspector/InjectedScriptModule.cpp
530530
inspector/InspectorAgentRegistry.cpp
531531
inspector/InspectorFrontendRouter.cpp
532532
inspector/InspectorBackendDispatcher.cpp
533-
inspector/InspectorValues.cpp
534533
inspector/JSGlobalObjectConsoleClient.cpp
535534
inspector/JSGlobalObjectInspectorController.cpp
536535
inspector/JSGlobalObjectScriptDebugServer.cpp

Source/JavaScriptCore/bindings/ScriptValue.cpp

+13-13
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@
3232

3333
#include "APICast.h"
3434
#include "CatchScope.h"
35-
#include "InspectorValues.h"
3635
#include "JSCInlines.h"
3736
#include "JSLock.h"
37+
#include <wtf/JSONValues.h>
3838

3939
using namespace JSC;
4040
using namespace Inspector;
4141

4242
namespace Inspector {
4343

44-
static RefPtr<InspectorValue> jsToInspectorValue(ExecState& scriptState, JSValue value, int maxDepth)
44+
static RefPtr<JSON::Value> jsToInspectorValue(ExecState& scriptState, JSValue value, int maxDepth)
4545
{
4646
if (!value) {
4747
ASSERT_NOT_REACHED();
@@ -54,19 +54,19 @@ static RefPtr<InspectorValue> jsToInspectorValue(ExecState& scriptState, JSValue
5454
maxDepth--;
5555

5656
if (value.isUndefinedOrNull())
57-
return InspectorValue::null();
57+
return JSON::Value::null();
5858
if (value.isBoolean())
59-
return InspectorValue::create(value.asBoolean());
59+
return JSON::Value::create(value.asBoolean());
6060
if (value.isNumber() && value.isDouble())
61-
return InspectorValue::create(value.asNumber());
61+
return JSON::Value::create(value.asNumber());
6262
if (value.isNumber() && value.isAnyInt())
63-
return InspectorValue::create(static_cast<int>(value.asAnyInt()));
63+
return JSON::Value::create(static_cast<int>(value.asAnyInt()));
6464
if (value.isString())
65-
return InspectorValue::create(asString(value)->value(&scriptState));
65+
return JSON::Value::create(asString(value)->value(&scriptState));
6666

6767
if (value.isObject()) {
6868
if (isJSArray(value)) {
69-
auto inspectorArray = InspectorArray::create();
69+
auto inspectorArray = JSON::Array::create();
7070
auto& array = *asArray(value);
7171
unsigned length = array.length();
7272
for (unsigned i = 0; i < length; i++) {
@@ -77,7 +77,7 @@ static RefPtr<InspectorValue> jsToInspectorValue(ExecState& scriptState, JSValue
7777
}
7878
return WTFMove(inspectorArray);
7979
}
80-
auto inspectorObject = InspectorObject::create();
80+
auto inspectorObject = JSON::Object::create();
8181
auto& object = *value.getObject();
8282
PropertyNameArray propertyNames(&scriptState.vm(), PropertyNameMode::Strings, PrivateSymbolMode::Exclude);
8383
object.methodTable()->getOwnPropertyNames(&object, &scriptState, propertyNames, EnumerationMode());
@@ -94,12 +94,12 @@ static RefPtr<InspectorValue> jsToInspectorValue(ExecState& scriptState, JSValue
9494
return nullptr;
9595
}
9696

97-
RefPtr<InspectorValue> toInspectorValue(ExecState& state, JSValue value)
97+
RefPtr<JSON::Value> toInspectorValue(ExecState& state, JSValue value)
9898
{
9999
// FIXME: Maybe we should move the JSLockHolder stuff to the callers since this function takes a JSValue directly.
100100
// Doing the locking here made sense when we were trying to abstract the difference between multiple JavaScript engines.
101101
JSLockHolder holder(&state);
102-
return jsToInspectorValue(state, value, InspectorValue::maxDepth);
102+
return jsToInspectorValue(state, value, JSON::Value::maxDepth);
103103
}
104104

105105
} // namespace Inspector
@@ -166,10 +166,10 @@ bool ScriptValue::isFunction() const
166166
return getCallData(m_value.get(), callData) != CallType::None;
167167
}
168168

169-
RefPtr<InspectorValue> ScriptValue::toInspectorValue(ExecState* scriptState) const
169+
RefPtr<JSON::Value> ScriptValue::toInspectorValue(ExecState* scriptState) const
170170
{
171171
JSLockHolder holder(scriptState);
172-
return jsToInspectorValue(*scriptState, m_value.get(), InspectorValue::maxDepth);
172+
return jsToInspectorValue(*scriptState, m_value.get(), JSON::Value::maxDepth);
173173
}
174174

175175
} // namespace Deprecated

Source/JavaScriptCore/bindings/ScriptValue.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
3737
#include "StrongInlines.h"
3838
#include <wtf/text/WTFString.h>
3939

40-
namespace Inspector {
41-
42-
class InspectorValue;
43-
44-
JS_EXPORT_PRIVATE RefPtr<InspectorValue> toInspectorValue(JSC::ExecState&, JSC::JSValue);
40+
namespace JSON {
41+
class Value;
42+
}
4543

44+
namespace Inspector {
45+
JS_EXPORT_PRIVATE RefPtr<JSON::Value> toInspectorValue(JSC::ExecState&, JSC::JSValue);
4646
}
4747

4848
namespace Deprecated {
@@ -68,7 +68,7 @@ class JS_EXPORT_PRIVATE ScriptValue {
6868

6969
bool operator==(const ScriptValue& other) const { return m_value == other.m_value; }
7070

71-
RefPtr<Inspector::InspectorValue> toInspectorValue(JSC::ExecState*) const;
71+
RefPtr<JSON::Value> toInspectorValue(JSC::ExecState*) const;
7272

7373
private:
7474
JSC::Strong<JSC::Unknown> m_value;

Source/JavaScriptCore/inspector/AsyncStackTrace.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "config.h"
2727
#include "AsyncStackTrace.h"
2828

29-
#include "InspectorValues.h"
3029
#include "ScriptCallStack.h"
3130

3231
namespace Inspector {

Source/JavaScriptCore/inspector/ConsoleMessage.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include "InjectedScript.h"
3636
#include "InjectedScriptManager.h"
3737
#include "InspectorFrontendDispatchers.h"
38-
#include "InspectorValues.h"
3938
#include "ScriptArguments.h"
4039
#include "ScriptCallFrame.h"
4140
#include "ScriptCallStack.h"

Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "config.h"
3030
#include "ContentSearchUtilities.h"
3131

32-
#include "InspectorValues.h"
3332
#include "RegularExpression.h"
3433
#include "Yarr.h"
3534
#include "YarrInterpreter.h"

0 commit comments

Comments
 (0)