Source/JavaScriptCore:
authorburg@cs.washington.edu <burg@cs.washington.edu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Sep 2014 04:53:35 +0000 (04:53 +0000)
committerburg@cs.washington.edu <burg@cs.washington.edu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Sep 2014 04:53:35 +0000 (04:53 +0000)
commit714a9626531a514b49eba90b4a0d54ea4b339ed1
tree3564a7b0f4f3017f54c30e42bbb33a46a2b17a70
parente21260bef93335dee4cd25ba5effa48035e80283
Source/JavaScriptCore:
Web Inspector: disambiguate double and integer primitive types in the protocol
https://bugs.webkit.org/show_bug.cgi?id=136606

Reviewed by Timothy Hatcher.

Right now it's really easy to mix up doubles and integers when serializing or deserializing
values for the inspector protocol. This patch disambiguates setting/getting doubles and integers
so that it is clearer as to which type is intended.

A new InspectorValue::Type is added for Integer types, and the Number type is renamed to Double.
The existing callsites for asNumber/getNumber/setNumber have been fixed.

Address various integration points to make sure the right type tag is assigned to InspectorValues.

* bindings/ScriptValue.cpp:
(Deprecated::jsToInspectorValue): Make an Integer if the JSValue is Int52 or smaller.
* inspector/InjectedScriptManager.cpp:
(Inspector::InjectedScriptManager::injectedScriptForObjectId):
* inspector/InspectorBackendDispatcher.cpp:
(Inspector::InspectorBackendDispatcher::dispatch):
(Inspector::InspectorBackendDispatcher::sendResponse):
(Inspector::InspectorBackendDispatcher::reportProtocolError):
(Inspector::AsMethodBridges::asInteger):
(Inspector::AsMethodBridges::asDouble):
(Inspector::InspectorBackendDispatcher::getInteger):
(Inspector::InspectorBackendDispatcher::getDouble):
(Inspector::AsMethodBridges::asInt): Deleted.
(Inspector::InspectorBackendDispatcher::getInt): Deleted.
* inspector/InspectorBackendDispatcher.h:
* inspector/InspectorProtocolTypes.h: Remove the special case for checking int type tags.
(Inspector::Protocol::ArrayItemHelper<int>::Traits::pushRaw):
(Inspector::Protocol::ArrayItemHelper<double>::Traits::pushRaw):
(Inspector::Protocol::BindingTraits<int>::assertValueHasExpectedType): Deleted.
* inspector/InspectorValues.cpp: Allow integers and doubles to be convertible using asInteger/asDouble.
(Inspector::InspectorValue::asDouble):
(Inspector::InspectorValue::asInteger):
(Inspector::InspectorBasicValue::asDouble):
(Inspector::InspectorBasicValue::asInteger):
(Inspector::InspectorBasicValue::writeJSON):
(Inspector::InspectorValue::asNumber): Deleted.
(Inspector::InspectorBasicValue::asNumber): Deleted.
* inspector/InspectorValues.h:
(Inspector::InspectorObjectBase::setInteger):
(Inspector::InspectorObjectBase::setDouble):
(Inspector::InspectorArrayBase::pushInteger):
(Inspector::InspectorArrayBase::pushDouble):
(Inspector::InspectorObjectBase::setNumber): Deleted.
(Inspector::InspectorArrayBase::pushInt): Deleted.
(Inspector::InspectorArrayBase::pushNumber): Deleted.
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::buildObjectForBreakpointCookie):
(Inspector::InspectorDebuggerAgent::breakpointActionsFromProtocol):
(Inspector::parseLocation):
(Inspector::InspectorDebuggerAgent::didParseSource):
* inspector/agents/InspectorRuntimeAgent.cpp:
(Inspector::InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets):
* inspector/scripts/codegen/generator.py: Update emitted code and rebaseline test results.
(Generator.keyed_get_method_for_type):
(Generator.keyed_set_method_for_type):
* inspector/scripts/tests/expected/commands-with-async-attribute.json-result:
* inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result:
* inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result:
* inspector/scripts/tests/expected/events-with-optional-parameters.json-result:
* inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result:
* inspector/scripts/tests/expected/type-declaration-object-type.json-result:
* inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result:
* replay/EncodedValue.cpp:
(JSC::EncodedValue::convertTo<double>):
(JSC::EncodedValue::convertTo<float>):
(JSC::EncodedValue::convertTo<int32_t>):
(JSC::EncodedValue::convertTo<int64_t>):
(JSC::EncodedValue::convertTo<uint32_t>):
(JSC::EncodedValue::convertTo<uint64_t>):

