summaryrefslogtreecommitdiffstats
path: root/gin/converter.cc
diff options
context:
space:
mode:
authorhajimehoshi@chromium.org <hajimehoshi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-14 14:45:13 +0000
committerhajimehoshi@chromium.org <hajimehoshi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-14 14:45:13 +0000
commit7812cea037087dd48055829b20b4e722f97db444 (patch)
tree80a0c4a76d1631540f456607fb09d5bd2d0ee6dd /gin/converter.cc
parentd887774412e383d172c0e1b67ac073c08dba9cf0 (diff)
downloadchromium_src-7812cea037087dd48055829b20b4e722f97db444.zip
chromium_src-7812cea037087dd48055829b20b4e722f97db444.tar.gz
chromium_src-7812cea037087dd48055829b20b4e722f97db444.tar.bz2
gin: Automatic conversion from JS number to intger
Now gin doesn't convert JavaScript double to an integer. This means that gin::Arguments::GetNext() with a pointer of an integer fails when the next arguments is double, and nothing is set to the vairable. IMO this can cause bugs which are hard to understand. It is because on JavaScript side we can't distinguish integer and double, and GetNext() with an integer variable and JS number produces unstable results. For example, In [1], EventSender's mouseMoveTo is called with arguments which can be doubles, not integers, but EventSender::mouseToMove excepts integers. Now EventSender is implemented by CppBoundClass and toInt32 is used explicitly, but now EventSender is being moved to gin, and using GetNext with integer vairables simply will fail. [1] https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/LayoutTests/fast/events/5056619.html&sq=package:chromium BUG=331301 TEST=gin_unittests --gtest_filter=ConverterTest.Int32 Review URL: https://codereview.chromium.org/195893017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257105 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gin/converter.cc')
-rw-r--r--gin/converter.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/gin/converter.cc b/gin/converter.cc
index 07437b7..29da322 100644
--- a/gin/converter.cc
+++ b/gin/converter.cc
@@ -35,7 +35,7 @@ Handle<Value> Converter<int32_t>::ToV8(Isolate* isolate, int32_t val) {
bool Converter<int32_t>::FromV8(Isolate* isolate, Handle<Value> val,
int32_t* out) {
- if (!val->IsInt32())
+ if (!val->IsNumber())
return false;
*out = val->Int32Value();
return true;
@@ -47,7 +47,7 @@ Handle<Value> Converter<uint32_t>::ToV8(Isolate* isolate, uint32_t val) {
bool Converter<uint32_t>::FromV8(Isolate* isolate, Handle<Value> val,
uint32_t* out) {
- if (!val->IsUint32())
+ if (!val->IsNumber())
return false;
*out = val->Uint32Value();
return true;