Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp

Issue 2151083002: DevTools: explicitly differentiate ints vs doubles in the protocol bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lcean Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp
index ff6934ced067a8f8cad0595cb3db9bcb6a634a39..93d7cf37e4421a7a74f26b59dc9d025c54ca50fb 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8StringUtil.cpp
@@ -224,8 +224,13 @@ std::unique_ptr<protocol::Value> toProtocolValue(v8::Local<v8::Context> context,
return protocol::Value::null();
if (value->IsBoolean())
return protocol::FundamentalValue::create(value.As<v8::Boolean>()->Value());
- if (value->IsNumber())
- return protocol::FundamentalValue::create(value.As<v8::Number>()->Value());
+ if (value->IsNumber()) {
+ double doubleValue = value.As<v8::Number>()->Value();
+ int intValue = static_cast<int>(doubleValue);
+ if (intValue == doubleValue)
+ return protocol::FundamentalValue::create(intValue);
+ return protocol::FundamentalValue::create(doubleValue);
+ }
if (value->IsString())
return protocol::StringValue::create(toProtocolString(value.As<v8::String>()));
if (value->IsArray()) {

Powered by Google App Engine
This is Rietveld 408576698