Source/WebCore:
Web Inspector: disambiguate integral and real number primitive types in the protocol
https://bugs.webkit.org/show_bug.cgi?id=136606

Reviewed by Timothy Hatcher.

Update clients of InspectorValue to disambiguate integer and double primitive types.

No new tests, no behavior changed.

* inspector/InspectorDOMAgent.cpp:
(WebCore::parseColor):
(WebCore::parseQuad):
(WebCore::InspectorDOMAgent::performSearch):
* inspector/InspectorDOMDebuggerAgent.cpp:
(WebCore::InspectorDOMDebuggerAgent::descriptionForDOMEvent):
* inspector/InspectorIndexedDBAgent.cpp:
* inspector/InspectorOverlay.cpp:
(WebCore::buildObjectForPoint):
(WebCore::buildObjectForRect):
(WebCore::buildObjectForSize):
(WebCore::appendPathCommandAndPoints):
(WebCore::InspectorOverlay::reset):
* inspector/InspectorReplayAgent.cpp:
(WebCore::InspectorReplayAgent::replayToPosition):
* inspector/InspectorStyleSheet.h:
(WebCore::InspectorCSSId::InspectorCSSId):
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::didWriteHTML):
(WebCore::InspectorTimelineAgent::didCompleteRecordEntry):
* inspector/TimelineRecordFactory.cpp:
(WebCore::TimelineRecordFactory::createGenericRecord):
(WebCore::TimelineRecordFactory::createBackgroundRecord):
(WebCore::TimelineRecordFactory::createGCEventData):
(WebCore::TimelineRecordFactory::createFunctionCallData):
(WebCore::TimelineRecordFactory::createProbeSampleData):
(WebCore::TimelineRecordFactory::createGenericTimerData):
(WebCore::TimelineRecordFactory::createTimerInstallData):
(WebCore::TimelineRecordFactory::createXHRReadyStateChangeData):
(WebCore::TimelineRecordFactory::createEvaluateScriptData):
(WebCore::TimelineRecordFactory::createResourceReceiveResponseData):
(WebCore::TimelineRecordFactory::createResourceFinishData):
(WebCore::TimelineRecordFactory::createReceiveResourceData):
(WebCore::TimelineRecordFactory::createLayoutData):
(WebCore::TimelineRecordFactory::createParseHTMLData):
(WebCore::TimelineRecordFactory::createAnimationFrameData):
(WebCore::createQuad):
* inspector/TimelineRecordFactory.h:
(WebCore::TimelineRecordFactory::createWebSocketCreateData):
(WebCore::TimelineRecordFactory::createGenericWebSocketData):
* page/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::reportViolation):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173554 268f45cc-cd09-0410-ab3c-d52691b4dbfc
29 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bindings/ScriptValue.cpp
Source/JavaScriptCore/inspector/InjectedScriptManager.cpp
Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp
Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h
Source/JavaScriptCore/inspector/InspectorProtocolTypes.h
Source/JavaScriptCore/inspector/InspectorValues.cpp
Source/JavaScriptCore/inspector/InspectorValues.h
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp
Source/JavaScriptCore/inspector/scripts/codegen/generator.py
Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-async-attribute.json-result
Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result
Source/JavaScriptCore/inspector/scripts/tests/expected/events-with-optional-parameters.json-result
Source/JavaScriptCore/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result
Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-object-type.json-result
Source/JavaScriptCore/inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result
Source/JavaScriptCore/replay/EncodedValue.cpp
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorDOMAgent.cpp
Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp
Source/WebCore/inspector/InspectorIndexedDBAgent.cpp
Source/WebCore/inspector/InspectorOverlay.cpp
Source/WebCore/inspector/InspectorReplayAgent.cpp
Source/WebCore/inspector/InspectorStyleSheet.h
Source/WebCore/inspector/InspectorTimelineAgent.cpp
Source/WebCore/inspector/TimelineRecordFactory.cpp
Source/WebCore/inspector/TimelineRecordFactory.h
Source/WebCore/page/ContentSecurityPolicy.cpp