EnforceRange doesn't enforce range of a short
authorch.dumez@samsung.com <ch.dumez@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 3 Nov 2013 04:13:43 +0000 (04:13 +0000)
committerch.dumez@samsung.com <ch.dumez@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 3 Nov 2013 04:13:43 +0000 (04:13 +0000)
commit5d7968e8e484b828b5e8f8b2b9da4f7cbcc7d0b9
tree1674b453bb30c6162aae398e817943d03999c90d
parent92e7ecf746a3f2ff09099bf62bc16bb01097b8a6
EnforceRange doesn't enforce range of a short
https://bugs.webkit.org/show_bug.cgi?id=123661

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Handle Web IDL short / unsigned short types as per the
specification:
- http://www.w3.org/TR/WebIDL/#es-short
- http://www.w3.org/TR/WebIDL/#es-unsigned-short

Specifically, we used to treat short / unsigned short as 32bit
integers, which was wrong. We now properly handle them as 16bit
integers.

No new tests, added test cases to js/dom/webidl-type-mapping.html.

* WebCore.exp.in:
* bindings/js/JSDOMBinding.cpp:
(WebCore::toSmallerInt):
(WebCore::toSmallerUInt):
(WebCore::toInt8):
(WebCore::toUInt8):
(WebCore::toInt16):
(WebCore::toUInt16):
* bindings/js/JSDOMBinding.h:
* bindings/scripts/CodeGeneratorJS.pm:
(JSValueToNative):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::setJSTestObjShortAttr):
(WebCore::setJSTestObjUnsignedShortAttr):
* testing/TypeConversions.h:
(WebCore::TypeConversions::testShort):
(WebCore::TypeConversions::setTestShort):
(WebCore::TypeConversions::testEnforceRangeShort):
(WebCore::TypeConversions::setTestEnforceRangeShort):
(WebCore::TypeConversions::testUnsignedShort):
(WebCore::TypeConversions::setTestUnsignedShort):
(WebCore::TypeConversions::testEnforceRangeUnsignedShort):
(WebCore::TypeConversions::setTestEnforceRangeUnsignedShort):
* testing/TypeConversions.idl:

Source/WebKit:

Export symbols to fix Windows build.

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:

LayoutTests:

Extend js/dom/webidl-type-mapping.html layout test to validate
Web IDL type mapping for short / unsigned short.

* js/dom/webidl-type-mapping-expected.txt:
* js/dom/webidl-type-mapping.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158521 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/js/dom/webidl-type-mapping-expected.txt
LayoutTests/js/dom/webidl-type-mapping.html
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/bindings/js/JSDOMBinding.cpp
Source/WebCore/bindings/js/JSDOMBinding.h
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/testing/TypeConversions.h
Source/WebCore/testing/TypeConversions.idl
Source/WebKit/ChangeLog
Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in