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)
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

index 38084a3..5afcbe1 100644 (file)
@@ -1,3 +1,79 @@
+2014-09-11  Brian J. Burg  <burg@cs.washington.edu>
+
+        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>):
+
 2014-09-11  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Occasional ASSERT closing web inspector
index 004ff24..d046ab2 100644 (file)
@@ -114,8 +114,10 @@ static PassRefPtr<InspectorValue> jsToInspectorValue(ExecState* scriptState, JSV
         return InspectorValue::null();
     if (value.isBoolean())
         return InspectorBasicValue::create(value.asBoolean());
-    if (value.isNumber())
+    if (value.isNumber() && value.isDouble())
         return InspectorBasicValue::create(value.asNumber());
+    if (value.isNumber() && value.isMachineInt())
+        return InspectorBasicValue::create(static_cast<int>(value.asMachineInt()));
     if (value.isString())
         return InspectorString::create(value.getString(scriptState));
 
index 59a0ede..adcccfc 100644 (file)
@@ -97,7 +97,7 @@ InjectedScript InjectedScriptManager::injectedScriptForObjectId(const String& ob
     RefPtr<InspectorValue> parsedObjectId = InspectorValue::parseJSON(objectId);
     if (parsedObjectId && parsedObjectId->type() == InspectorValue::Type::Object) {
         long injectedScriptId = 0;
-        bool success = parsedObjectId->asObject()->getNumber(ASCIILiteral("injectedScriptId"), &injectedScriptId);
+        bool success = parsedObjectId->asObject()->getInteger(ASCIILiteral("injectedScriptId"), &injectedScriptId);
         if (success)
             return m_idToInjectedScript.get(injectedScriptId);
     }
index bb3ec82..af1b8e5 100644 (file)
@@ -97,8 +97,8 @@ void InspectorBackendDispatcher::dispatch(const String& message)
     }
 
     long callId = 0;
-    if (!callIdValue->asNumber(&callId)) {
-        reportProtocolError(nullptr, InvalidRequest, ASCIILiteral("The type of 'id' property must be number"));
+    if (!callIdValue->asInteger(&callId)) {
+        reportProtocolError(nullptr, InvalidRequest, ASCIILiteral("The type of 'id' property must be integer"));
         return;
     }
 
@@ -143,7 +143,7 @@ void InspectorBackendDispatcher::sendResponse(long callId, PassRefPtr<InspectorO
 
     RefPtr<InspectorObject> responseMessage = InspectorObject::create();
     responseMessage->setObject(ASCIILiteral("result"), result);
-    responseMessage->setNumber(ASCIILiteral("id"), callId);
+    responseMessage->setInteger(ASCIILiteral("id"), callId);
     m_inspectorFrontendChannel->sendMessageToFrontend(responseMessage->toJSONString());
 }
 
@@ -171,7 +171,7 @@ void InspectorBackendDispatcher::reportProtocolError(const long* const callId, C
         return;
 
     RefPtr<InspectorObject> error = InspectorObject::create();
-    error->setNumber(ASCIILiteral("code"), errorCodes[errorCode]);
+    error->setInteger(ASCIILiteral("code"), errorCodes[errorCode]);
     error->setString(ASCIILiteral("message"), errorMessage);
     if (data)
         error->setArray(ASCIILiteral("data"), data);
@@ -179,7 +179,7 @@ void InspectorBackendDispatcher::reportProtocolError(const long* const callId, C
     RefPtr<InspectorObject> message = InspectorObject::create();
     message->setObject(ASCIILiteral("error"), error.release());
     if (callId)
-        message->setNumber(ASCIILiteral("id"), *callId);
+        message->setInteger(ASCIILiteral("id"), *callId);
     else
         message->setValue(ASCIILiteral("id"), InspectorValue::null());
 
@@ -221,17 +221,17 @@ static ReturnValueType getPropertyValue(InspectorObject* object, const String& n
 }
 
 struct AsMethodBridges {
-    static bool asInt(InspectorValue* value, int* output) { return value->asNumber(output); }
-    static bool asDouble(InspectorValue* value, double* output) { return value->asNumber(output); }
+    static bool asInteger(InspectorValue* value, int* output) { return value->asInteger(output); }
+    static bool asDouble(InspectorValue* value, double* output) { return value->asDouble(output); }
     static bool asString(InspectorValue* value, String* output) { return value->asString(output); }
     static bool asBoolean(InspectorValue* value, bool* output) { return value->asBoolean(output); }
     static bool asObject(InspectorValue* value, RefPtr<InspectorObject>* output) { return value->asObject(output); }
     static bool asArray(InspectorValue* value, RefPtr<InspectorArray>* output) { return value->asArray(output); }
 };
 
-int InspectorBackendDispatcher::getInt(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
+int InspectorBackendDispatcher::getInteger(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
 {
-    return getPropertyValue<int, int, int>(object, name, valueFound, protocolErrors, 0, AsMethodBridges::asInt, "Number");
+    return getPropertyValue<int, int, int>(object, name, valueFound, protocolErrors, 0, AsMethodBridges::asInteger, "Integer");
 }
 
 double InspectorBackendDispatcher::getDouble(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors)
index 0a55a1c..2958a4d 100644 (file)
@@ -86,7 +86,7 @@ public:
     void reportProtocolError(const long* const callId, CommonErrorCode, const String& errorMessage) const;
     void reportProtocolError(const long* const callId, CommonErrorCode, const String& errorMessage, PassRefPtr<InspectorArray> data) const;
 
-    static int getInt(InspectorObject*, const String& name, bool* valueFound, InspectorArray* protocolErrors);
+    static int getInteger(InspectorObject*, const String& name, bool* valueFound, InspectorArray* protocolErrors);
     static double getDouble(InspectorObject*, const String& name, bool* valueFound, InspectorArray* protocolErrors);
     static String getString(InspectorObject*, const String& name, bool* valueFound, InspectorArray* protocolErrors);
     static bool getBoolean(InspectorObject*, const String& name, bool* valueFound, InspectorArray* protocolErrors);
index 0e92ce6..aa20a6a 100644 (file)
@@ -120,7 +120,7 @@ struct ArrayItemHelper<int> {
     struct Traits {
         static void pushRaw(InspectorArray* array, int value)
         {
-            array->pushInt(value);
+            array->pushInteger(value);
         }
     };
 };
@@ -130,7 +130,7 @@ struct ArrayItemHelper<double> {
     struct Traits {
         static void pushRaw(InspectorArray* array, double value)
         {
-            array->pushNumber(value);
+            array->pushDouble(value);
         }
     };
 };
@@ -248,21 +248,8 @@ template<> struct BindingTraits<InspectorArray> : public PrimitiveBindingTraits<
 template<> struct BindingTraits<InspectorObject> : public PrimitiveBindingTraits<InspectorValue::Type::Object> { };
 template<> struct BindingTraits<String> : public PrimitiveBindingTraits<InspectorValue::Type::String> { };
 template<> struct BindingTraits<bool> : public PrimitiveBindingTraits<InspectorValue::Type::Boolean> { };
-template<> struct BindingTraits<double> : public PrimitiveBindingTraits<InspectorValue::Type::Number> { };
-
-// FIXME: Add an Inspector::Type tag for int so we can remove this special case.
-template<>
-struct BindingTraits<int> {
-#if !ASSERT_DISABLED
-    static void assertValueHasExpectedType(InspectorValue* value)
-    {
-        double v;
-        bool castRes = value->asNumber(&v);
-        ASSERT_UNUSED(castRes, castRes);
-        ASSERT(static_cast<double>(static_cast<int>(v)) == v);
-    }
-#endif // !ASSERT_DISABLED
-};
+template<> struct BindingTraits<double> : public PrimitiveBindingTraits<InspectorValue::Type::Double> { };
+template<> struct BindingTraits<int> : public PrimitiveBindingTraits<InspectorValue::Type::Integer> { };
 
 } // namespace Protocol
 
index e2d035d..b203961 100644 (file)
@@ -485,42 +485,42 @@ bool InspectorValue::asBoolean(bool*) const
     return false;
 }
 
-bool InspectorValue::asNumber(double*) const
+bool InspectorValue::asDouble(double*) const
 {
     return false;
 }
 
-bool InspectorValue::asNumber(float*) const
+bool InspectorValue::asDouble(float*) const
 {
     return false;
 }
 
-bool InspectorValue::asNumber(int*) const
+bool InspectorValue::asInteger(int*) const
 {
     return false;
 }
 
-bool InspectorValue::asNumber(unsigned*) const
+bool InspectorValue::asInteger(unsigned*) const
 {
     return false;
 }
 
-bool InspectorValue::asNumber(long*) const
+bool InspectorValue::asInteger(long*) const
 {
     return false;
 }
 
-bool InspectorValue::asNumber(long long*) const
+bool InspectorValue::asInteger(long long*) const
 {
     return false;
 }
 
-bool InspectorValue::asNumber(unsigned long*) const
+bool InspectorValue::asInteger(unsigned long*) const
 {
     return false;
 }
 
-bool InspectorValue::asNumber(unsigned long long*) const
+bool InspectorValue::asInteger(unsigned long long*) const
 {
     return false;
 }
@@ -591,65 +591,65 @@ bool InspectorBasicValue::asBoolean(bool* output) const
     return true;
 }
 
-bool InspectorBasicValue::asNumber(double* output) const
+bool InspectorBasicValue::asDouble(double* output) const
 {
-    if (type() != Type::Number)
+    if (type() != Type::Double)
         return false;
     *output = m_doubleValue;
     return true;
 }
 
-bool InspectorBasicValue::asNumber(float* output) const
+bool InspectorBasicValue::asDouble(float* output) const
 {
-    if (type() != Type::Number)
+    if (type() != Type::Double)
         return false;
     *output = static_cast<float>(m_doubleValue);
     return true;
 }
 
-bool InspectorBasicValue::asNumber(int* output) const
+bool InspectorBasicValue::asInteger(int* output) const
 {
-    if (type() != Type::Number)
+    if (type() != Type::Integer && type() != Type::Double)
         return false;
     *output = static_cast<int>(m_doubleValue);
     return true;
 }
 
-bool InspectorBasicValue::asNumber(unsigned* output) const
+bool InspectorBasicValue::asInteger(unsigned* output) const
 {
-    if (type() != Type::Number)
+    if (type() != Type::Integer && type() != Type::Double)
         return false;
     *output = static_cast<unsigned>(m_doubleValue);
     return true;
 }
 
-bool InspectorBasicValue::asNumber(long* output) const
+bool InspectorBasicValue::asInteger(long* output) const
 {
-    if (type() != Type::Number)
+    if (type() != Type::Integer && type() != Type::Double)
         return false;
     *output = static_cast<long>(m_doubleValue);
     return true;
 }
 
-bool InspectorBasicValue::asNumber(long long* output) const
+bool InspectorBasicValue::asInteger(long long* output) const
 {
-    if (type() != Type::Number)
+    if (type() != Type::Integer && type() != Type::Double)
         return false;
     *output = static_cast<long long>(m_doubleValue);
     return true;
 }
 
-bool InspectorBasicValue::asNumber(unsigned long* output) const
+bool InspectorBasicValue::asInteger(unsigned long* output) const
 {
-    if (type() != Type::Number)
+    if (type() != Type::Integer && type() != Type::Double)
         return false;
     *output = static_cast<unsigned long>(m_doubleValue);
     return true;
 }
 
-bool InspectorBasicValue::asNumber(unsigned long long* output) const
+bool InspectorBasicValue::asInteger(unsigned long long* output) const
 {
-    if (type() != Type::Number)
+    if (type() != Type::Integer && type() != Type::Double)
         return false;
     *output = static_cast<unsigned long long>(m_doubleValue);
     return true;
@@ -657,13 +657,13 @@ bool InspectorBasicValue::asNumber(unsigned long long* output) const
 
 void InspectorBasicValue::writeJSON(StringBuilder* output) const
 {
-    ASSERT(type() == Type::Boolean || type() == Type::Number);
+    ASSERT(type() == Type::Boolean || type() == Type::Double || type() == Type::Integer);
     if (type() == Type::Boolean) {
         if (m_boolValue)
             output->append(trueString, 4);
         else
             output->append(falseString, 5);
-    } else if (type() == Type::Number) {
+    } else if (type() == Type::Double || type() == Type::Integer) {
         NumberToLStringBuffer buffer;
         if (!std::isfinite(m_doubleValue)) {
             output->append(nullString, 4);
index 97cb88b..d30e9b3 100644 (file)
@@ -58,7 +58,8 @@ public:
     enum class Type {
         Null = 0,
         Boolean,
-        Number,
+        Double,
+        Integer,
         String,
         Object,
         Array
@@ -69,14 +70,14 @@ public:
     bool isNull() const { return m_type == Type::Null; }
 
     virtual bool asBoolean(bool* output) const;
-    virtual bool asNumber(double* output) const;
-    virtual bool asNumber(float* output) const;
-    virtual bool asNumber(int* output) const;
-    virtual bool asNumber(unsigned* output) const;
-    virtual bool asNumber(long* output) const;
-    virtual bool asNumber(long long* output) const;
-    virtual bool asNumber(unsigned long* output) const;
-    virtual bool asNumber(unsigned long long* output) const;
+    virtual bool asInteger(int* output) const;
+    virtual bool asInteger(unsigned* output) const;
+    virtual bool asInteger(long* output) const;
+    virtual bool asInteger(long long* output) const;
+    virtual bool asInteger(unsigned long* output) const;
+    virtual bool asInteger(unsigned long long* output) const;
+    virtual bool asDouble(double* output) const;
+    virtual bool asDouble(float* output) const;
     virtual bool asString(String* output) const;
     virtual bool asValue(RefPtr<InspectorValue>* output);
     virtual bool asObject(RefPtr<InspectorObject>* output);
@@ -104,14 +105,16 @@ public:
     static PassRefPtr<InspectorBasicValue> create(double);
 
     virtual bool asBoolean(bool* output) const override;
-    virtual bool asNumber(double* output) const override;
-    virtual bool asNumber(float* output) const override;
-    virtual bool asNumber(int* output) const override;
-    virtual bool asNumber(unsigned* output) const override;
-    virtual bool asNumber(long* output) const override;
-    virtual bool asNumber(long long* output) const override;
-    virtual bool asNumber(unsigned long* output) const override;
-    virtual bool asNumber(unsigned long long* output) const override;
+    // Numbers from the frontend are always parsed as doubles, so we allow
+    // clients to convert to integral values with this function.
+    virtual bool asInteger(int* output) const override;
+    virtual bool asInteger(unsigned* output) const override;
+    virtual bool asInteger(long* output) const override;
+    virtual bool asInteger(long long* output) const override;
+    virtual bool asInteger(unsigned long* output) const override;
+    virtual bool asInteger(unsigned long long* output) const override;
+    virtual bool asDouble(double* output) const override;
+    virtual bool asDouble(float* output) const override;
 
     virtual void writeJSON(StringBuilder* output) const override;
 
@@ -121,11 +124,11 @@ private:
         , m_boolValue(value) { }
 
     explicit InspectorBasicValue(int value)
-        : InspectorValue(Type::Number)
+        : InspectorValue(Type::Integer)
         , m_doubleValue(static_cast<double>(value)) { }
 
     explicit InspectorBasicValue(double value)
-        : InspectorValue(Type::Number)
+        : InspectorValue(Type::Double)
         , m_doubleValue(value) { }
 
     union {
@@ -171,8 +174,10 @@ protected:
 
     virtual bool asObject(RefPtr<InspectorObject>* output) override;
 
+    // FIXME: use templates to reduce the amount of duplicated set*() methods.
     void setBoolean(const String& name, bool);
-    void setNumber(const String& name, double);
+    void setInteger(const String& name, int);
+    void setDouble(const String& name, double);
     void setString(const String& name, const String&);
     void setValue(const String& name, PassRefPtr<InspectorValue>);
     void setObject(const String& name, PassRefPtr<InspectorObjectBase>);
@@ -180,14 +185,24 @@ protected:
 
     iterator find(const String& name);
     const_iterator find(const String& name) const;
+
+    // FIXME: use templates to reduce the amount of duplicated get*() methods.
     bool getBoolean(const String& name, bool* output) const;
-    template<class T> bool getNumber(const String& name, T* output) const
+    template<class T> bool getDouble(const String& name, T* output) const
+    {
+        RefPtr<InspectorValue> value = get(name);
+        if (!value)
+            return false;
+        return value->asDouble(output);
+    }
+    template<class T> bool getInteger(const String& name, T* output) const
     {
         RefPtr<InspectorValue> value = get(name);
         if (!value)
             return false;
-        return value->asNumber(output);
+        return value->asInteger(output);
     }
+
     bool getString(const String& name, String* output) const;
     PassRefPtr<InspectorObject> getObject(const String& name) const;
     PassRefPtr<InspectorArray> getArray(const String& name) const;
@@ -219,7 +234,8 @@ public:
     using InspectorObjectBase::asObject;
 
     using InspectorObjectBase::setBoolean;
-    using InspectorObjectBase::setNumber;
+    using InspectorObjectBase::setInteger;
+    using InspectorObjectBase::setDouble;
     using InspectorObjectBase::setString;
     using InspectorObjectBase::setValue;
     using InspectorObjectBase::setObject;
@@ -227,7 +243,8 @@ public:
 
     using InspectorObjectBase::find;
     using InspectorObjectBase::getBoolean;
-    using InspectorObjectBase::getNumber;
+    using InspectorObjectBase::getInteger;
+    using InspectorObjectBase::getDouble;
     using InspectorObjectBase::getString;
     using InspectorObjectBase::getObject;
     using InspectorObjectBase::getArray;
@@ -257,8 +274,8 @@ protected:
     virtual bool asArray(RefPtr<InspectorArray>* output) override;
 
     void pushBoolean(bool);
-    void pushInt(int);
-    void pushNumber(double);
+    void pushInteger(int);
+    void pushDouble(double);
     void pushString(const String&);
     void pushValue(PassRefPtr<InspectorValue>);
     void pushObject(PassRefPtr<InspectorObject>);
@@ -287,8 +304,8 @@ public:
     using InspectorArrayBase::asArray;
 
     using InspectorArrayBase::pushBoolean;
-    using InspectorArrayBase::pushInt;
-    using InspectorArrayBase::pushNumber;
+    using InspectorArrayBase::pushInteger;
+    using InspectorArrayBase::pushDouble;
     using InspectorArrayBase::pushString;
     using InspectorArrayBase::pushValue;
     using InspectorArrayBase::pushObject;
@@ -316,7 +333,12 @@ inline void InspectorObjectBase::setBoolean(const String& name, bool value)
     setValue(name, InspectorBasicValue::create(value));
 }
 
-inline void InspectorObjectBase::setNumber(const String& name, double value)
+inline void InspectorObjectBase::setInteger(const String& name, int value)
+{
+    setValue(name, InspectorBasicValue::create(value));
+}
+
+inline void InspectorObjectBase::setDouble(const String& name, double value)
 {
     setValue(name, InspectorBasicValue::create(value));
 }
@@ -352,12 +374,12 @@ inline void InspectorArrayBase::pushBoolean(bool value)
     m_data.append(InspectorBasicValue::create(value));
 }
 
-inline void InspectorArrayBase::pushInt(int value)
+inline void InspectorArrayBase::pushInteger(int value)
 {
     m_data.append(InspectorBasicValue::create(value));
 }
 
-inline void InspectorArrayBase::pushNumber(double value)
+inline void InspectorArrayBase::pushDouble(double value)
 {
     m_data.append(InspectorBasicValue::create(value));
 }
index 3a528af..0ade34e 100644 (file)
@@ -152,8 +152,8 @@ static PassRefPtr<InspectorObject> buildObjectForBreakpointCookie(const String&
 {
     RefPtr<InspectorObject> breakpointObject = InspectorObject::create();
     breakpointObject->setString(ASCIILiteral("url"), url);
-    breakpointObject->setNumber(ASCIILiteral("lineNumber"), lineNumber);
-    breakpointObject->setNumber(ASCIILiteral("columnNumber"), columnNumber);
+    breakpointObject->setInteger(ASCIILiteral("lineNumber"), lineNumber);
+    breakpointObject->setInteger(ASCIILiteral("columnNumber"), columnNumber);
     breakpointObject->setString(ASCIILiteral("condition"), condition);
     breakpointObject->setBoolean(ASCIILiteral("isRegex"), isRegex);
     breakpointObject->setBoolean(ASCIILiteral("autoContinue"), autoContinue);
@@ -228,7 +228,7 @@ bool InspectorDebuggerAgent::breakpointActionsFromProtocol(ErrorString* errorStr
         // Specifying an identifier is optional. They are used to correlate probe samples
         // in the frontend across multiple backend probe actions and segregate object groups.
         int identifier = 0;
-        object->getNumber(ASCIILiteral("id"), &identifier);
+        object->getInteger(ASCIILiteral("id"), &identifier);
 
         String data;
         object->getString(ASCIILiteral("data"), &data);
@@ -288,7 +288,7 @@ void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int li
 static bool parseLocation(ErrorString* errorString, InspectorObject* location, JSC::SourceID* sourceID, unsigned* lineNumber, unsigned* columnNumber)
 {
     String scriptIDStr;
-    if (!location->getString(ASCIILiteral("scriptId"), &scriptIDStr) || !location->getNumber(ASCIILiteral("lineNumber"), lineNumber)) {
+    if (!location->getString(ASCIILiteral("scriptId"), &scriptIDStr) || !location->getInteger(ASCIILiteral("lineNumber"), lineNumber)) {
         *sourceID = JSC::noSourceID;
         *errorString = ASCIILiteral("scriptId and lineNumber are required.");
         return false;
@@ -296,7 +296,7 @@ static bool parseLocation(ErrorString* errorString, InspectorObject* location, J
 
     *sourceID = scriptIDStr.toIntPtr();
     *columnNumber = 0;
-    location->getNumber(ASCIILiteral("columnNumber"), columnNumber);
+    location->getInteger(ASCIILiteral("columnNumber"), columnNumber);
     return true;
 }
 
@@ -601,8 +601,8 @@ void InspectorDebuggerAgent::didParseSource(JSC::SourceID sourceID, const Script
         if (!matches(scriptURL, url, isRegex))
             continue;
         ScriptBreakpoint breakpoint;
-        breakpointObject->getNumber(ASCIILiteral("lineNumber"), &breakpoint.lineNumber);
-        breakpointObject->getNumber(ASCIILiteral("columnNumber"), &breakpoint.columnNumber);
+        breakpointObject->getInteger(ASCIILiteral("lineNumber"), &breakpoint.lineNumber);
+        breakpointObject->getInteger(ASCIILiteral("columnNumber"), &breakpoint.columnNumber);
         breakpointObject->getString(ASCIILiteral("condition"), &breakpoint.condition);
         breakpointObject->getBoolean(ASCIILiteral("autoContinue"), &breakpoint.autoContinue);
         ErrorString errorString;
index 7c3bae2..9e32890 100644 (file)
@@ -221,9 +221,9 @@ void InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets(ErrorString* er
         int descriptor;
         String sourceIDAsString;
         int divot;
-        location->getNumber(ASCIILiteral("typeInformationDescriptor"), &descriptor);
+        location->getInteger(ASCIILiteral("typeInformationDescriptor"), &descriptor);
         location->getString(ASCIILiteral("sourceID"), &sourceIDAsString);
-        location->getNumber(ASCIILiteral("divot"), &divot);
+        location->getInteger(ASCIILiteral("divot"), &divot);
 
         bool okay;
         TypeLocation* typeLocation = vm.typeProfiler()->findLocation(divot, sourceIDAsString.toIntPtrStrict(&okay), static_cast<TypeProfilerSearchDescriptor>(descriptor));
index 629f3a8..2a6eb67 100644 (file)
@@ -232,7 +232,9 @@ class Generator:
             return 'getArray'
         if isinstance(_type, PrimitiveType):
             if _type.raw_name() is 'integer':
-                return 'getInt'
+                return 'getInteger'
+            elif _type.raw_name() is 'number':
+                return 'getDouble'
             else:
                 return 'get' + ucfirst(_type.raw_name())
         if isinstance(_type, AliasedType):
@@ -247,9 +249,11 @@ class Generator:
         if isinstance(_type, ArrayType):
             return 'setArray'
         if isinstance(_type, PrimitiveType):
-            if _type.raw_name() in ['integer', 'number']:
-                return 'setNumber'
-            elif _type.raw_name() in ['any']:
+            if _type.raw_name() is 'integer':
+                return 'setInteger'
+            elif _type.raw_name() is 'number':
+                return 'setDouble'
+            elif _type.raw_name() is 'any':
                 return 'setValue'
             else:
                 return 'set' + ucfirst(_type.raw_name())
index c1931d5..4e19adb 100644 (file)
@@ -215,7 +215,7 @@ void InspectorDatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long
     RefPtr<InspectorObject> paramsContainer = message.getObject(ASCIILiteral("params"));
     InspectorObject* paramsContainerPtr = paramsContainer.get();
     InspectorArray* protocolErrorsPtr = protocolErrors.get();
-    int in_databaseId = InspectorBackendDispatcher::getInt(paramsContainerPtr, ASCIILiteral("databaseId"), nullptr, protocolErrorsPtr);
+    int in_databaseId = InspectorBackendDispatcher::getInteger(paramsContainerPtr, ASCIILiteral("databaseId"), nullptr, protocolErrorsPtr);
     String in_query = InspectorBackendDispatcher::getString(paramsContainerPtr, ASCIILiteral("query"), nullptr, protocolErrorsPtr);
     if (protocolErrors->length()) {
         String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLSyncOptionalReturnValues");
@@ -242,13 +242,13 @@ void InspectorDatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long
         if (out_notes.isAssigned())
             result->setString(ASCIILiteral("notes"), out_notes.getValue());
         if (out_timestamp.isAssigned())
-            result->setNumber(ASCIILiteral("timestamp"), out_timestamp.getValue());
+            result->setDouble(ASCIILiteral("timestamp"), out_timestamp.getValue());
         if (out_values.isAssigned())
             result->setObject(ASCIILiteral("values"), out_values.getValue());
         if (out_payload.isAssigned())
             result->setValue(ASCIILiteral("payload"), out_payload.getValue());
         if (out_databaseId.isAssigned())
-            result->setNumber(ASCIILiteral("databaseId"), out_databaseId.getValue());
+            result->setInteger(ASCIILiteral("databaseId"), out_databaseId.getValue());
         if (out_sqlError)
             result->setObject(ASCIILiteral("sqlError"), out_sqlError);
         if (out_screenColor.isAssigned())
@@ -269,13 +269,13 @@ void InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnVal
     if (notes.isAssigned())
         jsonMessage->setString(ASCIILiteral("notes"), notes.getValue());
     if (timestamp.isAssigned())
-        jsonMessage->setNumber(ASCIILiteral("timestamp"), timestamp.getValue());
+        jsonMessage->setDouble(ASCIILiteral("timestamp"), timestamp.getValue());
     if (values.isAssigned())
         jsonMessage->setObject(ASCIILiteral("values"), values.getValue());
     if (payload.isAssigned())
         jsonMessage->setValue(ASCIILiteral("payload"), payload.getValue());
     if (databaseId.isAssigned())
-        jsonMessage->setNumber(ASCIILiteral("databaseId"), databaseId.getValue());
+        jsonMessage->setInteger(ASCIILiteral("databaseId"), databaseId.getValue());
     if (sqlError)
         jsonMessage->setObject(ASCIILiteral("sqlError"), sqlError);
     if (screenColor.isAssigned())
@@ -291,7 +291,7 @@ void InspectorDatabaseBackendDispatcher::executeSQLAsyncOptionalReturnValues(lon
     RefPtr<InspectorObject> paramsContainer = message.getObject(ASCIILiteral("params"));
     InspectorObject* paramsContainerPtr = paramsContainer.get();
     InspectorArray* protocolErrorsPtr = protocolErrors.get();
-    int in_databaseId = InspectorBackendDispatcher::getInt(paramsContainerPtr, ASCIILiteral("databaseId"), nullptr, protocolErrorsPtr);
+    int in_databaseId = InspectorBackendDispatcher::getInteger(paramsContainerPtr, ASCIILiteral("databaseId"), nullptr, protocolErrorsPtr);
     String in_query = InspectorBackendDispatcher::getString(paramsContainerPtr, ASCIILiteral("query"), nullptr, protocolErrorsPtr);
     if (protocolErrors->length()) {
         String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLAsyncOptionalReturnValues");
@@ -317,7 +317,7 @@ void InspectorDatabaseBackendDispatcher::executeSQLSync(long callId, const Inspe
     RefPtr<InspectorObject> paramsContainer = message.getObject(ASCIILiteral("params"));
     InspectorObject* paramsContainerPtr = paramsContainer.get();
     InspectorArray* protocolErrorsPtr = protocolErrors.get();
-    int in_databaseId = InspectorBackendDispatcher::getInt(paramsContainerPtr, ASCIILiteral("databaseId"), nullptr, protocolErrorsPtr);
+    int in_databaseId = InspectorBackendDispatcher::getInteger(paramsContainerPtr, ASCIILiteral("databaseId"), nullptr, protocolErrorsPtr);
     String in_query = InspectorBackendDispatcher::getString(paramsContainerPtr, ASCIILiteral("query"), nullptr, protocolErrorsPtr);
     if (protocolErrors->length()) {
         String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLSync");
@@ -341,10 +341,10 @@ void InspectorDatabaseBackendDispatcher::executeSQLSync(long callId, const Inspe
     if (!error.length()) {
         result->setArray(ASCIILiteral("columnNames"), out_columnNames);
         result->setString(ASCIILiteral("notes"), out_notes);
-        result->setNumber(ASCIILiteral("timestamp"), out_timestamp);
+        result->setDouble(ASCIILiteral("timestamp"), out_timestamp);
         result->setObject(ASCIILiteral("values"), out_values);
         result->setValue(ASCIILiteral("payload"), out_payload);
-        result->setNumber(ASCIILiteral("databaseId"), out_databaseId);
+        result->setInteger(ASCIILiteral("databaseId"), out_databaseId);
         result->setObject(ASCIILiteral("sqlError"), out_sqlError);
         result->setString(ASCIILiteral("screenColor"), Inspector::Protocol::getTestEnumConstantValue(out_screenColor));
         result->setString(ASCIILiteral("printColor"), Inspector::Protocol::getTestEnumConstantValue(out_printColor));
@@ -359,10 +359,10 @@ void InspectorDatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback::sendSuc
     RefPtr<InspectorObject> jsonMessage = InspectorObject::create();
     jsonMessage->setArray(ASCIILiteral("columnNames"), columnNames);
     jsonMessage->setString(ASCIILiteral("notes"), notes);
-    jsonMessage->setNumber(ASCIILiteral("timestamp"), timestamp);
+    jsonMessage->setDouble(ASCIILiteral("timestamp"), timestamp);
     jsonMessage->setObject(ASCIILiteral("values"), values);
     jsonMessage->setValue(ASCIILiteral("payload"), payload);
-    jsonMessage->setNumber(ASCIILiteral("databaseId"), databaseId);
+    jsonMessage->setInteger(ASCIILiteral("databaseId"), databaseId);
     jsonMessage->setObject(ASCIILiteral("sqlError"), sqlError);
     jsonMessage->setString(ASCIILiteral("screenColor"), Inspector::Protocol::getTestEnumConstantValue(screenColor));
     jsonMessage->setString(ASCIILiteral("printColor"), Inspector::Protocol::getTestEnumConstantValue(printColor));
@@ -375,7 +375,7 @@ void InspectorDatabaseBackendDispatcher::executeSQLAsync(long callId, const Insp
     RefPtr<InspectorObject> paramsContainer = message.getObject(ASCIILiteral("params"));
     InspectorObject* paramsContainerPtr = paramsContainer.get();
     InspectorArray* protocolErrorsPtr = protocolErrors.get();
-    int in_databaseId = InspectorBackendDispatcher::getInt(paramsContainerPtr, ASCIILiteral("databaseId"), nullptr, protocolErrorsPtr);
+    int in_databaseId = InspectorBackendDispatcher::getInteger(paramsContainerPtr, ASCIILiteral("databaseId"), nullptr, protocolErrorsPtr);
     String in_query = InspectorBackendDispatcher::getString(paramsContainerPtr, ASCIILiteral("query"), nullptr, protocolErrorsPtr);
     if (protocolErrors->length()) {
         String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLAsync");
@@ -614,7 +614,7 @@ public:
         Builder<STATE | CodeSet>& setCode(int value)
         {
             COMPILE_ASSERT(!(STATE & CodeSet), property_code_already_set);
-            m_result->setNumber(ASCIILiteral("code"), value);
+            m_result->setInteger(ASCIILiteral("code"), value);
             return castState<CodeSet>();
         }
 
index 8387223..0510aec 100644 (file)
@@ -199,13 +199,13 @@ void InspectorDatabaseBackendDispatcher::executeAllOptionalParameters(long callI
     bool notes_valueFound = false;
     String in_notes = InspectorBackendDispatcher::getString(paramsContainerPtr, ASCIILiteral("notes"), &notes_valueFound, protocolErrorsPtr);
     bool timestamp_valueFound = false;
-    Inspector::Protocol::OptOutput<double> in_timestamp = InspectorBackendDispatcher::getNumber(paramsContainerPtr, ASCIILiteral("timestamp"), &timestamp_valueFound, protocolErrorsPtr);
+    Inspector::Protocol::OptOutput<double> in_timestamp = InspectorBackendDispatcher::getDouble(paramsContainerPtr, ASCIILiteral("timestamp"), &timestamp_valueFound, protocolErrorsPtr);
     bool values_valueFound = false;
     RefPtr<Inspector::InspectorObject> in_values = InspectorBackendDispatcher::getObject(paramsContainerPtr, ASCIILiteral("values"), &values_valueFound, protocolErrorsPtr);
     bool payload_valueFound = false;
     RefPtr<Inspector::InspectorValue> in_payload = InspectorBackendDispatcher::getAny(paramsContainerPtr, ASCIILiteral("payload"), &payload_valueFound, protocolErrorsPtr);
     bool databaseId_valueFound = false;
-    int in_databaseId = InspectorBackendDispatcher::getInt(paramsContainerPtr, ASCIILiteral("databaseId"), &databaseId_valueFound, protocolErrorsPtr);
+    int in_databaseId = InspectorBackendDispatcher::getInteger(paramsContainerPtr, ASCIILiteral("databaseId"), &databaseId_valueFound, protocolErrorsPtr);
     bool sqlError_valueFound = false;
     RefPtr<Inspector::InspectorObject> in_sqlError = InspectorBackendDispatcher::getObject(paramsContainerPtr, ASCIILiteral("sqlError"), &sqlError_valueFound, protocolErrorsPtr);
     bool screenColor_valueFound = false;
@@ -237,13 +237,13 @@ void InspectorDatabaseBackendDispatcher::executeAllOptionalParameters(long callI
         if (out_notes.isAssigned())
             result->setString(ASCIILiteral("notes"), out_notes.getValue());
         if (out_timestamp.isAssigned())
-            result->setNumber(ASCIILiteral("timestamp"), out_timestamp.getValue());
+            result->setDouble(ASCIILiteral("timestamp"), out_timestamp.getValue());
         if (out_values.isAssigned())
             result->setObject(ASCIILiteral("values"), out_values.getValue());
         if (out_payload.isAssigned())
             result->setValue(ASCIILiteral("payload"), out_payload.getValue());
         if (out_databaseId.isAssigned())
-            result->setNumber(ASCIILiteral("databaseId"), out_databaseId.getValue());
+            result->setInteger(ASCIILiteral("databaseId"), out_databaseId.getValue());
         if (out_sqlError)
             result->setObject(ASCIILiteral("sqlError"), out_sqlError);
         if (out_screenColor.isAssigned())
@@ -262,10 +262,10 @@ void InspectorDatabaseBackendDispatcher::executeNoOptionalParameters(long callId
     InspectorArray* protocolErrorsPtr = protocolErrors.get();
     RefPtr<Inspector::InspectorArray> in_columnNames = InspectorBackendDispatcher::getArray(paramsContainerPtr, ASCIILiteral("columnNames"), nullptr, protocolErrorsPtr);
     String in_notes = InspectorBackendDispatcher::getString(paramsContainerPtr, ASCIILiteral("notes"), nullptr, protocolErrorsPtr);
-    double in_timestamp = InspectorBackendDispatcher::getNumber(paramsContainerPtr, ASCIILiteral("timestamp"), nullptr, protocolErrorsPtr);
+    double in_timestamp = InspectorBackendDispatcher::getDouble(paramsContainerPtr, ASCIILiteral("timestamp"), nullptr, protocolErrorsPtr);
     RefPtr<Inspector::InspectorObject> in_values = InspectorBackendDispatcher::getObject(paramsContainerPtr, ASCIILiteral("values"), nullptr, protocolErrorsPtr);
     RefPtr<Inspector::InspectorValue> in_payload = InspectorBackendDispatcher::getAny(paramsContainerPtr, ASCIILiteral("payload"), nullptr, protocolErrorsPtr);
-    int in_databaseId = InspectorBackendDispatcher::getInt(paramsContainerPtr, ASCIILiteral("databaseId"), nullptr, protocolErrorsPtr);
+    int in_databaseId = InspectorBackendDispatcher::getInteger(paramsContainerPtr, ASCIILiteral("databaseId"), nullptr, protocolErrorsPtr);
     RefPtr<Inspector::InspectorObject> in_sqlError = InspectorBackendDispatcher::getObject(paramsContainerPtr, ASCIILiteral("sqlError"), nullptr, protocolErrorsPtr);
     String in_screenColor = InspectorBackendDispatcher::getString(paramsContainerPtr, ASCIILiteral("screenColor"), nullptr, protocolErrorsPtr);
     String in_printColor = InspectorBackendDispatcher::getString(paramsContainerPtr, ASCIILiteral("printColor"), nullptr, protocolErrorsPtr);
@@ -291,10 +291,10 @@ void InspectorDatabaseBackendDispatcher::executeNoOptionalParameters(long callId
     if (!error.length()) {
         result->setArray(ASCIILiteral("columnNames"), out_columnNames);
         result->setString(ASCIILiteral("notes"), out_notes);
-        result->setNumber(ASCIILiteral("timestamp"), out_timestamp);
+        result->setDouble(ASCIILiteral("timestamp"), out_timestamp);
         result->setObject(ASCIILiteral("values"), out_values);
         result->setValue(ASCIILiteral("payload"), out_payload);
-        result->setNumber(ASCIILiteral("databaseId"), out_databaseId);
+        result->setInteger(ASCIILiteral("databaseId"), out_databaseId);
         result->setObject(ASCIILiteral("sqlError"), out_sqlError);
         result->setString(ASCIILiteral("screenColor"), Inspector::Protocol::getTestEnumConstantValue(out_screenColor));
         result->setString(ASCIILiteral("printColor"), Inspector::Protocol::getTestEnumConstantValue(out_printColor));
@@ -521,7 +521,7 @@ public:
         Builder<STATE | CodeSet>& setCode(int value)
         {
             COMPILE_ASSERT(!(STATE & CodeSet), property_code_already_set);
-            m_result->setNumber(ASCIILiteral("code"), value);
+            m_result->setInteger(ASCIILiteral("code"), value);
             return castState<CodeSet>();
         }
 
index 5ce9a5e..c988761 100644 (file)
@@ -249,7 +249,7 @@ void InspectorDatabaseFrontendDispatcher::didExecuteOptionalParameters(PassRefPt
     if (notes)
         paramsObject->setString(ASCIILiteral("notes"), *notes);
     if (timestamp)
-        paramsObject->setNumber(ASCIILiteral("timestamp"), *timestamp);
+        paramsObject->setDouble(ASCIILiteral("timestamp"), *timestamp);
     if (values)
         paramsObject->setObject(ASCIILiteral("values"), values);
     if (payload)
@@ -272,7 +272,7 @@ void InspectorDatabaseFrontendDispatcher::didExecuteNoOptionalParameters(PassRef
     RefPtr<InspectorObject> paramsObject = InspectorObject::create();
     paramsObject->setArray(ASCIILiteral("columnNames"), columnNames);
     paramsObject->setString(ASCIILiteral("notes"), notes);
-    paramsObject->setNumber(ASCIILiteral("timestamp"), timestamp);
+    paramsObject->setDouble(ASCIILiteral("timestamp"), timestamp);
     paramsObject->setObject(ASCIILiteral("values"), values);
     paramsObject->setValue(ASCIILiteral("payload"), payload);
     paramsObject->setObject(ASCIILiteral("sqlError"), sqlError);
@@ -398,7 +398,7 @@ public:
         Builder<STATE | CodeSet>& setCode(int value)
         {
             COMPILE_ASSERT(!(STATE & CodeSet), property_code_already_set);
-            m_result->setNumber(ASCIILiteral("code"), value);
+            m_result->setInteger(ASCIILiteral("code"), value);
             return castState<CodeSet>();
         }
 
index 080e648..0432cf4 100644 (file)
@@ -419,7 +419,7 @@ public:
         Builder<STATE | CodeSet>& setCode(int value)
         {
             COMPILE_ASSERT(!(STATE & CodeSet), property_code_already_set);
-            m_result->setNumber(ASCIILiteral("code"), value);
+            m_result->setInteger(ASCIILiteral("code"), value);
             return castState<CodeSet>();
         }
 
index df97c20..ca8fd2a 100644 (file)
@@ -341,7 +341,7 @@ public:
         Builder<STATE | CodeSet>& setCode(int value)
         {
             COMPILE_ASSERT(!(STATE & CodeSet), property_code_already_set);
-            m_result->setNumber(ASCIILiteral("code"), value);
+            m_result->setInteger(ASCIILiteral("code"), value);
             return castState<CodeSet>();
         }
 
@@ -431,7 +431,7 @@ public:
 
     void setTimestamp(double value)
     {
-        InspectorObjectBase::setNumber(ASCIILiteral("timestamp"), value);
+        InspectorObjectBase::setDouble(ASCIILiteral("timestamp"), value);
     }
 
     void setValues(PassRefPtr<Inspector::InspectorObject> value)
@@ -498,7 +498,7 @@ public:
         Builder<STATE | TimestampSet>& setTimestamp(double value)
         {
             COMPILE_ASSERT(!(STATE & TimestampSet), property_timestamp_already_set);
-            m_result->setNumber(ASCIILiteral("timestamp"), value);
+            m_result->setDouble(ASCIILiteral("timestamp"), value);
             return castState<TimestampSet>();
         }
 
@@ -699,7 +699,7 @@ public:
         Builder<STATE | TimestampSet>& setTimestamp(double value)
         {
             COMPILE_ASSERT(!(STATE & TimestampSet), property_timestamp_already_set);
-            m_result->setNumber(ASCIILiteral("timestamp"), value);
+            m_result->setDouble(ASCIILiteral("timestamp"), value);
             return castState<TimestampSet>();
         }
 
index 1ef13c7..d131908 100644 (file)
@@ -350,7 +350,7 @@ public:
         Builder<STATE | NumberSet>& setNumber(int value)
         {
             COMPILE_ASSERT(!(STATE & NumberSet), property_number_already_set);
-            m_result->setNumber(ASCIILiteral("number"), value);
+            m_result->setInteger(ASCIILiteral("number"), value);
             return castState<NumberSet>();
         }
 
@@ -364,7 +364,7 @@ public:
         Builder<STATE | IdSet>& setId(int value)
         {
             COMPILE_ASSERT(!(STATE & IdSet), property_id_already_set);
-            m_result->setNumber(ASCIILiteral("id"), value);
+            m_result->setInteger(ASCIILiteral("id"), value);
             return castState<IdSet>();
         }
 
index 73f98a5..863f5b4 100644 (file)
@@ -112,7 +112,7 @@ template<> bool EncodedValue::convertTo<bool>()
 template<> double EncodedValue::convertTo<double>()
 {
     double result;
-    bool castSucceeded = m_value->asNumber(&result);
+    bool castSucceeded = m_value->asDouble(&result);
     ASSERT_UNUSED(castSucceeded, castSucceeded);
 
     return result;
@@ -121,7 +121,7 @@ template<> double EncodedValue::convertTo<double>()
 template<> float EncodedValue::convertTo<float>()
 {
     float result;
-    bool castSucceeded = m_value->asNumber(&result);
+    bool castSucceeded = m_value->asDouble(&result);
     ASSERT_UNUSED(castSucceeded, castSucceeded);
 
     return result;
@@ -130,7 +130,7 @@ template<> float EncodedValue::convertTo<float>()
 template<> int32_t EncodedValue::convertTo<int32_t>()
 {
     int32_t result;
-    bool castSucceeded = m_value->asNumber(&result);
+    bool castSucceeded = m_value->asInteger(&result);
     ASSERT_UNUSED(castSucceeded, castSucceeded);
 
     return result;
@@ -139,7 +139,7 @@ template<> int32_t EncodedValue::convertTo<int32_t>()
 template<> int64_t EncodedValue::convertTo<int64_t>()
 {
     int64_t result;
-    bool castSucceeded = m_value->asNumber(&result);
+    bool castSucceeded = m_value->asInteger(&result);
     ASSERT_UNUSED(castSucceeded, castSucceeded);
 
     return result;
@@ -148,7 +148,7 @@ template<> int64_t EncodedValue::convertTo<int64_t>()
 template<> uint32_t EncodedValue::convertTo<uint32_t>()
 {
     uint32_t result;
-    bool castSucceeded = m_value->asNumber(&result);
+    bool castSucceeded = m_value->asInteger(&result);
     ASSERT_UNUSED(castSucceeded, castSucceeded);
 
     return result;
@@ -157,7 +157,7 @@ template<> uint32_t EncodedValue::convertTo<uint32_t>()
 template<> uint64_t EncodedValue::convertTo<uint64_t>()
 {
     uint64_t result;
-    bool castSucceeded = m_value->asNumber(&result);
+    bool castSucceeded = m_value->asInteger(&result);
     ASSERT_UNUSED(castSucceeded, castSucceeded);
 
     return result;
index 7dc9a43..0ede8d7 100644 (file)
@@ -1,3 +1,57 @@
+2014-09-11  Brian J. Burg  <burg@cs.washington.edu>
+
+        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):
+
 2014-09-11  Ryuan Choi  <ryuan.choi@gmail.com>
 
         [EFL][CoordinatedGraphics] Move CoordinatedGraphicsScene and CoordinatedBackingStore to WebKit2
index 4b29793..fd7e923 100644 (file)
@@ -119,14 +119,14 @@ static Color parseColor(const RefPtr<InspectorObject>* colorObject)
     int r;
     int g;
     int b;
-    bool success = (*colorObject)->getNumber("r", &r);
-    success |= (*colorObject)->getNumber("g", &g);
-    success |= (*colorObject)->getNumber("b", &b);
+    bool success = (*colorObject)->getInteger("r", &r);
+    success |= (*colorObject)->getInteger("g", &g);
+    success |= (*colorObject)->getInteger("b", &b);
     if (!success)
         return Color::transparent;
 
     double a;
-    success = (*colorObject)->getNumber("a", &a);
+    success = (*colorObject)->getDouble("a", &a);
     if (!success)
         return Color(r, g, b);
 
@@ -154,7 +154,7 @@ static bool parseQuad(const RefPtr<InspectorArray>& quadArray, FloatQuad* quad)
     if (quadArray->length() != coordinatesInQuad)
         return false;
     for (size_t i = 0; i < coordinatesInQuad; ++i) {
-        if (!quadArray->get(i)->asNumber(coordinates + i))
+        if (!quadArray->get(i)->asDouble(coordinates + i))
             return false;
     }
     quad->setP1(FloatPoint(coordinates[0], coordinates[1]));
@@ -899,7 +899,7 @@ void InspectorDOMAgent::performSearch(ErrorString* errorString, const String& wh
                 return;
             }
             int nodeId = 0;
-            if (!nodeValue->asNumber(&nodeId)) {
+            if (!nodeValue->asInteger(&nodeId)) {
                 *errorString = "Invalid nodeIds item type. Expecting integer types.";
                 return;
             }
index c559711..4c0fdd9 100644 (file)
@@ -328,7 +328,7 @@ void InspectorDOMDebuggerAgent::descriptionForDOMEvent(Node* target, int breakpo
 
     int breakpointOwnerNodeId = m_domAgent->boundNodeId(breakpointOwner);
     ASSERT(breakpointOwnerNodeId);
-    description->setNumber("nodeId", breakpointOwnerNodeId);
+    description->setInteger("nodeId", breakpointOwnerNodeId);
     description->setString("type", domTypeName(breakpointType));
 }
 
index 73cd06b..0ae6bee 100644 (file)
@@ -336,7 +336,7 @@ static PassRefPtr<IDBKey> idbKeyFromInspectorObject(InspectorObject* key)
 
     if (type == number) {
         double number;
-        if (!key->getNumber("number", &number))
+        if (!key->getDouble("number", &number))
             return nullptr;
         idbKey = IDBKey::createNumber(number);
     } else if (type == string) {
@@ -346,7 +346,7 @@ static PassRefPtr<IDBKey> idbKeyFromInspectorObject(InspectorObject* key)
         idbKey = IDBKey::createString(string);
     } else if (type == date) {
         double date;
-        if (!key->getNumber("date", &date))
+        if (!key->getDouble("date", &date))
             return nullptr;
         idbKey = IDBKey::createDate(date);
     } else if (type == array) {
index 28c0a12..c41b04c 100644 (file)
@@ -333,18 +333,18 @@ void InspectorOverlay::update()
 static PassRefPtr<InspectorObject> buildObjectForPoint(const FloatPoint& point)
 {
     RefPtr<InspectorObject> object = InspectorObject::create();
-    object->setNumber(ASCIILiteral("x"), point.x());
-    object->setNumber(ASCIILiteral("y"), point.y());
+    object->setDouble(ASCIILiteral("x"), point.x());
+    object->setDouble(ASCIILiteral("y"), point.y());
     return object.release();
 }
 
 static PassRefPtr<InspectorObject> buildObjectForRect(const FloatRect& rect)
 {
     RefPtr<InspectorObject> object = InspectorObject::create();
-    object->setNumber(ASCIILiteral("x"), rect.x());
-    object->setNumber(ASCIILiteral("y"), rect.y());
-    object->setNumber(ASCIILiteral("width"), rect.width());
-    object->setNumber(ASCIILiteral("height"), rect.height());
+    object->setDouble(ASCIILiteral("x"), rect.x());
+    object->setDouble(ASCIILiteral("y"), rect.y());
+    object->setDouble(ASCIILiteral("width"), rect.width());
+    object->setDouble(ASCIILiteral("height"), rect.height());
     return object.release();
 }
 
@@ -440,8 +440,8 @@ static PassRefPtr<InspectorArray> buildObjectForCSSRegionsHighlight(RenderRegion
 static PassRefPtr<InspectorObject> buildObjectForSize(const IntSize& size)
 {
     RefPtr<InspectorObject> result = InspectorObject::create();
-    result->setNumber("width", size.width());
-    result->setNumber("height", size.height());
+    result->setInteger("width", size.width());
+    result->setInteger("height", size.height());
     return result.release();
 }
 
@@ -599,8 +599,8 @@ static void appendPathCommandAndPoints(PathApplyInfo* info, const String& comman
     for (unsigned i = 0; i < length; i++) {
         point = info->shapeOutsideInfo->shapeToRendererPoint(points[i]);
         point = localPointToRoot(info->renderer, info->rootView, info->view, point);
-        info->array->pushNumber(point.x());
-        info->array->pushNumber(point.y());
+        info->array->pushDouble(point.x());
+        info->array->pushDouble(point.y());
     }
 }
 
@@ -859,7 +859,7 @@ void InspectorOverlay::forcePaint()
 void InspectorOverlay::reset(const IntSize& viewportSize, const IntSize& frameViewFullSize)
 {
     RefPtr<InspectorObject> resetData = InspectorObject::create();
-    resetData->setNumber("deviceScaleFactor", m_page.deviceScaleFactor());
+    resetData->setDouble("deviceScaleFactor", m_page.deviceScaleFactor());
     resetData->setObject("viewportSize", buildObjectForSize(viewportSize));
     resetData->setObject("frameViewFullSize", buildObjectForSize(frameViewFullSize));
     evaluateInOverlay("reset", resetData.release());
index c1487a0..ec4a4ba 100644 (file)
@@ -340,12 +340,12 @@ void InspectorReplayAgent::stopCapturing(ErrorString* errorString)
 void InspectorReplayAgent::replayToPosition(ErrorString* errorString, const RefPtr<InspectorObject>& positionObject, bool fastReplay)
 {
     ReplayPosition position;
-    if (!positionObject->getNumber(ASCIILiteral("segmentOffset"), &position.segmentOffset)) {
+    if (!positionObject->getInteger(ASCIILiteral("segmentOffset"), &position.segmentOffset)) {
         *errorString = ASCIILiteral("Couldn't decode ReplayPosition segment offset provided to ReplayAgent.replayToPosition.");
         return;
     }
 
-    if (!positionObject->getNumber(ASCIILiteral("inputOffset"), &position.inputOffset)) {
+    if (!positionObject->getInteger(ASCIILiteral("inputOffset"), &position.inputOffset)) {
         *errorString = ASCIILiteral("Couldn't decode ReplayPosition input offset provided to ReplayAgent.replayToPosition.");
         return;
     }
index 4183b94..45b4cd2 100644 (file)
@@ -69,7 +69,7 @@ public:
             return;
         
         RefPtr<Inspector::InspectorValue> ordinalValue = value->get("ordinal");
-        if (!ordinalValue || !ordinalValue->asNumber(&m_ordinal))
+        if (!ordinalValue || !ordinalValue->asInteger(&m_ordinal))
             m_styleSheetId = "";
     }
 
index bc496d0..016d678 100644 (file)
@@ -356,7 +356,7 @@ void InspectorTimelineAgent::didWriteHTML(unsigned endLine)
 {
     if (!m_recordStack.isEmpty()) {
         const TimelineRecordEntry& entry = m_recordStack.last();
-        entry.data->setNumber("endLine", endLine);
+        entry.data->setInteger("endLine", endLine);
         didCompleteCurrentRecord(TimelineRecordType::ParseHTML);
     }
 }
@@ -670,7 +670,7 @@ void InspectorTimelineAgent::didCompleteRecordEntry(const TimelineRecordEntry& e
 {
     entry.record->setObject(ASCIILiteral("data"), entry.data);
     entry.record->setArray(ASCIILiteral("children"), entry.children);
-    entry.record->setNumber(ASCIILiteral("endTime"), timestamp());
+    entry.record->setDouble(ASCIILiteral("endTime"), timestamp());
     addRecordToTimeline(entry.record, entry.type);
 }
 
index d459dfc..49a0ecd 100644 (file)
@@ -56,7 +56,7 @@ namespace WebCore {
 PassRefPtr<InspectorObject> TimelineRecordFactory::createGenericRecord(double startTime, int maxCallStackDepth)
 {
     RefPtr<InspectorObject> record = InspectorObject::create();
-    record->setNumber("startTime", startTime);
+    record->setDouble("startTime", startTime);
 
     if (maxCallStackDepth) {
         RefPtr<ScriptCallStack> stackTrace = createScriptCallStack(JSMainThreadExecState::currentState(), maxCallStackDepth);
@@ -69,7 +69,7 @@ PassRefPtr<InspectorObject> TimelineRecordFactory::createGenericRecord(double st
 PassRefPtr<InspectorObject> TimelineRecordFactory::createBackgroundRecord(double startTime, const String& threadName)
 {
     RefPtr<InspectorObject> record = InspectorObject::create();
-    record->setNumber("startTime", startTime);
+    record->setDouble("startTime", startTime);
     record->setString("thread", threadName);
     return record.release();
 }
@@ -77,7 +77,7 @@ PassRefPtr<InspectorObject> TimelineRecordFactory::createBackgroundRecord(double
 PassRefPtr<InspectorObject> TimelineRecordFactory::createGCEventData(const size_t usedHeapSizeDelta)
 {
     RefPtr<InspectorObject> data = InspectorObject::create();
-    data->setNumber("usedHeapSizeDelta", usedHeapSizeDelta);
+    data->setInteger("usedHeapSizeDelta", usedHeapSizeDelta);
     return data.release();
 }
 
@@ -85,7 +85,7 @@ PassRefPtr<InspectorObject> TimelineRecordFactory::createFunctionCallData(const
 {
     RefPtr<InspectorObject> data = InspectorObject::create();
     data->setString("scriptName", scriptName);
-    data->setNumber("scriptLine", scriptLine);
+    data->setInteger("scriptLine", scriptLine);
     return data.release();
 }
 
@@ -99,8 +99,8 @@ PassRefPtr<InspectorObject> TimelineRecordFactory::createConsoleProfileData(cons
 PassRefPtr<InspectorObject> TimelineRecordFactory::createProbeSampleData(const ScriptBreakpointAction& action, int hitCount)
 {
     RefPtr<InspectorObject> data = InspectorObject::create();
-    data->setNumber(ASCIILiteral("probeId"), action.identifier);
-    data->setNumber(ASCIILiteral("hitCount"), hitCount);
+    data->setInteger(ASCIILiteral("probeId"), action.identifier);
+    data->setInteger(ASCIILiteral("hitCount"), hitCount);
     return data.release();
 }
 
@@ -114,15 +114,15 @@ PassRefPtr<InspectorObject> TimelineRecordFactory::createEventDispatchData(const
 PassRefPtr<InspectorObject> TimelineRecordFactory::createGenericTimerData(int timerId)
 {
     RefPtr<InspectorObject> data = InspectorObject::create();
-    data->setNumber("timerId", timerId);
+    data->setInteger("timerId", timerId);
     return data.release();
 }
 
 PassRefPtr<InspectorObject> TimelineRecordFactory::createTimerInstallData(int timerId, int timeout, bool singleShot)
 {
     RefPtr<InspectorObject> data = InspectorObject::create();
-    data->setNumber("timerId", timerId);
-    data->setNumber("timeout", timeout);
+    data->setInteger("timerId", timerId);
+    data->setInteger("timeout", timeout);
     data->setBoolean("singleShot", singleShot);
     return data.release();
 }
@@ -131,7 +131,7 @@ PassRefPtr<InspectorObject> TimelineRecordFactory::createXHRReadyStateChangeData
 {
     RefPtr<InspectorObject> data = InspectorObject::create();
     data->setString("url", url);
-    data->setNumber("readyState", readyState);
+    data->setInteger("readyState", readyState);
     return data.release();
 }
 
@@ -146,7 +146,7 @@ PassRefPtr<InspectorObject> TimelineRecordFactory::createEvaluateScriptData(cons
 {
     RefPtr<InspectorObject> data = InspectorObject::create();
     data->setString("url", url);
-    data->setNumber("lineNumber", lineNumber);
+    data->setInteger("lineNumber", lineNumber);
     return data.release();
 }
 
@@ -177,7 +177,7 @@ PassRefPtr<InspectorObject> TimelineRecordFactory::createResourceReceiveResponse
 {
     RefPtr<InspectorObject> data = InspectorObject::create();
     data->setString("requestId", requestId);
-    data->setNumber("statusCode", response.httpStatusCode());
+    data->setInteger("statusCode", response.httpStatusCode());
     data->setString("mimeType", response.mimeType());
     return data.release();
 }
@@ -188,7 +188,7 @@ PassRefPtr<InspectorObject> TimelineRecordFactory::createResourceFinishData(cons
     data->setString("requestId", requestId);
     data->setBoolean("didFail", didFail);
     if (finishTime)
-        data->setNumber("networkTime", finishTime);
+        data->setDouble("networkTime", finishTime);
     return data.release();
 }
 
@@ -196,15 +196,15 @@ PassRefPtr<InspectorObject> TimelineRecordFactory::createReceiveResourceData(con
 {
     RefPtr<InspectorObject> data = InspectorObject::create();
     data->setString("requestId", requestId);
-    data->setNumber("encodedDataLength", length);
+    data->setInteger("encodedDataLength", length);
     return data.release();
 }
 
 PassRefPtr<InspectorObject> TimelineRecordFactory::createLayoutData(unsigned dirtyObjects, unsigned totalObjects, bool partialLayout)
 {
     RefPtr<InspectorObject> data = InspectorObject::create();
-    data->setNumber("dirtyObjects", dirtyObjects);
-    data->setNumber("totalObjects", totalObjects);
+    data->setInteger("dirtyObjects", dirtyObjects);
+    data->setInteger("totalObjects", totalObjects);
     data->setBoolean("partialLayout", partialLayout);
     return data.release();
 }
@@ -233,28 +233,28 @@ PassRefPtr<InspectorObject> TimelineRecordFactory::createMarkData(bool isMainFra
 PassRefPtr<InspectorObject> TimelineRecordFactory::createParseHTMLData(unsigned startLine)
 {
     RefPtr<InspectorObject> data = InspectorObject::create();
-    data->setNumber("startLine", startLine);
+    data->setInteger("startLine", startLine);
     return data.release();
 }
 
 PassRefPtr<InspectorObject> TimelineRecordFactory::createAnimationFrameData(int callbackId)
 {
     RefPtr<InspectorObject> data = InspectorObject::create();
-    data->setNumber("id", callbackId);
+    data->setInteger("id", callbackId);
     return data.release();
 }
 
 static PassRefPtr<InspectorArray> createQuad(const FloatQuad& quad)
 {
     RefPtr<InspectorArray> array = InspectorArray::create();
-    array->pushNumber(quad.p1().x());
-    array->pushNumber(quad.p1().y());
-    array->pushNumber(quad.p2().x());
-    array->pushNumber(quad.p2().y());
-    array->pushNumber(quad.p3().x());
-    array->pushNumber(quad.p3().y());
-    array->pushNumber(quad.p4().x());
-    array->pushNumber(quad.p4().y());
+    array->pushDouble(quad.p1().x());
+    array->pushDouble(quad.p1().y());
+    array->pushDouble(quad.p2().x());
+    array->pushDouble(quad.p2().y());
+    array->pushDouble(quad.p3().x());
+    array->pushDouble(quad.p3().y());
+    array->pushDouble(quad.p4().x());
+    array->pushDouble(quad.p4().y());
     return array.release();
 }
 
index 6e1f656..9f11311 100644 (file)
@@ -111,7 +111,7 @@ namespace WebCore {
         static inline PassRefPtr<Inspector::InspectorObject> createWebSocketCreateData(unsigned long identifier, const URL& url, const String& protocol)
         {
             RefPtr<Inspector::InspectorObject> data = Inspector::InspectorObject::create();
-            data->setNumber("identifier", identifier);
+            data->setInteger("identifier", identifier);
             data->setString("url", url.string());
             if (!protocol.isNull())
                 data->setString("webSocketProtocol", protocol);
@@ -121,7 +121,7 @@ namespace WebCore {
         static inline PassRefPtr<Inspector::InspectorObject> createGenericWebSocketData(unsigned long identifier)
         {
             RefPtr<Inspector::InspectorObject> data = Inspector::InspectorObject::create();
-            data->setNumber("identifier", identifier);
+            data->setInteger("identifier", identifier);
             return data.release();
         }
 #endif
index 54b8a63..f9c5c98 100644 (file)
@@ -1661,7 +1661,7 @@ void ContentSecurityPolicy::reportViolation(const String& directiveText, const S
     if (callFrame && callFrame->lineNumber()) {
         URL source = URL(URL(), callFrame->sourceURL());
         cspReport->setString(ASCIILiteral("source-file"), stripURLForUseInReport(document, source));
-        cspReport->setNumber(ASCIILiteral("line-number"), callFrame->lineNumber());
+        cspReport->setInteger(ASCIILiteral("line-number"), callFrame->lineNumber());
     }
 
     RefPtr<InspectorObject> reportObject = InspectorObject::create();