diff options
author | kbr@google.com <kbr@google.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2010-05-07 17:52:29 +0000 |
---|---|---|
committer | kbr@google.com <kbr@google.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2010-05-07 17:52:29 +0000 |
commit | a07406037d1730f778564f90d48bdc0ea7108b31 (patch) | |
tree | 5476d32945bf4c4c5fe36debdbec843781e34ce6 | |
parent | 573a2a6ff875eb7a22435deca1325cd910ee54ef (diff) | |
download | chromium_src-a07406037d1730f778564f90d48bdc0ea7108b31.zip chromium_src-a07406037d1730f778564f90d48bdc0ea7108b31.tar.gz chromium_src-a07406037d1730f778564f90d48bdc0ea7108b31.tar.bz2 |
2010-05-06 Kenneth Russell <kbr@google.com>
Reviewed by Dimitri Glazkov.
WebCore::WebGLUnsignedIntArrayInternal::getCallback ReadAV@Arbitrary (deef89ee3d0345edebeaf13cf974c47c)
https://bugs.webkit.org/show_bug.cgi?id=38039
Web IDL now allows indexed getters and setters to be unnamed. Per
discussion in WebGL working group and recent update to spec,
removed the buggy get() and single-element set() methods from the
JavaScript bindings to the WebGL array types. Refactored set()
implementation in JSC bindings to share more code and modified V8
binding to look more like it. Added unit tests for indexed getter
with out-of-range indices and verifying removal of get and
single-element set methods. Updated existing WebGL array tests.
Tests: fast/canvas/webgl/array-get-and-set-method-removal.html
fast/canvas/webgl/array-get-out-of-bounds.html
* bindings/js/JSWebGLArrayHelper.h:
(WebCore::setWebGLArrayHelper):
* bindings/js/JSWebGLByteArrayCustom.cpp:
(WebCore::JSWebGLByteArray::set):
* bindings/js/JSWebGLFloatArrayCustom.cpp:
(WebCore::JSWebGLFloatArray::set):
* bindings/js/JSWebGLIntArrayCustom.cpp:
(WebCore::JSWebGLIntArray::set):
* bindings/js/JSWebGLShortArrayCustom.cpp:
(WebCore::JSWebGLShortArray::set):
* bindings/js/JSWebGLUnsignedByteArrayCustom.cpp:
(WebCore::JSWebGLUnsignedByteArray::set):
* bindings/js/JSWebGLUnsignedIntArrayCustom.cpp:
(WebCore::JSWebGLUnsignedIntArray::set):
* bindings/js/JSWebGLUnsignedShortArrayCustom.cpp:
(WebCore::JSWebGLUnsignedShortArray::set):
* bindings/v8/custom/V8WebGLArrayCustom.h:
(WebCore::setWebGLArrayHelper):
* bindings/v8/custom/V8WebGLByteArrayCustom.cpp:
(WebCore::V8WebGLByteArray::setCallback):
* bindings/v8/custom/V8WebGLFloatArrayCustom.cpp:
(WebCore::V8WebGLFloatArray::setCallback):
* bindings/v8/custom/V8WebGLIntArrayCustom.cpp:
(WebCore::V8WebGLIntArray::setCallback):
* bindings/v8/custom/V8WebGLShortArrayCustom.cpp:
(WebCore::V8WebGLShortArray::setCallback):
* bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp:
(WebCore::V8WebGLUnsignedByteArray::setCallback):
* bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp:
(WebCore::V8WebGLUnsignedIntArray::setCallback):
* bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp:
(WebCore::V8WebGLUnsignedShortArray::setCallback):
* html/canvas/WebGLByteArray.h:
* html/canvas/WebGLByteArray.idl:
* html/canvas/WebGLFloatArray.h:
* html/canvas/WebGLFloatArray.idl:
* html/canvas/WebGLIntArray.h:
* html/canvas/WebGLIntArray.idl:
* html/canvas/WebGLShortArray.h:
* html/canvas/WebGLShortArray.idl:
* html/canvas/WebGLUnsignedByteArray.h:
* html/canvas/WebGLUnsignedByteArray.idl:
* html/canvas/WebGLUnsignedIntArray.h:
* html/canvas/WebGLUnsignedIntArray.idl:
* html/canvas/WebGLUnsignedShortArray.h:
* html/canvas/WebGLUnsignedShortArray.idl:
2010-05-06 Kenneth Russell <kbr@google.com>
Reviewed by Dimitri Glazkov.
WebCore::WebGLUnsignedIntArrayInternal::getCallback ReadAV@Arbitrary (deef89ee3d0345edebeaf13cf974c47c)
https://bugs.webkit.org/show_bug.cgi?id=38039
Web IDL now allows indexed getters and setters to be unnamed. Per
discussion in WebGL working group and recent update to spec,
removed the buggy get() and single-element set() methods from the
JavaScript bindings to the WebGL array types. Refactored set()
implementation in JSC bindings to share more code and modified V8
binding to look more like it. Added unit tests for indexed getter
with out-of-range indices and verifying removal of get and
single-element set methods. Updated existing WebGL array tests.
* fast/canvas/webgl/array-get-and-set-method-removal-expected.txt: Added.
* fast/canvas/webgl/array-get-and-set-method-removal.html: Added.
* fast/canvas/webgl/array-get-out-of-bounds-expected.txt: Added.
* fast/canvas/webgl/array-get-out-of-bounds.html: Added.
* fast/canvas/webgl/array-setters-expected.txt:
* fast/canvas/webgl/array-setters.html:
* fast/canvas/webgl/array-unit-tests-expected.txt:
* fast/canvas/webgl/array-unit-tests.html:
* fast/canvas/webgl/bug-32456-expected.txt:
* fast/canvas/webgl/bug-32456.html:
git-svn-id: svn://svn.chromium.org/blink/trunk@58957 bbb929c8-8fbe-4397-9dbb-9b2b20218538
42 files changed, 424 insertions, 467 deletions
diff --git a/third_party/WebKit/LayoutTests/ChangeLog b/third_party/WebKit/LayoutTests/ChangeLog index db4d7ba..7131c39 100644 --- a/third_party/WebKit/LayoutTests/ChangeLog +++ b/third_party/WebKit/LayoutTests/ChangeLog @@ -1,3 +1,30 @@ +2010-05-06 Kenneth Russell <kbr@google.com> + + Reviewed by Dimitri Glazkov. + + WebCore::WebGLUnsignedIntArrayInternal::getCallback ReadAV@Arbitrary (deef89ee3d0345edebeaf13cf974c47c) + https://bugs.webkit.org/show_bug.cgi?id=38039 + + Web IDL now allows indexed getters and setters to be unnamed. Per + discussion in WebGL working group and recent update to spec, + removed the buggy get() and single-element set() methods from the + JavaScript bindings to the WebGL array types. Refactored set() + implementation in JSC bindings to share more code and modified V8 + binding to look more like it. Added unit tests for indexed getter + with out-of-range indices and verifying removal of get and + single-element set methods. Updated existing WebGL array tests. + + * fast/canvas/webgl/array-get-and-set-method-removal-expected.txt: Added. + * fast/canvas/webgl/array-get-and-set-method-removal.html: Added. + * fast/canvas/webgl/array-get-out-of-bounds-expected.txt: Added. + * fast/canvas/webgl/array-get-out-of-bounds.html: Added. + * fast/canvas/webgl/array-setters-expected.txt: + * fast/canvas/webgl/array-setters.html: + * fast/canvas/webgl/array-unit-tests-expected.txt: + * fast/canvas/webgl/array-unit-tests.html: + * fast/canvas/webgl/bug-32456-expected.txt: + * fast/canvas/webgl/bug-32456.html: + 2010-05-07 John Gregg <johnnyg@google.com> Unreviewed, rebaseline for chromium. diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-get-and-set-method-removal-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-get-and-set-method-removal-expected.txt new file mode 100644 index 0000000..bc13270 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-get-and-set-method-removal-expected.txt @@ -0,0 +1,23 @@ +Verifies that the get method, and the set method for individual elements, on the WebGLArray types no longer exist. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + +Regression test for https://bugs.webkit.org/show_bug.cgi?id=38039 +PASS webGLArray.get is undefined. +PASS webGLArray.set(0, 1) threw exception. +PASS webGLArray.get is undefined. +PASS webGLArray.set(0, 1) threw exception. +PASS webGLArray.get is undefined. +PASS webGLArray.set(0, 1) threw exception. +PASS webGLArray.get is undefined. +PASS webGLArray.set(0, 1) threw exception. +PASS webGLArray.get is undefined. +PASS webGLArray.set(0, 1) threw exception. +PASS webGLArray.get is undefined. +PASS webGLArray.set(0, 1) threw exception. +PASS webGLArray.get is undefined. +PASS webGLArray.set(0, 1) threw exception. +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-get-and-set-method-removal.html b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-get-and-set-method-removal.html new file mode 100644 index 0000000..d2e7e74 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-get-and-set-method-removal.html @@ -0,0 +1,55 @@ +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"/> +<script src="../../js/resources/js-test-pre.js"></script> +<script src="resources/webgl-test.js"></script> +</head> +<body> +<div id="description"></div> +<div id="console"></div> + +<script> + +description("Verifies that the get method, and the set method for individual elements, on the WebGLArray types no longer exist."); + +debug('Regression test for <a href="https://bugs.webkit.org/show_bug.cgi?id=38039">https://bugs.webkit.org/show_bug.cgi?id=38039</a>'); + +// Global scope so shouldThrow can see it +var webGLArray; + +function negativeTestGetAndSetMethods(typeName) { + var type = window[typeName]; + webGLArray = new type([2, 3]); + shouldBeUndefined("webGLArray.get"); + var exceptionThrown = false; + // We deliberately check for an exception here rather than using + // shouldThrow here because the precise contents of the syntax + // error are not specified. + try { + webGLArray.set(0, 1); + } catch (e) { + exceptionThrown = true; + } + var output = "webGLArray.set(0, 1) "; + if (exceptionThrown) { + testPassed(output + "threw exception."); + } else { + testFailed(output + "did not throw exception."); + } +} + +negativeTestGetAndSetMethods("WebGLByteArray"); +negativeTestGetAndSetMethods("WebGLUnsignedByteArray"); +negativeTestGetAndSetMethods("WebGLShortArray"); +negativeTestGetAndSetMethods("WebGLUnsignedShortArray"); +negativeTestGetAndSetMethods("WebGLIntArray"); +negativeTestGetAndSetMethods("WebGLUnsignedIntArray"); +negativeTestGetAndSetMethods("WebGLFloatArray"); + +successfullyParsed = true; + +</script> + +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-get-out-of-bounds-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-get-out-of-bounds-expected.txt new file mode 100644 index 0000000..29660e2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-get-out-of-bounds-expected.txt @@ -0,0 +1,30 @@ +Verifies that calling the indexing operator on WebGLArrays with out-of-range indices returns undefined. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + +Regression test for https://bugs.webkit.org/show_bug.cgi?id=38039 +PASS webGLArray[2] is undefined. +PASS webGLArray[-1] is undefined. +PASS webGLArray[0x20000000] is undefined. +PASS webGLArray[2] is undefined. +PASS webGLArray[-1] is undefined. +PASS webGLArray[0x20000000] is undefined. +PASS webGLArray[2] is undefined. +PASS webGLArray[-1] is undefined. +PASS webGLArray[0x20000000] is undefined. +PASS webGLArray[2] is undefined. +PASS webGLArray[-1] is undefined. +PASS webGLArray[0x20000000] is undefined. +PASS webGLArray[2] is undefined. +PASS webGLArray[-1] is undefined. +PASS webGLArray[0x20000000] is undefined. +PASS webGLArray[2] is undefined. +PASS webGLArray[-1] is undefined. +PASS webGLArray[0x20000000] is undefined. +PASS webGLArray[2] is undefined. +PASS webGLArray[-1] is undefined. +PASS webGLArray[0x20000000] is undefined. +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-get-out-of-bounds.html b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-get-out-of-bounds.html new file mode 100644 index 0000000..0c757d6 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-get-out-of-bounds.html @@ -0,0 +1,42 @@ +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"/> +<script src="../../js/resources/js-test-pre.js"></script> +<script src="resources/webgl-test.js"></script> +</head> +<body> +<div id="description"></div> +<div id="console"></div> + +<script> + +description("Verifies that calling the indexing operator on WebGLArrays with out-of-range indices returns undefined."); + +debug('Regression test for <a href="https://bugs.webkit.org/show_bug.cgi?id=38039">https://bugs.webkit.org/show_bug.cgi?id=38039</a>'); + +// Global scope so shouldThrow can see it +var webGLArray; + +function testGetWithOutOfRangeIndices(typeName) { + var type = window[typeName]; + webGLArray = new type([2, 3]); + shouldBeUndefined("webGLArray[2]"); + shouldBeUndefined("webGLArray[-1]"); + shouldBeUndefined("webGLArray[0x20000000]"); +} + +testGetWithOutOfRangeIndices("WebGLByteArray"); +testGetWithOutOfRangeIndices("WebGLUnsignedByteArray"); +testGetWithOutOfRangeIndices("WebGLShortArray"); +testGetWithOutOfRangeIndices("WebGLUnsignedShortArray"); +testGetWithOutOfRangeIndices("WebGLIntArray"); +testGetWithOutOfRangeIndices("WebGLUnsignedIntArray"); +testGetWithOutOfRangeIndices("WebGLFloatArray"); + +successfullyParsed = true; + +</script> + +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-setters-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-setters-expected.txt index 9b7ff1f..5fc6fe4 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-setters-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-setters-expected.txt @@ -6,17 +6,11 @@ Regression test for https://bugs.webkit.org/show_bug.cgi?id=33350 : WebGLArray s Testing WebGLByteArray PASS webGLArray is array PASS webGLArray[0] is array[0] -PASS webGLArray.get(0) is array[0] PASS webGLArray[1] is array[1] -PASS webGLArray.get(1) is array[1] PASS webGLArray[0] is 0 -PASS webGLArray.get(0) is 0 PASS webGLArray[1] is 0 -PASS webGLArray.get(1) is 0 PASS webGLArray[0] is array[0] -PASS webGLArray.get(0) is array[0] PASS webGLArray[1] is array[1] -PASS webGLArray.get(1) is array[1] PASS webGLArray[2] is 88 PASS webGLArray[3] is 99 PASS webGLArray[1] is 88 @@ -30,17 +24,11 @@ PASS array[1] is 99 Testing WebGLUnsignedByteArray PASS webGLArray is array PASS webGLArray[0] is array[0] -PASS webGLArray.get(0) is array[0] PASS webGLArray[1] is array[1] -PASS webGLArray.get(1) is array[1] PASS webGLArray[0] is 0 -PASS webGLArray.get(0) is 0 PASS webGLArray[1] is 0 -PASS webGLArray.get(1) is 0 PASS webGLArray[0] is array[0] -PASS webGLArray.get(0) is array[0] PASS webGLArray[1] is array[1] -PASS webGLArray.get(1) is array[1] PASS webGLArray[2] is 88 PASS webGLArray[3] is 99 PASS webGLArray[1] is 88 @@ -54,17 +42,11 @@ PASS array[1] is 99 Testing WebGLShortArray PASS webGLArray is array PASS webGLArray[0] is array[0] -PASS webGLArray.get(0) is array[0] PASS webGLArray[1] is array[1] -PASS webGLArray.get(1) is array[1] PASS webGLArray[0] is 0 -PASS webGLArray.get(0) is 0 PASS webGLArray[1] is 0 -PASS webGLArray.get(1) is 0 PASS webGLArray[0] is array[0] -PASS webGLArray.get(0) is array[0] PASS webGLArray[1] is array[1] -PASS webGLArray.get(1) is array[1] PASS webGLArray[2] is 88 PASS webGLArray[3] is 99 PASS webGLArray[1] is 88 @@ -78,17 +60,11 @@ PASS array[1] is 99 Testing WebGLUnsignedShortArray PASS webGLArray is array PASS webGLArray[0] is array[0] -PASS webGLArray.get(0) is array[0] PASS webGLArray[1] is array[1] -PASS webGLArray.get(1) is array[1] PASS webGLArray[0] is 0 -PASS webGLArray.get(0) is 0 PASS webGLArray[1] is 0 -PASS webGLArray.get(1) is 0 PASS webGLArray[0] is array[0] -PASS webGLArray.get(0) is array[0] PASS webGLArray[1] is array[1] -PASS webGLArray.get(1) is array[1] PASS webGLArray[2] is 88 PASS webGLArray[3] is 99 PASS webGLArray[1] is 88 @@ -102,17 +78,11 @@ PASS array[1] is 99 Testing WebGLIntArray PASS webGLArray is array PASS webGLArray[0] is array[0] -PASS webGLArray.get(0) is array[0] PASS webGLArray[1] is array[1] -PASS webGLArray.get(1) is array[1] PASS webGLArray[0] is 0 -PASS webGLArray.get(0) is 0 PASS webGLArray[1] is 0 -PASS webGLArray.get(1) is 0 PASS webGLArray[0] is array[0] -PASS webGLArray.get(0) is array[0] PASS webGLArray[1] is array[1] -PASS webGLArray.get(1) is array[1] PASS webGLArray[2] is 88 PASS webGLArray[3] is 99 PASS webGLArray[1] is 88 @@ -126,17 +96,11 @@ PASS array[1] is 99 Testing WebGLUnsignedIntArray PASS webGLArray is array PASS webGLArray[0] is array[0] -PASS webGLArray.get(0) is array[0] PASS webGLArray[1] is array[1] -PASS webGLArray.get(1) is array[1] PASS webGLArray[0] is 0 -PASS webGLArray.get(0) is 0 PASS webGLArray[1] is 0 -PASS webGLArray.get(1) is 0 PASS webGLArray[0] is array[0] -PASS webGLArray.get(0) is array[0] PASS webGLArray[1] is array[1] -PASS webGLArray.get(1) is array[1] PASS webGLArray[2] is 88 PASS webGLArray[3] is 99 PASS webGLArray[1] is 88 @@ -150,17 +114,11 @@ PASS array[1] is 99 Testing WebGLFloatArray PASS webGLArray is array PASS webGLArray[0] is array[0] -PASS webGLArray.get(0) is array[0] PASS webGLArray[1] is array[1] -PASS webGLArray.get(1) is array[1] PASS webGLArray[0] is 0 -PASS webGLArray.get(0) is 0 PASS webGLArray[1] is 0 -PASS webGLArray.get(1) is 0 PASS webGLArray[0] is array[0] -PASS webGLArray.get(0) is array[0] PASS webGLArray[1] is array[1] -PASS webGLArray.get(1) is array[1] PASS webGLArray[2] is 88 PASS webGLArray[3] is 99 PASS webGLArray[1] is 88 diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-setters.html b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-setters.html index 9e06c14..2b12623 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-setters.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-setters.html @@ -24,21 +24,15 @@ function testSetters(typeName, low, high) { webGLArray.set(array); shouldBe("webGLArray", "array"); shouldBe("webGLArray[0]", "array[0]"); - shouldBe("webGLArray.get(0)", "array[0]"); shouldBe("webGLArray[1]", "array[1]"); - shouldBe("webGLArray.get(1)", "array[1]"); webGLArray[0] = 0; webGLArray[1] = 0; shouldBe("webGLArray[0]", "0"); - shouldBe("webGLArray.get(0)", "0"); shouldBe("webGLArray[1]", "0"); - shouldBe("webGLArray.get(1)", "0"); webGLArray[0] = array[0]; shouldBe("webGLArray[0]", "array[0]"); - shouldBe("webGLArray.get(0)", "array[0]"); - webGLArray.set(1, array[1]); + webGLArray[1] = array[1]; shouldBe("webGLArray[1]", "array[1]"); - shouldBe("webGLArray.get(1)", "array[1]"); // Verify set() behaves correctly with shared underlying buffer. array = [0, 1, 2, 3, 4, 5]; diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt index 665bf4a..c89712c 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt @@ -3,9 +3,12 @@ Verifies the functionality of the new array-like objects in the WebGL spec On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". PASS test WebGLByteArray SetAndGetPos10ToNeg10 -PASS test WebGLByteArray SetAndGetMethodsPos10ToNeg10 PASS test WebGLByteArray ConstructWithArrayOfSignedValues PASS test WebGLByteArray ConstructWithWebGLArrayOfSignedValues +Testing WebGLByteArray GetWithOutOfRangeIndices +PASS array[2] is undefined. +PASS array[-1] is undefined. +PASS array[0x20000000] is undefined. PASS test WebGLByteArray OffsetsAndSizes PASS test WebGLByteArray SetFromWebGLArray PASS negativeTest WebGLByteArray SetFromWebGLArray @@ -30,10 +33,15 @@ PASS array.slice(-2147483648).length is (32 / typeSize) PASS Setting WebGLByteArray from array with out-of-range offset was caught PASS Setting WebGLByteArray from fake array with invalid length was caught PASS Setting WebGLByteArray from WebGLByteArray with out-of-range offset was caught +PASS array.get is undefined. +PASS array.set(0, 1) threw exception. PASS test WebGLFloatArray SetAndGetPos10ToNeg10 -PASS test WebGLFloatArray SetAndGetMethodsPos10ToNeg10 PASS test WebGLFloatArray ConstructWithArrayOfSignedValues PASS test WebGLFloatArray ConstructWithWebGLArrayOfSignedValues +Testing WebGLFloatArray GetWithOutOfRangeIndices +PASS array[2] is undefined. +PASS array[-1] is undefined. +PASS array[0x20000000] is undefined. PASS test WebGLFloatArray OffsetsAndSizes PASS test WebGLFloatArray SetFromWebGLArray PASS negativeTest WebGLFloatArray SetFromWebGLArray @@ -60,10 +68,15 @@ PASS array.slice(-2147483648).length is (32 / typeSize) PASS Setting WebGLFloatArray from array with out-of-range offset was caught PASS Setting WebGLFloatArray from fake array with invalid length was caught PASS Setting WebGLFloatArray from WebGLFloatArray with out-of-range offset was caught +PASS array.get is undefined. +PASS array.set(0, 1) threw exception. PASS test WebGLIntArray SetAndGetPos10ToNeg10 -PASS test WebGLIntArray SetAndGetMethodsPos10ToNeg10 PASS test WebGLIntArray ConstructWithArrayOfSignedValues PASS test WebGLIntArray ConstructWithWebGLArrayOfSignedValues +Testing WebGLIntArray GetWithOutOfRangeIndices +PASS array[2] is undefined. +PASS array[-1] is undefined. +PASS array[0x20000000] is undefined. PASS test WebGLIntArray OffsetsAndSizes PASS test WebGLIntArray SetFromWebGLArray PASS negativeTest WebGLIntArray SetFromWebGLArray @@ -90,10 +103,15 @@ PASS array.slice(-2147483648).length is (32 / typeSize) PASS Setting WebGLIntArray from array with out-of-range offset was caught PASS Setting WebGLIntArray from fake array with invalid length was caught PASS Setting WebGLIntArray from WebGLIntArray with out-of-range offset was caught +PASS array.get is undefined. +PASS array.set(0, 1) threw exception. PASS test WebGLShortArray SetAndGetPos10ToNeg10 -PASS test WebGLShortArray SetAndGetMethodsPos10ToNeg10 PASS test WebGLShortArray ConstructWithArrayOfSignedValues PASS test WebGLShortArray ConstructWithWebGLArrayOfSignedValues +Testing WebGLShortArray GetWithOutOfRangeIndices +PASS array[2] is undefined. +PASS array[-1] is undefined. +PASS array[0x20000000] is undefined. PASS test WebGLShortArray OffsetsAndSizes PASS test WebGLShortArray SetFromWebGLArray PASS negativeTest WebGLShortArray SetFromWebGLArray @@ -120,10 +138,15 @@ PASS array.slice(-2147483648).length is (32 / typeSize) PASS Setting WebGLShortArray from array with out-of-range offset was caught PASS Setting WebGLShortArray from fake array with invalid length was caught PASS Setting WebGLShortArray from WebGLShortArray with out-of-range offset was caught +PASS array.get is undefined. +PASS array.set(0, 1) threw exception. PASS test WebGLUnsignedByteArray SetAndGet10To1 -PASS test WebGLUnsignedByteArray SetAndGetMethods10To1 PASS test WebGLUnsignedByteArray ConstructWithArrayOfUnsignedValues PASS test WebGLUnsignedByteArray ConstructWithWebGLArrayOfUnsignedValues +Testing WebGLUnsignedByteArray GetWithOutOfRangeIndices +PASS array[2] is undefined. +PASS array[-1] is undefined. +PASS array[0x20000000] is undefined. PASS test WebGLUnsignedByteArray OffsetsAndSizes PASS test WebGLUnsignedByteArray SetFromWebGLArray PASS negativeTest WebGLUnsignedByteArray SetFromWebGLArray @@ -148,10 +171,15 @@ PASS array.slice(-2147483648).length is (32 / typeSize) PASS Setting WebGLUnsignedByteArray from array with out-of-range offset was caught PASS Setting WebGLUnsignedByteArray from fake array with invalid length was caught PASS Setting WebGLUnsignedByteArray from WebGLUnsignedByteArray with out-of-range offset was caught +PASS array.get is undefined. +PASS array.set(0, 1) threw exception. PASS test WebGLUnsignedIntArray SetAndGet10To1 -PASS test WebGLUnsignedIntArray SetAndGetMethods10To1 PASS test WebGLUnsignedIntArray ConstructWithArrayOfUnsignedValues PASS test WebGLUnsignedIntArray ConstructWithWebGLArrayOfUnsignedValues +Testing WebGLUnsignedIntArray GetWithOutOfRangeIndices +PASS array[2] is undefined. +PASS array[-1] is undefined. +PASS array[0x20000000] is undefined. PASS test WebGLUnsignedIntArray OffsetsAndSizes PASS test WebGLUnsignedIntArray SetFromWebGLArray PASS negativeTest WebGLUnsignedIntArray SetFromWebGLArray @@ -178,10 +206,15 @@ PASS array.slice(-2147483648).length is (32 / typeSize) PASS Setting WebGLUnsignedIntArray from array with out-of-range offset was caught PASS Setting WebGLUnsignedIntArray from fake array with invalid length was caught PASS Setting WebGLUnsignedIntArray from WebGLUnsignedIntArray with out-of-range offset was caught +PASS array.get is undefined. +PASS array.set(0, 1) threw exception. PASS test WebGLUnsignedShortArray SetAndGet10To1 -PASS test WebGLUnsignedShortArray SetAndGetMethods10To1 PASS test WebGLUnsignedShortArray ConstructWithArrayOfUnsignedValues PASS test WebGLUnsignedShortArray ConstructWithWebGLArrayOfUnsignedValues +Testing WebGLUnsignedShortArray GetWithOutOfRangeIndices +PASS array[2] is undefined. +PASS array[-1] is undefined. +PASS array[0x20000000] is undefined. PASS test WebGLUnsignedShortArray OffsetsAndSizes PASS test WebGLUnsignedShortArray SetFromWebGLArray PASS negativeTest WebGLUnsignedShortArray SetFromWebGLArray @@ -208,6 +241,8 @@ PASS array.slice(-2147483648).length is (32 / typeSize) PASS Setting WebGLUnsignedShortArray from array with out-of-range offset was caught PASS Setting WebGLUnsignedShortArray from fake array with invalid length was caught PASS Setting WebGLUnsignedShortArray from WebGLUnsignedShortArray with out-of-range offset was caught +PASS array.get is undefined. +PASS array.set(0, 1) threw exception. Test passed. PASS successfullyParsed is true diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-unit-tests.html b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-unit-tests.html index c26e5bb..a5b7280 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-unit-tests.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-unit-tests.html @@ -78,22 +78,6 @@ function testSetAndGet10To1(type, name) { } } -function testSetAndGetMethods10To1(type, name) { - running('test ' + name + ' SetAndGetMethods10To1'); - try { - var array = new type(10); - for (var i = 0; i < 10; i++) { - array.set(i, 10 - i); - } - for (var i = 0; i < 10; i++) { - assertEq('Element ' + i, 10 - i, array.get(i)); - } - pass(); - } catch (e) { - fail(e); - } -} - function testConstructWithArrayOfUnsignedValues(type, name) { running('test ' + name + ' ConstructWithArrayOfUnsignedValues'); try { @@ -143,22 +127,6 @@ function testSetAndGetPos10ToNeg10(type, name) { } } -function testSetAndGetMethodsPos10ToNeg10(type, name) { - running('test ' + name + ' SetAndGetMethodsPos10ToNeg10'); - try { - var array = new type(21); - for (var i = 0; i < 21; i++) { - array.set(i, 10 - i); - } - for (var i = 0; i < 21; i++) { - assertEq('Element ' + i, 10 - i, array.get(i)); - } - pass(); - } catch (e) { - fail(e); - } -} - function testConstructWithArrayOfSignedValues(type, name) { running('test ' + name + ' ConstructWithArrayOfSignedValues'); try { @@ -192,6 +160,15 @@ function testConstructWithWebGLArrayOfSignedValues(type, name) { // Test cases for both signed and unsigned types // +function testGetWithOutOfRangeIndices(type, name) { + debug('Testing ' + name + ' GetWithOutOfRangeIndices'); + // See below for declaration of this global variable + array = new type([2, 3]); + shouldBeUndefined("array[2]"); + shouldBeUndefined("array[-1]"); + shouldBeUndefined("array[0x20000000]"); +} + function testOffsetsAndSizes(type, name, elementSizeInBytes) { running('test ' + name + ' OffsetsAndSizes'); try { @@ -357,11 +334,6 @@ function testBoundaryConditions(type, name, lowValue, expectedLowValue, highValu assertEq('Element 0', expectedLowValue, array[0]); array[0] = highValue; assertEq('Element 0', expectedHighValue, array[0]); - // Test the get and set methods with these values - array.set(0, lowValue); - assertEq('Element 0 set / get', expectedLowValue, array.get(0)); - array.set(0, highValue); - assertEq('Element 0 set / get', expectedHighValue, array.get(0)); pass(); } catch (e) { fail(e); @@ -506,6 +478,26 @@ function testSettingFromWebGLArrayWithOutOfRangeOffset(type, name) { } } +function negativeTestGetAndSetMethods(type, name) { + array = new type([2, 3]); + shouldBeUndefined("array.get"); + var exceptionThrown = false; + // We deliberately check for an exception here rather than using + // shouldThrow here because the precise contents of the syntax + // error are not specified. + try { + webGLArray.set(0, 1); + } catch (e) { + exceptionThrown = true; + } + var output = "array.set(0, 1) "; + if (exceptionThrown) { + testPassed(output + "threw exception."); + } else { + testFailed(output + "did not throw exception."); + } +} + // // Test driver // @@ -577,15 +569,14 @@ function runTests() { var name = testCase.name; if (testCase.unsigned) { testSetAndGet10To1(type, name); - testSetAndGetMethods10To1(type, name); testConstructWithArrayOfUnsignedValues(type, name); testConstructWithWebGLArrayOfUnsignedValues(type, name); } else { testSetAndGetPos10ToNeg10(type, name); - testSetAndGetMethodsPos10ToNeg10(type, name); testConstructWithArrayOfSignedValues(type, name); testConstructWithWebGLArrayOfSignedValues(type, name); } + testGetWithOutOfRangeIndices(type, name); testOffsetsAndSizes(type, name, testCase.elementSizeInBytes); testSetFromWebGLArray(type, name); negativeTestSetFromWebGLArray(type, name); @@ -608,6 +599,7 @@ function runTests() { testSettingFromArrayWithOutOfRangeOffset(type, name); testSettingFromFakeArrayWithOutOfRangeLength(type, name); testSettingFromWebGLArrayWithOutOfRangeOffset(type, name); + negativeTestGetAndSetMethods(type, name); } printSummary(); diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/bug-32456-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/webgl/bug-32456-expected.txt index 0e1923a..8c4ff6e 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/bug-32456-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/bug-32456-expected.txt @@ -2,44 +2,33 @@ Regression test for https://bugs.webkit.org/show_bug.cgi?id=32456 : Errors in We On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -Testing WebGLFloatArray get / set -PASS array.get(0) is 1.5 +Testing WebGLFloatArray indexed getter / setter PASS array[0] is 1.5 -PASS array.set(0, 2.5) is undefined. -PASS array.get(0) is 2.5 +PASS array[0] = 2.5 is 2.5 PASS array[0] is 2.5 -Testing WebGLByteArray get / set -PASS array.set(0, 127) is undefined. -PASS array.get(0) is 127 +Testing WebGLByteArray indexed getter / setter +PASS array[0] = 127 is 127 PASS array[0] is 127 -PASS array.set(0, -128) is undefined. -PASS array.get(0) is -128 +PASS array[0] = -128 is -128 PASS array[0] is -128 -Testing WebGLUnsignedByteArray get / set -PASS array.set(0, 255) is undefined. -PASS array.get(0) is 255 +Testing WebGLUnsignedByteArray indexed getter / setter +PASS array[0] = 255 is 255 PASS array[0] is 255 -Testing WebGLShortArray get / set -PASS array.set(0, 32767) is undefined. -PASS array.get(0) is 32767 +Testing WebGLShortArray indexed getter / setter +PASS array[0] = 32767 is 32767 PASS array[0] is 32767 -PASS array.set(0, -32768) is undefined. -PASS array.get(0) is -32768 +PASS array[0] = -32768 is -32768 PASS array[0] is -32768 -Testing WebGLUnsignedShortArray get / set -PASS array.set(0, 65535) is undefined. -PASS array.get(0) is 65535 +Testing WebGLUnsignedShortArray indexed getter / setter +PASS array[0] = 65535 is 65535 PASS array[0] is 65535 -Testing WebGLIntArray get / set -PASS array.set(0, -2147483648) is undefined. -PASS array.get(0) is -2147483648 +Testing WebGLIntArray indexed getter / setter +PASS array[0] = -2147483648 is -2147483648 PASS array[0] is -2147483648 -PASS array.set(0, 2147483647) is undefined. -PASS array.get(0) is 2147483647 +PASS array[0] = 2147483647 is 2147483647 PASS array[0] is 2147483647 -Testing WebGLUnsignedIntArray get / set -PASS array.set(0, 4294967295) is undefined. -PASS array.get(0) is 4294967295 +Testing WebGLUnsignedIntArray indexed getter / setter +PASS array[0] = 4294967295 is 4294967295 PASS array[0] is 4294967295 PASS successfullyParsed is true diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/bug-32456.html b/third_party/WebKit/LayoutTests/fast/canvas/webgl/bug-32456.html index 50ec8f4..c69ec5d 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/bug-32456.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/bug-32456.html @@ -12,57 +12,46 @@ description('Regression test for <a href="https://bugs.webkit.org/show_bug.cgi?id=32456">https://bugs.webkit.org/show_bug.cgi?id=32456</a> : <code>Errors in WebGL[T]Array set() and get() methods</code>'); -debug("Testing WebGLFloatArray get / set"); +debug("Testing WebGLFloatArray indexed getter / setter"); var array = new WebGLFloatArray([1.5]); -shouldBe("array.get(0)", "1.5"); shouldBe("array[0]", "1.5"); -shouldBeUndefined("array.set(0, 2.5)"); -shouldBe("array.get(0)", "2.5"); +shouldBe("array[0] = 2.5", "2.5"); shouldBe("array[0]", "2.5"); -debug("Testing WebGLByteArray get / set"); +debug("Testing WebGLByteArray indexed getter / setter"); array = new WebGLByteArray(1); -shouldBeUndefined("array.set(0, 127)"); -shouldBe("array.get(0)", "127"); +shouldBe("array[0] = 127", "127"); shouldBe("array[0]", "127"); -shouldBeUndefined("array.set(0, -128)"); -shouldBe("array.get(0)", "-128"); +shouldBe("array[0] = -128", "-128"); shouldBe("array[0]", "-128"); -debug("Testing WebGLUnsignedByteArray get / set"); +debug("Testing WebGLUnsignedByteArray indexed getter / setter"); array = new WebGLUnsignedByteArray(1); -shouldBeUndefined("array.set(0, 255)"); -shouldBe("array.get(0)", "255"); +shouldBe("array[0] = 255", "255"); shouldBe("array[0]", "255"); -debug("Testing WebGLShortArray get / set"); +debug("Testing WebGLShortArray indexed getter / setter"); array = new WebGLShortArray(1); -shouldBeUndefined("array.set(0, 32767)"); -shouldBe("array.get(0)", "32767"); +shouldBe("array[0] = 32767", "32767"); shouldBe("array[0]", "32767"); -shouldBeUndefined("array.set(0, -32768)"); -shouldBe("array.get(0)", "-32768"); +shouldBe("array[0] = -32768", "-32768"); shouldBe("array[0]", "-32768"); -debug("Testing WebGLUnsignedShortArray get / set"); +debug("Testing WebGLUnsignedShortArray indexed getter / setter"); array = new WebGLUnsignedShortArray(1); -shouldBeUndefined("array.set(0, 65535)"); -shouldBe("array.get(0)", "65535"); +shouldBe("array[0] = 65535", "65535"); shouldBe("array[0]", "65535"); -debug("Testing WebGLIntArray get / set"); +debug("Testing WebGLIntArray indexed getter / setter"); array = new WebGLIntArray(1); -shouldBeUndefined("array.set(0, -2147483648)"); -shouldBe("array.get(0)", "-2147483648"); +shouldBe("array[0] = -2147483648", "-2147483648"); shouldBe("array[0]", "-2147483648"); -shouldBeUndefined("array.set(0, 2147483647)"); -shouldBe("array.get(0)", "2147483647"); +shouldBe("array[0] = 2147483647", "2147483647"); shouldBe("array[0]", "2147483647"); -debug("Testing WebGLUnsignedIntArray get / set"); +debug("Testing WebGLUnsignedIntArray indexed getter / setter"); array = new WebGLUnsignedIntArray(1); -shouldBeUndefined("array.set(0, 4294967295)"); -shouldBe("array.get(0)", "4294967295"); +shouldBe("array[0] = 4294967295", "4294967295"); shouldBe("array[0]", "4294967295"); successfullyParsed = true; diff --git a/third_party/WebKit/WebCore/ChangeLog b/third_party/WebKit/WebCore/ChangeLog index c6bf40b..836bc4e 100644 --- a/third_party/WebKit/WebCore/ChangeLog +++ b/third_party/WebKit/WebCore/ChangeLog @@ -1,3 +1,69 @@ +2010-05-06 Kenneth Russell <kbr@google.com> + + Reviewed by Dimitri Glazkov. + + WebCore::WebGLUnsignedIntArrayInternal::getCallback ReadAV@Arbitrary (deef89ee3d0345edebeaf13cf974c47c) + https://bugs.webkit.org/show_bug.cgi?id=38039 + + Web IDL now allows indexed getters and setters to be unnamed. Per + discussion in WebGL working group and recent update to spec, + removed the buggy get() and single-element set() methods from the + JavaScript bindings to the WebGL array types. Refactored set() + implementation in JSC bindings to share more code and modified V8 + binding to look more like it. Added unit tests for indexed getter + with out-of-range indices and verifying removal of get and + single-element set methods. Updated existing WebGL array tests. + + Tests: fast/canvas/webgl/array-get-and-set-method-removal.html + fast/canvas/webgl/array-get-out-of-bounds.html + + * bindings/js/JSWebGLArrayHelper.h: + (WebCore::setWebGLArrayHelper): + * bindings/js/JSWebGLByteArrayCustom.cpp: + (WebCore::JSWebGLByteArray::set): + * bindings/js/JSWebGLFloatArrayCustom.cpp: + (WebCore::JSWebGLFloatArray::set): + * bindings/js/JSWebGLIntArrayCustom.cpp: + (WebCore::JSWebGLIntArray::set): + * bindings/js/JSWebGLShortArrayCustom.cpp: + (WebCore::JSWebGLShortArray::set): + * bindings/js/JSWebGLUnsignedByteArrayCustom.cpp: + (WebCore::JSWebGLUnsignedByteArray::set): + * bindings/js/JSWebGLUnsignedIntArrayCustom.cpp: + (WebCore::JSWebGLUnsignedIntArray::set): + * bindings/js/JSWebGLUnsignedShortArrayCustom.cpp: + (WebCore::JSWebGLUnsignedShortArray::set): + * bindings/v8/custom/V8WebGLArrayCustom.h: + (WebCore::setWebGLArrayHelper): + * bindings/v8/custom/V8WebGLByteArrayCustom.cpp: + (WebCore::V8WebGLByteArray::setCallback): + * bindings/v8/custom/V8WebGLFloatArrayCustom.cpp: + (WebCore::V8WebGLFloatArray::setCallback): + * bindings/v8/custom/V8WebGLIntArrayCustom.cpp: + (WebCore::V8WebGLIntArray::setCallback): + * bindings/v8/custom/V8WebGLShortArrayCustom.cpp: + (WebCore::V8WebGLShortArray::setCallback): + * bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp: + (WebCore::V8WebGLUnsignedByteArray::setCallback): + * bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp: + (WebCore::V8WebGLUnsignedIntArray::setCallback): + * bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp: + (WebCore::V8WebGLUnsignedShortArray::setCallback): + * html/canvas/WebGLByteArray.h: + * html/canvas/WebGLByteArray.idl: + * html/canvas/WebGLFloatArray.h: + * html/canvas/WebGLFloatArray.idl: + * html/canvas/WebGLIntArray.h: + * html/canvas/WebGLIntArray.idl: + * html/canvas/WebGLShortArray.h: + * html/canvas/WebGLShortArray.idl: + * html/canvas/WebGLUnsignedByteArray.h: + * html/canvas/WebGLUnsignedByteArray.idl: + * html/canvas/WebGLUnsignedIntArray.h: + * html/canvas/WebGLUnsignedIntArray.idl: + * html/canvas/WebGLUnsignedShortArray.h: + * html/canvas/WebGLUnsignedShortArray.idl: + 2010-05-07 Pavel Feldman <pfeldman@chromium.org> Not reviewed: chromium dev tools tests fix. diff --git a/third_party/WebKit/WebCore/bindings/js/JSWebGLArrayHelper.h b/third_party/WebKit/WebCore/bindings/js/JSWebGLArrayHelper.h index 481c68f..c9b48f4 100644 --- a/third_party/WebKit/WebCore/bindings/js/JSWebGLArrayHelper.h +++ b/third_party/WebKit/WebCore/bindings/js/JSWebGLArrayHelper.h @@ -38,8 +38,23 @@ namespace WebCore { template <class T> -JSC::JSValue setWebGLArrayFromArray(JSC::ExecState* exec, T* webGLArray, JSC::ArgList const& args) +JSC::JSValue setWebGLArrayHelper(JSC::ExecState* exec, T* impl, JSC::ArgList const& args, T* (*conversionFunc)(JSC::JSValue)) { + if (args.size() < 1) + return throwError(exec, JSC::SyntaxError); + + T* array = (*conversionFunc)(args.at(0)); + if (array) { + // void set(in WebGL<T>Array array, [Optional] in unsigned long offset); + unsigned offset = 0; + if (args.size() == 2) + offset = args.at(1).toInt32(exec); + ExceptionCode ec = 0; + impl->set(array, offset, ec); + setDOMException(exec, ec); + return JSC::jsUndefined(); + } + if (args.at(0).isObject()) { // void set(in sequence<long> array, [Optional] in unsigned long offset); JSC::JSObject* array = JSC::asObject(args.at(0)); @@ -47,16 +62,16 @@ JSC::JSValue setWebGLArrayFromArray(JSC::ExecState* exec, T* webGLArray, JSC::Ar if (args.size() == 2) offset = args.at(1).toInt32(exec); uint32_t length = array->get(exec, JSC::Identifier(exec, "length")).toInt32(exec); - if (offset > webGLArray->length() || - offset + length > webGLArray->length() || - offset + length < offset) + if (offset > impl->length() + || offset + length > impl->length() + || offset + length < offset) setDOMException(exec, INDEX_SIZE_ERR); else { for (uint32_t i = 0; i < length; i++) { JSC::JSValue v = array->get(exec, i); if (exec->hadException()) return JSC::jsUndefined(); - webGLArray->set(i + offset, v.toNumber(exec)); + impl->set(i + offset, v.toNumber(exec)); } } diff --git a/third_party/WebKit/WebCore/bindings/js/JSWebGLByteArrayCustom.cpp b/third_party/WebKit/WebCore/bindings/js/JSWebGLByteArrayCustom.cpp index f7872a8..9ef632c 100644 --- a/third_party/WebKit/WebCore/bindings/js/JSWebGLByteArrayCustom.cpp +++ b/third_party/WebKit/WebCore/bindings/js/JSWebGLByteArrayCustom.cpp @@ -50,29 +50,7 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, WebGLBy JSC::JSValue JSWebGLByteArray::set(JSC::ExecState* exec, JSC::ArgList const& args) { - if (args.size() < 1 || args.size() > 2) - return throwError(exec, SyntaxError); - - if (args.size() == 2 && args.at(0).isInt32()) { - // void set(in unsigned long index, in long value); - unsigned index = args.at(0).toUInt32(exec); - impl()->set(index, static_cast<signed char>(args.at(1).toInt32(exec))); - return jsUndefined(); - } - - WebGLByteArray* array = toWebGLByteArray(args.at(0)); - if (array) { - // void set(in WebGLByteArray array, [Optional] in unsigned long offset); - unsigned offset = 0; - if (args.size() == 2) - offset = args.at(1).toInt32(exec); - ExceptionCode ec = 0; - impl()->set(array, offset, ec); - setDOMException(exec, ec); - return jsUndefined(); - } - - return setWebGLArrayFromArray(exec, impl(), args); + return setWebGLArrayHelper(exec, impl(), args, toWebGLByteArray); } } // namespace WebCore diff --git a/third_party/WebKit/WebCore/bindings/js/JSWebGLFloatArrayCustom.cpp b/third_party/WebKit/WebCore/bindings/js/JSWebGLFloatArrayCustom.cpp index f4acbcf..25615a2 100644 --- a/third_party/WebKit/WebCore/bindings/js/JSWebGLFloatArrayCustom.cpp +++ b/third_party/WebKit/WebCore/bindings/js/JSWebGLFloatArrayCustom.cpp @@ -48,29 +48,7 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, WebGLFl JSC::JSValue JSWebGLFloatArray::set(JSC::ExecState* exec, JSC::ArgList const& args) { - if (args.size() > 2) - return throwError(exec, SyntaxError); - - if (args.size() == 2 && args.at(0).isInt32()) { - // void set(in unsigned long index, in float value); - unsigned index = args.at(0).toUInt32(exec); - impl()->set(index, static_cast<float>(args.at(1).toNumber(exec))); - return jsUndefined(); - } - - WebGLFloatArray* array = toWebGLFloatArray(args.at(0)); - if (array) { - // void set(in WebGLFloatArray array, [Optional] in unsigned long offset); - unsigned offset = 0; - if (args.size() == 2) - offset = args.at(1).toInt32(exec); - ExceptionCode ec = 0; - impl()->set(array, offset, ec); - setDOMException(exec, ec); - return jsUndefined(); - } - - return setWebGLArrayFromArray(exec, impl(), args); + return setWebGLArrayHelper(exec, impl(), args, toWebGLFloatArray); } } // namespace WebCore diff --git a/third_party/WebKit/WebCore/bindings/js/JSWebGLIntArrayCustom.cpp b/third_party/WebKit/WebCore/bindings/js/JSWebGLIntArrayCustom.cpp index de08256..704c4ab 100644 --- a/third_party/WebKit/WebCore/bindings/js/JSWebGLIntArrayCustom.cpp +++ b/third_party/WebKit/WebCore/bindings/js/JSWebGLIntArrayCustom.cpp @@ -48,29 +48,7 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, WebGLIn JSC::JSValue JSWebGLIntArray::set(JSC::ExecState* exec, JSC::ArgList const& args) { - if (args.size() > 2) - return throwError(exec, SyntaxError); - - if (args.size() == 2 && args.at(0).isInt32()) { - // void set(in unsigned long index, in long value); - unsigned index = args.at(0).toUInt32(exec); - impl()->set(index, static_cast<signed int>(args.at(1).toInt32(exec))); - return jsUndefined(); - } - - WebGLIntArray* array = toWebGLIntArray(args.at(0)); - if (array) { - // void set(in WebGLIntArray array, [Optional] in unsigned long offset); - unsigned offset = 0; - if (args.size() == 2) - offset = args.at(1).toInt32(exec); - ExceptionCode ec = 0; - impl()->set(array, offset, ec); - setDOMException(exec, ec); - return jsUndefined(); - } - - return setWebGLArrayFromArray(exec, impl(), args); + return setWebGLArrayHelper(exec, impl(), args, toWebGLIntArray); } } // namespace WebCore diff --git a/third_party/WebKit/WebCore/bindings/js/JSWebGLShortArrayCustom.cpp b/third_party/WebKit/WebCore/bindings/js/JSWebGLShortArrayCustom.cpp index 899b0c9..84978e4 100644 --- a/third_party/WebKit/WebCore/bindings/js/JSWebGLShortArrayCustom.cpp +++ b/third_party/WebKit/WebCore/bindings/js/JSWebGLShortArrayCustom.cpp @@ -48,29 +48,7 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, WebGLSh JSC::JSValue JSWebGLShortArray::set(JSC::ExecState* exec, JSC::ArgList const& args) { - if (args.size() > 2) - return throwError(exec, SyntaxError); - - if (args.size() == 2 && args.at(0).isInt32()) { - // void set(in unsigned long index, in long value); - unsigned index = args.at(0).toUInt32(exec); - impl()->set(index, static_cast<signed short>(args.at(1).toInt32(exec))); - return jsUndefined(); - } - - WebGLShortArray* shortArray = toWebGLShortArray(args.at(0)); - if (shortArray) { - // void set(in WebGLShortArray array, [Optional] in unsigned long offset); - unsigned offset = 0; - if (args.size() == 2) - offset = args.at(1).toInt32(exec); - ExceptionCode ec = 0; - impl()->set(shortArray, offset, ec); - setDOMException(exec, ec); - return jsUndefined(); - } - - return setWebGLArrayFromArray(exec, impl(), args); + return setWebGLArrayHelper(exec, impl(), args, toWebGLShortArray); } } // namespace WebCore diff --git a/third_party/WebKit/WebCore/bindings/js/JSWebGLUnsignedByteArrayCustom.cpp b/third_party/WebKit/WebCore/bindings/js/JSWebGLUnsignedByteArrayCustom.cpp index b576374..26f7cd2 100644 --- a/third_party/WebKit/WebCore/bindings/js/JSWebGLUnsignedByteArrayCustom.cpp +++ b/third_party/WebKit/WebCore/bindings/js/JSWebGLUnsignedByteArrayCustom.cpp @@ -48,29 +48,7 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, WebGLUn JSC::JSValue JSWebGLUnsignedByteArray::set(JSC::ExecState* exec, JSC::ArgList const& args) { - if (args.size() > 2) - return throwError(exec, SyntaxError); - - if (args.size() == 2 && args.at(0).isInt32()) { - // void set(in unsigned long index, in long value); - unsigned index = args.at(0).toUInt32(exec); - impl()->set(index, static_cast<unsigned char>(args.at(1).toInt32(exec))); - return jsUndefined(); - } - - WebGLUnsignedByteArray* array = toWebGLUnsignedByteArray(args.at(0)); - if (array) { - // void set(in WebGLUnsignedByteArray array, [Optional] in unsigned long offset); - unsigned offset = 0; - if (args.size() == 2) - offset = args.at(1).toInt32(exec); - ExceptionCode ec = 0; - impl()->set(array, offset, ec); - setDOMException(exec, ec); - return jsUndefined(); - } - - return setWebGLArrayFromArray(exec, impl(), args); + return setWebGLArrayHelper(exec, impl(), args, toWebGLUnsignedByteArray); } } // namespace WebCore diff --git a/third_party/WebKit/WebCore/bindings/js/JSWebGLUnsignedIntArrayCustom.cpp b/third_party/WebKit/WebCore/bindings/js/JSWebGLUnsignedIntArrayCustom.cpp index c8b7454..c531d04 100644 --- a/third_party/WebKit/WebCore/bindings/js/JSWebGLUnsignedIntArrayCustom.cpp +++ b/third_party/WebKit/WebCore/bindings/js/JSWebGLUnsignedIntArrayCustom.cpp @@ -48,29 +48,7 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, WebGLUn JSC::JSValue JSWebGLUnsignedIntArray::set(JSC::ExecState* exec, JSC::ArgList const& args) { - if (args.size() > 2) - return throwError(exec, SyntaxError); - - if (args.size() == 2 && args.at(0).isInt32()) { - // void set(in unsigned long index, in long value); - unsigned index = args.at(0).toUInt32(exec); - impl()->set(index, static_cast<unsigned int>(args.at(1).toUInt32(exec))); - return jsUndefined(); - } - - WebGLUnsignedIntArray* array = toWebGLUnsignedIntArray(args.at(0)); - if (array) { - // void set(in WebGLUnsignedIntArray array, [Optional] in unsigned long offset); - unsigned offset = 0; - if (args.size() == 2) - offset = args.at(1).toInt32(exec); - ExceptionCode ec = 0; - impl()->set(array, offset, ec); - setDOMException(exec, ec); - return jsUndefined(); - } - - return setWebGLArrayFromArray(exec, impl(), args); + return setWebGLArrayHelper(exec, impl(), args, toWebGLUnsignedIntArray); } } // namespace WebCore diff --git a/third_party/WebKit/WebCore/bindings/js/JSWebGLUnsignedShortArrayCustom.cpp b/third_party/WebKit/WebCore/bindings/js/JSWebGLUnsignedShortArrayCustom.cpp index 0c82c3e..14a360a 100644 --- a/third_party/WebKit/WebCore/bindings/js/JSWebGLUnsignedShortArrayCustom.cpp +++ b/third_party/WebKit/WebCore/bindings/js/JSWebGLUnsignedShortArrayCustom.cpp @@ -48,29 +48,7 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, WebGLUn JSC::JSValue JSWebGLUnsignedShortArray::set(JSC::ExecState* exec, JSC::ArgList const& args) { - if (args.size() > 2) - return throwError(exec, SyntaxError); - - if (args.size() == 2 && args.at(0).isInt32()) { - // void set(in unsigned long index, in long value); - unsigned index = args.at(0).toUInt32(exec); - impl()->set(index, static_cast<unsigned short>(args.at(1).toInt32(exec))); - return jsUndefined(); - } - - WebGLUnsignedShortArray* array = toWebGLUnsignedShortArray(args.at(0)); - if (array) { - // void set(in WebGLUnsignedShortArray array, [Optional] in unsigned long offset); - unsigned offset = 0; - if (args.size() == 2) - offset = args.at(1).toInt32(exec); - ExceptionCode ec = 0; - impl()->set(array, offset, ec); - setDOMException(exec, ec); - return jsUndefined(); - } - - return setWebGLArrayFromArray(exec, impl(), args); + return setWebGLArrayHelper(exec, impl(), args, toWebGLUnsignedShortArray); } } // namespace WebCore diff --git a/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h b/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h index 02bce9c..6015dd9 100644 --- a/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h +++ b/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h @@ -128,46 +128,15 @@ v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args, WrapperType return toV8(array.release(), args.Holder()); } -template <class T> -v8::Handle<v8::Value> setWebGLArrayFromArray(T* webGLArray, const v8::Arguments& args) -{ - if (args[0]->IsObject()) { - // void set(in sequence<long> array, [Optional] in unsigned long offset); - v8::Local<v8::Object> array = args[0]->ToObject(); - uint32_t offset = 0; - if (args.Length() == 2) - offset = toUInt32(args[1]); - uint32_t length = toUInt32(array->Get(v8::String::New("length"))); - if (offset > webGLArray->length() || - offset + length > webGLArray->length() || - offset + length < offset) - // Out of range offset or overflow - V8Proxy::setDOMException(INDEX_SIZE_ERR); - else - for (uint32_t i = 0; i < length; i++) - webGLArray->set(offset + i, array->Get(v8::Integer::NewFromUnsigned(i))->NumberValue()); - } - - return v8::Undefined(); -} - template <class CPlusPlusArrayType, class JavaScriptWrapperArrayType> -v8::Handle<v8::Value> setWebGLArray(const v8::Arguments& args) +v8::Handle<v8::Value> setWebGLArrayHelper(const v8::Arguments& args) { - if (args.Length() < 1 || args.Length() > 2) { + if (args.Length() < 1) { V8Proxy::setDOMException(SYNTAX_ERR); return notHandledByInterceptor(); } - CPlusPlusArrayType* array = JavaScriptWrapperArrayType::toNative(args.Holder()); - - // FIXME: change to IsUInt32() when available - if (args.Length() == 2 && args[0]->IsInt32()) { - // void set(in unsigned long index, in {long|float} value); - uint32_t index = toUInt32(args[0]); - array->set(index, args[1]->NumberValue()); - return v8::Undefined(); - } + CPlusPlusArrayType* impl = JavaScriptWrapperArrayType::toNative(args.Holder()); if (JavaScriptWrapperArrayType::HasInstance(args[0])) { // void set(in WebGL<T>Array array, [Optional] in unsigned long offset); @@ -176,12 +145,32 @@ v8::Handle<v8::Value> setWebGLArray(const v8::Arguments& args) if (args.Length() == 2) offset = toUInt32(args[1]); ExceptionCode ec = 0; - array->set(src, offset, ec); + impl->set(src, offset, ec); V8Proxy::setDOMException(ec); return v8::Undefined(); } - return setWebGLArrayFromArray(array, args); + if (args[0]->IsObject()) { + // void set(in sequence<long> array, [Optional] in unsigned long offset); + v8::Local<v8::Object> array = args[0]->ToObject(); + uint32_t offset = 0; + if (args.Length() == 2) + offset = toUInt32(args[1]); + uint32_t length = toUInt32(array->Get(v8::String::New("length"))); + if (offset > impl->length() + || offset + length > impl->length() + || offset + length < offset) + // Out of range offset or overflow + V8Proxy::setDOMException(INDEX_SIZE_ERR); + else + for (uint32_t i = 0; i < length; i++) + impl->set(offset + i, array->Get(v8::Integer::NewFromUnsigned(i))->NumberValue()); + + return v8::Undefined(); + } + + V8Proxy::setDOMException(SYNTAX_ERR); + return notHandledByInterceptor(); } } diff --git a/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp b/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp index 8487ace..3e98ec2 100644 --- a/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp +++ b/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp @@ -53,7 +53,7 @@ v8::Handle<v8::Value> V8WebGLByteArray::constructorCallback(const v8::Arguments& v8::Handle<v8::Value> V8WebGLByteArray::setCallback(const v8::Arguments& args) { INC_STATS("DOM.WebGLByteArray.set()"); - return setWebGLArray<WebGLByteArray, V8WebGLByteArray>(args); + return setWebGLArrayHelper<WebGLByteArray, V8WebGLByteArray>(args); } v8::Handle<v8::Value> toV8(WebGLByteArray* impl) diff --git a/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp b/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp index 77223ea..71b3e76 100644 --- a/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp +++ b/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp @@ -53,7 +53,7 @@ v8::Handle<v8::Value> V8WebGLFloatArray::constructorCallback(const v8::Arguments v8::Handle<v8::Value> V8WebGLFloatArray::setCallback(const v8::Arguments& args) { INC_STATS("DOM.WebGLFloatArray.set()"); - return setWebGLArray<WebGLFloatArray, V8WebGLFloatArray>(args); + return setWebGLArrayHelper<WebGLFloatArray, V8WebGLFloatArray>(args); } v8::Handle<v8::Value> toV8(WebGLFloatArray* impl) diff --git a/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp b/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp index 532bdef..70036d2 100644 --- a/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp +++ b/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp @@ -53,7 +53,7 @@ v8::Handle<v8::Value> V8WebGLIntArray::constructorCallback(const v8::Arguments& v8::Handle<v8::Value> V8WebGLIntArray::setCallback(const v8::Arguments& args) { INC_STATS("DOM.WebGLIntArray.set()"); - return setWebGLArray<WebGLIntArray, V8WebGLIntArray>(args); + return setWebGLArrayHelper<WebGLIntArray, V8WebGLIntArray>(args); } v8::Handle<v8::Value> toV8(WebGLIntArray* impl) diff --git a/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp b/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp index 328f227..663d70b 100644 --- a/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp +++ b/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp @@ -53,7 +53,7 @@ v8::Handle<v8::Value> V8WebGLShortArray::constructorCallback(const v8::Arguments v8::Handle<v8::Value> V8WebGLShortArray::setCallback(const v8::Arguments& args) { INC_STATS("DOM.WebGLShortArray.set()"); - return setWebGLArray<WebGLShortArray, V8WebGLShortArray>(args); + return setWebGLArrayHelper<WebGLShortArray, V8WebGLShortArray>(args); } v8::Handle<v8::Value> toV8(WebGLShortArray* impl) diff --git a/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp b/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp index 5185298..8256a31 100644 --- a/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp +++ b/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp @@ -53,7 +53,7 @@ v8::Handle<v8::Value> V8WebGLUnsignedByteArray::constructorCallback(const v8::Ar v8::Handle<v8::Value> V8WebGLUnsignedByteArray::setCallback(const v8::Arguments& args) { INC_STATS("DOM.WebGLUnsignedByteArray.set()"); - return setWebGLArray<WebGLUnsignedByteArray, V8WebGLUnsignedByteArray>(args); + return setWebGLArrayHelper<WebGLUnsignedByteArray, V8WebGLUnsignedByteArray>(args); } v8::Handle<v8::Value> toV8(WebGLUnsignedByteArray* impl) diff --git a/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp b/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp index 14aa1bb..1742eb8 100644 --- a/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp +++ b/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp @@ -53,7 +53,7 @@ v8::Handle<v8::Value> V8WebGLUnsignedIntArray::constructorCallback(const v8::Arg v8::Handle<v8::Value> V8WebGLUnsignedIntArray::setCallback(const v8::Arguments& args) { INC_STATS("DOM.WebGLUnsignedIntArray.set()"); - return setWebGLArray<WebGLUnsignedIntArray, V8WebGLUnsignedIntArray>(args); + return setWebGLArrayHelper<WebGLUnsignedIntArray, V8WebGLUnsignedIntArray>(args); } v8::Handle<v8::Value> toV8(WebGLUnsignedIntArray* impl) diff --git a/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp b/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp index e9ebb4f..de9c6a3 100644 --- a/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp +++ b/third_party/WebKit/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp @@ -53,7 +53,7 @@ v8::Handle<v8::Value> V8WebGLUnsignedShortArray::constructorCallback(const v8::A v8::Handle<v8::Value> V8WebGLUnsignedShortArray::setCallback(const v8::Arguments& args) { INC_STATS("DOM.WebGLUnsignedShortArray.set()"); - return setWebGLArray<WebGLUnsignedShortArray, V8WebGLUnsignedShortArray>(args); + return setWebGLArrayHelper<WebGLUnsignedShortArray, V8WebGLUnsignedShortArray>(args); } v8::Handle<v8::Value> toV8(WebGLUnsignedShortArray* impl) diff --git a/third_party/WebKit/WebCore/html/canvas/WebGLByteArray.h b/third_party/WebKit/WebCore/html/canvas/WebGLByteArray.h index 60d301c..1214905 100644 --- a/third_party/WebKit/WebCore/html/canvas/WebGLByteArray.h +++ b/third_party/WebKit/WebCore/html/canvas/WebGLByteArray.h @@ -65,20 +65,8 @@ class WebGLByteArray : public WebGLArray { storage[index] = static_cast<signed char>(value); } - bool get(unsigned index, signed char& result) const - { - if (index >= m_size) - return false; - signed char* storage = static_cast<signed char*>(m_baseAddress); - result = storage[index]; - return true; - } - - signed char get(unsigned index) const - { - return item(index); - } - + // Invoked by the indexed getter. Does not perform range checks; caller + // is responsible for doing so and returning undefined as necessary. signed char item(unsigned index) const { ASSERT(index < m_size); diff --git a/third_party/WebKit/WebCore/html/canvas/WebGLByteArray.idl b/third_party/WebKit/WebCore/html/canvas/WebGLByteArray.idl index dbb3bb2..8974c6c 100644 --- a/third_party/WebKit/WebCore/html/canvas/WebGLByteArray.idl +++ b/third_party/WebKit/WebCore/html/canvas/WebGLByteArray.idl @@ -33,8 +33,6 @@ module html { CustomConstructor, CustomToJS ] WebGLByteArray : WebGLArray { - long get(in unsigned long index); - // void set(in unsigned long index, in long value); // void set(in WebGLByteArray array, [Optional] in unsigned long offset); // void set(in sequence<long> array, [Optional] in unsigned long offset); [Custom] void set(); diff --git a/third_party/WebKit/WebCore/html/canvas/WebGLFloatArray.h b/third_party/WebKit/WebCore/html/canvas/WebGLFloatArray.h index 5b4e6c9..3ae4718 100644 --- a/third_party/WebKit/WebCore/html/canvas/WebGLFloatArray.h +++ b/third_party/WebKit/WebCore/html/canvas/WebGLFloatArray.h @@ -58,19 +58,8 @@ class WebGLFloatArray : public WebGLArray { storage[index] = static_cast<float>(value); } - bool get(unsigned index, float& result) const - { - if (index >= m_size) - return false; - result = item(index); - return true; - } - - float get(unsigned index) const - { - return item(index); - } - + // Invoked by the indexed getter. Does not perform range checks; caller + // is responsible for doing so and returning undefined as necessary. float item(unsigned index) const { ASSERT(index < m_size); diff --git a/third_party/WebKit/WebCore/html/canvas/WebGLFloatArray.idl b/third_party/WebKit/WebCore/html/canvas/WebGLFloatArray.idl index e0a80f2..2d4cd47 100644 --- a/third_party/WebKit/WebCore/html/canvas/WebGLFloatArray.idl +++ b/third_party/WebKit/WebCore/html/canvas/WebGLFloatArray.idl @@ -33,8 +33,6 @@ module html { CustomConstructor, CustomToJS ] WebGLFloatArray : WebGLArray { - float get(in unsigned long index); - // void set(in unsigned long index, in float value); // void set(in WebGLFloatArray array, [Optional] in unsigned long offset); // void set(in sequence<long> array, [Optional] in unsigned long offset); [Custom] void set(); diff --git a/third_party/WebKit/WebCore/html/canvas/WebGLIntArray.h b/third_party/WebKit/WebCore/html/canvas/WebGLIntArray.h index 5929e75..c811dc8 100644 --- a/third_party/WebKit/WebCore/html/canvas/WebGLIntArray.h +++ b/third_party/WebKit/WebCore/html/canvas/WebGLIntArray.h @@ -63,19 +63,8 @@ class WebGLIntArray : public WebGLArray { storage[index] = static_cast<int>(value); } - bool get(unsigned index, int& result) const - { - if (index >= m_size) - return false; - result = item(index); - return true; - } - - int get(unsigned index) const - { - return item(index); - } - + // Invoked by the indexed getter. Does not perform range checks; caller + // is responsible for doing so and returning undefined as necessary. int item(unsigned index) const { ASSERT(index < m_size); diff --git a/third_party/WebKit/WebCore/html/canvas/WebGLIntArray.idl b/third_party/WebKit/WebCore/html/canvas/WebGLIntArray.idl index ef0d92f..a3d900c 100644 --- a/third_party/WebKit/WebCore/html/canvas/WebGLIntArray.idl +++ b/third_party/WebKit/WebCore/html/canvas/WebGLIntArray.idl @@ -33,8 +33,6 @@ module html { CustomConstructor, CustomToJS ] WebGLIntArray : WebGLArray { - long get(in unsigned long index); - // void set(in unsigned long index, in long value); // void set(in WebGLIntArray array, [Optional] in unsigned long offset); // void set(in sequence<long> array, [Optional] in unsigned long offset); [Custom] void set(); diff --git a/third_party/WebKit/WebCore/html/canvas/WebGLShortArray.h b/third_party/WebKit/WebCore/html/canvas/WebGLShortArray.h index af4befb..89d12a2 100644 --- a/third_party/WebKit/WebCore/html/canvas/WebGLShortArray.h +++ b/third_party/WebKit/WebCore/html/canvas/WebGLShortArray.h @@ -62,19 +62,8 @@ class WebGLShortArray : public WebGLArray { storage[index] = static_cast<short>(value); } - bool get(unsigned index, short& result) const - { - if (index >= m_size) - return false; - result = item(index); - return true; - } - - short get(unsigned index) const - { - return item(index); - } - + // Invoked by the indexed getter. Does not perform range checks; caller + // is responsible for doing so and returning undefined as necessary. short item(unsigned index) const { ASSERT(index < m_size); diff --git a/third_party/WebKit/WebCore/html/canvas/WebGLShortArray.idl b/third_party/WebKit/WebCore/html/canvas/WebGLShortArray.idl index 59dce76..9ad32c0 100644 --- a/third_party/WebKit/WebCore/html/canvas/WebGLShortArray.idl +++ b/third_party/WebKit/WebCore/html/canvas/WebGLShortArray.idl @@ -32,8 +32,6 @@ module html { CustomConstructor, CustomToJS ] WebGLShortArray : WebGLArray { - long get(in unsigned long index); - // void set(in unsigned long index, in long value); // void set(in WebGLShortArray array, [Optional] in unsigned long offset); // void set(in sequence<long> array, [Optional] in unsigned long offset); [Custom] void set(); diff --git a/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedByteArray.h b/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedByteArray.h index 505b2fd..c8d49db 100644 --- a/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedByteArray.h +++ b/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedByteArray.h @@ -63,19 +63,8 @@ class WebGLUnsignedByteArray : public WebGLArray { storage[index] = static_cast<unsigned char>(value); } - bool get(unsigned index, unsigned char& result) const - { - if (index >= m_size) - return false; - result = item(index); - return true; - } - - unsigned char get(unsigned index) const - { - return item(index); - } - + // Invoked by the indexed getter. Does not perform range checks; caller + // is responsible for doing so and returning undefined as necessary. unsigned char item(unsigned index) const { ASSERT(index < m_size); diff --git a/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedByteArray.idl b/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedByteArray.idl index 4de8b42..80cf4d6 100644 --- a/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedByteArray.idl +++ b/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedByteArray.idl @@ -33,8 +33,6 @@ module html { CustomConstructor, CustomToJS ] WebGLUnsignedByteArray : WebGLArray { - long get(in unsigned long index); - // void set(in unsigned long index, in long value); // void set(in WebGLUnsignedByteArray array, [Optional] in unsigned long offset); // void set(in sequence<long> array, [Optional] in unsigned long offset); [Custom] void set(); diff --git a/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedIntArray.h b/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedIntArray.h index 6e9b220..c8b94c7 100644 --- a/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedIntArray.h +++ b/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedIntArray.h @@ -63,19 +63,8 @@ class WebGLUnsignedIntArray : public WebGLArray { storage[index] = static_cast<unsigned int>(value); } - bool get(unsigned index, unsigned int& result) const - { - if (index >= m_size) - return false; - result = item(index); - return true; - } - - unsigned int get(unsigned index) const - { - return item(index); - } - + // Invoked by the indexed getter. Does not perform range checks; caller + // is responsible for doing so and returning undefined as necessary. unsigned int item(unsigned index) const { ASSERT(index < m_size); diff --git a/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedIntArray.idl b/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedIntArray.idl index 75ff598..ebacd90 100644 --- a/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedIntArray.idl +++ b/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedIntArray.idl @@ -33,8 +33,6 @@ module html { GenerateNativeConverter, CustomToJS ] WebGLUnsignedIntArray : WebGLArray { - unsigned long get(in unsigned long index); - // void set(in unsigned long index, in long value); // void set(in WebGLUnsignedIntArray array, [Optional] in unsigned long offset); // void set(in sequence<long> array, [Optional] in unsigned long offset); [Custom] void set(); diff --git a/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedShortArray.h b/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedShortArray.h index 94b428a..892430a 100644 --- a/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedShortArray.h +++ b/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedShortArray.h @@ -63,20 +63,8 @@ class WebGLUnsignedShortArray : public WebGLArray { storage[index] = static_cast<unsigned short>(value); } - bool get(unsigned index, unsigned short& result) const - { - if (index >= m_size) - return false; - unsigned short* storage = static_cast<unsigned short*>(m_baseAddress); - result = storage[index]; - return true; - } - - unsigned short get(unsigned index) const - { - return item(index); - } - + // Invoked by the indexed getter. Does not perform range checks; caller + // is responsible for doing so and returning undefined as necessary. unsigned short item(unsigned index) const { ASSERT(index < m_size); diff --git a/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedShortArray.idl b/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedShortArray.idl index fc53929..753c6d1 100644 --- a/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedShortArray.idl +++ b/third_party/WebKit/WebCore/html/canvas/WebGLUnsignedShortArray.idl @@ -33,8 +33,6 @@ module html { GenerateNativeConverter, CustomToJS ] WebGLUnsignedShortArray : WebGLArray { - long get(in unsigned long index); - // void set(in unsigned long index, in long value); // void set(in WebGLUnsignedShortArray array, [Optional] in unsigned long offset); // void set(in sequence<long> array, [Optional] in unsigned long offset); [Custom] void set(); |