diff options
author | dslomov@chromium.org <dslomov@chromium.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2013-07-23 21:54:25 +0000 |
---|---|---|
committer | dslomov@chromium.org <dslomov@chromium.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2013-07-23 21:54:25 +0000 |
commit | ae6f64288493d41cc52af1f382e5169060b3445d (patch) | |
tree | 7a991e08c3cf71546618feb32f4dec27850877d5 | |
parent | d6c1215f20b0b6b01f5c7baaddfb42cd3c742af7 (diff) | |
download | chromium_src-ae6f64288493d41cc52af1f382e5169060b3445d.zip chromium_src-ae6f64288493d41cc52af1f382e5169060b3445d.tar.gz chromium_src-ae6f64288493d41cc52af1f382e5169060b3445d.tar.bz2 |
Revert 154741 "Use V8 implementation of TypedArrays and DataView..."
Broke webgl conformance tests for DataView.
> Use V8 implementation of TypedArrays and DataView in Blink
>
> R=jochen@chromium.org,kbr@chromium.org
> BUG=259731
>
> Review URL: https://chromiumcodereview.appspot.com/19230002
TBR=dslomov@chromium.org
Review URL: https://codereview.chromium.org/20063002
git-svn-id: svn://svn.chromium.org/blink/trunk@154783 bbb929c8-8fbe-4397-9dbb-9b2b20218538
56 files changed, 1128 insertions, 1831 deletions
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 7b2ff80..3f61a57 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations @@ -1363,9 +1363,6 @@ crbug.com/241665 fast/events/touch/emulate-touch-events.html [ Failure Pass ] crbug.com/242511 [ Mac Debug ] svg/custom/uri-reference-handling.svg [ Crash Pass ] -crbug.com/260660 fast/canvas/webgl/array-large-array-tests.html [ Crash ] -crbug.com/260660 virtual/gpu/fast/canvas/webgl/array-large-array-tests.html [ Crash ] - # Seems to be flaky on all platforms crbug.com/244921 http/tests/navigation/back-twice-without-commit.html [ Failure Pass ] diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-large-array-tests-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-large-array-tests-expected.txt deleted file mode 100644 index 66b8bcb..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-large-array-tests-expected.txt +++ /dev/null @@ -1,14 +0,0 @@ -Verifies allocation of large array buffers - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - -PASS Construction of huge Float32Array threw exception -PASS Construction of huge Float64Array threw exception -PASS Construction of huge Int16Array threw exception -PASS Construction of huge Int32Array threw exception -PASS Construction of huge Uint16Array threw exception -PASS Construction of huge Uint32Array threw exception -PASS successfullyParsed is true - -TEST COMPLETE - diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-large-array-tests.html b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-large-array-tests.html deleted file mode 100644 index 0d63287..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-large-array-tests.html +++ /dev/null @@ -1,101 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset="utf-8"> -<link rel="stylesheet" href="../../resources/js-test-style.css"/> -<script src="../../js/resources/js-test-pre.js"></script> -<script src="resources/webgl-test.js"></script> -<script src="resources/typed-array-test-cases.js"></script> -</head> -<body> -<div id="description"></div> -<div id="console"></div> - -<script> -description("Verifies allocation of large array buffers"); - -var currentlyRunning = ''; -var allPassed = true; -function running(str) { - currentlyRunning = str; -} - -function output(str) { - debug(str); -} - -function pass() { - testPassed(currentlyRunning); -} - -function fail(str) { - allPassed = false; - var exc; - if (str) - exc = currentlyRunning + ': ' + str; - else - exc = currentlyRunning; - testFailed(exc); -} - -function assertEq(prefix, expected, val) { - if (expected != val) { - var str = prefix + ': expected ' + expected + ', got ' + val; - throw str; - } -} - -function assert(prefix, expected) { - if (!expected) { - var str = prefix + ': expected value / true'; - throw str; - } -} - -function printSummary() { - if (allPassed) { - debug("Test passed."); - } else { - debug("TEST FAILED"); - } -} - - -function testConstructionOfHugeArray(type, name, sz) { - if (sz == 1) - return; - try { - // Construction of huge arrays must fail because byteLength is - // an unsigned long - array = new type(3000000000); - testFailed("Construction of huge " + name + " should throw exception"); - } catch (e) { - testPassed("Construction of huge " + name + " threw exception"); - } -} - -function runTests() { - allPassed = true; - - for (var i = 0; i < testCases.length; i++) { - var testCase = testCases[i]; - running(testCase.name); - if (!(testCase.name in window)) { - fail("does not exist"); - continue; - } - var type = window[testCase.name]; - var name = testCase.name; - testConstructionOfHugeArray(type, name, testCase.elementSizeInBytes); - } -} - -runTests(); -var 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-set-invalid-arguments-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-set-invalid-arguments-expected.txt index bae03bc..6e5bd04 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-set-invalid-arguments-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-set-invalid-arguments-expected.txt @@ -2,27 +2,27 @@ Verifies that attempting to set invalid elements to a Typed Array throws an exce On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -PASS typedArray.set() threw exception TypeError: Cannot read property 'length' of undefined. -PASS typedArray.set('hello world') threw exception RangeError: Source is too large. -PASS typedArray.set(otherArray, 1) threw exception RangeError: Source is too large. -PASS typedArray.set() threw exception TypeError: Cannot read property 'length' of undefined. -PASS typedArray.set('hello world') threw exception RangeError: Source is too large. -PASS typedArray.set(otherArray, 1) threw exception RangeError: Source is too large. -PASS typedArray.set() threw exception TypeError: Cannot read property 'length' of undefined. -PASS typedArray.set('hello world') threw exception RangeError: Source is too large. -PASS typedArray.set(otherArray, 1) threw exception RangeError: Source is too large. -PASS typedArray.set() threw exception TypeError: Cannot read property 'length' of undefined. -PASS typedArray.set('hello world') threw exception RangeError: Source is too large. -PASS typedArray.set(otherArray, 1) threw exception RangeError: Source is too large. -PASS typedArray.set() threw exception TypeError: Cannot read property 'length' of undefined. -PASS typedArray.set('hello world') threw exception RangeError: Source is too large. -PASS typedArray.set(otherArray, 1) threw exception RangeError: Source is too large. -PASS typedArray.set() threw exception TypeError: Cannot read property 'length' of undefined. -PASS typedArray.set('hello world') threw exception RangeError: Source is too large. -PASS typedArray.set(otherArray, 1) threw exception RangeError: Source is too large. -PASS typedArray.set() threw exception TypeError: Cannot read property 'length' of undefined. -PASS typedArray.set('hello world') threw exception RangeError: Source is too large. -PASS typedArray.set(otherArray, 1) threw exception RangeError: Source is too large. +PASS typedArray.set() threw exception TypeError: Not enough arguments. +PASS typedArray.set('hello world') threw exception TypeError: Invalid argument. +PASS typedArray.set(otherArray, 1) threw exception RangeError: Index is out of range.. +PASS typedArray.set() threw exception TypeError: Not enough arguments. +PASS typedArray.set('hello world') threw exception TypeError: Invalid argument. +PASS typedArray.set(otherArray, 1) threw exception RangeError: Index is out of range.. +PASS typedArray.set() threw exception TypeError: Not enough arguments. +PASS typedArray.set('hello world') threw exception TypeError: Invalid argument. +PASS typedArray.set(otherArray, 1) threw exception RangeError: Index is out of range.. +PASS typedArray.set() threw exception TypeError: Not enough arguments. +PASS typedArray.set('hello world') threw exception TypeError: Invalid argument. +PASS typedArray.set(otherArray, 1) threw exception RangeError: Index is out of range.. +PASS typedArray.set() threw exception TypeError: Not enough arguments. +PASS typedArray.set('hello world') threw exception TypeError: Invalid argument. +PASS typedArray.set(otherArray, 1) threw exception RangeError: Index is out of range.. +PASS typedArray.set() threw exception TypeError: Not enough arguments. +PASS typedArray.set('hello world') threw exception TypeError: Invalid argument. +PASS typedArray.set(otherArray, 1) threw exception RangeError: Index is out of range.. +PASS typedArray.set() threw exception TypeError: Not enough arguments. +PASS typedArray.set('hello world') threw exception TypeError: Invalid argument. +PASS typedArray.set(otherArray, 1) threw exception RangeError: Index is out of range.. PASS successfullyParsed is true TEST COMPLETE diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-set-out-of-bounds-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-set-out-of-bounds-expected.txt index cd91ae1..bcc7d85 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-set-out-of-bounds-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-set-out-of-bounds-expected.txt @@ -4,26 +4,26 @@ 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=33352 : Passing array that is too large to set method of WebGLArrays does not throw an exception Testing Int8Array -PASS webGLArray.set([4, 5], 1) threw exception RangeError: Source is too large. -PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Source is too large. +PASS webGLArray.set([4, 5], 1) threw exception RangeError: Index is out of range.. +PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Index is out of range.. Testing Uint8Array -PASS webGLArray.set([4, 5], 1) threw exception RangeError: Source is too large. -PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Source is too large. +PASS webGLArray.set([4, 5], 1) threw exception RangeError: Index is out of range.. +PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Index is out of range.. Testing Int16Array -PASS webGLArray.set([4, 5], 1) threw exception RangeError: Source is too large. -PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Source is too large. +PASS webGLArray.set([4, 5], 1) threw exception RangeError: Index is out of range.. +PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Index is out of range.. Testing Uint16Array -PASS webGLArray.set([4, 5], 1) threw exception RangeError: Source is too large. -PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Source is too large. +PASS webGLArray.set([4, 5], 1) threw exception RangeError: Index is out of range.. +PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Index is out of range.. Testing Int32Array -PASS webGLArray.set([4, 5], 1) threw exception RangeError: Source is too large. -PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Source is too large. +PASS webGLArray.set([4, 5], 1) threw exception RangeError: Index is out of range.. +PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Index is out of range.. Testing Uint32Array -PASS webGLArray.set([4, 5], 1) threw exception RangeError: Source is too large. -PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Source is too large. +PASS webGLArray.set([4, 5], 1) threw exception RangeError: Index is out of range.. +PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Index is out of range.. Testing Float32Array -PASS webGLArray.set([4, 5], 1) threw exception RangeError: Source is too large. -PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Source is too large. +PASS webGLArray.set([4, 5], 1) threw exception RangeError: Index is out of range.. +PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Index is out of range.. PASS successfullyParsed is true TEST COMPLETE 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 21d3c33..b9d69e9 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 @@ -5,7 +5,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE PASS testSlice test inheritance hierarchy of typed array views PASS ArrayBufferView has [NoInterfaceObject] extended attribute and was (correctly) not defined -PASS new Uint8ClampedArray(1) instanceof Uint8Array is false +PASS new Uint8ClampedArray(1) instanceof Uint8Array is true PASS test Float32Array SetAndGetPos10ToNeg10 PASS test Float32Array ConstructWithArrayOfSignedValues PASS test Float32Array ConstructWithTypedArrayOfSignedValues @@ -34,6 +34,7 @@ PASS Construction of Float32Array with negative size threw exception PASS Construction of Float32Array with negative out-of-range values threw an exception PASS Construction of Float32Array with unaligned offset threw an exception PASS Construction of Float32Array with unaligned length threw an exception +PASS Construction of huge Float32Array threw exception PASS Array lengths matched with explicit and implicit creation of ArrayBuffer PASS new Float32Array(new ArrayBuffer(18), 0, 2) succeeded Testing subarray of Float32Array @@ -89,6 +90,7 @@ PASS Construction of Float64Array with negative size threw exception PASS Construction of Float64Array with negative out-of-range values threw an exception PASS Construction of Float64Array with unaligned offset threw an exception PASS Construction of Float64Array with unaligned length threw an exception +PASS Construction of huge Float64Array threw exception PASS Array lengths matched with explicit and implicit creation of ArrayBuffer PASS new Float64Array(new ArrayBuffer(36), 0, 2) succeeded Testing subarray of Float64Array @@ -197,6 +199,7 @@ PASS Construction of Int16Array with negative size threw exception PASS Construction of Int16Array with negative out-of-range values threw an exception PASS Construction of Int16Array with unaligned offset threw an exception PASS Construction of Int16Array with unaligned length threw an exception +PASS Construction of huge Int16Array threw exception PASS Array lengths matched with explicit and implicit creation of ArrayBuffer PASS new Int16Array(new ArrayBuffer(9), 0, 2) succeeded Testing subarray of Int16Array @@ -253,6 +256,7 @@ PASS Construction of Int32Array with negative size threw exception PASS Construction of Int32Array with negative out-of-range values threw an exception PASS Construction of Int32Array with unaligned offset threw an exception PASS Construction of Int32Array with unaligned length threw an exception +PASS Construction of huge Int32Array threw exception PASS Array lengths matched with explicit and implicit creation of ArrayBuffer PASS new Int32Array(new ArrayBuffer(18), 0, 2) succeeded Testing subarray of Int32Array @@ -413,6 +417,7 @@ PASS Construction of Uint16Array with negative size threw exception PASS Construction of Uint16Array with negative out-of-range values threw an exception PASS Construction of Uint16Array with unaligned offset threw an exception PASS Construction of Uint16Array with unaligned length threw an exception +PASS Construction of huge Uint16Array threw exception PASS Array lengths matched with explicit and implicit creation of ArrayBuffer PASS new Uint16Array(new ArrayBuffer(9), 0, 2) succeeded Testing subarray of Uint16Array @@ -469,6 +474,7 @@ PASS Construction of Uint32Array with negative size threw exception PASS Construction of Uint32Array with negative out-of-range values threw an exception PASS Construction of Uint32Array with unaligned offset threw an exception PASS Construction of Uint32Array with unaligned length threw an exception +PASS Construction of huge Uint32Array threw exception PASS Array lengths matched with explicit and implicit creation of ArrayBuffer PASS new Uint32Array(new ArrayBuffer(18), 0, 2) succeeded Testing subarray of Uint32Array 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 b182516..30fd961 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 @@ -123,12 +123,9 @@ function testInheritanceHierarchy() { } catch (e) { testPassed('ArrayBufferView has [NoInterfaceObject] extended attribute and was (correctly) not defined'); } - - // There is currently only one kind of view that inherits from another - // Uint8ClampedArray inherited from Uint8Array in earlier versions - // of the typed array specification. Since this is no longer the - // case, assert the new behavior. - shouldBe('new Uint8ClampedArray(1) instanceof Uint8Array', 'false'); + + // There is currently only one kind of view that inherits from another + shouldBe('new Uint8ClampedArray(1) instanceof Uint8Array', 'true'); } // @@ -651,6 +648,19 @@ function testConstructionWithUnalignedLength(type, name, elementSizeInBytes) { } } +function testConstructionOfHugeArray(type, name, sz) { + if (sz == 1) + return; + try { + // Construction of huge arrays must fail because byteLength is + // an unsigned long + array = new type(3000000000); + testFailed("Construction of huge " + name + " should throw exception"); + } catch (e) { + testPassed("Construction of huge " + name + " threw exception"); + } +} + function testConstructionWithBothArrayBufferAndLength(type, name, elementSizeInBytes) { var bufByteLength = 1000 * elementSizeInBytes; var buf = new ArrayBuffer(bufByteLength); @@ -993,6 +1003,7 @@ function runTests() { testConstructionWithNegativeOutOfRangeValues(type, name); testConstructionWithUnalignedOffset(type, name, testCase.elementSizeInBytes); testConstructionWithUnalignedLength(type, name, testCase.elementSizeInBytes); + testConstructionOfHugeArray(type, name, testCase.elementSizeInBytes); testConstructionWithBothArrayBufferAndLength(type, name, testCase.elementSizeInBytes); testConstructionWithSubPortionOfArrayBuffer(type, name, testCase.elementSizeInBytes); testSubarrayWithOutOfRangeValues(type, name, testCase.elementSizeInBytes); diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/data-view-crash-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/webgl/data-view-crash-expected.txt index 479df30..6e201b2 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/data-view-crash-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/data-view-crash-expected.txt @@ -2,8 +2,8 @@ Test that DataView does not crash with bad offset or length. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -PASS view = new DataView(array.buffer, -4500000000) threw exception RangeError: Start offset is outside the bounds of the buffer. -PASS view = new DataView(array.buffer, -4500000000, 4500000000) threw exception RangeError: Start offset is outside the bounds of the buffer. +PASS view = new DataView(array.buffer, -4500000000) threw exception RangeError: Size is too large (or is negative).. +PASS view = new DataView(array.buffer, -4500000000, 4500000000) threw exception RangeError: Size is too large (or is negative).. PASS successfullyParsed is true TEST COMPLETE diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/data-view-test-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/webgl/data-view-test-expected.txt index a8258e7..3f15da4 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/data-view-test-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/data-view-test-expected.txt @@ -22,9 +22,9 @@ PASS view.byteOffset is 0 PASS view.byteLength is 1 Test for constructor throwing exception -PASS view = new DataView(arayBuffer, 0, 3) threw exception RangeError: Invalid data view length. -PASS view = new DataView(arayBuffer, 1, 2) threw exception RangeError: Invalid data view length. -PASS view = new DataView(arayBuffer, 2, 1) threw exception RangeError: Invalid data view length. +PASS view = new DataView(arayBuffer, 0, 3) threw exception RangeError: Size is too large (or is negative).. +PASS view = new DataView(arayBuffer, 1, 2) threw exception RangeError: Size is too large (or is negative).. +PASS view = new DataView(arayBuffer, 2, 1) threw exception RangeError: Size is too large (or is negative).. Test for get methods that work PASS view.getInt8(0) is 0 @@ -152,161 +152,161 @@ PASS view.getFloat64(10, false) is -NaN Test for get methods that might read beyond range PASS view.getInt8(0) is 0 -PASS view.getInt8(8) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt8(15) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.getInt8(8) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt8(15) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.getUint8(0) is 0 -PASS view.getUint8(8) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint8(15) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.getUint8(8) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint8(15) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.getInt16(0, true) is 256 -PASS view.getInt16(5, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt16(9, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt16(14, true) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.getInt16(5, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt16(9, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt16(14, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.getInt16(0) is 1 -PASS view.getInt16(5) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt16(9) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt16(14) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.getInt16(5) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt16(9) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt16(14) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.getUint16(0, true) is 256 -PASS view.getUint16(5, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint16(9, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint16(14, true) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.getUint16(5, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint16(9, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint16(14, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.getUint16(0) is 1 -PASS view.getUint16(5) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint16(9) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint16(14) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt32(0, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt32(3, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt32(6, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt32(9, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt32(12, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt32(0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt32(3) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt32(6) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt32(9) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt32(12) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint32(0, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint32(3, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint32(6, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint32(9, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint32(12, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint32(0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint32(3) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint32(6) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint32(9) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint32(12) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(0, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(3, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(7, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(10, true) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.getUint16(5) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint16(9) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint16(14) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt32(0, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt32(3, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt32(6, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt32(9, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt32(12, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt32(0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt32(3) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt32(6) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt32(9) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt32(12) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint32(0, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint32(3, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint32(6, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint32(9, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint32(12, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint32(0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint32(3) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint32(6) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint32(9) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint32(12) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(0, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(3, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(7, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(10, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.getFloat32(0, false) is 10 PASS view.getFloat32(3, false) is 10 PASS view.getFloat32(7, false) is 10 PASS view.getFloat32(10, false) is 10 -PASS view.getFloat32(0, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(3, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(7, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(10, true) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.getFloat32(0, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(3, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(7, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(10, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.getFloat32(0, false) is 1.2300000190734863 PASS view.getFloat32(3, false) is 1.2300000190734863 PASS view.getFloat32(7, false) is 1.2300000190734863 PASS view.getFloat32(10, false) is 1.2300000190734863 -PASS view.getFloat32(0, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(3, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(7, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(10, true) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.getFloat32(0, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(3, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(7, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(10, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.getFloat32(0, false) is -45621.37109375 PASS view.getFloat32(3, false) is -45621.37109375 PASS view.getFloat32(7, false) is -45621.37109375 PASS view.getFloat32(10, false) is -45621.37109375 -PASS view.getFloat32(0, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(3, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(7, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(10, true) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.getFloat32(0, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(3, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(7, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(10, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.getFloat32(0, false) is NaN PASS view.getFloat32(3, false) is NaN PASS view.getFloat32(7, false) is NaN PASS view.getFloat32(10, false) is NaN -PASS view.getFloat32(0, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(3, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(7, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(10, true) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.getFloat32(0, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(3, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(7, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(10, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.getFloat32(0, false) is -NaN PASS view.getFloat32(3, false) is -NaN PASS view.getFloat32(7, false) is -NaN PASS view.getFloat32(10, false) is -NaN -PASS view.getFloat64(0, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat64(3, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat64(7, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat64(10, true) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.getFloat64(0, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat64(3, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat64(7, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat64(10, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.getFloat64(0, false) is 10 PASS view.getFloat64(3, false) is 10 PASS view.getFloat64(7, false) is 10 PASS view.getFloat64(10, false) is 10 -PASS view.getFloat64(0, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat64(3, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat64(7, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat64(10, true) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.getFloat64(0, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat64(3, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat64(7, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat64(10, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.getFloat64(0, false) is 1.23 PASS view.getFloat64(3, false) is 1.23 PASS view.getFloat64(7, false) is 1.23 PASS view.getFloat64(10, false) is 1.23 -PASS view.getFloat64(0, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat64(3, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat64(7, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat64(10, true) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.getFloat64(0, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat64(3, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat64(7, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat64(10, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.getFloat64(0, false) is -6213576.4839 PASS view.getFloat64(3, false) is -6213576.4839 PASS view.getFloat64(7, false) is -6213576.4839 PASS view.getFloat64(10, false) is -6213576.4839 -PASS view.getFloat64(0, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat64(3, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat64(7, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat64(10, true) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.getFloat64(0, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat64(3, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat64(7, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat64(10, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.getFloat64(0, false) is NaN PASS view.getFloat64(3, false) is NaN PASS view.getFloat64(7, false) is NaN PASS view.getFloat64(10, false) is NaN -PASS view.getFloat64(0, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat64(3, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat64(7, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat64(10, true) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.getFloat64(0, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat64(3, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat64(7, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat64(10, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.getFloat64(0, false) is -NaN PASS view.getFloat64(3, false) is -NaN PASS view.getFloat64(7, false) is -NaN PASS view.getFloat64(10, false) is -NaN Test for get methods that read from negative index -PASS view.getInt8(-1) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt8(-2) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint8(-1) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint8(-2) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt16(-1) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt16(-2) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt16(-3) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint16(-1) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint16(-2) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint16(-3) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt32(-1) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt32(-3) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getInt32(-5) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint32(-1) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint32(-3) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getUint32(-5) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(-1) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(-3) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat32(-5) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat64(-1) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat64(-5) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.getFloat64(-9) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.getInt8(-1) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt8(-2) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint8(-1) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint8(-2) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt16(-1) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt16(-2) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt16(-3) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint16(-1) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint16(-2) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint16(-3) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt32(-1) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt32(-3) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getInt32(-5) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint32(-1) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint32(-3) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getUint32(-5) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(-1) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(-3) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat32(-5) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat64(-1) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat64(-5) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.getFloat64(-9) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. Test for wrong arguments passed to get methods -PASS view.getInt8() threw exception TypeError: invalid_argument. -PASS view.getUint8() threw exception TypeError: invalid_argument. -PASS view.getInt16() threw exception TypeError: invalid_argument. -PASS view.getUint16() threw exception TypeError: invalid_argument. -PASS view.getInt32() threw exception TypeError: invalid_argument. -PASS view.getUint32() threw exception TypeError: invalid_argument. -PASS view.getFloat32() threw exception TypeError: invalid_argument. -PASS view.getFloat64() threw exception TypeError: invalid_argument. +PASS view.getInt8() threw exception TypeError: Not enough arguments. +PASS view.getUint8() threw exception TypeError: Not enough arguments. +PASS view.getInt16() threw exception TypeError: Not enough arguments. +PASS view.getUint16() threw exception TypeError: Not enough arguments. +PASS view.getInt32() threw exception TypeError: Not enough arguments. +PASS view.getUint32() threw exception TypeError: Not enough arguments. +PASS view.getFloat32() threw exception TypeError: Not enough arguments. +PASS view.getFloat64() threw exception TypeError: Not enough arguments. Test for set methods that work PASS view.setInt8(0, 0) is undefined. @@ -557,52 +557,52 @@ PASS view.getFloat64(10, false) is -NaN Test for set methods that might write beyond the range PASS view.setInt8(0, 0) is undefined. PASS view.getInt8(0) is 0 -PASS view.setInt8(8, -128) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt8(15, -1) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.setInt8(8, -128) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt8(15, -1) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.setUint8(0, 0) is undefined. PASS view.getUint8(0) is 0 -PASS view.setUint8(8, 128) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint8(15, 255) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.setUint8(8, 128) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint8(15, 255) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.setInt16(0, 256, true) is undefined. PASS view.getInt16(0, true) is 256 -PASS view.setInt16(5, 26213, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt16(9, -32127, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt16(14, -2, true) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.setInt16(5, 26213, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt16(9, -32127, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt16(14, -2, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.setInt16(0, 1) is undefined. PASS view.getInt16(0) is 1 -PASS view.setInt16(5, 25958) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt16(9, -32382) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt16(14, -257) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.setInt16(5, 25958) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt16(9, -32382) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt16(14, -257) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.setUint16(0, 256, true) is undefined. PASS view.getUint16(0, true) is 256 -PASS view.setUint16(5, 26213, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint16(9, 33409, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint16(14, 65534, true) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.setUint16(5, 26213, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint16(9, 33409, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint16(14, 65534, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.setUint16(0, 1) is undefined. PASS view.getUint16(0) is 1 -PASS view.setUint16(5, 25958) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint16(9, 33154) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint16(14, 65279) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt32(0, 50462976, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt32(3, 1717920771, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt32(6, -2122291354, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt32(9, -58490239, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt32(12, -66052, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt32(0, 66051) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt32(3, 56911206) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt32(6, 1718059137) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt32(9, -2122152964) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt32(12, -50462977) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint32(0, 50462976, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint32(3, 1717920771, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint32(6, 2172675942, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint32(9, 4236477057, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint32(12, 4294901244, true) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint32(0, 66051) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint32(3, 56911206) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint32(6, 1718059137) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint32(9, 2172814332) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint32(12, 4244504319) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.setUint16(5, 25958) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint16(9, 33154) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint16(14, 65279) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt32(0, 50462976, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt32(3, 1717920771, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt32(6, -2122291354, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt32(9, -58490239, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt32(12, -66052, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt32(0, 66051) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt32(3, 56911206) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt32(6, 1718059137) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt32(9, -2122152964) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt32(12, -50462977) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint32(0, 50462976, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint32(3, 1717920771, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint32(6, 2172675942, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint32(9, 4236477057, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint32(12, 4294901244, true) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint32(0, 66051) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint32(3, 56911206) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint32(6, 1718059137) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint32(9, 2172814332) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint32(12, 4244504319) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. PASS view.setFloat32(0, 10, true) is undefined. PASS view.getFloat32(0, true) is 10 PASS view.setFloat32(3, 10, true) is undefined. @@ -765,46 +765,46 @@ PASS view.setFloat64(10, -NaN, false) is undefined. PASS view.getFloat64(10, false) is -NaN Test for set methods that write to negative index -PASS view.setInt8(-1, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt8(-2, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint8(-1, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint8(-2, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt16(-1, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt16(-2, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt16(-3, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint16(-1, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint16(-2, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint16(-3, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt32(-1, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt32(-3, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt32(-5, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint32(-1, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint32(-3, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint32(-5, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setFloat32(-1, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setFloat32(-3, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setFloat32(-5, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setFloat64(-1, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setFloat64(-5, 0) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setFloat64(-9, 0) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.setInt8(-1, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt8(-2, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint8(-1, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint8(-2, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt16(-1, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt16(-2, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt16(-3, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint16(-1, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint16(-2, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint16(-3, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt32(-1, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt32(-3, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setInt32(-5, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint32(-1, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint32(-3, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setUint32(-5, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setFloat32(-1, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setFloat32(-3, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setFloat32(-5, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setFloat64(-1, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setFloat64(-5, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. +PASS view.setFloat64(-9, 0) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value.. Test for wrong arguments passed to set methods -PASS view.setInt8() threw exception TypeError: invalid_argument. -PASS view.setUint8() threw exception TypeError: invalid_argument. -PASS view.setInt16() threw exception TypeError: invalid_argument. -PASS view.setUint16() threw exception TypeError: invalid_argument. -PASS view.setInt32() threw exception TypeError: invalid_argument. -PASS view.setUint32() threw exception TypeError: invalid_argument. -PASS view.setFloat32() threw exception TypeError: invalid_argument. -PASS view.setFloat64() threw exception TypeError: invalid_argument. -FAIL view.setInt8(1) should throw an exception. Was undefined. -FAIL view.setUint8(1) should throw an exception. Was undefined. -PASS view.setInt16(1) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setUint16(1) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setInt32(1) threw exception TypeError: invalid_argument. -PASS view.setUint32(1) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setFloat32(1) threw exception RangeError: Offset is outside the bounds of the DataView. -PASS view.setFloat64(1) threw exception RangeError: Offset is outside the bounds of the DataView. +PASS view.setInt8() threw exception TypeError: Not enough arguments. +PASS view.setUint8() threw exception TypeError: Not enough arguments. +PASS view.setInt16() threw exception TypeError: Not enough arguments. +PASS view.setUint16() threw exception TypeError: Not enough arguments. +PASS view.setInt32() threw exception TypeError: Not enough arguments. +PASS view.setUint32() threw exception TypeError: Not enough arguments. +PASS view.setFloat32() threw exception TypeError: Not enough arguments. +PASS view.setFloat64() threw exception TypeError: Not enough arguments. +PASS view.setInt8(1) threw exception TypeError: Not enough arguments. +PASS view.setUint8(1) threw exception TypeError: Not enough arguments. +PASS view.setInt16(1) threw exception TypeError: Not enough arguments. +PASS view.setUint16(1) threw exception TypeError: Not enough arguments. +PASS view.setInt32(1) threw exception TypeError: Not enough arguments. +PASS view.setUint32(1) threw exception TypeError: Not enough arguments. +PASS view.setFloat32(1) threw exception TypeError: Not enough arguments. +PASS view.setFloat64(1) threw exception TypeError: Not enough arguments. Test for indexing that should not work PASS view[0] is undefined. diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/script-tests/arraybuffer-transfer-of-control.js b/third_party/WebKit/LayoutTests/fast/canvas/webgl/script-tests/arraybuffer-transfer-of-control.js index a239803..4e1ede2 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/script-tests/arraybuffer-transfer-of-control.js +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/script-tests/arraybuffer-transfer-of-control.js @@ -13,7 +13,6 @@ var basicBufferTypes = ["Uint32", Uint32Array, 4], ["Int8", Int8Array, 1], ["Uint8", Uint8Array, 1], - ["Uint8Clamped", Uint8ClampedArray, 1], ["Int16", Int16Array, 2], ["Uint16", Uint16Array, 2], ["Float32", Float32Array, 4], @@ -116,7 +115,7 @@ function assertViewClosed(testName, view) return false; } catch (xn) { } try { - view.set([0], 1); + view.set(0, 1); testFailed(testName + ": set on a closed view succeeded"); return false; } catch (xn) { } diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/webgl-array-invalid-ranges-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/webgl/webgl-array-invalid-ranges-expected.txt index bf5165f..c314633 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/webgl-array-invalid-ranges-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/webgl-array-invalid-ranges-expected.txt @@ -25,6 +25,7 @@ PASS Setting Uint8Array from Uint8Array with out-of-range offset was caught PASS Construction of Int16Array with null buffer threw exception PASS Construction of Int16Array with out-of-range values threw exception PASS Construction of Int16Array with negative out-of-range values threw exception +PASS Construction of huge Int16Array threw exception Testing subarray of Int16Array PASS array.length is 32 / typeSize PASS array.subarray(4, 0x3FFFFFFF).length is (32 / typeSize) - 4 @@ -35,6 +36,7 @@ PASS Setting Int16Array from Int16Array with out-of-range offset was caught PASS Construction of Uint16Array with null buffer threw exception PASS Construction of Uint16Array with out-of-range values threw exception PASS Construction of Uint16Array with negative out-of-range values threw exception +PASS Construction of huge Uint16Array threw exception Testing subarray of Uint16Array PASS array.length is 32 / typeSize PASS array.subarray(4, 0x3FFFFFFF).length is (32 / typeSize) - 4 @@ -45,6 +47,7 @@ PASS Setting Uint16Array from Uint16Array with out-of-range offset was caught PASS Construction of Int32Array with null buffer threw exception PASS Construction of Int32Array with out-of-range values threw exception PASS Construction of Int32Array with negative out-of-range values threw exception +PASS Construction of huge Int32Array threw exception Testing subarray of Int32Array PASS array.length is 32 / typeSize PASS array.subarray(4, 0x3FFFFFFF).length is (32 / typeSize) - 4 @@ -55,6 +58,7 @@ PASS Setting Int32Array from Int32Array with out-of-range offset was caught PASS Construction of Uint32Array with null buffer threw exception PASS Construction of Uint32Array with out-of-range values threw exception PASS Construction of Uint32Array with negative out-of-range values threw exception +PASS Construction of huge Uint32Array threw exception Testing subarray of Uint32Array PASS array.length is 32 / typeSize PASS array.subarray(4, 0x3FFFFFFF).length is (32 / typeSize) - 4 @@ -65,6 +69,7 @@ PASS Setting Uint32Array from Uint32Array with out-of-range offset was caught PASS Construction of Float32Array with null buffer threw exception PASS Construction of Float32Array with out-of-range values threw exception PASS Construction of Float32Array with negative out-of-range values threw exception +PASS Construction of huge Float32Array threw exception Testing subarray of Float32Array PASS array.length is 32 / typeSize PASS array.subarray(4, 0x3FFFFFFF).length is (32 / typeSize) - 4 diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/webgl-array-invalid-ranges.html b/third_party/WebKit/LayoutTests/fast/canvas/webgl/webgl-array-invalid-ranges.html index c876455..37ac73a 100644 --- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/webgl-array-invalid-ranges.html +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/webgl-array-invalid-ranges.html @@ -44,7 +44,6 @@ function testConstructionWithNegativeOutOfRangeValues(type, name) { } } -/* function testConstructionOfHugeArray(type, name, sz) { if (sz == 1) return; @@ -57,7 +56,6 @@ function testConstructionOfHugeArray(type, name, sz) { testPassed("Construction of huge " + name + " threw exception"); } } -*/ // These need to be global for shouldBe to see them var array; @@ -140,7 +138,7 @@ for (var i = 0; i < typeNames.length; i++) { testConstructionWithNullBuffer(type, name); testConstructionWithOutOfRangeValues(type, name); testConstructionWithNegativeOutOfRangeValues(type, name); - //testConstructionOfHugeArray(type, name, typeSizes[i]); + testConstructionOfHugeArray(type, name, typeSizes[i]); testSubarrayWithOutOfRangeValues(type, name, typeSizes[i]); testSettingFromArrayWithOutOfRangeOffset(type, name); testSettingFromFakeArrayWithOutOfRangeLength(type, name); diff --git a/third_party/WebKit/LayoutTests/fast/js/constructor-length-expected.txt b/third_party/WebKit/LayoutTests/fast/js/constructor-length-expected.txt index d44fc4b..a0a44fe 100644 --- a/third_party/WebKit/LayoutTests/fast/js/constructor-length-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/js/constructor-length-expected.txt @@ -12,18 +12,18 @@ PASS CloseEvent.length is 1 PASS CustomEvent.length is 1 FAIL DOMFormData.length should be 0. Threw exception ReferenceError: DOMFormData is not defined PASS DOMParser.length is 0 -PASS DataView.length is 3 +PASS DataView.length is 1 PASS ErrorEvent.length is 1 PASS Event.length is 1 PASS EventSource.length is 1 -PASS Float32Array.length is 3 -PASS Float64Array.length is 3 +PASS Float32Array.length is 1 +PASS Float64Array.length is 1 PASS FileReader.length is 0 FAIL FileReaderSync.length should be 0. Threw exception ReferenceError: FileReaderSync is not defined PASS HashChangeEvent.length is 1 -PASS Int16Array.length is 3 -PASS Int32Array.length is 3 -PASS Int8Array.length is 3 +PASS Int16Array.length is 1 +PASS Int32Array.length is 1 +PASS Int8Array.length is 1 FAIL Intent.length should be 3. Threw exception ReferenceError: Intent is not defined PASS MediaController.length is 0 FAIL MediaStream.length should be 0. Threw exception ReferenceError: MediaStream is not defined @@ -39,10 +39,10 @@ PASS SharedWorker.length is 1 PASS StorageEvent.length is 1 PASS TextTrackCue.length is 3 PASS TrackEvent.length is 1 -PASS Uint16Array.length is 3 -PASS Uint32Array.length is 3 -PASS Uint8Array.length is 3 -PASS Uint8ClampedArray.length is 3 +PASS Uint16Array.length is 1 +PASS Uint32Array.length is 1 +PASS Uint8Array.length is 1 +PASS Uint8ClampedArray.length is 1 PASS WebGLContextEvent.length is 1 PASS WebKitAnimationEvent.length is 1 PASS WebKitCSSMatrix.length is 0 diff --git a/third_party/WebKit/LayoutTests/fast/js/constructor-length.html b/third_party/WebKit/LayoutTests/fast/js/constructor-length.html index 45a64ca..076cb0f 100644 --- a/third_party/WebKit/LayoutTests/fast/js/constructor-length.html +++ b/third_party/WebKit/LayoutTests/fast/js/constructor-length.html @@ -16,18 +16,18 @@ shouldBe('CloseEvent.length', '1'); shouldBe('CustomEvent.length', '1'); shouldBe('DOMFormData.length', '0'); shouldBe('DOMParser.length', '0'); -shouldBe('DataView.length', '3'); +shouldBe('DataView.length', '1'); shouldBe('ErrorEvent.length', '1'); shouldBe('Event.length', '1'); shouldBe('EventSource.length', '1'); -shouldBe('Float32Array.length', '3'); -shouldBe('Float64Array.length', '3'); +shouldBe('Float32Array.length', '1'); +shouldBe('Float64Array.length', '1'); shouldBe('FileReader.length', '0'); shouldBe('FileReaderSync.length', '0'); shouldBe('HashChangeEvent.length', '1'); -shouldBe('Int16Array.length', '3'); -shouldBe('Int32Array.length', '3'); -shouldBe('Int8Array.length', '3'); +shouldBe('Int16Array.length', '1'); +shouldBe('Int32Array.length', '1'); +shouldBe('Int8Array.length', '1'); shouldBe('Intent.length', '3'); shouldBe('MediaController.length', '0'); shouldBe('MediaStream.length', '0'); @@ -43,10 +43,10 @@ shouldBe('SharedWorker.length', '1'); shouldBe('StorageEvent.length', '1'); shouldBe('TextTrackCue.length', '3'); shouldBe('TrackEvent.length', '1'); -shouldBe('Uint16Array.length', '3'); -shouldBe('Uint32Array.length', '3'); -shouldBe('Uint8Array.length', '3'); -shouldBe('Uint8ClampedArray.length', '3'); +shouldBe('Uint16Array.length', '1'); +shouldBe('Uint32Array.length', '1'); +shouldBe('Uint8Array.length', '1'); +shouldBe('Uint8ClampedArray.length', '1'); shouldBe('WebGLContextEvent.length', '1'); shouldBe('WebKitAnimationEvent.length', '1'); shouldBe('WebKitCSSMatrix.length', '0'); diff --git a/third_party/WebKit/LayoutTests/fast/js/getOwnPropertyDescriptor-expected.txt b/third_party/WebKit/LayoutTests/fast/js/getOwnPropertyDescriptor-expected.txt index 4423736..dc494d8 100644 --- a/third_party/WebKit/LayoutTests/fast/js/getOwnPropertyDescriptor-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/js/getOwnPropertyDescriptor-expected.txt @@ -159,6 +159,16 @@ PASS Object.getOwnPropertyDescriptor(document.getElementsByClassName('pass'), 'l PASS Object.getOwnPropertyDescriptor(document.getElementsByClassName('pass'), 'length').hasOwnProperty('set') is false FAIL Object.getOwnPropertyDescriptor(document.getElementsByClassName('pass'), 'length').enumerable should be true. Was false. FAIL Object.getOwnPropertyDescriptor(document.getElementsByClassName('pass'), 'length').configurable should be false. Was true. +PASS Object.getOwnPropertyDescriptor(canvasPixelArray, 'length').value is canvasPixelArray.length +PASS Object.getOwnPropertyDescriptor(canvasPixelArray, 'length').hasOwnProperty('get') is false +PASS Object.getOwnPropertyDescriptor(canvasPixelArray, 'length').hasOwnProperty('set') is false +PASS Object.getOwnPropertyDescriptor(canvasPixelArray, 'length').enumerable is true +FAIL Object.getOwnPropertyDescriptor(canvasPixelArray, 'length').configurable should be false. Was true. +PASS Object.getOwnPropertyDescriptor(canvasPixelArray, 0).value is canvasPixelArray[0] +PASS Object.getOwnPropertyDescriptor(canvasPixelArray, 0).hasOwnProperty('get') is false +PASS Object.getOwnPropertyDescriptor(canvasPixelArray, 0).hasOwnProperty('set') is false +PASS Object.getOwnPropertyDescriptor(canvasPixelArray, 0).enumerable is true +FAIL Object.getOwnPropertyDescriptor(canvasPixelArray, 0).configurable should be false. Was true. PASS Object.getOwnPropertyDescriptor(select, 'length').value is select.length PASS Object.getOwnPropertyDescriptor(select, 'length').hasOwnProperty('get') is false PASS Object.getOwnPropertyDescriptor(select, 'length').hasOwnProperty('set') is false diff --git a/third_party/WebKit/LayoutTests/fast/js/resources/getOwnPropertyDescriptor.js b/third_party/WebKit/LayoutTests/fast/js/resources/getOwnPropertyDescriptor.js index 19d0d2b..09c244d 100644 --- a/third_party/WebKit/LayoutTests/fast/js/resources/getOwnPropertyDescriptor.js +++ b/third_party/WebKit/LayoutTests/fast/js/resources/getOwnPropertyDescriptor.js @@ -50,6 +50,10 @@ descriptorShouldBe("document.getElementsByTagName('div')", "'length'", {writable descriptorShouldBe("document.getElementsByTagName('div')", "0", {writable: false, enumerable: true, configurable: false, value:"document.getElementsByTagName('div')[0]"}); descriptorShouldBe("document.getElementsByClassName('pass')", "0", {writable: false, enumerable: true, configurable: false, value:"document.getElementsByClassName('pass')[0]"}); descriptorShouldBe("document.getElementsByClassName('pass')", "'length'", {writable: false, enumerable: true, configurable: false, value:"document.getElementsByClassName('pass').length"}); +var canvas = document.createElement("canvas"); +var canvasPixelArray = canvas.getContext("2d").createImageData(10,10).data; +descriptorShouldBe("canvasPixelArray", "'length'", {writable: false, enumerable: true, configurable: false, value:"canvasPixelArray.length"}); +descriptorShouldBe("canvasPixelArray", "0", {writable: true, enumerable: true, configurable: false, value:"canvasPixelArray[0]"}); var select = document.createElement("select"); select.innerHTML = "<option>foo</option>"; descriptorShouldBe("select", "'length'", {writable: false, enumerable: true, configurable: false, value:"select.length"}); diff --git a/third_party/WebKit/Source/bindings/bindings.gypi b/third_party/WebKit/Source/bindings/bindings.gypi index 494cc5e..88834da 100644 --- a/third_party/WebKit/Source/bindings/bindings.gypi +++ b/third_party/WebKit/Source/bindings/bindings.gypi @@ -163,7 +163,6 @@ 'v8/custom/V8CustomXPathNSResolver.cpp', 'v8/custom/V8CustomXPathNSResolver.h', 'v8/custom/V8DataViewCustom.cpp', - 'v8/custom/V8DataViewCustom.h', 'v8/custom/V8DedicatedWorkerGlobalScopeCustom.cpp', 'v8/custom/V8DeviceMotionEventCustom.cpp', 'v8/custom/V8DeviceOrientationEventCustom.cpp', @@ -175,8 +174,6 @@ 'v8/custom/V8EventCustom.cpp', 'v8/custom/V8EventTargetCustom.cpp', 'v8/custom/V8FileReaderCustom.cpp', - 'v8/custom/V8Float32ArrayCustom.h', - 'v8/custom/V8Float64ArrayCustom.h', 'v8/custom/V8FormDataCustom.cpp', 'v8/custom/V8GeolocationCustom.cpp', 'v8/custom/V8HTMLAllCollectionCustom.cpp', @@ -200,9 +197,6 @@ 'v8/custom/V8InjectedScriptHostCustom.cpp', 'v8/custom/V8InjectedScriptManager.cpp', 'v8/custom/V8InspectorFrontendHostCustom.cpp', - 'v8/custom/V8Int8ArrayCustom.h', - 'v8/custom/V8Int16ArrayCustom.h', - 'v8/custom/V8Int32ArrayCustom.h', 'v8/custom/V8JavaScriptCallFrameCustom.cpp', 'v8/custom/V8LocationCustom.cpp', 'v8/custom/V8MessageChannelCustom.cpp', @@ -227,11 +221,6 @@ 'v8/custom/V8StyleSheetCustom.cpp', 'v8/custom/V8TextCustom.cpp', 'v8/custom/V8TrackEventCustom.cpp', - 'v8/custom/V8TypedArrayCustom.h', - 'v8/custom/V8Uint8ArrayCustom.h', - 'v8/custom/V8Uint8ClampedArrayCustom.h', - 'v8/custom/V8Uint16ArrayCustom.h', - 'v8/custom/V8Uint32ArrayCustom.h', 'v8/custom/V8WebGLRenderingContextCustom.cpp', 'v8/custom/V8WebKitPointCustom.cpp', 'v8/custom/V8WindowCustom.cpp', diff --git a/third_party/WebKit/Source/bindings/scripts/deprecated_code_generator_v8.pm b/third_party/WebKit/Source/bindings/scripts/deprecated_code_generator_v8.pm index 279e57f8..cd82aff 100644 --- a/third_party/WebKit/Source/bindings/scripts/deprecated_code_generator_v8.pm +++ b/third_party/WebKit/Source/bindings/scripts/deprecated_code_generator_v8.pm @@ -426,8 +426,8 @@ sub AddIncludesForType AddToImplIncludes("bindings/v8/SerializedScriptValue.h"); } elsif ($type eq "any" || IsCallbackFunctionType($type)) { AddToImplIncludes("bindings/v8/ScriptValue.h"); - } elsif (IsTypedArrayType($type)) { - AddToImplIncludes("bindings/v8/custom/V8${type}Custom.h"); + } elsif ($type eq "ArrayBuffer") { + AddToImplIncludes("bindings/v8/custom/V8ArrayBufferCustom.h"); } else { AddToImplIncludes("V8${type}.h"); } @@ -439,7 +439,7 @@ sub HeaderFilesForInterface my $implClassName = shift; my @includes = (); - if (IsTypedArrayType($interfaceName)) { + if (IsTypedArrayType($interfaceName) or $interfaceName eq "ArrayBuffer") { push(@includes, "wtf/${interfaceName}.h"); } elsif (!SkipIncludeHeader($interfaceName)) { my $idlFilename = IDLFileForInterface($interfaceName) or die("Could NOT find IDL file for interface \"$interfaceName\" $!\n"); @@ -2711,6 +2711,24 @@ END $implementation{nameSpaceWebCore}->add($code); } +sub GenerateTypedArrayConstructor +{ + my $interface = shift; + my $implClassName = GetImplName($interface); + my $v8ClassName = GetV8ClassName($interface); + + my ($nativeType, $arrayType) = GetNativeTypeOfTypedArray($interface); + AddToImplIncludes("bindings/v8/custom/V8ArrayBufferViewCustom.h"); + + $implementation{nameSpaceInternal}->add(<<END); +static void constructor(const v8::FunctionCallbackInfo<v8::Value>& args) +{ + return constructWebGLArray<$implClassName, ${v8ClassName}, $nativeType>(args, &${v8ClassName}::info, $arrayType); +} + +END +} + sub GenerateNamedConstructor { my $function = shift; @@ -4999,8 +5017,8 @@ sub GetNativeType die "UnionType is not supported" if IsUnionType($type); - if (IsTypedArrayType($type)) { - return $isParameter ? "${type}*" : "RefPtr<${type}>"; + if ($type eq "ArrayBuffer") { + return $isParameter ? "ArrayBuffer*" : "RefPtr<ArrayBuffer>"; } # We need to check [ImplementedAs] extended attribute for wrapper types. @@ -5128,9 +5146,9 @@ sub JSValueToNative return "V8DOMWrapper::isDOMWrapper($value) ? toWrapperTypeInfo(v8::Handle<v8::Object>::Cast($value))->toEventTarget(v8::Handle<v8::Object>::Cast($value)) : 0"; } - if (IsTypedArrayType($type)) { + if ($type eq "ArrayBuffer") { AddIncludesForType($type); - return "$value->Is${type}() ? V8${type}::toNative(v8::Handle<v8::${type}>::Cast($value)) : 0" + return "$value->IsArrayBuffer() ? V8ArrayBuffer::toNative(v8::Handle<v8::ArrayBuffer>::Cast($value)) : 0" } if ($type eq "XPathNSResolver") { @@ -5164,7 +5182,7 @@ sub CreateCustomSignature foreach my $parameter (@{$function->parameters}) { if ($first) { $first = 0; } else { $code .= ", "; } - if (IsWrapperType($parameter->type) && not IsTypedArrayType($parameter->type)) { + if (IsWrapperType($parameter->type) && $parameter->type ne "ArrayBuffer") { if ($parameter->type eq "XPathNSResolver") { # Special case for XPathNSResolver. All other browsers accepts a callable, # so, even though it's against IDL, accept objects here. @@ -5253,7 +5271,7 @@ sub IsCallbackInterface { my $type = shift; return 0 unless IsWrapperType($type); - return 0 if IsTypedArrayType($type); + return 0 if $type eq "ArrayBuffer"; my $idlFile = IDLFileForInterface($type) or die("Could NOT find IDL file for interface \"$type\"!\n"); diff --git a/third_party/WebKit/Source/bindings/v8/Dictionary.cpp b/third_party/WebKit/Source/bindings/v8/Dictionary.cpp index 199197b..a25d7fa 100644 --- a/third_party/WebKit/Source/bindings/v8/Dictionary.cpp +++ b/third_party/WebKit/Source/bindings/v8/Dictionary.cpp @@ -36,13 +36,12 @@ #include "V8SpeechRecognitionResult.h" #include "V8SpeechRecognitionResultList.h" #include "V8Storage.h" +#include "V8Uint8Array.h" #include "V8VoidCallback.h" #include "V8Window.h" #include "bindings/v8/ArrayValue.h" #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8Utilities.h" -#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" -#include "bindings/v8/custom/V8Uint8ArrayCustom.h" #include "core/dom/DOMStringList.h" #include "modules/indexeddb/IDBKeyRange.h" #include "modules/speech/SpeechRecognitionError.h" diff --git a/third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp b/third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp index e7c30bb..1e34ad8 100644 --- a/third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp +++ b/third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "bindings/v8/ScriptProfiler.h" +#include "V8ArrayBufferView.h" #include "V8Node.h" #include "V8Window.h" #include "bindings/v8/RetainedDOMInfo.h" @@ -38,7 +39,6 @@ #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8DOMWrapper.h" #include "bindings/v8/WrapperTypeInfo.h" -#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" #include "core/dom/Document.h" #include "core/inspector/BindingVisitors.h" @@ -320,7 +320,7 @@ void ScriptProfiler::visitExternalArrays(ExternalArrayVisitor* visitor) // GCd during visiting. ASSERT((*reinterpret_cast<v8::Handle<v8::Value>*>(value))->IsObject()); v8::Handle<v8::Object>* wrapper = reinterpret_cast<v8::Handle<v8::Object>*>(value); - if (!(*wrapper)->IsArrayBufferView()) + if (!toWrapperTypeInfo(*wrapper)->isSubclass(&V8ArrayBufferView::info)) return; m_visitor->visitJSExternalArray(V8ArrayBufferView::toNative(*wrapper)); } diff --git a/third_party/WebKit/Source/bindings/v8/SerializedScriptValue.cpp b/third_party/WebKit/Source/bindings/v8/SerializedScriptValue.cpp index c014cbd..17256d3 100644 --- a/third_party/WebKit/Source/bindings/v8/SerializedScriptValue.cpp +++ b/third_party/WebKit/Source/bindings/v8/SerializedScriptValue.cpp @@ -31,26 +31,26 @@ #include "config.h" #include "bindings/v8/SerializedScriptValue.h" +#include "V8ArrayBufferView.h" #include "V8Blob.h" #include "V8DOMFileSystem.h" +#include "V8DataView.h" #include "V8File.h" #include "V8FileList.h" +#include "V8Float32Array.h" #include "V8ImageData.h" +#include "V8Int16Array.h" +#include "V8Int32Array.h" +#include "V8Int8Array.h" #include "V8MessagePort.h" +#include "V8Uint16Array.h" +#include "V8Uint32Array.h" +#include "V8Uint8Array.h" +#include "V8Uint8ClampedArray.h" +#include "bindings/tests/results/V8Float64Array.h" #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8Utilities.h" #include "bindings/v8/custom/V8ArrayBufferCustom.h" -#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" -#include "bindings/v8/custom/V8DataViewCustom.h" -#include "bindings/v8/custom/V8Float32ArrayCustom.h" -#include "bindings/v8/custom/V8Float64ArrayCustom.h" -#include "bindings/v8/custom/V8Int16ArrayCustom.h" -#include "bindings/v8/custom/V8Int32ArrayCustom.h" -#include "bindings/v8/custom/V8Int8ArrayCustom.h" -#include "bindings/v8/custom/V8Uint16ArrayCustom.h" -#include "bindings/v8/custom/V8Uint32ArrayCustom.h" -#include "bindings/v8/custom/V8Uint8ArrayCustom.h" -#include "bindings/v8/custom/V8Uint8ClampedArrayCustom.h" #include "core/dom/ExceptionCode.h" #include "core/dom/MessagePort.h" #include "core/fileapi/Blob.h" diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp b/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp index 1d83f4d..367a723 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp @@ -25,63 +25,32 @@ #include "config.h" #include "bindings/v8/custom/V8ArrayBufferViewCustom.h" -#include "bindings/v8/custom/V8DataViewCustom.h" -#include "bindings/v8/custom/V8Float32ArrayCustom.h" -#include "bindings/v8/custom/V8Float64ArrayCustom.h" -#include "bindings/v8/custom/V8Int16ArrayCustom.h" -#include "bindings/v8/custom/V8Int32ArrayCustom.h" -#include "bindings/v8/custom/V8Int8ArrayCustom.h" -#include "bindings/v8/custom/V8Uint16ArrayCustom.h" -#include "bindings/v8/custom/V8Uint32ArrayCustom.h" -#include "bindings/v8/custom/V8Uint8ArrayCustom.h" -#include "bindings/v8/custom/V8Uint8ClampedArrayCustom.h" +#include "V8ArrayBufferViewCustomScript.h" +#include "bindings/v8/V8HiddenPropertyName.h" +#include "bindings/v8/V8ScriptRunner.h" #include <v8.h> namespace WebCore { -using namespace WTF; - -ArrayBufferView* V8ArrayBufferView::toNative(v8::Handle<v8::Object> object) +bool copyElements(v8::Handle<v8::Object> destArray, v8::Handle<v8::Object> srcArray, uint32_t length, uint32_t offset, v8::Isolate* isolate) { - ASSERT(object->IsArrayBufferView()); - void* viewPtr = object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex); - if (viewPtr) - return reinterpret_cast<ArrayBufferView*>(viewPtr); - - if (object->IsUint8Array()) { - return V8Uint8Array::toNative(object); - } - if (object->IsInt8Array()) { - return V8Int8Array::toNative(object); - } - if (object->IsUint16Array()) { - return V8Uint16Array::toNative(object); - } - if (object->IsInt16Array()) { - return V8Int16Array::toNative(object); - } - if (object->IsUint32Array()) { - return V8Uint32Array::toNative(object); - } - if (object->IsInt32Array()) { - return V8Int32Array::toNative(object); - } - if (object->IsFloat32Array()) { - return V8Float32Array::toNative(object); - } - if (object->IsFloat64Array()) { - return V8Float64Array::toNative(object); - } - if (object->IsUint8ClampedArray()) { - return V8Uint8ClampedArray::toNative(object); - } - if (object->IsDataView()) { - return V8DataView::toNative(object); - } - ASSERT_NOT_REACHED(); - return 0; + v8::Handle<v8::Value> prototype_value = destArray->GetPrototype(); + if (prototype_value.IsEmpty() || !prototype_value->IsObject()) + return false; + v8::Handle<v8::Object> prototype = prototype_value.As<v8::Object>(); + v8::Handle<v8::Value> value = prototype->GetHiddenValue(V8HiddenPropertyName::typedArrayHiddenCopyMethod()); + if (value.IsEmpty()) { + String source(reinterpret_cast<const char*>(V8ArrayBufferViewCustomScript_js), sizeof(V8ArrayBufferViewCustomScript_js)); + value = V8ScriptRunner::compileAndRunInternalScript(v8String(source, isolate), isolate); + prototype->SetHiddenValue(V8HiddenPropertyName::typedArrayHiddenCopyMethod(), value); + } + if (value.IsEmpty() || !value->IsFunction()) + return false; + v8::Handle<v8::Function> copy_method = value.As<v8::Function>(); + v8::Handle<v8::Value> arguments[3] = { srcArray, v8::Uint32::New(length), v8::Uint32::New(offset) }; + V8ScriptRunner::callInternalFunction(copy_method, destArray, WTF_ARRAY_LENGTH(arguments), arguments, isolate); + return true; } - -} // namespace WebCore +} diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h index d39a9d2..98de7f5 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h +++ b/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h @@ -37,29 +37,273 @@ #include "core/dom/ExceptionCode.h" #include "wtf/ArrayBuffer.h" -#include "wtf/ArrayBufferView.h" namespace WebCore { +const char tooLargeSize[] = "Size is too large (or is negative)."; +const char outOfRangeLengthAndOffset[] = "Index is out of range."; -class V8ArrayBufferView { -public: - static bool HasInstance(v8::Handle<v8::Value> value, v8::Isolate*, WrapperWorldType) - { - return value->IsArrayBufferView(); +// Copy the elements from the source array to the typed destination array. +// Returns true if it succeeded, otherwise returns false. +bool copyElements(v8::Handle<v8::Object> destArray, v8::Handle<v8::Object> srcArray, uint32_t length, uint32_t offset, v8::Isolate*); + +template<class JavaScriptWrapperArrayType, class ArrayClass> +void wrapArrayBufferView(const v8::FunctionCallbackInfo<v8::Value>& args, WrapperTypeInfo* type, ArrayClass array, v8::ExternalArrayType arrayType, bool hasIndexer) +{ + // Transform the holder into a wrapper object for the array. + ASSERT(!hasIndexer || static_cast<int32_t>(array.get()->length()) >= 0); + if (hasIndexer) + args.Holder()->SetIndexedPropertiesToExternalArrayData(array.get()->baseAddress(), arrayType, array.get()->length()); + v8::Handle<v8::Object> wrapper = args.Holder(); + V8DOMWrapper::associateObjectWithWrapper<JavaScriptWrapperArrayType>(array.release(), type, wrapper, args.GetIsolate(), WrapperConfiguration::Independent); + args.GetReturnValue().Set(wrapper); +} + +// Template function used by the ArrayBufferView*Constructor callbacks. +template<class ArrayClass, class ElementType, class JavaScriptWrapperArrayType> +void constructWebGLArrayWithArrayBufferArgument(const v8::FunctionCallbackInfo<v8::Value>& args, WrapperTypeInfo* type, v8::ExternalArrayType arrayType, bool hasIndexer) +{ + ArrayBuffer* buf = V8ArrayBuffer::toNative(args[0]->ToObject()); + if (!buf) { + throwTypeError("Could not convert argument 0 to a ArrayBuffer", args.GetIsolate()); + return; + } + bool ok; + uint32_t offset = 0; + int argLen = args.Length(); + if (argLen > 1) { + offset = toUInt32(args[1], ok); + if (!ok) { + throwTypeError("Could not convert argument 1 to a number", args.GetIsolate()); + return; + } + } + uint32_t length = 0; + if (argLen > 2) { + length = toUInt32(args[2], ok); + if (!ok) { + throwTypeError("Could not convert argument 2 to a number", args.GetIsolate()); + return; + } + } else { + if ((buf->byteLength() - offset) % sizeof(ElementType)) { + throwError(v8RangeError, "ArrayBuffer length minus the byteOffset is not a multiple of the element size.", args.GetIsolate()); + return; + } + length = (buf->byteLength() - offset) / sizeof(ElementType); + } + + if (static_cast<int32_t>(length) < 0) { + throwError(v8RangeError, tooLargeSize, args.GetIsolate()); + return; + } + + RefPtr<ArrayClass> array = ArrayClass::create(buf, offset, length); + if (!array) { + throwError(v8RangeError, tooLargeSize, args.GetIsolate()); + return; + } + + wrapArrayBufferView<JavaScriptWrapperArrayType>(args, type, array, arrayType, hasIndexer); +} + +// Template function used by the ArrayBufferView*Constructor callbacks. +template<class ArrayClass, class JavaScriptWrapperArrayType, class ElementType> +void constructWebGLArray(const v8::FunctionCallbackInfo<v8::Value>& args, WrapperTypeInfo* type, v8::ExternalArrayType arrayType) +{ + if (!args.IsConstructCall()) { + throwTypeError("DOM object constructor cannot be called as a function.", args.GetIsolate()); + return; + } + + if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { + args.GetReturnValue().Set(args.Holder()); + return; + } + + int argLen = args.Length(); + if (!argLen) { + // This happens when we return a previously constructed + // ArrayBufferView, e.g. from the call to <Type>Array.subset(). + // The V8DOMWrapper will set the internal pointer in the + // created object. Unfortunately it doesn't look like it's + // possible to distinguish between this case and that where + // the user calls "new <Type>Array()" from JavaScript. We must + // construct an empty view to avoid crashes when fetching the + // length. + RefPtr<ArrayClass> array = ArrayClass::create(0); + // Do not call SetIndexedPropertiesToExternalArrayData on this + // object. Not only is there no point from a performance + // perspective, but doing so causes errors in the subset() case. + wrapArrayBufferView<JavaScriptWrapperArrayType>(args, type, array, arrayType, false); + return; + } + + // Supported constructors: + // WebGL<T>Array(n) where n is an integer: + // -- create an empty array of n elements + // WebGL<T>Array(arr) where arr is an array: + // -- create a WebGL<T>Array containing the contents of "arr" + // WebGL<T>Array(buf, offset, length) + // -- create a WebGL<T>Array pointing to the ArrayBuffer + // "buf", starting at the specified offset, for the given + // length + + if (args[0]->IsNull()) { + // Invalid first argument + throwTypeError(args.GetIsolate()); + return; + } + + // See whether the first argument is a ArrayBuffer. + if (V8ArrayBuffer::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))) { + constructWebGLArrayWithArrayBufferArgument<ArrayClass, ElementType, JavaScriptWrapperArrayType>(args, type, arrayType, true); + return; + } + + // See whether the first argument is the same type as impl. In that case, + // we can simply memcpy data from source to impl. + if (JavaScriptWrapperArrayType::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))) { + ArrayClass* source = JavaScriptWrapperArrayType::toNative(args[0]->ToObject()); + uint32_t length = source->length(); + + if (static_cast<int32_t>(length) < 0) { + throwError(v8RangeError, tooLargeSize, args.GetIsolate()); + return; + } + + RefPtr<ArrayClass> array = ArrayClass::createUninitialized(length); + if (!array.get()) { + throwError(v8RangeError, tooLargeSize, args.GetIsolate()); + return; + } + + array->buffer()->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instance()); + v8::V8::AdjustAmountOfExternalAllocatedMemory(array->byteLength()); + + memcpy(array->baseAddress(), source->baseAddress(), length * sizeof(ElementType)); + + wrapArrayBufferView<JavaScriptWrapperArrayType>(args, type, array, arrayType, true); + return; + } + + uint32_t len = 0; + v8::Handle<v8::Object> srcArray; + bool doInstantiation = false; + + if (args[0]->IsObject()) { + srcArray = args[0]->ToObject(); + if (srcArray.IsEmpty()) { + throwTypeError("Could not convert argument 0 to an array", args.GetIsolate()); + return; + } + v8::Local<v8::Value> val = srcArray->Get(v8::String::NewSymbol("length")); + if (val.IsEmpty()) { + // Exception thrown during fetch of length property. + return; + } + len = toUInt32(val); + doInstantiation = true; + } else { + bool ok = false; + int32_t tempLength = toInt32(args[0], ok); // NaN/+inf/-inf returns 0, this is intended by WebIDL + if (ok && tempLength >= 0) { + len = static_cast<uint32_t>(tempLength); + doInstantiation = true; + } + } + + if (static_cast<int32_t>(len) < 0) { + throwError(v8RangeError, tooLargeSize, args.GetIsolate()); + return; + } + + RefPtr<ArrayClass> array; + if (doInstantiation) { + if (srcArray.IsEmpty()) + array = ArrayClass::create(len); + else + array = ArrayClass::createUninitialized(len); + } + + if (!array.get()) { + throwError(v8RangeError, tooLargeSize, args.GetIsolate()); + return; } - static bool HasInstanceInAnyWorld(v8::Handle<v8::Value> value, v8::Isolate*) - { - return value->IsArrayBufferView(); + + if (doInstantiation) { + array->buffer()->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instance()); + v8::V8::AdjustAmountOfExternalAllocatedMemory(array->byteLength()); + } + + + // Transform the holder into a wrapper object for the array. + args.Holder()->SetIndexedPropertiesToExternalArrayData(array.get()->baseAddress(), arrayType, array.get()->length()); + + if (!srcArray.IsEmpty()) { + bool copied = copyElements(args.Holder(), srcArray, len, 0, args.GetIsolate()); + if (!copied) { + for (unsigned i = 0; i < len; i++) { + v8::Local<v8::Value> val = srcArray->Get(i); + if (val.IsEmpty()) { + // Exception thrown during fetch. + return; + } + array->set(i, val->NumberValue()); + } + } + } + + v8::Handle<v8::Object> wrapper = args.Holder(); + V8DOMWrapper::associateObjectWithWrapper<JavaScriptWrapperArrayType>(array.release(), type, wrapper, args.GetIsolate(), WrapperConfiguration::Independent); + args.GetReturnValue().Set(wrapper); +} + +template <class CPlusPlusArrayType, class JavaScriptWrapperArrayType> +void setWebGLArrayHelper(const v8::FunctionCallbackInfo<v8::Value>& args) +{ + if (args.Length() < 1) { + throwNotEnoughArgumentsError(args.GetIsolate()); + return; + } + + CPlusPlusArrayType* impl = JavaScriptWrapperArrayType::toNative(args.Holder()); + + if (JavaScriptWrapperArrayType::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))) { + // void set(in WebGL<T>Array array, [Optional] in unsigned long offset); + CPlusPlusArrayType* src = JavaScriptWrapperArrayType::toNative(args[0]->ToObject()); + uint32_t offset = 0; + if (args.Length() == 2) + offset = toUInt32(args[1]); + if (!impl->set(src, offset)) { + throwError(v8RangeError, outOfRangeLengthAndOffset, args.GetIsolate()); + return; + } + return; } - static ArrayBufferView* toNative(v8::Handle<v8::Object>); - static inline void* toInternalPointer(ArrayBufferView* impl) - { - return impl; + 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::NewSymbol("length"))); + if (!impl->checkInboundData(offset, length)) { + throwError(v8RangeError, outOfRangeLengthAndOffset, args.GetIsolate()); + return; + } + bool copied = copyElements(args.Holder(), array, length, offset, args.GetIsolate()); + if (!copied) { + for (uint32_t i = 0; i < length; i++) + impl->set(offset + i, array->Get(i)->NumberValue()); + } + return; } -}; + throwTypeError("Invalid argument", args.GetIsolate()); +} + +} -} // namespace WebCore #endif // V8ArrayBufferViewCustom_h diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8BlobCustom.cpp b/third_party/WebKit/Source/bindings/v8/custom/V8BlobCustom.cpp index 32e35c3..b13f701 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8BlobCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8BlobCustom.cpp @@ -31,13 +31,13 @@ #include "config.h" #include "core/fileapi/Blob.h" +#include "V8ArrayBufferView.h" #include "V8Blob.h" #include "V8File.h" #include "bindings/v8/Dictionary.h" #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8Utilities.h" #include "bindings/v8/custom/V8ArrayBufferCustom.h" -#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" #include "core/fileapi/BlobBuilder.h" #include "wtf/RefPtr.h" diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8CryptoCustom.cpp b/third_party/WebKit/Source/bindings/v8/custom/V8CryptoCustom.cpp index 6c6e2fc..569e9c3 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8CryptoCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8CryptoCustom.cpp @@ -25,11 +25,10 @@ #include "config.h" #include "V8Crypto.h" +#include "V8ArrayBufferView.h" #include "bindings/v8/ExceptionState.h" #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8Utilities.h" -#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" -#include "core/dom/ExceptionCode.h" #include "modules/crypto/Crypto.h" #include "wtf/ArrayBufferView.h" diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.cpp b/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.cpp index e07dfa5..72b7af1 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.cpp @@ -24,29 +24,37 @@ */ #include "config.h" -#include "bindings/v8/custom/V8DataViewCustom.h" +#include "core/html/canvas/DataView.h" +#include "V8DataView.h" #include "bindings/v8/V8Binding.h" #include "bindings/v8/custom/V8ArrayBufferViewCustom.h" -#include "core/html/canvas/DataView.h" namespace WebCore { -static void initializeScriptWrappableForInterface(DataView* object) +void V8DataView::constructorCustom(const v8::FunctionCallbackInfo<v8::Value>& args) { - if (ScriptWrappable::wrapperCanBeStoredInObject(object)) - ScriptWrappable::setTypeInfoInObject(object, &V8DataView::info); - else - ASSERT_NOT_REACHED(); + if (!args.Length()) { + // see constructWebGLArray -- we don't seem to be able to distingish between + // 'new DataView()' and the call used to construct the cached DataView object. + RefPtr<DataView> dataView = DataView::create(0); + v8::Handle<v8::Object> wrapper = args.Holder(); + V8DOMWrapper::associateObjectWithWrapper<V8DataView>(dataView.release(), &info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); + args.GetReturnValue().Set(wrapper); + return; + } + if (args[0]->IsNull() || !V8ArrayBuffer::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))) { + throwTypeError(args.GetIsolate()); + return; + } + constructWebGLArrayWithArrayBufferArgument<DataView, char, V8DataView>(args, &info, v8::kExternalByteArray, false); } -} // namespace WebCore - -// In ScriptWrappable::init, the use of a local function declaration has an issue on Windows: -// the local declaration does not pick up the surrounding namespace. Therefore, we provide this function -// in the global namespace. -// (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/feedback/details/664619/the-namespace-of-local-function-declarations-in-c) -void webCoreInitializeScriptWrappableForInterface(WebCore::DataView* object) +// FIXME: Don't need this override. +v8::Handle<v8::Object> wrap(DataView* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) { - WebCore::initializeScriptWrappableForInterface(object); + ASSERT(impl); + return V8DataView::createWrapper(impl, creationContext, isolate); } + +} // namespace WebCore diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.h deleted file mode 100644 index 67f9781..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8DataViewCustom_h -#define V8DataViewCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "core/html/canvas/DataView.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<DataView> { -public: - typedef v8::DataView V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsDataView(); - } - - static size_t length(v8::Handle<v8::DataView> value) - { - return value->ByteLength(); - } - - static size_t length(DataView* array) - { - return array->byteLength(); - } -}; - -typedef V8TypedArray<DataView> V8DataView; - -template<> -class WrapperTypeTraits<DataView> : public TypedArrayWrapperTraits<DataView> { }; - - -inline v8::Handle<v8::Object> wrap(DataView* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<DataView>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(DataView* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<DataView>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(DataView* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<DataView>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(DataView* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<DataView>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(DataView* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<DataView>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< DataView > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< DataView > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< DataView > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8Float32ArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8Float32ArrayCustom.h deleted file mode 100644 index f980ea0..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8Float32ArrayCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Float32ArrayCustom_h -#define V8Float32ArrayCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Float32Array.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<Float32Array> { -public: - typedef v8::Float32Array V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsFloat32Array(); - } - - static size_t length(v8::Handle<v8::Float32Array> value) - { - return value->Length(); - } - - static size_t length(Float32Array* array) - { - return array->length(); - } -}; - -typedef V8TypedArray<Float32Array> V8Float32Array; - -template<> -class WrapperTypeTraits<Float32Array> : public TypedArrayWrapperTraits<Float32Array> { }; - - -inline v8::Handle<v8::Object> wrap(Float32Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Float32Array>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(Float32Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Float32Array>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(Float32Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Float32Array>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(Float32Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Float32Array>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(Float32Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Float32Array>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Float32Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Float32Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Float32Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8Float64ArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8Float64ArrayCustom.h deleted file mode 100644 index 1cabb08..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8Float64ArrayCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Float64ArrayCustom_h -#define V8Float64ArrayCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Float64Array.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<Float64Array> { -public: - typedef v8::Float64Array V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsFloat64Array(); - } - - static size_t length(v8::Handle<v8::Float64Array> value) - { - return value->Length(); - } - - static size_t length(Float64Array* array) - { - return array->length(); - } -}; - -typedef V8TypedArray<Float64Array> V8Float64Array; - -template<> -class WrapperTypeTraits<Float64Array> : public TypedArrayWrapperTraits<Float64Array> { }; - - -inline v8::Handle<v8::Object> wrap(Float64Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Float64Array>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(Float64Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Float64Array>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(Float64Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Float64Array>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(Float64Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Float64Array>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(Float64Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Float64Array>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Float64Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Float64Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Float64Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8ImageDataCustom.cpp b/third_party/WebKit/Source/bindings/v8/custom/V8ImageDataCustom.cpp index 3e2e670..cb35401 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8ImageDataCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8ImageDataCustom.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "V8ImageData.h" -#include "bindings/v8/custom/V8Uint8ClampedArrayCustom.h" +#include "V8Uint8ClampedArray.h" namespace WebCore { diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/third_party/WebKit/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp index 73b8d63..1ac446e 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp @@ -32,11 +32,20 @@ #include "V8InjectedScriptHost.h" #include "V8Database.h" +#include "V8Float32Array.h" #include "V8HTMLAllCollection.h" #include "V8HTMLCollection.h" +#include "V8Int16Array.h" +#include "V8Int32Array.h" +#include "V8Int8Array.h" #include "V8Node.h" #include "V8NodeList.h" #include "V8Storage.h" +#include "V8Uint16Array.h" +#include "V8Uint32Array.h" +#include "V8Uint8Array.h" +#include "V8Uint8ClampedArray.h" +#include "bindings/tests/results/V8Float64Array.h" #include "bindings/v8/BindingSecurity.h" #include "bindings/v8/ScriptDebugServer.h" #include "bindings/v8/ScriptValue.h" @@ -44,15 +53,6 @@ #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8HiddenPropertyName.h" #include "bindings/v8/V8ScriptRunner.h" -#include "bindings/v8/custom/V8Float32ArrayCustom.h" -#include "bindings/v8/custom/V8Float64ArrayCustom.h" -#include "bindings/v8/custom/V8Int16ArrayCustom.h" -#include "bindings/v8/custom/V8Int32ArrayCustom.h" -#include "bindings/v8/custom/V8Int8ArrayCustom.h" -#include "bindings/v8/custom/V8Uint16ArrayCustom.h" -#include "bindings/v8/custom/V8Uint32ArrayCustom.h" -#include "bindings/v8/custom/V8Uint8ArrayCustom.h" -#include "bindings/v8/custom/V8Uint8ClampedArrayCustom.h" #include "core/inspector/InjectedScript.h" #include "core/inspector/InjectedScriptHost.h" #include "core/inspector/InspectorDOMAgent.h" diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8Int16ArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8Int16ArrayCustom.h deleted file mode 100644 index f5a7c83..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8Int16ArrayCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Int16ArrayCustom_h -#define V8Int16ArrayCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Int16Array.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<Int16Array> { -public: - typedef v8::Int16Array V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsInt16Array(); - } - - static size_t length(v8::Handle<v8::Int16Array> value) - { - return value->Length(); - } - - static size_t length(Int16Array* array) - { - return array->length(); - } -}; - -typedef V8TypedArray<Int16Array> V8Int16Array; - -template<> -class WrapperTypeTraits<Int16Array> : public TypedArrayWrapperTraits<Int16Array> { }; - - -inline v8::Handle<v8::Object> wrap(Int16Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Int16Array>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(Int16Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Int16Array>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(Int16Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Int16Array>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(Int16Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Int16Array>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(Int16Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Int16Array>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Int16Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Int16Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Int16Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8Int32ArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8Int32ArrayCustom.h deleted file mode 100644 index 29a927b..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8Int32ArrayCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Int32ArrayCustom_h -#define V8Int32ArrayCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Int32Array.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<Int32Array> { -public: - typedef v8::Int32Array V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsInt32Array(); - } - - static size_t length(v8::Handle<v8::Int32Array> value) - { - return value->Length(); - } - - static size_t length(Int32Array* array) - { - return array->length(); - } -}; - -typedef V8TypedArray<Int32Array> V8Int32Array; - -template<> -class WrapperTypeTraits<Int32Array> : public TypedArrayWrapperTraits<Int32Array> { }; - - -inline v8::Handle<v8::Object> wrap(Int32Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Int32Array>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(Int32Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Int32Array>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(Int32Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Int32Array>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(Int32Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Int32Array>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(Int32Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Int32Array>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Int32Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Int32Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Int32Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8Int8ArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8Int8ArrayCustom.h deleted file mode 100644 index f325aba..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8Int8ArrayCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Int8ArrayCustom_h -#define V8Int8ArrayCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Int8Array.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<Int8Array> { -public: - typedef v8::Int8Array V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsInt8Array(); - } - - static size_t length(v8::Handle<v8::Int8Array> value) - { - return value->Length(); - } - - static size_t length(Int8Array* array) - { - return array->length(); - } -}; - -typedef V8TypedArray<Int8Array> V8Int8Array; - -template<> -class WrapperTypeTraits<Int8Array> : public TypedArrayWrapperTraits<Int8Array> { }; - - -inline v8::Handle<v8::Object> wrap(Int8Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Int8Array>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(Int8Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Int8Array>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(Int8Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Int8Array>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(Int8Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Int8Array>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(Int8Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Int8Array>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Int8Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Int8Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Int8Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8TypedArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8TypedArrayCustom.h deleted file mode 100644 index 864a4ad..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8TypedArrayCustom.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8TypedArrayCustom_h -#define V8TypedArrayCustom_h - -#include "bindings/v8/V8Binding.h" -#include "bindings/v8/V8DOMWrapper.h" -#include "bindings/v8/WrapperTypeInfo.h" -#include "bindings/v8/custom/V8ArrayBufferCustom.h" - -#include "wtf/ArrayBuffer.h" - -#include <v8.h> - -namespace WebCore { - -template<typename T> -class TypedArrayTraits -{ }; - -template<typename TypedArray> -class V8TypedArray { -public: - static bool HasInstance(v8::Handle<v8::Value> value, v8::Isolate*, WrapperWorldType) - { - return TypedArrayTraits<TypedArray>::IsInstance(value); - } - - static bool HasInstanceInAnyWorld(v8::Handle<v8::Value> value, v8::Isolate*) - { - return TypedArrayTraits<TypedArray>::IsInstance(value); - } - - static TypedArray* toNative(v8::Handle<v8::Object>); - static void derefObject(void*); - static WrapperTypeInfo info; - static const int internalFieldCount = v8DefaultWrapperInternalFieldCount; - - static v8::Handle<v8::Object> wrap(TypedArray* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) - { - ASSERT(impl); - ASSERT((DOMDataStore::template getWrapper<Binding>(impl, isolate).IsEmpty())); - return V8TypedArray<TypedArray>::createWrapper(impl, creationContext, isolate); - } - - static v8::Handle<v8::Value> toV8(TypedArray* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) - { - if (UNLIKELY(!impl)) - return v8NullWithCheck(isolate); - v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<Binding>(impl, isolate); - if (!wrapper.IsEmpty()) - return wrapper; - return wrap(impl, creationContext, isolate); - } - - static v8::Handle<v8::Value> toV8ForMainWorld(TypedArray* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) - { - ASSERT(worldType(isolate) == MainWorld); - if (UNLIKELY(!impl)) - return v8NullWithCheck(isolate); - v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<Binding>(impl); - if (!wrapper.IsEmpty()) - return wrapper; - return wrap(impl, creationContext, isolate); - } - - template<class HolderContainer, class Wrappable> - static v8::Handle<v8::Value> toV8Fast(TypedArray* impl, const HolderContainer& container, Wrappable* wrappable) - { - if (UNLIKELY(!impl)) - return v8::Null(container.GetIsolate()); - v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<Binding>(impl, container, wrappable); - if (!wrapper.IsEmpty()) - return wrapper; - return wrap(impl, container.Holder(), container.GetIsolate()); - } - - template<class HolderContainer, class Wrappable> - static v8::Handle<v8::Value> toV8FastForMainWorld(TypedArray* impl, const HolderContainer& container, Wrappable* wrappable) - { - ASSERT(worldType(container.GetIsolate()) == MainWorld); - if (UNLIKELY(!impl)) - return v8::Null(container.GetIsolate()); - v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<Binding>(impl); - if (!wrapper.IsEmpty()) - return wrapper; - return wrap(impl, container.Holder(), container.GetIsolate()); - } - - static inline void* toInternalPointer(TypedArray* impl) - { - return impl; - } -private: - typedef TypedArrayTraits<TypedArray> Traits; - typedef typename Traits::V8Type V8Type; - typedef V8TypedArray<TypedArray> Binding; - - static v8::Handle<v8::Object> createWrapper(PassRefPtr<TypedArray>, v8::Handle<v8::Object> creationContext, v8::Isolate*); -}; - -template<typename TypedArray> -class TypedArrayWrapperTraits { -public: - static WrapperTypeInfo* info() { return &V8TypedArray<TypedArray>::info; } -}; - - -template <typename TypedArray> -v8::Handle<v8::Object> V8TypedArray<TypedArray>::createWrapper(PassRefPtr<TypedArray> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - ASSERT(impl.get()); - ASSERT(DOMDataStore::getWrapper<Binding>(impl.get(), isolate).IsEmpty()); - - RefPtr<ArrayBuffer> buffer = impl->buffer(); - v8::Handle<v8::Value> v8Buffer = WebCore::toV8(buffer.get(), creationContext, isolate); - - v8::Handle<v8::Object> wrapper = V8Type::New(v8Buffer.As<v8::ArrayBuffer>(), impl->byteOffset(), Traits::length(impl.get())); - - V8DOMWrapper::associateObjectWithWrapper<Binding>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent); - return wrapper; -} - -template <typename TypedArray> -TypedArray* V8TypedArray<TypedArray>::toNative(v8::Handle<v8::Object> object) -{ - ASSERT(Traits::IsInstance(object)); - void* typedarrayPtr = object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex); - if (typedarrayPtr) - return reinterpret_cast<TypedArray*>(typedarrayPtr); - - v8::Handle<V8Type> view = object.As<V8Type>(); - RefPtr<ArrayBuffer> arrayBuffer = V8ArrayBuffer::toNative(view->Buffer()); - RefPtr<TypedArray> typedArray = TypedArray::create(arrayBuffer, view->ByteOffset(), Traits::length(view)); - ASSERT(typedArray.get()); - V8DOMWrapper::associateObjectWithWrapper<Binding>(typedArray.release(), &info, object, v8::Isolate::GetCurrent(), WrapperConfiguration::Independent); - - typedarrayPtr = object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex); - ASSERT(typedarrayPtr); - return reinterpret_cast<TypedArray*>(typedarrayPtr); -} - - -template <typename TypedArray> -WrapperTypeInfo V8TypedArray<TypedArray>::info = { - 0, V8TypedArray<TypedArray>::derefObject, - 0, 0, 0, 0, 0, WrapperTypeObjectPrototype -}; - -template <typename TypedArray> -void V8TypedArray<TypedArray>::derefObject(void* object) -{ - static_cast<TypedArray*>(object)->deref(); -} - - -} // namespace WebCode - -#endif // V8TypedArrayCustom_h diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8Uint16ArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8Uint16ArrayCustom.h deleted file mode 100644 index 30a7403..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8Uint16ArrayCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Uint16ArrayCustom_h -#define V8Uint16ArrayCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Uint16Array.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<Uint16Array> { -public: - typedef v8::Uint16Array V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsUint16Array(); - } - - static size_t length(v8::Handle<v8::Uint16Array> value) - { - return value->Length(); - } - - static size_t length(Uint16Array* array) - { - return array->length(); - } -}; - -typedef V8TypedArray<Uint16Array> V8Uint16Array; - -template<> -class WrapperTypeTraits<Uint16Array> : public TypedArrayWrapperTraits<Uint16Array> { }; - - -inline v8::Handle<v8::Object> wrap(Uint16Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint16Array>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(Uint16Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint16Array>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(Uint16Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint16Array>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(Uint16Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Uint16Array>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(Uint16Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Uint16Array>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Uint16Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Uint16Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Uint16Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8Uint32ArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8Uint32ArrayCustom.h deleted file mode 100644 index 0f86baa..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8Uint32ArrayCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Uint32ArrayCustom_h -#define V8Uint32ArrayCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Uint32Array.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<Uint32Array> { -public: - typedef v8::Uint32Array V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsUint32Array(); - } - - static size_t length(v8::Handle<v8::Uint32Array> value) - { - return value->Length(); - } - - static size_t length(Uint32Array* array) - { - return array->length(); - } -}; - -typedef V8TypedArray<Uint32Array> V8Uint32Array; - -template<> -class WrapperTypeTraits<Uint32Array> : public TypedArrayWrapperTraits<Uint32Array> { }; - - -inline v8::Handle<v8::Object> wrap(Uint32Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint32Array>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(Uint32Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint32Array>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(Uint32Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint32Array>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(Uint32Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Uint32Array>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(Uint32Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Uint32Array>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Uint32Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Uint32Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Uint32Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8Uint8ArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8Uint8ArrayCustom.h deleted file mode 100644 index fffaecd..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8Uint8ArrayCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Uint8ArrayCustom_h -#define V8Uint8ArrayCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Uint8Array.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<Uint8Array> { -public: - typedef v8::Uint8Array V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsUint8Array(); - } - - static size_t length(v8::Handle<v8::Uint8Array> value) - { - return value->Length(); - } - - static size_t length(Uint8Array* array) - { - return array->length(); - } -}; - -typedef V8TypedArray<Uint8Array> V8Uint8Array; - -template<> -class WrapperTypeTraits<Uint8Array> : public TypedArrayWrapperTraits<Uint8Array> { }; - - -inline v8::Handle<v8::Object> wrap(Uint8Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint8Array>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(Uint8Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint8Array>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(Uint8Array* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint8Array>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(Uint8Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Uint8Array>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(Uint8Array* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Uint8Array>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Uint8Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Uint8Array > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Uint8Array > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8Uint8ClampedArrayCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8Uint8ClampedArrayCustom.h deleted file mode 100644 index 2edd476..0000000 --- a/third_party/WebKit/Source/bindings/v8/custom/V8Uint8ClampedArrayCustom.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8Uint8ClampedArrayCustom_h -#define V8Uint8ClampedArrayCustom_h - -#include "bindings/v8/custom/V8TypedArrayCustom.h" -#include "wtf/Uint8ClampedArray.h" - -namespace WebCore { - -template<> -class TypedArrayTraits<Uint8ClampedArray> { -public: - typedef v8::Uint8ClampedArray V8Type; - - static bool IsInstance(v8::Handle<v8::Value> value) - { - return value->IsUint8ClampedArray(); - } - - static size_t length(v8::Handle<v8::Uint8ClampedArray> value) - { - return value->Length(); - } - - static size_t length(Uint8ClampedArray* array) - { - return array->length(); - } -}; - -typedef V8TypedArray<Uint8ClampedArray> V8Uint8ClampedArray; - -template<> -class WrapperTypeTraits<Uint8ClampedArray> : public TypedArrayWrapperTraits<Uint8ClampedArray> { }; - - -inline v8::Handle<v8::Object> wrap(Uint8ClampedArray* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint8ClampedArray>::wrap(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8(Uint8ClampedArray* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint8ClampedArray>::toV8(impl, creationContext, isolate); -} - -inline v8::Handle<v8::Value> toV8ForMainWorld(Uint8ClampedArray* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return V8TypedArray<Uint8ClampedArray>::toV8ForMainWorld(impl, creationContext, isolate); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(Uint8ClampedArray* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Uint8ClampedArray>::toV8Fast(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(Uint8ClampedArray* impl, const HolderContainer& container, Wrappable* wrappable) -{ - return V8TypedArray<Uint8ClampedArray>::toV8FastForMainWorld(impl, container, wrappable); -} - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Uint8ClampedArray > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8FastForMainWorld(impl.get(), container, wrappable); -} - - -template<class HolderContainer, class Wrappable> -inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Uint8ClampedArray > impl, const HolderContainer& container, Wrappable* wrappable) -{ - return toV8Fast(impl.get(), container, wrappable); -} - -inline v8::Handle<v8::Value> toV8(PassRefPtr< Uint8ClampedArray > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) -{ - return toV8(impl.get(), creationContext, isolate); -} - -} // namespace WebCore - -#endif diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/third_party/WebKit/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp index 7617d97..fa3532e 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp @@ -32,12 +32,17 @@ #include "V8WebGLRenderingContext.h" #include "V8ANGLEInstancedArrays.h" +#include "V8ArrayBufferView.h" #include "V8EXTFragDepth.h" #include "V8EXTTextureFilterAnisotropic.h" +#include "V8Float32Array.h" #include "V8HTMLCanvasElement.h" #include "V8HTMLImageElement.h" #include "V8HTMLVideoElement.h" #include "V8ImageData.h" +#include "V8Int16Array.h" +#include "V8Int32Array.h" +#include "V8Int8Array.h" #include "V8OESElementIndexUint.h" #include "V8OESStandardDerivatives.h" #include "V8OESTextureFloat.h" @@ -45,6 +50,9 @@ #include "V8OESTextureHalfFloat.h" #include "V8OESTextureHalfFloatLinear.h" #include "V8OESVertexArrayObject.h" +#include "V8Uint16Array.h" +#include "V8Uint32Array.h" +#include "V8Uint8Array.h" #include "V8WebGLBuffer.h" #include "V8WebGLCompressedTextureATC.h" #include "V8WebGLCompressedTexturePVRTC.h" @@ -64,14 +72,6 @@ #include "bindings/v8/ExceptionState.h" #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8HiddenPropertyName.h" -#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" -#include "bindings/v8/custom/V8Float32ArrayCustom.h" -#include "bindings/v8/custom/V8Int16ArrayCustom.h" -#include "bindings/v8/custom/V8Int32ArrayCustom.h" -#include "bindings/v8/custom/V8Int8ArrayCustom.h" -#include "bindings/v8/custom/V8Uint16ArrayCustom.h" -#include "bindings/v8/custom/V8Uint32ArrayCustom.h" -#include "bindings/v8/custom/V8Uint8ArrayCustom.h" #include "core/dom/ExceptionCode.h" #include "core/html/canvas/WebGLRenderingContext.h" #include "core/platform/NotImplemented.h" diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/third_party/WebKit/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp index 89a6d19..a5196e7 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "V8XMLHttpRequest.h" +#include "V8ArrayBufferView.h" #include "V8Blob.h" #include "V8Document.h" #include "V8FormData.h" @@ -39,7 +40,6 @@ #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8Utilities.h" #include "bindings/v8/custom/V8ArrayBufferCustom.h" -#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" #include "core/dom/Document.h" #include "core/inspector/InspectorInstrumentation.h" #include "core/page/Frame.h" diff --git a/third_party/WebKit/Source/core/core.gypi b/third_party/WebKit/Source/core/core.gypi index ccbc333..dfe8ffa 100644 --- a/third_party/WebKit/Source/core/core.gypi +++ b/third_party/WebKit/Source/core/core.gypi @@ -203,13 +203,20 @@ 'html/ValidityState.idl', 'html/VoidCallback.idl', 'html/canvas/ANGLEInstancedArrays.idl', + 'html/canvas/ArrayBufferView.idl', 'html/canvas/CanvasGradient.idl', 'html/canvas/CanvasPattern.idl', 'html/canvas/CanvasRenderingContext.idl', 'html/canvas/CanvasRenderingContext2D.idl', 'html/canvas/Canvas2DContextAttributes.idl', + 'html/canvas/DataView.idl', 'html/canvas/EXTFragDepth.idl', 'html/canvas/EXTTextureFilterAnisotropic.idl', + 'html/canvas/Float32Array.idl', + 'html/canvas/Float64Array.idl', + 'html/canvas/Int16Array.idl', + 'html/canvas/Int32Array.idl', + 'html/canvas/Int8Array.idl', 'html/canvas/OESStandardDerivatives.idl', 'html/canvas/OESTextureFloat.idl', 'html/canvas/OESTextureFloatLinear.idl', @@ -218,6 +225,10 @@ 'html/canvas/OESVertexArrayObject.idl', 'html/canvas/OESElementIndexUint.idl', 'html/canvas/Path.idl', + 'html/canvas/Uint16Array.idl', + 'html/canvas/Uint32Array.idl', + 'html/canvas/Uint8Array.idl', + 'html/canvas/Uint8ClampedArray.idl', 'html/canvas/WebGLActiveInfo.idl', 'html/canvas/WebGLBuffer.idl', 'html/canvas/WebGLCompressedTextureATC.idl', diff --git a/third_party/WebKit/Source/core/html/canvas/ArrayBufferView.idl b/third_party/WebKit/Source/core/html/canvas/ArrayBufferView.idl new file mode 100644 index 0000000..0f0aba6 --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/ArrayBufferView.idl @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +[ + NoInterfaceObject, + CustomToV8 +] interface ArrayBufferView { + readonly attribute ArrayBuffer buffer; + readonly attribute unsigned long byteOffset; + readonly attribute unsigned long byteLength; +}; diff --git a/third_party/WebKit/Source/core/html/canvas/DataView.idl b/third_party/WebKit/Source/core/html/canvas/DataView.idl new file mode 100644 index 0000000..5847f9c --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/DataView.idl @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + CustomConstructor(ArrayBuffer buffer, optional unsigned long byteOffset, optional unsigned long byteLength), + CustomToV8 +] interface DataView : ArrayBufferView { + // All these methods raise an exception if they would read or write beyond the end of the view. + + [RaisesException] byte getInt8(unsigned long byteOffset); + [RaisesException] octet getUint8(unsigned long byteOffset); + + [StrictTypeChecking, RaisesException] short getInt16(unsigned long byteOffset, optional boolean littleEndian); + [StrictTypeChecking, RaisesException] unsigned short getUint16(unsigned long byteOffset, optional boolean littleEndian); + [StrictTypeChecking, RaisesException] long getInt32(unsigned long byteOffset, optional boolean littleEndian); + [StrictTypeChecking, RaisesException] unsigned long getUint32(unsigned long byteOffset, optional boolean littleEndian); + + // Use custom code to handle NaN case for JSC. + [StrictTypeChecking, RaisesException] float getFloat32(unsigned long byteOffset, optional boolean littleEndian); + [StrictTypeChecking, RaisesException] double getFloat64(unsigned long byteOffset, optional boolean littleEndian); + + [RaisesException] void setInt8(unsigned long byteOffset, byte value); + [RaisesException] void setUint8(unsigned long byteOffset, octet value); + + [StrictTypeChecking, RaisesException] void setInt16(unsigned long byteOffset, short value, optional boolean littleEndian); + [StrictTypeChecking, RaisesException] void setUint16(unsigned long byteOffset, unsigned short value, optional boolean littleEndian); + [StrictTypeChecking, RaisesException] void setInt32(unsigned long byteOffset, long value, optional boolean littleEndian); + [StrictTypeChecking, RaisesException] void setUint32(unsigned long byteOffset, unsigned long value, optional boolean littleEndian); + [StrictTypeChecking, RaisesException] void setFloat32(unsigned long byteOffset, float value, optional boolean littleEndian); + [StrictTypeChecking, RaisesException] void setFloat64(unsigned long byteOffset, double value, optional boolean littleEndian); +}; + diff --git a/third_party/WebKit/Source/core/html/canvas/Float32Array.idl b/third_party/WebKit/Source/core/html/canvas/Float32Array.idl new file mode 100644 index 0000000..7d5818d --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/Float32Array.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2006, 2010 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + ConstructorTemplate=TypedArray, + CustomToV8, + DoNotCheckConstants +] interface Float32Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 4; + + readonly attribute unsigned long length; + Float32Array subarray([Default=Undefined] optional long start, + optional long end); + + // void set(Float32Array array, optional in unsigned long offset); + // void set(sequence<long> array, optional in unsigned long offset); + void set(); +}; diff --git a/third_party/WebKit/Source/core/html/canvas/Float64Array.idl b/third_party/WebKit/Source/core/html/canvas/Float64Array.idl new file mode 100644 index 0000000..3215e80 --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/Float64Array.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + ConstructorTemplate=TypedArray, + CustomToV8, + DoNotCheckConstants +] interface Float64Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 8; + + readonly attribute unsigned long length; + Float64Array subarray([Default=Undefined] optional long start, + optional long end); + + // void set(Float64Array array, optional in unsigned long offset); + // void set(sequence<long> array, optional in unsigned long offset); + void set(); +}; diff --git a/third_party/WebKit/Source/core/html/canvas/Int16Array.idl b/third_party/WebKit/Source/core/html/canvas/Int16Array.idl new file mode 100644 index 0000000..63640db --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/Int16Array.idl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2006, 2010 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + ConstructorTemplate=TypedArray, + CustomToV8, + DoNotCheckConstants +] interface Int16Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 2; + + readonly attribute unsigned long length; + Int16Array subarray([Default=Undefined] optional long start, + optional long end); + + // void set(Int16Array array, optional in unsigned long offset); + // void set(sequence<long> array, optional in unsigned long offset); + void set(); +}; diff --git a/third_party/WebKit/Source/core/html/canvas/Int32Array.idl b/third_party/WebKit/Source/core/html/canvas/Int32Array.idl new file mode 100644 index 0000000..012e6a8 --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/Int32Array.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + ConstructorTemplate=TypedArray, + CustomToV8, + DoNotCheckConstants +] interface Int32Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 4; + + readonly attribute unsigned long length; + Int32Array subarray([Default=Undefined] optional long start, + optional long end); + + // void set(Int32Array array, optional in unsigned long offset); + // void set(sequence<long> array, optional in unsigned long offset); + void set(); +}; diff --git a/third_party/WebKit/Source/core/html/canvas/Int8Array.idl b/third_party/WebKit/Source/core/html/canvas/Int8Array.idl new file mode 100644 index 0000000..5c65ac1 --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/Int8Array.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + ConstructorTemplate=TypedArray, + CustomToV8, + DoNotCheckConstants +] interface Int8Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 1; + + readonly attribute unsigned long length; + Int8Array subarray([Default=Undefined] optional long start, + optional long end); + + // void set(Int8Array array, optional in unsigned long offset); + // void set(sequence<long> array, optional in unsigned long offset); + void set(); +}; diff --git a/third_party/WebKit/Source/core/html/canvas/Uint16Array.idl b/third_party/WebKit/Source/core/html/canvas/Uint16Array.idl new file mode 100644 index 0000000..96e95ee --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/Uint16Array.idl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + ConstructorTemplate=TypedArray, + CustomToV8, + DoNotCheckConstants +] interface Uint16Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 2; + + readonly attribute unsigned long length; + Uint16Array subarray([Default=Undefined] optional long start, optional long end); + + // void set(Uint16Array array, optional in unsigned long offset); + // void set(sequence<long> array, optional in unsigned long offset); + void set(); +}; diff --git a/third_party/WebKit/Source/core/html/canvas/Uint32Array.idl b/third_party/WebKit/Source/core/html/canvas/Uint32Array.idl new file mode 100644 index 0000000..a964686 --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/Uint32Array.idl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + ConstructorTemplate=TypedArray, + CustomToV8, + DoNotCheckConstants +] interface Uint32Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 4; + + readonly attribute unsigned long length; + Uint32Array subarray([Default=Undefined] optional long start, optional long end); + + // void set(Uint32Array array, optional in unsigned long offset); + // void set(sequence<long> array, optional in unsigned long offset); + void set(); +}; diff --git a/third_party/WebKit/Source/core/html/canvas/Uint8Array.idl b/third_party/WebKit/Source/core/html/canvas/Uint8Array.idl new file mode 100644 index 0000000..afa941c --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/Uint8Array.idl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + ConstructorTemplate=TypedArray, + CustomToV8, + DoNotCheckConstants +] interface Uint8Array : ArrayBufferView { + const unsigned long BYTES_PER_ELEMENT = 1; + + readonly attribute unsigned long length; + Uint8Array subarray([Default=Undefined] optional long start, optional long end); + + // void set(Uint8Array array, optional in unsigned long offset); + // void set(sequence<long> array, optional in unsigned long offset); + void set(); +}; diff --git a/third_party/WebKit/Source/core/html/canvas/Uint8ClampedArray.idl b/third_party/WebKit/Source/core/html/canvas/Uint8ClampedArray.idl new file mode 100644 index 0000000..66c9289 --- /dev/null +++ b/third_party/WebKit/Source/core/html/canvas/Uint8ClampedArray.idl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +[ + GlobalContext=Window&WorkerGlobalScope, + ConstructorTemplate=TypedArray, + CustomToV8, + DoNotCheckConstants +] interface Uint8ClampedArray : Uint8Array { + const unsigned long BYTES_PER_ELEMENT = 1; + + readonly attribute unsigned long length; + Uint8ClampedArray subarray([Default=Undefined] optional long start, optional long end); + + // FIXME: Missing other setters! + // void set(Uint8ClampedArray array, optional in unsigned long offset); + // void set(sequence<long> array, optional in unsigned long offset); + void set(); +}; diff --git a/third_party/WebKit/Source/web/WebArrayBufferView.cpp b/third_party/WebKit/Source/web/WebArrayBufferView.cpp index 044ace4..ae05b7c 100644 --- a/third_party/WebKit/Source/web/WebArrayBufferView.cpp +++ b/third_party/WebKit/Source/web/WebArrayBufferView.cpp @@ -29,7 +29,7 @@ #include "config.h" #include "WebArrayBufferView.h" -#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" +#include "V8ArrayBufferView.h" #include "wtf/ArrayBufferView.h" using namespace WTF; @@ -63,7 +63,7 @@ unsigned WebArrayBufferView::byteLength() const WebArrayBufferView* WebArrayBufferView::createFromV8Value(v8::Handle<v8::Value> value) { - if (!value->IsArrayBufferView()) + if (!WebCore::V8ArrayBufferView::HasInstanceInAnyWorld(value, v8::Isolate::GetCurrent())) return 0; ArrayBufferView* view = WebCore::V8ArrayBufferView::toNative(value->ToObject()); return new WebArrayBufferView(view); diff --git a/third_party/WebKit/Source/web/WebBindings.cpp b/third_party/WebKit/Source/web/WebBindings.cpp index 664b8d7..dacdc25 100644 --- a/third_party/WebKit/Source/web/WebBindings.cpp +++ b/third_party/WebKit/Source/web/WebBindings.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "WebBindings.h" +#include "V8ArrayBufferView.h" #include "V8Element.h" #include "V8Range.h" #include "WebArrayBufferView.h" @@ -41,7 +42,6 @@ #include "bindings/v8/V8DOMWrapper.h" #include "bindings/v8/V8NPUtils.h" #include "bindings/v8/custom/V8ArrayBufferCustom.h" -#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" #include "bindings/v8/npruntime_impl.h" #include "bindings/v8/npruntime_priv.h" #include "core/dom/Range.h" diff --git a/third_party/WebKit/Source/web/WebKit.cpp b/third_party/WebKit/Source/web/WebKit.cpp index 918034d..3e16662 100644 --- a/third_party/WebKit/Source/web/WebKit.cpp +++ b/third_party/WebKit/Source/web/WebKit.cpp @@ -103,8 +103,8 @@ void initialize(Platform* platform) v8::V8::SetEntropySource(&generateEntropy); v8::V8::SetArrayBufferAllocator(WebCore::v8ArrayBufferAllocator()); - static const char* kTypedArraysFlag = "--harmony_array_buffer --harmony_typed_arrays"; - v8::V8::SetFlagsFromString(kTypedArraysFlag, strlen(kTypedArraysFlag)); + static const char* kArrayBufferFlag = "--harmony_array_buffer"; + v8::V8::SetFlagsFromString(kArrayBufferFlag, strlen(kArrayBufferFlag)); v8::V8::Initialize(); WebCore::V8PerIsolateData::ensureInitialized(v8::Isolate::GetCurrent()); |