diff options
author | dslomov@chromium.org <dslomov@chromium.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2013-08-06 13:44:54 +0000 |
---|---|---|
committer | dslomov@chromium.org <dslomov@chromium.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2013-08-06 13:44:54 +0000 |
commit | 35f18d9fde4e9e5deee4276ba4e684ef1baa86bb (patch) | |
tree | 649fc026a9840748ea37c53ca6aa698d00aa288e | |
parent | e1b283f535e9daa615b4492285357ebabd13ec54 (diff) | |
download | chromium_src-35f18d9fde4e9e5deee4276ba4e684ef1baa86bb.zip chromium_src-35f18d9fde4e9e5deee4276ba4e684ef1baa86bb.tar.gz chromium_src-35f18d9fde4e9e5deee4276ba4e684ef1baa86bb.tar.bz2 |
Use V8 implementation of TypedArrays and DataView in Blink
R=jochen@chromium.org,kbr@chromium.org
BUG=259731
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=154741
Review URL: https://chromiumcodereview.appspot.com/19230002
git-svn-id: svn://svn.chromium.org/blink/trunk@155611 bbb929c8-8fbe-4397-9dbb-9b2b20218538
59 files changed, 1856 insertions, 1077 deletions
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index fa8eeff..a5f1d7c 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations @@ -1077,6 +1077,9 @@ crbug.com/248938 virtual/threaded/transitions/equivalent-background-image-no-tra crbug.com/255726 [ Debug ] compositing/contents-opaque/visibility-hidden.html [ Pass Failure ] +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 ] + # Switching to content shell failures crbug.com/178709 plugins/document-open.html [ Failure ] crbug.com/178744 plugins/npruntime/browser-object-identity.html [ Failure ] 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 new file mode 100644 index 0000000..66b8bcb --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-large-array-tests-expected.txt @@ -0,0 +1,14 @@ +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 new file mode 100644 index 0000000..0d63287 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/array-large-array-tests.html @@ -0,0 +1,101 @@ +<!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 6e5bd04..bae03bc 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: 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 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 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 bcc7d85..cd91ae1 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: Index is out of range.. -PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Index is out of range.. +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. Testing Uint8Array -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 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. Testing Int16Array -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 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. Testing Uint16Array -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 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. Testing Int32Array -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 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. Testing Uint32Array -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 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. Testing Float32Array -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 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 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 b9d69e9..21d3c33 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 true +PASS new Uint8ClampedArray(1) instanceof Uint8Array is false PASS test Float32Array SetAndGetPos10ToNeg10 PASS test Float32Array ConstructWithArrayOfSignedValues PASS test Float32Array ConstructWithTypedArrayOfSignedValues @@ -34,7 +34,6 @@ 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 @@ -90,7 +89,6 @@ 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 @@ -199,7 +197,6 @@ 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 @@ -256,7 +253,6 @@ 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 @@ -417,7 +413,6 @@ 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 @@ -474,7 +469,6 @@ 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 30fd961..b182516 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,9 +123,12 @@ 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 - shouldBe('new Uint8ClampedArray(1) instanceof Uint8Array', 'true'); + + // 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'); } // @@ -648,19 +651,6 @@ 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); @@ -1003,7 +993,6 @@ 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 6e201b2..479df30 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: 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 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 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 3f15da4..03a2e2a 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: 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).. +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. 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 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.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.getUint8(0) is 0 -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.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.getInt16(0, true) is 256 -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(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(0) is 1 -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.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.getUint16(0, true) is 256 -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(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(0) is 1 -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.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.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 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, 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, 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 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, 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, 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 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, 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, 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 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, 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, 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 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, 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, 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 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, 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, 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 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, 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, 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 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, 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, 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 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, 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, 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 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.. +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. Test for wrong arguments passed to get methods -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. +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. 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 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.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.setUint8(0, 0) is undefined. PASS view.getUint8(0) is 0 -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.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.setInt16(0, 256, true) is undefined. PASS view.getInt16(0, true) is 256 -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(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(0, 1) is undefined. PASS view.getInt16(0) is 1 -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.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.setUint16(0, 256, true) is undefined. PASS view.getUint16(0, true) is 256 -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(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(0, 1) is undefined. PASS view.getUint16(0) is 1 -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.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.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 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.. +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. Test for wrong arguments passed to set methods -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. +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. +PASS view.setInt8(1) threw exception TypeError: invalid_argument. +PASS view.setUint8(1) threw exception TypeError: invalid_argument. +PASS view.setInt16(1) threw exception TypeError: invalid_argument. +PASS view.setUint16(1) threw exception TypeError: invalid_argument. +PASS view.setInt32(1) threw exception TypeError: invalid_argument. +PASS view.setUint32(1) threw exception TypeError: invalid_argument. +PASS view.setFloat32(1) threw exception TypeError: invalid_argument. +PASS view.setFloat64(1) threw exception TypeError: invalid_argument. 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 4e1ede2..a239803 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,6 +13,7 @@ var basicBufferTypes = ["Uint32", Uint32Array, 4], ["Int8", Int8Array, 1], ["Uint8", Uint8Array, 1], + ["Uint8Clamped", Uint8ClampedArray, 1], ["Int16", Int16Array, 2], ["Uint16", Uint16Array, 2], ["Float32", Float32Array, 4], @@ -115,7 +116,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 c314633..bf5165f 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,7 +25,6 @@ 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 @@ -36,7 +35,6 @@ 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 @@ -47,7 +45,6 @@ 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 @@ -58,7 +55,6 @@ 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 @@ -69,7 +65,6 @@ 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 37ac73a..9c82655 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,19 +44,6 @@ function testConstructionWithNegativeOutOfRangeValues(type, name) { } } -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"); - } -} - // These need to be global for shouldBe to see them var array; var typeSize; @@ -138,7 +125,6 @@ for (var i = 0; i < typeNames.length; i++) { testConstructionWithNullBuffer(type, name); testConstructionWithOutOfRangeValues(type, name); testConstructionWithNegativeOutOfRangeValues(type, name); - testConstructionOfHugeArray(type, name, typeSizes[i]); testSubarrayWithOutOfRangeValues(type, name, typeSizes[i]); testSettingFromArrayWithOutOfRangeOffset(type, name); testSettingFromFakeArrayWithOutOfRangeLength(type, name); diff --git a/third_party/WebKit/LayoutTests/fast/dom/call-a-constructor-as-a-function-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/call-a-constructor-as-a-function-expected.txt index 1c1de48..03388eb 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/call-a-constructor-as-a-function-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/call-a-constructor-as-a-function-expected.txt @@ -6,22 +6,22 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE PASS ArrayBuffer() threw exception TypeError: Constructor ArrayBuffer requires 'new'. SKIP AudioContext is not implemented. PASS FormData() threw exception TypeError: DOM object constructor cannot be called as a function.. -PASS DataView() threw exception TypeError: DOM object constructor cannot be called as a function.. +PASS DataView() threw exception TypeError: Constructor DataView requires 'new'. PASS EventSource() threw exception TypeError: DOM object constructor cannot be called as a function.. PASS FileReader() threw exception TypeError: DOM object constructor cannot be called as a function.. -PASS Float32Array() threw exception TypeError: DOM object constructor cannot be called as a function.. -PASS Float64Array() threw exception TypeError: DOM object constructor cannot be called as a function.. +PASS Float32Array() threw exception TypeError: Constructor Float32Array requires 'new'. +PASS Float64Array() threw exception TypeError: Constructor Float64Array requires 'new'. PASS Audio() threw exception TypeError: DOM object constructor cannot be called as a function.. PASS Image() threw exception TypeError: DOM object constructor cannot be called as a function.. PASS Option() threw exception TypeError: DOM object constructor cannot be called as a function.. -PASS Int16Array() threw exception TypeError: DOM object constructor cannot be called as a function.. -PASS Int32Array() threw exception TypeError: DOM object constructor cannot be called as a function.. -PASS Int8Array() threw exception TypeError: DOM object constructor cannot be called as a function.. +PASS Int16Array() threw exception TypeError: Constructor Int16Array requires 'new'. +PASS Int32Array() threw exception TypeError: Constructor Int32Array requires 'new'. +PASS Int8Array() threw exception TypeError: Constructor Int8Array requires 'new'. PASS MessageChannel() threw exception TypeError: DOM object constructor cannot be called as a function.. PASS SharedWorker() threw exception TypeError: DOM object constructor cannot be called as a function.. -PASS Uint16Array() threw exception TypeError: DOM object constructor cannot be called as a function.. -PASS Uint32Array() threw exception TypeError: DOM object constructor cannot be called as a function.. -PASS Uint8Array() threw exception TypeError: DOM object constructor cannot be called as a function.. +PASS Uint16Array() threw exception TypeError: Constructor Uint16Array requires 'new'. +PASS Uint32Array() threw exception TypeError: Constructor Uint32Array requires 'new'. +PASS Uint8Array() threw exception TypeError: Constructor Uint8Array requires 'new'. PASS WebKitCSSMatrix() threw exception TypeError: DOM object constructor cannot be called as a function.. PASS WebKitPoint() threw exception TypeError: DOM object constructor cannot be called as a function.. PASS WebSocket() threw exception TypeError: DOM object constructor cannot be called as a function.. 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 a0a44fe..d44fc4b 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 1 +PASS DataView.length is 3 PASS ErrorEvent.length is 1 PASS Event.length is 1 PASS EventSource.length is 1 -PASS Float32Array.length is 1 -PASS Float64Array.length is 1 +PASS Float32Array.length is 3 +PASS Float64Array.length is 3 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 1 -PASS Int32Array.length is 1 -PASS Int8Array.length is 1 +PASS Int16Array.length is 3 +PASS Int32Array.length is 3 +PASS Int8Array.length is 3 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 1 -PASS Uint32Array.length is 1 -PASS Uint8Array.length is 1 -PASS Uint8ClampedArray.length is 1 +PASS Uint16Array.length is 3 +PASS Uint32Array.length is 3 +PASS Uint8Array.length is 3 +PASS Uint8ClampedArray.length is 3 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 076cb0f..45a64ca 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', '1'); +shouldBe('DataView.length', '3'); shouldBe('ErrorEvent.length', '1'); shouldBe('Event.length', '1'); shouldBe('EventSource.length', '1'); -shouldBe('Float32Array.length', '1'); -shouldBe('Float64Array.length', '1'); +shouldBe('Float32Array.length', '3'); +shouldBe('Float64Array.length', '3'); shouldBe('FileReader.length', '0'); shouldBe('FileReaderSync.length', '0'); shouldBe('HashChangeEvent.length', '1'); -shouldBe('Int16Array.length', '1'); -shouldBe('Int32Array.length', '1'); -shouldBe('Int8Array.length', '1'); +shouldBe('Int16Array.length', '3'); +shouldBe('Int32Array.length', '3'); +shouldBe('Int8Array.length', '3'); 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', '1'); -shouldBe('Uint32Array.length', '1'); -shouldBe('Uint8Array.length', '1'); -shouldBe('Uint8ClampedArray.length', '1'); +shouldBe('Uint16Array.length', '3'); +shouldBe('Uint32Array.length', '3'); +shouldBe('Uint8Array.length', '3'); +shouldBe('Uint8ClampedArray.length', '3'); 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 dc494d8..4423736 100644 --- a/third_party/WebKit/LayoutTests/fast/js/getOwnPropertyDescriptor-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/js/getOwnPropertyDescriptor-expected.txt @@ -159,16 +159,6 @@ 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 09c244d..19d0d2b 100644 --- a/third_party/WebKit/LayoutTests/fast/js/resources/getOwnPropertyDescriptor.js +++ b/third_party/WebKit/LayoutTests/fast/js/resources/getOwnPropertyDescriptor.js @@ -50,10 +50,6 @@ 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 d178f48..13a3dd7 100644 --- a/third_party/WebKit/Source/bindings/bindings.gypi +++ b/third_party/WebKit/Source/bindings/bindings.gypi @@ -163,6 +163,7 @@ '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,6 +176,8 @@ 'v8/custom/V8EventTargetCustom.cpp', 'v8/custom/V8ErrorEventCustom.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', @@ -198,6 +201,9 @@ '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', @@ -224,6 +230,11 @@ 'v8/custom/V8TextCustom.cpp', 'v8/custom/V8TrackEventCustom.cpp', 'v8/custom/V8TreeWalkerCustom.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 1ecc85d..0a668971 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 ($type eq "ArrayBuffer") { - AddToImplIncludes("bindings/v8/custom/V8ArrayBufferCustom.h"); + } elsif (IsTypedArrayType($type)) { + AddToImplIncludes("bindings/v8/custom/V8${type}Custom.h"); } else { AddToImplIncludes("V8${type}.h"); } @@ -439,7 +439,7 @@ sub HeaderFilesForInterface my $implClassName = shift; my @includes = (); - if (IsTypedArrayType($interfaceName) or $interfaceName eq "ArrayBuffer") { + if (IsTypedArrayType($interfaceName)) { push(@includes, "wtf/${interfaceName}.h"); } elsif (!SkipIncludeHeader($interfaceName)) { my $idlFilename = IDLFileForInterface($interfaceName) or die("Could NOT find IDL file for interface \"$interfaceName\" $!\n"); @@ -2727,24 +2727,6 @@ 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; @@ -4149,8 +4131,6 @@ END GenerateConstructor($interface); } elsif (IsConstructorTemplate($interface, "Event")) { GenerateEventConstructor($interface); - } elsif (IsConstructorTemplate($interface, "TypedArray")) { - GenerateTypedArrayConstructor($interface); } } if (IsConstructable($interface)) { @@ -5033,8 +5013,8 @@ sub GetNativeType die "UnionType is not supported" if IsUnionType($type); - if ($type eq "ArrayBuffer") { - return $isParameter ? "ArrayBuffer*" : "RefPtr<ArrayBuffer>"; + if (IsTypedArrayType($type)) { + return $isParameter ? "${type}*" : "RefPtr<${type}>"; } # We need to check [ImplementedAs] extended attribute for wrapper types. @@ -5162,9 +5142,9 @@ sub JSValueToNative return "V8DOMWrapper::isDOMWrapper($value) ? toWrapperTypeInfo(v8::Handle<v8::Object>::Cast($value))->toEventTarget(v8::Handle<v8::Object>::Cast($value)) : 0"; } - if ($type eq "ArrayBuffer") { + if (IsTypedArrayType($type)) { AddIncludesForType($type); - return "$value->IsArrayBuffer() ? V8ArrayBuffer::toNative(v8::Handle<v8::ArrayBuffer>::Cast($value)) : 0" + return "$value->Is${type}() ? V8${type}::toNative(v8::Handle<v8::${type}>::Cast($value)) : 0" } if ($type eq "XPathNSResolver") { @@ -5198,7 +5178,7 @@ sub CreateCustomSignature foreach my $parameter (@{$function->parameters}) { if ($first) { $first = 0; } else { $code .= ", "; } - if (IsWrapperType($parameter->type) && $parameter->type ne "ArrayBuffer") { + if (IsWrapperType($parameter->type) && not IsTypedArrayType($parameter->type)) { 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. @@ -5287,7 +5267,7 @@ sub IsCallbackInterface { my $type = shift; return 0 unless IsWrapperType($type); - return 0 if $type eq "ArrayBuffer"; + return 0 if IsTypedArrayType($type); my $idlFile = IDLFileForInterface($type) or die("Could NOT find IDL file for interface \"$type\"!\n"); diff --git a/third_party/WebKit/Source/bindings/tests/results/V8Float64Array.cpp b/third_party/WebKit/Source/bindings/tests/results/V8Float64Array.cpp index 2fece9b..b107b10 100644 --- a/third_party/WebKit/Source/bindings/tests/results/V8Float64Array.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/V8Float64Array.cpp @@ -23,8 +23,6 @@ #include "RuntimeEnabledFeatures.h" #include "V8ArrayBufferView.h" -#include "V8Float32Array.h" -#include "V8Int32Array.h" #include "bindings/v8/ExceptionState.h" #include "bindings/v8/ScriptController.h" #include "bindings/v8/V8Binding.h" @@ -33,6 +31,9 @@ #include "bindings/v8/V8ObjectConstructor.h" #include "bindings/v8/custom/V8ArrayBufferCustom.h" #include "bindings/v8/custom/V8ArrayBufferViewCustom.h" +#include "bindings/v8/custom/V8Float32ArrayCustom.h" +#include "bindings/v8/custom/V8Float64ArrayCustom.h" +#include "bindings/v8/custom/V8Int32ArrayCustom.h" #include "core/dom/ContextFeatures.h" #include "core/dom/Document.h" #include "core/page/Frame.h" @@ -76,7 +77,7 @@ static void fooMethod(const v8::FunctionCallbackInfo<v8::Value>& args) return; } Float64Array* imp = V8Float64Array::toNative(args.Holder()); - V8TRYCATCH_VOID(Float32Array*, array, V8Float32Array::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate())) ? V8Float32Array::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); + V8TRYCATCH_VOID(Float32Array*, array, args[0]->IsFloat32Array() ? V8Float32Array::toNative(v8::Handle<v8::Float32Array>::Cast(args[0])) : 0); v8SetReturnValue(args, toV8(imp->foo(array), args.Holder(), args.GetIsolate())); return; } @@ -100,11 +101,6 @@ static void setMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); } -static void constructor(const v8::FunctionCallbackInfo<v8::Value>& args) -{ - return constructWebGLArray<Float64Array, V8Float64Array, double>(args, &V8Float64Array::info, v8::kExternalDoubleArray); -} - static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); @@ -169,7 +165,7 @@ static v8::Handle<v8::FunctionTemplate> ConfigureV8Float64ArrayTemplate(v8::Hand // Custom Signature 'foo' const int fooArgc = 1; - v8::Handle<v8::FunctionTemplate> fooArgv[fooArgc] = { V8PerIsolateData::from(isolate)->rawTemplate(&V8Float32Array::info, currentWorldType) }; + v8::Handle<v8::FunctionTemplate> fooArgv[fooArgc] = { v8::Handle<v8::FunctionTemplate>() }; v8::Handle<v8::Signature> fooSignature = v8::Signature::New(desc, fooArgc, fooArgv); proto->Set(v8::String::NewSymbol("foo"), v8::FunctionTemplate::New(Float64ArrayV8Internal::fooMethodCallback, v8Undefined(), fooSignature, 1)); diff --git a/third_party/WebKit/Source/bindings/tests/results/V8TestObject.cpp b/third_party/WebKit/Source/bindings/tests/results/V8TestObject.cpp index 7551278..2386c59 100644 --- a/third_party/WebKit/Source/bindings/tests/results/V8TestObject.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/V8TestObject.cpp @@ -25,7 +25,6 @@ #include "RuntimeEnabledFeatures.h" #include "V8DOMStringList.h" #include "V8Document.h" -#include "V8Float32Array.h" #include "V8MessagePort.h" #include "V8Node.h" #include "V8SVGDocument.h" @@ -50,6 +49,7 @@ #include "bindings/v8/V8EventListenerList.h" #include "bindings/v8/V8HiddenPropertyName.h" #include "bindings/v8/V8ObjectConstructor.h" +#include "bindings/v8/custom/V8Float32ArrayCustom.h" #include "core/dom/ContextFeatures.h" #include "core/dom/CustomElementCallbackDispatcher.h" #include "core/dom/Document.h" @@ -845,7 +845,7 @@ static void typedArrayAttrAttrGetterCallback(v8::Local<v8::String> name, const v static void typedArrayAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) { TestObj* imp = V8TestObject::toNative(info.Holder()); - V8TRYCATCH_VOID(Float32Array*, v, V8Float32Array::HasInstance(value, info.GetIsolate(), worldType(info.GetIsolate())) ? V8Float32Array::toNative(v8::Handle<v8::Object>::Cast(value)) : 0); + V8TRYCATCH_VOID(Float32Array*, v, value->IsFloat32Array() ? V8Float32Array::toNative(v8::Handle<v8::Float32Array>::Cast(value)) : 0); imp->setTypedArrayAttr(WTF::getPtr(v)); return; } diff --git a/third_party/WebKit/Source/bindings/tests/results/V8TestOverloadedConstructors.cpp b/third_party/WebKit/Source/bindings/tests/results/V8TestOverloadedConstructors.cpp index 70493c0..aa56c3c 100644 --- a/third_party/WebKit/Source/bindings/tests/results/V8TestOverloadedConstructors.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/V8TestOverloadedConstructors.cpp @@ -22,7 +22,6 @@ #include "V8TestOverloadedConstructors.h" #include "RuntimeEnabledFeatures.h" -#include "V8ArrayBufferView.h" #include "V8Blob.h" #include "bindings/v8/ExceptionState.h" #include "bindings/v8/ScriptController.h" @@ -31,6 +30,7 @@ #include "bindings/v8/V8DOMWrapper.h" #include "bindings/v8/V8ObjectConstructor.h" #include "bindings/v8/custom/V8ArrayBufferCustom.h" +#include "bindings/v8/custom/V8ArrayBufferViewCustom.h" #include "core/dom/ContextFeatures.h" #include "core/dom/Document.h" #include "core/page/Frame.h" @@ -78,7 +78,7 @@ static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& args) static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& args) { - V8TRYCATCH_VOID(ArrayBufferView*, arrayBufferView, V8ArrayBufferView::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate())) ? V8ArrayBufferView::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); + V8TRYCATCH_VOID(ArrayBufferView*, arrayBufferView, args[0]->IsArrayBufferView() ? V8ArrayBufferView::toNative(v8::Handle<v8::ArrayBufferView>::Cast(args[0])) : 0); RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create(arrayBufferView); v8::Handle<v8::Object> wrapper = args.Holder(); diff --git a/third_party/WebKit/Source/bindings/v8/Dictionary.cpp b/third_party/WebKit/Source/bindings/v8/Dictionary.cpp index a25d7fa..199197b 100644 --- a/third_party/WebKit/Source/bindings/v8/Dictionary.cpp +++ b/third_party/WebKit/Source/bindings/v8/Dictionary.cpp @@ -36,12 +36,13 @@ #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 1e34ad8..e7c30bb 100644 --- a/third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp +++ b/third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp @@ -31,7 +31,6 @@ #include "config.h" #include "bindings/v8/ScriptProfiler.h" -#include "V8ArrayBufferView.h" #include "V8Node.h" #include "V8Window.h" #include "bindings/v8/RetainedDOMInfo.h" @@ -39,6 +38,7 @@ #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 (!toWrapperTypeInfo(*wrapper)->isSubclass(&V8ArrayBufferView::info)) + if (!(*wrapper)->IsArrayBufferView()) 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 6de4de2..7bd247f 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/V8Binding.cpp b/third_party/WebKit/Source/bindings/v8/V8Binding.cpp index 137a7a4..8e01e2d 100644 --- a/third_party/WebKit/Source/bindings/v8/V8Binding.cpp +++ b/third_party/WebKit/Source/bindings/v8/V8Binding.cpp @@ -110,6 +110,13 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { return data; } + virtual void* AllocateUninitialized(size_t size) OVERRIDE + { + void* data; + WTF::ArrayBufferContents::allocateMemory(size, WTF::ArrayBufferContents::DontInitialize, data); + return data; + } + virtual void Free(void* data) { WTF::ArrayBufferContents::freeMemory(data); diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp b/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp index 367a723..1d83f4d 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.cpp @@ -25,32 +25,63 @@ #include "config.h" #include "bindings/v8/custom/V8ArrayBufferViewCustom.h" -#include "V8ArrayBufferViewCustomScript.h" -#include "bindings/v8/V8HiddenPropertyName.h" -#include "bindings/v8/V8ScriptRunner.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 <v8.h> namespace WebCore { -bool copyElements(v8::Handle<v8::Object> destArray, v8::Handle<v8::Object> srcArray, uint32_t length, uint32_t offset, v8::Isolate* isolate) +using namespace WTF; + +ArrayBufferView* V8ArrayBufferView::toNative(v8::Handle<v8::Object> object) { - 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; -} + 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; } + + +} // 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 98de7f5..d39a9d2 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h +++ b/third_party/WebKit/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h @@ -37,273 +37,29 @@ #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."; -// 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; +class V8ArrayBufferView { +public: + static bool HasInstance(v8::Handle<v8::Value> value, v8::Isolate*, WrapperWorldType) + { + 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 bool HasInstanceInAnyWorld(v8::Handle<v8::Value> value, v8::Isolate*) + { + return value->IsArrayBufferView(); } + static ArrayBufferView* toNative(v8::Handle<v8::Object>); - 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; + static inline void* toInternalPointer(ArrayBufferView* impl) + { + return impl; } +}; - 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 b13f701..32e35c3 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 569e9c3..6c6e2fc 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8CryptoCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8CryptoCustom.cpp @@ -25,10 +25,11 @@ #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 72b7af1..e07dfa5 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.cpp @@ -24,37 +24,29 @@ */ #include "config.h" -#include "core/html/canvas/DataView.h" +#include "bindings/v8/custom/V8DataViewCustom.h" -#include "V8DataView.h" #include "bindings/v8/V8Binding.h" #include "bindings/v8/custom/V8ArrayBufferViewCustom.h" +#include "core/html/canvas/DataView.h" namespace WebCore { -void V8DataView::constructorCustom(const v8::FunctionCallbackInfo<v8::Value>& args) +static void initializeScriptWrappableForInterface(DataView* object) { - 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); + if (ScriptWrappable::wrapperCanBeStoredInObject(object)) + ScriptWrappable::setTypeInfoInObject(object, &V8DataView::info); + else + ASSERT_NOT_REACHED(); } -// FIXME: Don't need this override. -v8::Handle<v8::Object> wrap(DataView* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) +} // 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) { - ASSERT(impl); - return V8DataView::createWrapper(impl, creationContext, isolate); + WebCore::initializeScriptWrappableForInterface(object); } - -} // namespace WebCore diff --git a/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.h b/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.h new file mode 100644 index 0000000..67f9781 --- /dev/null +++ b/third_party/WebKit/Source/bindings/v8/custom/V8DataViewCustom.h @@ -0,0 +1,113 @@ +/* + * 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 new file mode 100644 index 0000000..f980ea0 --- /dev/null +++ b/third_party/WebKit/Source/bindings/v8/custom/V8Float32ArrayCustom.h @@ -0,0 +1,113 @@ +/* + * 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 new file mode 100644 index 0000000..1cabb08 --- /dev/null +++ b/third_party/WebKit/Source/bindings/v8/custom/V8Float64ArrayCustom.h @@ -0,0 +1,113 @@ +/* + * 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 cb35401..3e2e670 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 "V8Uint8ClampedArray.h" +#include "bindings/v8/custom/V8Uint8ClampedArrayCustom.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 1ac446e..73b8d63 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp @@ -32,20 +32,11 @@ #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" @@ -53,6 +44,15 @@ #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 new file mode 100644 index 0000000..f5a7c83 --- /dev/null +++ b/third_party/WebKit/Source/bindings/v8/custom/V8Int16ArrayCustom.h @@ -0,0 +1,113 @@ +/* + * 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 new file mode 100644 index 0000000..29a927b --- /dev/null +++ b/third_party/WebKit/Source/bindings/v8/custom/V8Int32ArrayCustom.h @@ -0,0 +1,113 @@ +/* + * 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 new file mode 100644 index 0000000..f325aba --- /dev/null +++ b/third_party/WebKit/Source/bindings/v8/custom/V8Int8ArrayCustom.h @@ -0,0 +1,113 @@ +/* + * 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 new file mode 100644 index 0000000..44997bf --- /dev/null +++ b/third_party/WebKit/Source/bindings/v8/custom/V8TypedArrayCustom.h @@ -0,0 +1,189 @@ +/* + * 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::Local<v8::Value> v8Buffer = v8::Local<v8::Value>::New(WebCore::toV8(buffer.get(), creationContext, isolate)); + + ASSERT(v8Buffer->IsArrayBuffer()); + + v8::Local<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 new file mode 100644 index 0000000..30a7403 --- /dev/null +++ b/third_party/WebKit/Source/bindings/v8/custom/V8Uint16ArrayCustom.h @@ -0,0 +1,113 @@ +/* + * 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 new file mode 100644 index 0000000..0f86baa --- /dev/null +++ b/third_party/WebKit/Source/bindings/v8/custom/V8Uint32ArrayCustom.h @@ -0,0 +1,113 @@ +/* + * 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 new file mode 100644 index 0000000..fffaecd --- /dev/null +++ b/third_party/WebKit/Source/bindings/v8/custom/V8Uint8ArrayCustom.h @@ -0,0 +1,113 @@ +/* + * 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 new file mode 100644 index 0000000..2edd476 --- /dev/null +++ b/third_party/WebKit/Source/bindings/v8/custom/V8Uint8ClampedArrayCustom.h @@ -0,0 +1,113 @@ +/* + * 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 18ec9ce..3d2c55a 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp @@ -32,17 +32,12 @@ #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" @@ -50,9 +45,6 @@ #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" @@ -72,6 +64,14 @@ #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 4302221..e9eabc2 100644 --- a/third_party/WebKit/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp +++ b/third_party/WebKit/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp @@ -31,7 +31,6 @@ #include "config.h" #include "V8XMLHttpRequest.h" -#include "V8ArrayBufferView.h" #include "V8Blob.h" #include "V8Document.h" #include "V8FormData.h" @@ -40,6 +39,7 @@ #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 de6e219..221ea62 100644 --- a/third_party/WebKit/Source/core/core.gypi +++ b/third_party/WebKit/Source/core/core.gypi @@ -198,26 +198,16 @@ 'html/URL.idl', 'html/ValidityState.idl', 'html/canvas/ANGLEInstancedArrays.idl', - 'html/canvas/ArrayBufferView.idl', 'html/canvas/CanvasGradient.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/OESTextureHalfFloat.idl', 'html/canvas/OESVertexArrayObject.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/WebGLCompressedTextureATC.idl', 'html/canvas/WebGLCompressedTexturePVRTC.idl', diff --git a/third_party/WebKit/Source/core/html/canvas/Float32Array.idl b/third_party/WebKit/Source/core/html/canvas/Float32Array.idl deleted file mode 100644 index 09e368b..0000000 --- a/third_party/WebKit/Source/core/html/canvas/Float32Array.idl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 deleted file mode 100644 index f9335ff..0000000 --- a/third_party/WebKit/Source/core/html/canvas/Float64Array.idl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 deleted file mode 100644 index 350bcbb..0000000 --- a/third_party/WebKit/Source/core/html/canvas/Int16Array.idl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 deleted file mode 100644 index 7b28526..0000000 --- a/third_party/WebKit/Source/core/html/canvas/Int32Array.idl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 deleted file mode 100644 index 0cd83d5..0000000 --- a/third_party/WebKit/Source/core/html/canvas/Int8Array.idl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 deleted file mode 100644 index dd62b02..0000000 --- a/third_party/WebKit/Source/core/html/canvas/Uint16Array.idl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 deleted file mode 100644 index d47c7ca..0000000 --- a/third_party/WebKit/Source/core/html/canvas/Uint32Array.idl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 deleted file mode 100644 index 6058506..0000000 --- a/third_party/WebKit/Source/core/html/canvas/Uint8Array.idl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 deleted file mode 100644 index 66c9289..0000000 --- a/third_party/WebKit/Source/core/html/canvas/Uint8ClampedArray.idl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 ae05b7c..044ace4 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 "V8ArrayBufferView.h" +#include "bindings/v8/custom/V8ArrayBufferViewCustom.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 (!WebCore::V8ArrayBufferView::HasInstanceInAnyWorld(value, v8::Isolate::GetCurrent())) + if (!value->IsArrayBufferView()) 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 dacdc25..664b8d7 100644 --- a/third_party/WebKit/Source/web/WebBindings.cpp +++ b/third_party/WebKit/Source/web/WebBindings.cpp @@ -31,7 +31,6 @@ #include "config.h" #include "WebBindings.h" -#include "V8ArrayBufferView.h" #include "V8Element.h" #include "V8Range.h" #include "WebArrayBufferView.h" @@ -42,6 +41,7 @@ #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 3e16662..918034d 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* kArrayBufferFlag = "--harmony_array_buffer"; - v8::V8::SetFlagsFromString(kArrayBufferFlag, strlen(kArrayBufferFlag)); + static const char* kTypedArraysFlag = "--harmony_array_buffer --harmony_typed_arrays"; + v8::V8::SetFlagsFromString(kTypedArraysFlag, strlen(kTypedArraysFlag)); v8::V8::Initialize(); WebCore::V8PerIsolateData::ensureInitialized(v8::Isolate::GetCurrent()); |