[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

jianli at chromium.org jianli at chromium.org
Wed Dec 22 16:31:51 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 3cbb559a984d6d48eb6fd3166e9a1492ab54cf46
Author: jianli at chromium.org <jianli at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Nov 25 03:34:21 2010 +0000

    Implement DataView interface from Typed Array specification
    https://bugs.webkit.org/show_bug.cgi?id=46541
    
    Reviewed by Kenneth Russell.
    
    WebCore:
    
    Test: fast/canvas/webgl/data-view-test.html
    
    * CMakeLists.txt:
    * DerivedSources.make:
    * GNUmakefile.am:
    * WebCore.gypi:
    * WebCore.pri:
    * WebCore.pro:
    * WebCore.xcodeproj/project.pbxproj:
    * bindings/generic/RuntimeEnabledFeatures.h:
    (WebCore::RuntimeEnabledFeatures::dataViewEnabled):
    * bindings/js/JSArrayBufferViewHelper.h:
    (WebCore::constructArrayBufferViewWithArrayBufferArgument):
    (WebCore::constructArrayBufferView):
    * bindings/js/JSDOMWindowCustom.cpp:
    (WebCore::JSDOMWindow::dataView):
    * bindings/js/JSDataViewCustom.cpp: Added.
    * bindings/js/JSFloat32ArrayCustom.cpp:
    (WebCore::JSFloat32ArrayConstructor::constructJSFloat32Array):
    * bindings/js/JSInt16ArrayCustom.cpp:
    (WebCore::JSInt16ArrayConstructor::constructJSInt16Array):
    * bindings/js/JSInt32ArrayCustom.cpp:
    (WebCore::JSInt32ArrayConstructor::constructJSInt32Array):
    * bindings/js/JSInt8ArrayCustom.cpp:
    (WebCore::JSInt8ArrayConstructor::constructJSInt8Array):
    * bindings/js/JSUint16ArrayCustom.cpp:
    (WebCore::JSUint16ArrayConstructor::constructJSUint16Array):
    * bindings/js/JSUint32ArrayCustom.cpp:
    (WebCore::JSUint32ArrayConstructor::constructJSUint32Array):
    * bindings/js/JSUint8ArrayCustom.cpp:
    (WebCore::JSUint8ArrayConstructor::constructJSUint8Array):
    * bindings/v8/custom/V8ArrayBufferViewCustom.h:
    (WebCore::constructWebGLArrayWithArrayBufferArgument):
    (WebCore::constructWebGLArray):
    * bindings/v8/custom/V8DataViewCustom.cpp: Added.
    * html/canvas/ArrayBufferView.h:
    (WebCore::ArrayBufferView::isDataView):
    * html/canvas/DataView.cpp: Added.
    * html/canvas/DataView.h: Added.
    * html/canvas/DataView.idl: Added.
    * page/DOMWindow.idl:
    
    LayoutTests:
    
    Add a new test for testing DataView interface. Also update some tests
    to exclude DataView property from being tested because it is not
    exposed to all platforms.
    
    * fast/canvas/webgl/data-view-test-expected.txt: Added.
    * fast/canvas/webgl/data-view-test.html: Added.
    * fast/dom/Window/script-tests/window-property-descriptors.js:
    * fast/dom/Window/window-properties.html:
    * fast/dom/script-tests/prototype-inheritance-2.js:
    (constructorNamesForWindow):
    * fast/dom/script-tests/prototype-inheritance.js:
    * fast/js/script-tests/global-constructors.js:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72718 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 6c9fd93..e182840 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,23 @@
+2010-11-24  Jian Li  <jianli at chromium.org>
+
+        Reviewed by Kenneth Russell.
+
+        Implement DataView interface from Typed Array specification
+        https://bugs.webkit.org/show_bug.cgi?id=46541
+
+        Add a new test for testing DataView interface. Also update some tests
+        to exclude DataView property from being tested because it is not
+        exposed to all platforms.
+
+        * fast/canvas/webgl/data-view-test-expected.txt: Added.
+        * fast/canvas/webgl/data-view-test.html: Added.
+        * fast/dom/Window/script-tests/window-property-descriptors.js:
+        * fast/dom/Window/window-properties.html:
+        * fast/dom/script-tests/prototype-inheritance-2.js:
+        (constructorNamesForWindow):
+        * fast/dom/script-tests/prototype-inheritance.js:
+        * fast/js/script-tests/global-constructors.js:
+
 2010-11-24  Eric Uhrhane  <ericu at chromium.org>
 
         Reviewed by Tony Chang.
diff --git a/LayoutTests/fast/canvas/webgl/data-view-test-expected.txt b/LayoutTests/fast/canvas/webgl/data-view-test-expected.txt
new file mode 100644
index 0000000..6ad4e44
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/data-view-test-expected.txt
@@ -0,0 +1,765 @@
+Test DataView.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Test for constructor taking 1 argument
+PASS view = new DataView(arayBuffer) is defined.
+PASS view.byteOffset is 0
+PASS view.byteLength is 2
+
+Test for constructor taking 2 arguments
+PASS view = new DataView(arayBuffer, 1) is defined.
+PASS view.byteOffset is 1
+PASS view.byteLength is 1
+
+Test for constructor taking 3 arguments
+PASS view = new DataView(arayBuffer, 0, 1) is defined.
+PASS view.byteOffset is 0
+PASS view.byteLength is 1
+
+Test for constructor throwing exception
+PASS view = new DataView(arayBuffer, 0, 3) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view = new DataView(arayBuffer, 1, 2) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view = new DataView(arayBuffer, 2, 1) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+
+Test for get methods that work
+PASS view.getInt8(0) is 0
+PASS view.getInt8(8) is -128
+PASS view.getInt8(15) is -1
+PASS view.getUint8(0) is 0
+PASS view.getUint8(8) is 128
+PASS view.getUint8(15) is 255
+PASS view.getInt16(0, true) is 256
+PASS view.getInt16(5, true) is 26213
+PASS view.getInt16(9, true) is -32127
+PASS view.getInt16(14, true) is -2
+PASS view.getInt16(0) is 1
+PASS view.getInt16(5) is 25958
+PASS view.getInt16(9) is -32382
+PASS view.getInt16(14) is -257
+PASS view.getUint16(0, true) is 256
+PASS view.getUint16(5, true) is 26213
+PASS view.getUint16(9, true) is 33409
+PASS view.getUint16(14, true) is 65534
+PASS view.getUint16(0) is 1
+PASS view.getUint16(5) is 25958
+PASS view.getUint16(9) is 33154
+PASS view.getUint16(14) is 65279
+PASS view.getInt32(0, true) is 50462976
+PASS view.getInt32(3, true) is 1717920771
+PASS view.getInt32(6, true) is -2122291354
+PASS view.getInt32(9, true) is -58490239
+PASS view.getInt32(12, true) is -66052
+PASS view.getInt32(0) is 66051
+PASS view.getInt32(3) is 56911206
+PASS view.getInt32(6) is 1718059137
+PASS view.getInt32(9) is -2122152964
+PASS view.getInt32(12) is -50462977
+PASS view.getUint32(0, true) is 50462976
+PASS view.getUint32(3, true) is 1717920771
+PASS view.getUint32(6, true) is 2172675942
+PASS view.getUint32(9, true) is 4236477057
+PASS view.getUint32(12, true) is 4294901244
+PASS view.getUint32(0) is 66051
+PASS view.getUint32(3) is 56911206
+PASS view.getUint32(6) is 1718059137
+PASS view.getUint32(9) is 2172814332
+PASS view.getUint32(12) is 4244504319
+PASS view.getFloat32(0, true) is 10
+PASS view.getFloat32(3, true) is 10
+PASS view.getFloat32(7, true) is 10
+PASS view.getFloat32(10, true) is 10
+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) is 1.2300000190734863
+PASS view.getFloat32(3, true) is 1.2300000190734863
+PASS view.getFloat32(7, true) is 1.2300000190734863
+PASS view.getFloat32(10, true) is 1.2300000190734863
+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) is -45621.37109375
+PASS view.getFloat32(3, true) is -45621.37109375
+PASS view.getFloat32(7, true) is -45621.37109375
+PASS view.getFloat32(10, true) is -45621.37109375
+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) is NaN
+PASS view.getFloat32(3, true) is NaN
+PASS view.getFloat32(7, true) is NaN
+PASS view.getFloat32(10, true) is NaN
+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) is -NaN
+PASS view.getFloat32(3, true) is -NaN
+PASS view.getFloat32(7, true) is -NaN
+PASS view.getFloat32(10, true) is -NaN
+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) is 10
+PASS view.getFloat64(3, true) is 10
+PASS view.getFloat64(7, true) is 10
+PASS view.getFloat64(10, true) is 10
+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) is 1.23
+PASS view.getFloat64(3, true) is 1.23
+PASS view.getFloat64(7, true) is 1.23
+PASS view.getFloat64(10, true) is 1.23
+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) is -6213576.4839
+PASS view.getFloat64(3, true) is -6213576.4839
+PASS view.getFloat64(7, true) is -6213576.4839
+PASS view.getFloat64(10, true) is -6213576.4839
+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) is NaN
+PASS view.getFloat64(3, true) is NaN
+PASS view.getFloat64(7, true) is NaN
+PASS view.getFloat64(10, true) is NaN
+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) is -NaN
+PASS view.getFloat64(3, true) is -NaN
+PASS view.getFloat64(7, true) is -NaN
+PASS view.getFloat64(10, true) is -NaN
+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 might read beyound range
+PASS view.getInt8(0) is 0
+PASS view.getInt8(8) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getInt8(15) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getUint8(0) is 0
+PASS view.getUint8(8) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getUint8(15) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getInt16(0, true) is 256
+PASS view.getInt16(5, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getInt16(9, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getInt16(14, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getInt16(0) is 1
+PASS view.getInt16(5) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getInt16(9) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getInt16(14) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getUint16(0, true) is 256
+PASS view.getUint16(5, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getUint16(9, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getUint16(14, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getUint16(0) is 1
+PASS view.getUint16(5) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getUint16(9) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getUint16(14) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getInt32(0, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getInt32(3, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getInt32(6, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getInt32(9, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getInt32(12, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getInt32(0) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getInt32(3) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getInt32(6) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getInt32(9) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getInt32(12) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getUint32(0, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getUint32(3, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getUint32(6, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getUint32(9, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getUint32(12, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getUint32(0) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getUint32(3) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getUint32(6) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getUint32(9) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getUint32(12) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat32(0, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat32(3, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat32(7, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat32(10, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+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 Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat32(3, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat32(7, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat32(10, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+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 Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat32(3, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat32(7, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat32(10, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+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 Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat32(3, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat32(7, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat32(10, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+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 Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat32(3, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat32(7, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat32(10, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+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 Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat64(3, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat64(7, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat64(10, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+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 Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat64(3, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat64(7, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat64(10, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+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 Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat64(3, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat64(7, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat64(10, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+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 Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat64(3, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat64(7, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat64(10, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+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 Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat64(3, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat64(7, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.getFloat64(10, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+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 wrong arguments passed to get methods
+PASS view.getInt8() threw exception SyntaxError: Not enough arguments.
+PASS view.getUint8() threw exception SyntaxError: Not enough arguments.
+PASS view.getInt16() threw exception SyntaxError: Not enough arguments.
+PASS view.getUint16() threw exception SyntaxError: Not enough arguments.
+PASS view.getInt32() threw exception SyntaxError: Not enough arguments.
+PASS view.getUint32() threw exception SyntaxError: Not enough arguments.
+PASS view.getFloat32() threw exception SyntaxError: Not enough arguments.
+PASS view.getFloat64() threw exception SyntaxError: Not enough arguments.
+
+Test for set methods that work
+PASS view.setInt8(0, 0) is undefined.
+PASS view.getInt8(0) is 0
+PASS view.setInt8(8, -128) is undefined.
+PASS view.getInt8(8) is -128
+PASS view.setInt8(15, -1) is undefined.
+PASS view.getInt8(15) is -1
+PASS view.setUint8(0, 0) is undefined.
+PASS view.getUint8(0) is 0
+PASS view.setUint8(8, 128) is undefined.
+PASS view.getUint8(8) is 128
+PASS view.setUint8(15, 255) is undefined.
+PASS view.getUint8(15) is 255
+PASS view.setInt16(0, 256, true) is undefined.
+PASS view.getInt16(0, true) is 256
+PASS view.setInt16(5, 26213, true) is undefined.
+PASS view.getInt16(5, true) is 26213
+PASS view.setInt16(9, -32127, true) is undefined.
+PASS view.getInt16(9, true) is -32127
+PASS view.setInt16(14, -2, true) is undefined.
+PASS view.getInt16(14, true) is -2
+PASS view.setInt16(0, 1) is undefined.
+PASS view.getInt16(0) is 1
+PASS view.setInt16(5, 25958) is undefined.
+PASS view.getInt16(5) is 25958
+PASS view.setInt16(9, -32382) is undefined.
+PASS view.getInt16(9) is -32382
+PASS view.setInt16(14, -257) is undefined.
+PASS view.getInt16(14) is -257
+PASS view.setUint16(0, 256, true) is undefined.
+PASS view.getUint16(0, true) is 256
+PASS view.setUint16(5, 26213, true) is undefined.
+PASS view.getUint16(5, true) is 26213
+PASS view.setUint16(9, 33409, true) is undefined.
+PASS view.getUint16(9, true) is 33409
+PASS view.setUint16(14, 65534, true) is undefined.
+PASS view.getUint16(14, true) is 65534
+PASS view.setUint16(0, 1) is undefined.
+PASS view.getUint16(0) is 1
+PASS view.setUint16(5, 25958) is undefined.
+PASS view.getUint16(5) is 25958
+PASS view.setUint16(9, 33154) is undefined.
+PASS view.getUint16(9) is 33154
+PASS view.setUint16(14, 65279) is undefined.
+PASS view.getUint16(14) is 65279
+PASS view.setInt32(0, 50462976, true) is undefined.
+PASS view.getInt32(0, true) is 50462976
+PASS view.setInt32(3, 1717920771, true) is undefined.
+PASS view.getInt32(3, true) is 1717920771
+PASS view.setInt32(6, -2122291354, true) is undefined.
+PASS view.getInt32(6, true) is -2122291354
+PASS view.setInt32(9, -58490239, true) is undefined.
+PASS view.getInt32(9, true) is -58490239
+PASS view.setInt32(12, -66052, true) is undefined.
+PASS view.getInt32(12, true) is -66052
+PASS view.setInt32(0, 66051) is undefined.
+PASS view.getInt32(0) is 66051
+PASS view.setInt32(3, 56911206) is undefined.
+PASS view.getInt32(3) is 56911206
+PASS view.setInt32(6, 1718059137) is undefined.
+PASS view.getInt32(6) is 1718059137
+PASS view.setInt32(9, -2122152964) is undefined.
+PASS view.getInt32(9) is -2122152964
+PASS view.setInt32(12, -50462977) is undefined.
+PASS view.getInt32(12) is -50462977
+PASS view.setUint32(0, 50462976, true) is undefined.
+PASS view.getUint32(0, true) is 50462976
+PASS view.setUint32(3, 1717920771, true) is undefined.
+PASS view.getUint32(3, true) is 1717920771
+PASS view.setUint32(6, 2172675942, true) is undefined.
+PASS view.getUint32(6, true) is 2172675942
+PASS view.setUint32(9, 4236477057, true) is undefined.
+PASS view.getUint32(9, true) is 4236477057
+PASS view.setUint32(12, 4294901244, true) is undefined.
+PASS view.getUint32(12, true) is 4294901244
+PASS view.setUint32(0, 66051) is undefined.
+PASS view.getUint32(0) is 66051
+PASS view.setUint32(3, 56911206) is undefined.
+PASS view.getUint32(3) is 56911206
+PASS view.setUint32(6, 1718059137) is undefined.
+PASS view.getUint32(6) is 1718059137
+PASS view.setUint32(9, 2172814332) is undefined.
+PASS view.getUint32(9) is 2172814332
+PASS view.setUint32(12, 4244504319) is undefined.
+PASS view.getUint32(12) is 4244504319
+PASS view.setFloat32(0, 10, true) is undefined.
+PASS view.getFloat32(0, true) is 10
+PASS view.setFloat32(3, 10, true) is undefined.
+PASS view.getFloat32(3, true) is 10
+PASS view.setFloat32(7, 10, true) is undefined.
+PASS view.getFloat32(7, true) is 10
+PASS view.setFloat32(10, 10, true) is undefined.
+PASS view.getFloat32(10, true) is 10
+PASS view.setFloat32(0, 10, false) is undefined.
+PASS view.getFloat32(0, false) is 10
+PASS view.setFloat32(3, 10, false) is undefined.
+PASS view.getFloat32(3, false) is 10
+PASS view.setFloat32(7, 10, false) is undefined.
+PASS view.getFloat32(7, false) is 10
+PASS view.setFloat32(10, 10, false) is undefined.
+PASS view.getFloat32(10, false) is 10
+PASS view.setFloat32(0, 1.2300000190734863, true) is undefined.
+PASS view.getFloat32(0, true) is 1.2300000190734863
+PASS view.setFloat32(3, 1.2300000190734863, true) is undefined.
+PASS view.getFloat32(3, true) is 1.2300000190734863
+PASS view.setFloat32(7, 1.2300000190734863, true) is undefined.
+PASS view.getFloat32(7, true) is 1.2300000190734863
+PASS view.setFloat32(10, 1.2300000190734863, true) is undefined.
+PASS view.getFloat32(10, true) is 1.2300000190734863
+PASS view.setFloat32(0, 1.2300000190734863, false) is undefined.
+PASS view.getFloat32(0, false) is 1.2300000190734863
+PASS view.setFloat32(3, 1.2300000190734863, false) is undefined.
+PASS view.getFloat32(3, false) is 1.2300000190734863
+PASS view.setFloat32(7, 1.2300000190734863, false) is undefined.
+PASS view.getFloat32(7, false) is 1.2300000190734863
+PASS view.setFloat32(10, 1.2300000190734863, false) is undefined.
+PASS view.getFloat32(10, false) is 1.2300000190734863
+PASS view.setFloat32(0, -45621.37109375, true) is undefined.
+PASS view.getFloat32(0, true) is -45621.37109375
+PASS view.setFloat32(3, -45621.37109375, true) is undefined.
+PASS view.getFloat32(3, true) is -45621.37109375
+PASS view.setFloat32(7, -45621.37109375, true) is undefined.
+PASS view.getFloat32(7, true) is -45621.37109375
+PASS view.setFloat32(10, -45621.37109375, true) is undefined.
+PASS view.getFloat32(10, true) is -45621.37109375
+PASS view.setFloat32(0, -45621.37109375, false) is undefined.
+PASS view.getFloat32(0, false) is -45621.37109375
+PASS view.setFloat32(3, -45621.37109375, false) is undefined.
+PASS view.getFloat32(3, false) is -45621.37109375
+PASS view.setFloat32(7, -45621.37109375, false) is undefined.
+PASS view.getFloat32(7, false) is -45621.37109375
+PASS view.setFloat32(10, -45621.37109375, false) is undefined.
+PASS view.getFloat32(10, false) is -45621.37109375
+PASS view.setFloat32(0, NaN, true) is undefined.
+PASS view.getFloat32(0, true) is NaN
+PASS view.setFloat32(3, NaN, true) is undefined.
+PASS view.getFloat32(3, true) is NaN
+PASS view.setFloat32(7, NaN, true) is undefined.
+PASS view.getFloat32(7, true) is NaN
+PASS view.setFloat32(10, NaN, true) is undefined.
+PASS view.getFloat32(10, true) is NaN
+PASS view.setFloat32(0, NaN, false) is undefined.
+PASS view.getFloat32(0, false) is NaN
+PASS view.setFloat32(3, NaN, false) is undefined.
+PASS view.getFloat32(3, false) is NaN
+PASS view.setFloat32(7, NaN, false) is undefined.
+PASS view.getFloat32(7, false) is NaN
+PASS view.setFloat32(10, NaN, false) is undefined.
+PASS view.getFloat32(10, false) is NaN
+PASS view.setFloat32(0, -NaN, true) is undefined.
+PASS view.getFloat32(0, true) is -NaN
+PASS view.setFloat32(3, -NaN, true) is undefined.
+PASS view.getFloat32(3, true) is -NaN
+PASS view.setFloat32(7, -NaN, true) is undefined.
+PASS view.getFloat32(7, true) is -NaN
+PASS view.setFloat32(10, -NaN, true) is undefined.
+PASS view.getFloat32(10, true) is -NaN
+PASS view.setFloat32(0, -NaN, false) is undefined.
+PASS view.getFloat32(0, false) is -NaN
+PASS view.setFloat32(3, -NaN, false) is undefined.
+PASS view.getFloat32(3, false) is -NaN
+PASS view.setFloat32(7, -NaN, false) is undefined.
+PASS view.getFloat32(7, false) is -NaN
+PASS view.setFloat32(10, -NaN, false) is undefined.
+PASS view.getFloat32(10, false) is -NaN
+PASS view.setFloat64(0, 10, true) is undefined.
+PASS view.getFloat64(0, true) is 10
+PASS view.setFloat64(3, 10, true) is undefined.
+PASS view.getFloat64(3, true) is 10
+PASS view.setFloat64(7, 10, true) is undefined.
+PASS view.getFloat64(7, true) is 10
+PASS view.setFloat64(10, 10, true) is undefined.
+PASS view.getFloat64(10, true) is 10
+PASS view.setFloat64(0, 10, false) is undefined.
+PASS view.getFloat64(0, false) is 10
+PASS view.setFloat64(3, 10, false) is undefined.
+PASS view.getFloat64(3, false) is 10
+PASS view.setFloat64(7, 10, false) is undefined.
+PASS view.getFloat64(7, false) is 10
+PASS view.setFloat64(10, 10, false) is undefined.
+PASS view.getFloat64(10, false) is 10
+PASS view.setFloat64(0, 1.23, true) is undefined.
+PASS view.getFloat64(0, true) is 1.23
+PASS view.setFloat64(3, 1.23, true) is undefined.
+PASS view.getFloat64(3, true) is 1.23
+PASS view.setFloat64(7, 1.23, true) is undefined.
+PASS view.getFloat64(7, true) is 1.23
+PASS view.setFloat64(10, 1.23, true) is undefined.
+PASS view.getFloat64(10, true) is 1.23
+PASS view.setFloat64(0, 1.23, false) is undefined.
+PASS view.getFloat64(0, false) is 1.23
+PASS view.setFloat64(3, 1.23, false) is undefined.
+PASS view.getFloat64(3, false) is 1.23
+PASS view.setFloat64(7, 1.23, false) is undefined.
+PASS view.getFloat64(7, false) is 1.23
+PASS view.setFloat64(10, 1.23, false) is undefined.
+PASS view.getFloat64(10, false) is 1.23
+PASS view.setFloat64(0, -6213576.4839, true) is undefined.
+PASS view.getFloat64(0, true) is -6213576.4839
+PASS view.setFloat64(3, -6213576.4839, true) is undefined.
+PASS view.getFloat64(3, true) is -6213576.4839
+PASS view.setFloat64(7, -6213576.4839, true) is undefined.
+PASS view.getFloat64(7, true) is -6213576.4839
+PASS view.setFloat64(10, -6213576.4839, true) is undefined.
+PASS view.getFloat64(10, true) is -6213576.4839
+PASS view.setFloat64(0, -6213576.4839, false) is undefined.
+PASS view.getFloat64(0, false) is -6213576.4839
+PASS view.setFloat64(3, -6213576.4839, false) is undefined.
+PASS view.getFloat64(3, false) is -6213576.4839
+PASS view.setFloat64(7, -6213576.4839, false) is undefined.
+PASS view.getFloat64(7, false) is -6213576.4839
+PASS view.setFloat64(10, -6213576.4839, false) is undefined.
+PASS view.getFloat64(10, false) is -6213576.4839
+PASS view.setFloat64(0, NaN, true) is undefined.
+PASS view.getFloat64(0, true) is NaN
+PASS view.setFloat64(3, NaN, true) is undefined.
+PASS view.getFloat64(3, true) is NaN
+PASS view.setFloat64(7, NaN, true) is undefined.
+PASS view.getFloat64(7, true) is NaN
+PASS view.setFloat64(10, NaN, true) is undefined.
+PASS view.getFloat64(10, true) is NaN
+PASS view.setFloat64(0, NaN, false) is undefined.
+PASS view.getFloat64(0, false) is NaN
+PASS view.setFloat64(3, NaN, false) is undefined.
+PASS view.getFloat64(3, false) is NaN
+PASS view.setFloat64(7, NaN, false) is undefined.
+PASS view.getFloat64(7, false) is NaN
+PASS view.setFloat64(10, NaN, false) is undefined.
+PASS view.getFloat64(10, false) is NaN
+PASS view.setFloat64(0, -NaN, true) is undefined.
+PASS view.getFloat64(0, true) is -NaN
+PASS view.setFloat64(3, -NaN, true) is undefined.
+PASS view.getFloat64(3, true) is -NaN
+PASS view.setFloat64(7, -NaN, true) is undefined.
+PASS view.getFloat64(7, true) is -NaN
+PASS view.setFloat64(10, -NaN, true) is undefined.
+PASS view.getFloat64(10, true) is -NaN
+PASS view.setFloat64(0, -NaN, false) is undefined.
+PASS view.getFloat64(0, false) is -NaN
+PASS view.setFloat64(3, -NaN, false) is undefined.
+PASS view.getFloat64(3, false) is -NaN
+PASS view.setFloat64(7, -NaN, false) is undefined.
+PASS view.getFloat64(7, false) is -NaN
+PASS view.setFloat64(10, -NaN, false) is undefined.
+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 Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setInt8(15, -1) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setUint8(0, 0) is undefined.
+PASS view.getUint8(0) is 0
+PASS view.setUint8(8, 128) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setUint8(15, 255) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setInt16(0, 256, true) is undefined.
+PASS view.getInt16(0, true) is 256
+PASS view.setInt16(5, 26213, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setInt16(9, -32127, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setInt16(14, -2, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setInt16(0, 1) is undefined.
+PASS view.getInt16(0) is 1
+PASS view.setInt16(5, 25958) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setInt16(9, -32382) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setInt16(14, -257) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setUint16(0, 256, true) is undefined.
+PASS view.getUint16(0, true) is 256
+PASS view.setUint16(5, 26213, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setUint16(9, 33409, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setUint16(14, 65534, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setUint16(0, 1) is undefined.
+PASS view.getUint16(0) is 1
+PASS view.setUint16(5, 25958) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setUint16(9, 33154) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setUint16(14, 65279) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setInt32(0, 50462976, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setInt32(3, 1717920771, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setInt32(6, -2122291354, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setInt32(9, -58490239, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setInt32(12, -66052, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setInt32(0, 66051) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setInt32(3, 56911206) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setInt32(6, 1718059137) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setInt32(9, -2122152964) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setInt32(12, -50462977) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setUint32(0, 50462976, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setUint32(3, 1717920771, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setUint32(6, 2172675942, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setUint32(9, 4236477057, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setUint32(12, 4294901244, true) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setUint32(0, 66051) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setUint32(3, 56911206) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setUint32(6, 1718059137) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setUint32(9, 2172814332) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setUint32(12, 4244504319) threw exception Error: INDEX_SIZE_ERR: DOM Exception 1.
+PASS view.setFloat32(0, 10, true) is undefined.
+PASS view.getFloat32(0, true) is 10
+PASS view.setFloat32(3, 10, true) is undefined.
+PASS view.getFloat32(3, true) is 10
+PASS view.setFloat32(7, 10, true) is undefined.
+PASS view.getFloat32(7, true) is 10
+PASS view.setFloat32(10, 10, true) is undefined.
+PASS view.getFloat32(10, true) is 10
+PASS view.setFloat32(0, 10, false) is undefined.
+PASS view.getFloat32(0, false) is 10
+PASS view.setFloat32(3, 10, false) is undefined.
+PASS view.getFloat32(3, false) is 10
+PASS view.setFloat32(7, 10, false) is undefined.
+PASS view.getFloat32(7, false) is 10
+PASS view.setFloat32(10, 10, false) is undefined.
+PASS view.getFloat32(10, false) is 10
+PASS view.setFloat32(0, 1.2300000190734863, true) is undefined.
+PASS view.getFloat32(0, true) is 1.2300000190734863
+PASS view.setFloat32(3, 1.2300000190734863, true) is undefined.
+PASS view.getFloat32(3, true) is 1.2300000190734863
+PASS view.setFloat32(7, 1.2300000190734863, true) is undefined.
+PASS view.getFloat32(7, true) is 1.2300000190734863
+PASS view.setFloat32(10, 1.2300000190734863, true) is undefined.
+PASS view.getFloat32(10, true) is 1.2300000190734863
+PASS view.setFloat32(0, 1.2300000190734863, false) is undefined.
+PASS view.getFloat32(0, false) is 1.2300000190734863
+PASS view.setFloat32(3, 1.2300000190734863, false) is undefined.
+PASS view.getFloat32(3, false) is 1.2300000190734863
+PASS view.setFloat32(7, 1.2300000190734863, false) is undefined.
+PASS view.getFloat32(7, false) is 1.2300000190734863
+PASS view.setFloat32(10, 1.2300000190734863, false) is undefined.
+PASS view.getFloat32(10, false) is 1.2300000190734863
+PASS view.setFloat32(0, -45621.37109375, true) is undefined.
+PASS view.getFloat32(0, true) is -45621.37109375
+PASS view.setFloat32(3, -45621.37109375, true) is undefined.
+PASS view.getFloat32(3, true) is -45621.37109375
+PASS view.setFloat32(7, -45621.37109375, true) is undefined.
+PASS view.getFloat32(7, true) is -45621.37109375
+PASS view.setFloat32(10, -45621.37109375, true) is undefined.
+PASS view.getFloat32(10, true) is -45621.37109375
+PASS view.setFloat32(0, -45621.37109375, false) is undefined.
+PASS view.getFloat32(0, false) is -45621.37109375
+PASS view.setFloat32(3, -45621.37109375, false) is undefined.
+PASS view.getFloat32(3, false) is -45621.37109375
+PASS view.setFloat32(7, -45621.37109375, false) is undefined.
+PASS view.getFloat32(7, false) is -45621.37109375
+PASS view.setFloat32(10, -45621.37109375, false) is undefined.
+PASS view.getFloat32(10, false) is -45621.37109375
+PASS view.setFloat32(0, NaN, true) is undefined.
+PASS view.getFloat32(0, true) is NaN
+PASS view.setFloat32(3, NaN, true) is undefined.
+PASS view.getFloat32(3, true) is NaN
+PASS view.setFloat32(7, NaN, true) is undefined.
+PASS view.getFloat32(7, true) is NaN
+PASS view.setFloat32(10, NaN, true) is undefined.
+PASS view.getFloat32(10, true) is NaN
+PASS view.setFloat32(0, NaN, false) is undefined.
+PASS view.getFloat32(0, false) is NaN
+PASS view.setFloat32(3, NaN, false) is undefined.
+PASS view.getFloat32(3, false) is NaN
+PASS view.setFloat32(7, NaN, false) is undefined.
+PASS view.getFloat32(7, false) is NaN
+PASS view.setFloat32(10, NaN, false) is undefined.
+PASS view.getFloat32(10, false) is NaN
+PASS view.setFloat32(0, -NaN, true) is undefined.
+PASS view.getFloat32(0, true) is -NaN
+PASS view.setFloat32(3, -NaN, true) is undefined.
+PASS view.getFloat32(3, true) is -NaN
+PASS view.setFloat32(7, -NaN, true) is undefined.
+PASS view.getFloat32(7, true) is -NaN
+PASS view.setFloat32(10, -NaN, true) is undefined.
+PASS view.getFloat32(10, true) is -NaN
+PASS view.setFloat32(0, -NaN, false) is undefined.
+PASS view.getFloat32(0, false) is -NaN
+PASS view.setFloat32(3, -NaN, false) is undefined.
+PASS view.getFloat32(3, false) is -NaN
+PASS view.setFloat32(7, -NaN, false) is undefined.
+PASS view.getFloat32(7, false) is -NaN
+PASS view.setFloat32(10, -NaN, false) is undefined.
+PASS view.getFloat32(10, false) is -NaN
+PASS view.setFloat64(0, 10, true) is undefined.
+PASS view.getFloat64(0, true) is 10
+PASS view.setFloat64(3, 10, true) is undefined.
+PASS view.getFloat64(3, true) is 10
+PASS view.setFloat64(7, 10, true) is undefined.
+PASS view.getFloat64(7, true) is 10
+PASS view.setFloat64(10, 10, true) is undefined.
+PASS view.getFloat64(10, true) is 10
+PASS view.setFloat64(0, 10, false) is undefined.
+PASS view.getFloat64(0, false) is 10
+PASS view.setFloat64(3, 10, false) is undefined.
+PASS view.getFloat64(3, false) is 10
+PASS view.setFloat64(7, 10, false) is undefined.
+PASS view.getFloat64(7, false) is 10
+PASS view.setFloat64(10, 10, false) is undefined.
+PASS view.getFloat64(10, false) is 10
+PASS view.setFloat64(0, 1.23, true) is undefined.
+PASS view.getFloat64(0, true) is 1.23
+PASS view.setFloat64(3, 1.23, true) is undefined.
+PASS view.getFloat64(3, true) is 1.23
+PASS view.setFloat64(7, 1.23, true) is undefined.
+PASS view.getFloat64(7, true) is 1.23
+PASS view.setFloat64(10, 1.23, true) is undefined.
+PASS view.getFloat64(10, true) is 1.23
+PASS view.setFloat64(0, 1.23, false) is undefined.
+PASS view.getFloat64(0, false) is 1.23
+PASS view.setFloat64(3, 1.23, false) is undefined.
+PASS view.getFloat64(3, false) is 1.23
+PASS view.setFloat64(7, 1.23, false) is undefined.
+PASS view.getFloat64(7, false) is 1.23
+PASS view.setFloat64(10, 1.23, false) is undefined.
+PASS view.getFloat64(10, false) is 1.23
+PASS view.setFloat64(0, -6213576.4839, true) is undefined.
+PASS view.getFloat64(0, true) is -6213576.4839
+PASS view.setFloat64(3, -6213576.4839, true) is undefined.
+PASS view.getFloat64(3, true) is -6213576.4839
+PASS view.setFloat64(7, -6213576.4839, true) is undefined.
+PASS view.getFloat64(7, true) is -6213576.4839
+PASS view.setFloat64(10, -6213576.4839, true) is undefined.
+PASS view.getFloat64(10, true) is -6213576.4839
+PASS view.setFloat64(0, -6213576.4839, false) is undefined.
+PASS view.getFloat64(0, false) is -6213576.4839
+PASS view.setFloat64(3, -6213576.4839, false) is undefined.
+PASS view.getFloat64(3, false) is -6213576.4839
+PASS view.setFloat64(7, -6213576.4839, false) is undefined.
+PASS view.getFloat64(7, false) is -6213576.4839
+PASS view.setFloat64(10, -6213576.4839, false) is undefined.
+PASS view.getFloat64(10, false) is -6213576.4839
+PASS view.setFloat64(0, NaN, true) is undefined.
+PASS view.getFloat64(0, true) is NaN
+PASS view.setFloat64(3, NaN, true) is undefined.
+PASS view.getFloat64(3, true) is NaN
+PASS view.setFloat64(7, NaN, true) is undefined.
+PASS view.getFloat64(7, true) is NaN
+PASS view.setFloat64(10, NaN, true) is undefined.
+PASS view.getFloat64(10, true) is NaN
+PASS view.setFloat64(0, NaN, false) is undefined.
+PASS view.getFloat64(0, false) is NaN
+PASS view.setFloat64(3, NaN, false) is undefined.
+PASS view.getFloat64(3, false) is NaN
+PASS view.setFloat64(7, NaN, false) is undefined.
+PASS view.getFloat64(7, false) is NaN
+PASS view.setFloat64(10, NaN, false) is undefined.
+PASS view.getFloat64(10, false) is NaN
+PASS view.setFloat64(0, -NaN, true) is undefined.
+PASS view.getFloat64(0, true) is -NaN
+PASS view.setFloat64(3, -NaN, true) is undefined.
+PASS view.getFloat64(3, true) is -NaN
+PASS view.setFloat64(7, -NaN, true) is undefined.
+PASS view.getFloat64(7, true) is -NaN
+PASS view.setFloat64(10, -NaN, true) is undefined.
+PASS view.getFloat64(10, true) is -NaN
+PASS view.setFloat64(0, -NaN, false) is undefined.
+PASS view.getFloat64(0, false) is -NaN
+PASS view.setFloat64(3, -NaN, false) is undefined.
+PASS view.getFloat64(3, false) is -NaN
+PASS view.setFloat64(7, -NaN, false) is undefined.
+PASS view.getFloat64(7, false) is -NaN
+PASS view.setFloat64(10, -NaN, false) is undefined.
+PASS view.getFloat64(10, false) is -NaN
+
+Test for wrong arguments passed to get methods
+PASS view.setInt8() threw exception SyntaxError: Not enough arguments.
+PASS view.setUint8() threw exception SyntaxError: Not enough arguments.
+PASS view.setInt16() threw exception SyntaxError: Not enough arguments.
+PASS view.setUint16() threw exception SyntaxError: Not enough arguments.
+PASS view.setInt32() threw exception SyntaxError: Not enough arguments.
+PASS view.setUint32() threw exception SyntaxError: Not enough arguments.
+PASS view.setFloat32() threw exception SyntaxError: Not enough arguments.
+PASS view.setFloat64() threw exception SyntaxError: Not enough arguments.
+PASS view.setInt8(1) threw exception SyntaxError: Not enough arguments.
+PASS view.setUint8(1) threw exception SyntaxError: Not enough arguments.
+PASS view.setInt16(1) threw exception SyntaxError: Not enough arguments.
+PASS view.setUint16(1) threw exception SyntaxError: Not enough arguments.
+PASS view.setInt32(1) threw exception SyntaxError: Not enough arguments.
+PASS view.setUint32(1) threw exception SyntaxError: Not enough arguments.
+PASS view.setFloat32(1) threw exception SyntaxError: Not enough arguments.
+PASS view.setFloat64(1) threw exception SyntaxError: Not enough arguments.
+
+Test for indexing that should not work
+PASS view[0] is undefined.
+PASS view[0] = 3 is defined.
+PASS view.getUint8(0) is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/canvas/webgl/data-view-test.html b/LayoutTests/fast/canvas/webgl/data-view-test.html
new file mode 100755
index 0000000..d7cbcc0
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/data-view-test.html
@@ -0,0 +1,301 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css"/>
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+
+<script>
+description("Test DataView.");
+
+var intArray1 = [0, 1, 2, 3, 100, 101, 102, 103, 128, 129, 130, 131, 252, 253, 254, 255];
+var intArray2 = [31, 32, 33, 0, 1, 2, 3, 100, 101, 102, 103, 128, 129, 130, 131, 252, 253, 254, 255];
+var emptyArray = [204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204];
+
+var arayBuffer = null;
+var view = null;
+var viewStart = 0;
+var viewLength = 0;
+
+function getElementSize(func)
+{
+    switch (func) {
+    case "Int8":
+    case "Uint8":
+        return 1;
+    case "Int16":
+    case "Uint16":
+        return 2;
+    case "Int32":
+    case "Uint32":
+    case "Float32":
+        return 4;
+    case "Float64":
+        return 8;
+    default:
+        debug("Should not reached");
+    }
+}
+
+function checkGet(func, index, expected, littleEndian)
+{
+    var expr = "view.get" + func + "(" + index;
+    if (littleEndian != undefined) {
+        expr += ", ";
+        expr += littleEndian ? "true" : "false";
+    }
+    expr += ")";
+    if (index + getElementSize(func) - 1 < view.byteLength)
+        shouldBe(expr, expected);
+    else
+        shouldThrow(expr);
+}
+
+function checkSet(func, index, value, littleEndian)
+{
+    var expr = "view.set" + func + "(" + index + ", " + value;
+    if (littleEndian != undefined) {
+        expr += ", ";
+        expr += littleEndian ? "true" : "false";
+    }
+    expr += ")";
+    if (index + getElementSize(func) - 1 < view.byteLength) {
+        shouldBeUndefined(expr);
+        checkGet(func, index, value, littleEndian);
+    } else
+        shouldThrow(expr);
+}
+
+function test(isTestingGet, func, index, value, littleEndian)
+{
+    if (isTestingGet)
+        checkGet(func, index, value, littleEndian);
+     else
+        checkSet(func, index, value, littleEndian);
+}
+
+function createDataView(array, frontPaddingNum, littleEndian, start, length)
+{
+    if (!littleEndian)
+        array.reverse();
+    var paddingArray = new Array(frontPaddingNum);
+    arrayBuffer = (new Uint8Array(paddingArray.concat(array))).buffer;
+    viewStart = (start != undefined) ? start : 0;
+    viewLength = (length != undefined) ? length : arrayBuffer.byteLength - viewStart;
+    view = new DataView(arrayBuffer, viewStart, viewLength);
+    if (!littleEndian)
+        array.reverse(); // restore the array.
+}
+
+function runIntegerTestCases(isTestingGet, array, start, length)
+{
+    createDataView(array, 0, true, start, length);
+
+    test(isTestingGet, "Int8", 0, "0");
+    test(isTestingGet, "Int8", 8, "-128");
+    test(isTestingGet, "Int8", 15, "-1");
+
+    test(isTestingGet, "Uint8", 0, "0");
+    test(isTestingGet, "Uint8", 8, "128");
+    test(isTestingGet, "Uint8", 15, "255");
+
+    // Little endian.
+    test(isTestingGet, "Int16", 0, "256", true);
+    test(isTestingGet, "Int16", 5, "26213", true);
+    test(isTestingGet, "Int16", 9, "-32127", true);
+    test(isTestingGet, "Int16", 14, "-2", true);
+
+    // Big endian.
+    test(isTestingGet, "Int16", 0, "1");
+    test(isTestingGet, "Int16", 5, "25958");
+    test(isTestingGet, "Int16", 9, "-32382");
+    test(isTestingGet, "Int16", 14, "-257");
+
+    // Little endian.
+    test(isTestingGet, "Uint16", 0, "256", true);
+    test(isTestingGet, "Uint16", 5, "26213", true);
+    test(isTestingGet, "Uint16", 9, "33409", true);
+    test(isTestingGet, "Uint16", 14, "65534", true);
+
+    // Big endian.
+    test(isTestingGet, "Uint16", 0, "1");
+    test(isTestingGet, "Uint16", 5, "25958");
+    test(isTestingGet, "Uint16", 9, "33154");
+    test(isTestingGet, "Uint16", 14, "65279");
+
+    // Little endian.
+    test(isTestingGet, "Int32", 0, "50462976", true);
+    test(isTestingGet, "Int32", 3, "1717920771", true);
+    test(isTestingGet, "Int32", 6, "-2122291354", true);
+    test(isTestingGet, "Int32", 9, "-58490239", true);
+    test(isTestingGet, "Int32", 12, "-66052", true);
+
+    // Big endian.
+    test(isTestingGet, "Int32", 0, "66051");
+    test(isTestingGet, "Int32", 3, "56911206");
+    test(isTestingGet, "Int32", 6, "1718059137");
+    test(isTestingGet, "Int32", 9, "-2122152964");
+    test(isTestingGet, "Int32", 12, "-50462977");
+
+    // Little endian.
+    test(isTestingGet, "Uint32", 0, "50462976", true);
+    test(isTestingGet, "Uint32", 3, "1717920771", true);
+    test(isTestingGet, "Uint32", 6, "2172675942", true);
+    test(isTestingGet, "Uint32", 9, "4236477057", true);
+    test(isTestingGet, "Uint32", 12, "4294901244", true);
+
+    // Big endian.
+    test(isTestingGet, "Uint32", 0, "66051");
+    test(isTestingGet, "Uint32", 3, "56911206");
+    test(isTestingGet, "Uint32", 6, "1718059137");
+    test(isTestingGet, "Uint32", 9, "2172814332");
+    test(isTestingGet, "Uint32", 12, "4244504319");
+}
+
+function testFloat(isTestingGet, func, array, start, expected)
+{
+    // Little endian.
+    createDataView(array, 0, true, start);
+    test(isTestingGet, func, 0, expected, true);
+    createDataView(array, 3, true, start);
+    test(isTestingGet, func, 3, expected, true);
+    createDataView(array, 7, true, start);
+    test(isTestingGet, func, 7, expected, true);
+    createDataView(array, 10, true, start);
+    test(isTestingGet, func, 10, expected, true);
+    
+    // Big endian.
+    createDataView(array, 0, false);
+    test(isTestingGet, func, 0, expected, false);
+    createDataView(array, 3, false);
+    test(isTestingGet, func, 3, expected, false);
+    createDataView(array, 7, false);
+    test(isTestingGet, func, 7, expected, false);
+    createDataView(array, 10, false);
+    test(isTestingGet, func, 10, expected, false);
+}
+
+function runFloatTestCases(isTestingGet, start)
+{
+    testFloat(isTestingGet, "Float32", isTestingGet ? [0, 0, 32, 65] : emptyArray, start, "10");
+    testFloat(isTestingGet, "Float32", isTestingGet ? [164, 112, 157, 63] : emptyArray, start, "1.2300000190734863");
+    testFloat(isTestingGet, "Float32", isTestingGet ? [95, 53, 50, 199] : emptyArray, start, "-45621.37109375");
+    testFloat(isTestingGet, "Float32", isTestingGet ? [255, 255, 255, 127] : emptyArray, start, "NaN");
+    testFloat(isTestingGet, "Float32", isTestingGet ? [255, 255, 255, 255] : emptyArray, start, "-NaN");
+
+    testFloat(isTestingGet, "Float64", isTestingGet ? [0, 0, 0, 0, 0, 0, 36, 64] : emptyArray, start, "10");
+    testFloat(isTestingGet, "Float64", isTestingGet ? [174, 71, 225, 122, 20, 174, 243, 63] : emptyArray, start, "1.23");
+    testFloat(isTestingGet, "Float64", isTestingGet ? [181, 55, 248, 30, 242, 179, 87, 193] : emptyArray, start, "-6213576.4839");
+    testFloat(isTestingGet, "Float64", isTestingGet ? [255, 255, 255, 255, 255, 255, 255, 127] : emptyArray, start, "NaN");
+    testFloat(isTestingGet, "Float64", isTestingGet ? [255, 255, 255, 255, 255, 255, 255, 255] : emptyArray, start, "-NaN");
+}
+
+function runConstructorTests()
+{
+    arayBuffer = (new Uint8Array([1, 2])).buffer;
+
+    debug("");
+    debug("Test for constructor taking 1 argument");
+    shouldBeDefined("view = new DataView(arayBuffer)");
+    shouldBe("view.byteOffset", "0");
+    shouldBe("view.byteLength", "2");
+
+    debug("");
+    debug("Test for constructor taking 2 arguments");
+    shouldBeDefined("view = new DataView(arayBuffer, 1)");
+    shouldBe("view.byteOffset", "1");
+    shouldBe("view.byteLength", "1");
+
+    debug("");
+    debug("Test for constructor taking 3 arguments");
+    shouldBeDefined("view = new DataView(arayBuffer, 0, 1)");
+    shouldBe("view.byteOffset", "0");
+    shouldBe("view.byteLength", "1");
+
+    debug("");
+    debug("Test for constructor throwing exception");
+    shouldThrow("view = new DataView(arayBuffer, 0, 3)");
+    shouldThrow("view = new DataView(arayBuffer, 1, 2)");
+    shouldThrow("view = new DataView(arayBuffer, 2, 1)");
+}
+
+function runGetTests()
+{
+    debug("");
+    debug("Test for get methods that work");
+    runIntegerTestCases(true, intArray1, 0, 16);
+    runFloatTestCases(true, 0);
+
+    debug("");
+    debug("Test for get methods that might read beyound range");
+    runIntegerTestCases(true, intArray2, 3, 2);
+    runFloatTestCases(true, 3);
+
+    debug("");
+    debug("Test for wrong arguments passed to get methods");
+    view = new DataView((new Uint8Array([1, 2])).buffer);
+    shouldThrow("view.getInt8()");
+    shouldThrow("view.getUint8()");
+    shouldThrow("view.getInt16()");
+    shouldThrow("view.getUint16()");
+    shouldThrow("view.getInt32()");
+    shouldThrow("view.getUint32()");
+    shouldThrow("view.getFloat32()");
+    shouldThrow("view.getFloat64()");
+}
+
+function runSetTests()
+{
+    debug("");
+    debug("Test for set methods that work");
+    runIntegerTestCases(false, emptyArray, 0, 16);
+    runFloatTestCases(false);
+
+    debug("");
+    debug("Test for set methods that might write beyond the range");
+    runIntegerTestCases(false, emptyArray, 3, 2);
+    runFloatTestCases(false, 7);
+
+    debug("");
+    debug("Test for wrong arguments passed to get methods");
+    view = new DataView((new Uint8Array([1, 2])).buffer);
+    shouldThrow("view.setInt8()");
+    shouldThrow("view.setUint8()");
+    shouldThrow("view.setInt16()");
+    shouldThrow("view.setUint16()");
+    shouldThrow("view.setInt32()");
+    shouldThrow("view.setUint32()");
+    shouldThrow("view.setFloat32()");
+    shouldThrow("view.setFloat64()");
+    shouldThrow("view.setInt8(1)");
+    shouldThrow("view.setUint8(1)");
+    shouldThrow("view.setInt16(1)");
+    shouldThrow("view.setUint16(1)");
+    shouldThrow("view.setInt32(1)");
+    shouldThrow("view.setUint32(1)");
+    shouldThrow("view.setFloat32(1)");
+    shouldThrow("view.setFloat64(1)");
+}
+
+function runIndexingTests()
+{
+    debug("");
+    debug("Test for indexing that should not work");
+    view = new DataView((new Uint8Array([1, 2])).buffer);
+    shouldBeUndefined("view[0]");
+    shouldBeDefined("view[0] = 3");
+    shouldBe("view.getUint8(0)", "1");
+}
+
+runConstructorTests();
+runGetTests();
+runSetTests();
+runIndexingTests();
+successfullyParsed = true;
+</script>
+
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Window/script-tests/window-property-descriptors.js b/LayoutTests/fast/dom/Window/script-tests/window-property-descriptors.js
index 141b608..1a79692 100644
--- a/LayoutTests/fast/dom/Window/script-tests/window-property-descriptors.js
+++ b/LayoutTests/fast/dom/Window/script-tests/window-property-descriptors.js
@@ -21,6 +21,7 @@ var __skip__ = {
     // Ignore these properties because they do not exist in all implementations. They will be tested separately
     "WebGLRenderingContext" : 1,
     "ArrayBuffer" : 1,
+    "DataView" : 1,
     "Int8Array" : 1,
     "Uint8Array" : 1,
     "Int16Array" : 1,
diff --git a/LayoutTests/fast/dom/Window/window-properties.html b/LayoutTests/fast/dom/Window/window-properties.html
index d597482..fa1eb54 100644
--- a/LayoutTests/fast/dom/Window/window-properties.html
+++ b/LayoutTests/fast/dom/Window/window-properties.html
@@ -63,6 +63,7 @@ var __skip__ = {
     // Ignore these properties because they do not exist in all implementations. They will be tested separately
     "window.WebGLRenderingContext" : 1, 
     "window.ArrayBuffer" : 1,
+    "window.DataView" : 1,
     "window.Int8Array" : 1,
     "window.Uint8Array" : 1,
     "window.Int16Array" : 1,
diff --git a/LayoutTests/fast/dom/script-tests/prototype-inheritance-2.js b/LayoutTests/fast/dom/script-tests/prototype-inheritance-2.js
index 3c6d122..2309106 100644
--- a/LayoutTests/fast/dom/script-tests/prototype-inheritance-2.js
+++ b/LayoutTests/fast/dom/script-tests/prototype-inheritance-2.js
@@ -61,6 +61,7 @@ function constructorNamesForWindow(globalObject)
         // Ignore these properties because they do not exist in all implementations. They will be tested separately
         if (type == "WebGLRenderingContextConstructor" || 
             type == "ArrayBufferConstructor" ||
+            type == "DataViewConstructor" ||
             type =="Float32ArrayConstructor" ||
             type =="Int8ArrayConstructor" ||
             type =="Int16ArrayConstructor" ||
diff --git a/LayoutTests/fast/dom/script-tests/prototype-inheritance.js b/LayoutTests/fast/dom/script-tests/prototype-inheritance.js
index 88f2793..822ccb3 100644
--- a/LayoutTests/fast/dom/script-tests/prototype-inheritance.js
+++ b/LayoutTests/fast/dom/script-tests/prototype-inheritance.js
@@ -17,7 +17,7 @@ var skippedProperties = [
     "webkitPerformance",
     "WebGLRenderingContext",
     "ArrayBuffer",
-    "Int8Array", "Uint8Array", "Int16Array", "Uint16Array", "Int32Array", "Uint32Array", "Float32Array",
+    "DataView", "Int8Array", "Uint8Array", "Int16Array", "Uint16Array", "Int32Array", "Uint32Array", "Float32Array",
     "FileError", "FileReader", "requestFileSystem",
     "indexedDB", "IDBKeyRange", "IDBCursor", "IDBDatabase", "IDBDatabaseError", "IDBDatabaseException", "IDBErrorEvent", "IDBEvent", "IDBFactory", "IDBIndex", "IDBObjectStore", "IDBRequest", "IDBSuccessEvent", "IDBTransaction",
     "showModalDialog",
diff --git a/LayoutTests/fast/js/script-tests/global-constructors.js b/LayoutTests/fast/js/script-tests/global-constructors.js
index 03ef0df..d6c15e5 100644
--- a/LayoutTests/fast/js/script-tests/global-constructors.js
+++ b/LayoutTests/fast/js/script-tests/global-constructors.js
@@ -19,6 +19,7 @@ for (var x in constructorNames) {
     // Ignore these properties because they do not exist in all implementations. They will be tested separately
     if (name == "WebGLRenderingContext" ||
         name == "ArrayBuffer" ||
+        name == "DataView" ||
         name == "Int8Array" ||
         name == "Uint8Array" ||
         name == "Int16Array" ||
diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
index 35ac8d1..fa3ce9c 100644
--- a/WebCore/CMakeLists.txt
+++ b/WebCore/CMakeLists.txt
@@ -293,6 +293,7 @@ SET(WebCore_IDL_FILES
     html/canvas/CanvasPattern.idl
     html/canvas/CanvasRenderingContext2D.idl
     html/canvas/CanvasRenderingContext.idl
+    html/canvas/DataView.idl
     html/canvas/Float32Array.idl
     html/canvas/Int16Array.idl
     html/canvas/Int32Array.idl
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 54448d8..1e737dc 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,52 @@
+2010-11-24  Jian Li  <jianli at chromium.org>
+
+        Reviewed by Kenneth Russell.
+
+        Implement DataView interface from Typed Array specification
+        https://bugs.webkit.org/show_bug.cgi?id=46541
+
+        Test: fast/canvas/webgl/data-view-test.html
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pri:
+        * WebCore.pro:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/generic/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::dataViewEnabled):
+        * bindings/js/JSArrayBufferViewHelper.h:
+        (WebCore::constructArrayBufferViewWithArrayBufferArgument):
+        (WebCore::constructArrayBufferView):
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::JSDOMWindow::dataView):
+        * bindings/js/JSDataViewCustom.cpp: Added.
+        * bindings/js/JSFloat32ArrayCustom.cpp:
+        (WebCore::JSFloat32ArrayConstructor::constructJSFloat32Array):
+        * bindings/js/JSInt16ArrayCustom.cpp:
+        (WebCore::JSInt16ArrayConstructor::constructJSInt16Array):
+        * bindings/js/JSInt32ArrayCustom.cpp:
+        (WebCore::JSInt32ArrayConstructor::constructJSInt32Array):
+        * bindings/js/JSInt8ArrayCustom.cpp:
+        (WebCore::JSInt8ArrayConstructor::constructJSInt8Array):
+        * bindings/js/JSUint16ArrayCustom.cpp:
+        (WebCore::JSUint16ArrayConstructor::constructJSUint16Array):
+        * bindings/js/JSUint32ArrayCustom.cpp:
+        (WebCore::JSUint32ArrayConstructor::constructJSUint32Array):
+        * bindings/js/JSUint8ArrayCustom.cpp:
+        (WebCore::JSUint8ArrayConstructor::constructJSUint8Array):
+        * bindings/v8/custom/V8ArrayBufferViewCustom.h:
+        (WebCore::constructWebGLArrayWithArrayBufferArgument):
+        (WebCore::constructWebGLArray):
+        * bindings/v8/custom/V8DataViewCustom.cpp: Added.
+        * html/canvas/ArrayBufferView.h:
+        (WebCore::ArrayBufferView::isDataView):
+        * html/canvas/DataView.cpp: Added.
+        * html/canvas/DataView.h: Added.
+        * html/canvas/DataView.idl: Added.
+        * page/DOMWindow.idl:
+
 2010-11-24  Nicolas Dufresne  <nicolas.dufresne at collabora.co.uk>
 
         Reviewed by Martin Robinson.
diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make
index c2a15f7..7bfcf14 100644
--- a/WebCore/DerivedSources.make
+++ b/WebCore/DerivedSources.make
@@ -76,6 +76,7 @@ DOM_CLASSES = \
     WebGLActiveInfo \
     ArrayBufferView \
     ArrayBuffer \
+    DataView \
     WebGLBuffer \
     Int8Array \
     WebGLContextAttributes \
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 33b2094..fd8b5fc 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -186,6 +186,8 @@ webcore_built_sources += \
 	DerivedSources/WebCore/JSDataGridColumn.h \
 	DerivedSources/WebCore/JSDataGridColumnList.cpp \
 	DerivedSources/WebCore/JSDataGridColumnList.h \
+	DerivedSources/WebCore/JSDataView.cpp \
+	DerivedSources/WebCore/JSDataView.h \
 	DerivedSources/WebCore/JSDedicatedWorkerContext.cpp \
 	DerivedSources/WebCore/JSDedicatedWorkerContext.h \
 	DerivedSources/WebCore/JSDeviceMotionEvent.cpp \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 561fe1c..45a18e0 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -207,6 +207,7 @@
             'html/canvas/CanvasPixelArray.idl',
             'html/canvas/CanvasRenderingContext.idl',
             'html/canvas/CanvasRenderingContext2D.idl',
+            'html/canvas/DataView.idl',
             'html/canvas/Float32Array.idl',
             'html/canvas/Int16Array.idl',
             'html/canvas/Int32Array.idl',
@@ -747,6 +748,8 @@
             'bindings/v8/custom/V8CanvasPixelArrayCustom.cpp',
             'bindings/v8/custom/V8ArrayBufferViewCustom.h',
             'bindings/v8/custom/V8ArrayBufferCustom.cpp',
+            'bindings/v8/custom/V8DataViewCustom.cpp',
+            'bindings/v8/custom/V8DataViewCustom.h',
             'bindings/v8/custom/V8Int8ArrayCustom.cpp',
             'bindings/v8/custom/V8Int32ArrayCustom.cpp',
             'bindings/v8/custom/V8FileReaderCustom.cpp',
@@ -1865,6 +1868,8 @@
             'html/canvas/CanvasStyle.cpp',
             'html/canvas/CanvasStyle.h',
             'html/canvas/CheckedInt.h',
+            'html/canvas/DataView.cpp',
+            'html/canvas/DataView.h',
             'html/canvas/Float32Array.cpp',
             'html/canvas/Float32Array.h',
             'html/canvas/Int16Array.cpp',
diff --git a/WebCore/WebCore.pri b/WebCore/WebCore.pri
index f8cea41..5043188 100644
--- a/WebCore/WebCore.pri
+++ b/WebCore/WebCore.pri
@@ -182,6 +182,7 @@ IDL_BINDINGS += \
     fileapi/MetadataCallback.idl \
     html/canvas/ArrayBufferView.idl \
     html/canvas/ArrayBuffer.idl \
+    html/canvas/DataView.idl \
     html/canvas/Int8Array.idl \
     html/canvas/Float32Array.idl \
     html/canvas/CanvasGradient.idl \
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 75b9710..c1cd0c2 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -3700,6 +3700,7 @@ HEADERS += \
         html/canvas/WebGLActiveInfo.h \
         html/canvas/ArrayBuffer.h \
         html/canvas/ArrayBufferView.h \
+        html/canvas/DataView.h \
         html/canvas/WebGLBuffer.h \
         html/canvas/Int8Array.h \
         html/canvas/WebGLContextAttributes.h \
@@ -3724,6 +3725,7 @@ HEADERS += \
     !v8 {
         SOURCES += \
                 bindings/js/JSArrayBufferCustom.cpp \
+                bindings/js/JSDataViewCustom.cpp \
                 bindings/js/JSInt8ArrayCustom.cpp \
                 bindings/js/JSFloat32ArrayCustom.cpp \
                 bindings/js/JSInt32ArrayCustom.cpp \
@@ -3738,6 +3740,7 @@ SOURCES += \
         html/canvas/WebGLObject.cpp \
         html/canvas/ArrayBuffer.cpp \
         html/canvas/ArrayBufferView.cpp \
+        html/canvas/DataView.cpp \
         html/canvas/WebGLBuffer.cpp \
         html/canvas/Int8Array.cpp \
         html/canvas/WebGLContextAttributes.cpp \
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index e5439d2..e9b0f14 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -767,6 +767,11 @@
 		2E75841F12779ADA0062628B /* FileReaderLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E75841C12779ADA0062628B /* FileReaderLoaderClient.h */; };
 		2E94F43B119207DA00B7F75D /* JSFileReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E94F439119207DA00B7F75D /* JSFileReader.cpp */; };
 		2E94F43C119207DA00B7F75D /* JSFileReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E94F43A119207DA00B7F75D /* JSFileReader.h */; };
+		2E97CCEA12939CB800C5C8FF /* DataView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E97CCE712939CB800C5C8FF /* DataView.cpp */; };
+		2E97CCEB12939CB800C5C8FF /* DataView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E97CCE812939CB800C5C8FF /* DataView.h */; };
+		2E97CCF71293A43A00C5C8FF /* JSDataViewCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E97CCF61293A43A00C5C8FF /* JSDataViewCustom.cpp */; };
+		2E97CE6F1293AD6B00C5C8FF /* JSDataView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E97CE6D1293AD6B00C5C8FF /* JSDataView.cpp */; };
+		2E97CE701293AD6B00C5C8FF /* JSDataView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E97CE6E1293AD6B00C5C8FF /* JSDataView.h */; };
 		2EA768040FE7126400AB9C8A /* WorkerScriptLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EA768030FE7126400AB9C8A /* WorkerScriptLoaderClient.h */; };
 		2EB4BCD2121F03E300EC4885 /* BlobResourceHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EB4BCD0121F03E300EC4885 /* BlobResourceHandle.cpp */; };
 		2EB4BCD3121F03E300EC4885 /* BlobResourceHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EB4BCD1121F03E300EC4885 /* BlobResourceHandle.h */; };
@@ -6857,6 +6862,12 @@
 		2E75841C12779ADA0062628B /* FileReaderLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileReaderLoaderClient.h; path = fileapi/FileReaderLoaderClient.h; sourceTree = "<group>"; };
 		2E94F439119207DA00B7F75D /* JSFileReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFileReader.cpp; sourceTree = "<group>"; };
 		2E94F43A119207DA00B7F75D /* JSFileReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFileReader.h; sourceTree = "<group>"; };
+		2E97CCE712939CB800C5C8FF /* DataView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DataView.cpp; path = canvas/DataView.cpp; sourceTree = "<group>"; };
+		2E97CCE812939CB800C5C8FF /* DataView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DataView.h; path = canvas/DataView.h; sourceTree = "<group>"; };
+		2E97CCE912939CB800C5C8FF /* DataView.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = DataView.idl; path = canvas/DataView.idl; sourceTree = "<group>"; };
+		2E97CCF61293A43A00C5C8FF /* JSDataViewCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDataViewCustom.cpp; sourceTree = "<group>"; };
+		2E97CE6D1293AD6B00C5C8FF /* JSDataView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDataView.cpp; sourceTree = "<group>"; };
+		2E97CE6E1293AD6B00C5C8FF /* JSDataView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDataView.h; sourceTree = "<group>"; };
 		2EA768030FE7126400AB9C8A /* WorkerScriptLoaderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WorkerScriptLoaderClient.h; path = workers/WorkerScriptLoaderClient.h; sourceTree = "<group>"; };
 		2EB4BCD0121F03E300EC4885 /* BlobResourceHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobResourceHandle.cpp; sourceTree = "<group>"; };
 		2EB4BCD1121F03E300EC4885 /* BlobResourceHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobResourceHandle.h; sourceTree = "<group>"; };
@@ -12631,6 +12642,9 @@
 				49484FBF102CF23C00187DD3 /* CanvasStyle.cpp */,
 				49484FC0102CF23C00187DD3 /* CanvasStyle.h */,
 				A00B721911DE6427008AB9FF /* CheckedInt.h */,
+				2E97CCE712939CB800C5C8FF /* DataView.cpp */,
+				2E97CCE812939CB800C5C8FF /* DataView.h */,
+				2E97CCE912939CB800C5C8FF /* DataView.idl */,
 				49EECDCD10503C2300099FAB /* Float32Array.cpp */,
 				49EECDCE10503C2300099FAB /* Float32Array.h */,
 				49EECDCF10503C2300099FAB /* Float32Array.idl */,
@@ -15321,6 +15335,8 @@
 				BC77D1660FF19F550070887B /* JSDataGridColumn.h */,
 				BC77D1670FF19F550070887B /* JSDataGridColumnList.cpp */,
 				BC77D1680FF19F550070887B /* JSDataGridColumnList.h */,
+				2E97CE6D1293AD6B00C5C8FF /* JSDataView.cpp */,
+				2E97CE6E1293AD6B00C5C8FF /* JSDataView.h */,
 				2E0888D21148848A00AF4265 /* JSDOMFormData.cpp */,
 				2E0888D31148848A00AF4265 /* JSDOMFormData.h */,
 				4ACBC0C812713D0A0094F9B2 /* JSDOMSettableTokenList.cpp */,
@@ -17100,6 +17116,7 @@
 				E1AD14E71297377400ACA989 /* JSCSSStyleRuleCustom.cpp */,
 				BC20FB7E0C0E8E6C00D1447F /* JSCSSValueCustom.cpp */,
 				BC77D1510FF19C730070887B /* JSDataGridColumnListCustom.cpp */,
+				2E97CCF61293A43A00C5C8FF /* JSDataViewCustom.cpp */,
 				4162A453101145E300DFF3ED /* JSDedicatedWorkerContextCustom.cpp */,
 				33503CBF10179C1A003B47E1 /* JSDesktopNotificationsCustom.cpp */,
 				31FB1A6B120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp */,
@@ -21403,6 +21420,8 @@
 				75415D56129AB2D2003AD669 /* JSSpeechInputEvent.h in Headers */,
 				75415D58129AB2D2003AD669 /* JSSpeechInputResult.h in Headers */,
 				75415D5A129AB2D2003AD669 /* JSSpeechInputResultList.h in Headers */,
+				2E97CCEB12939CB800C5C8FF /* DataView.h in Headers */,
+				2E97CE701293AD6B00C5C8FF /* JSDataView.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -23978,6 +23997,9 @@
 				75415D57129AB2D2003AD669 /* JSSpeechInputResult.cpp in Sources */,
 				75415D59129AB2D2003AD669 /* JSSpeechInputResultList.cpp in Sources */,
 				46BC724E129B104C0071C07E /* FileWriterBase.cpp in Sources */,
+				2E97CCEA12939CB800C5C8FF /* DataView.cpp in Sources */,
+				2E97CCF71293A43A00C5C8FF /* JSDataViewCustom.cpp in Sources */,
+				2E97CE6F1293AD6B00C5C8FF /* JSDataView.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.h b/WebCore/bindings/generic/RuntimeEnabledFeatures.h
index 0ab5120..33432ce 100644
--- a/WebCore/bindings/generic/RuntimeEnabledFeatures.h
+++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.h
@@ -102,6 +102,7 @@ public:
     static bool int32ArrayEnabled() { return isWebGLEnabled; }
     static bool uint32ArrayEnabled() { return isWebGLEnabled; }
     static bool float32ArrayEnabled() { return isWebGLEnabled; }
+    static bool dataViewEnabled() { return isWebGLEnabled; }
     static bool webGLRenderingContextEnabled() { return isWebGLEnabled; }
     static bool webGLArrayBufferEnabled() { return isWebGLEnabled; }
     static bool webGLByteArrayEnabled() { return isWebGLEnabled; }
diff --git a/WebCore/bindings/js/JSArrayBufferViewHelper.h b/WebCore/bindings/js/JSArrayBufferViewHelper.h
index ba712c6..f34f4b9 100644
--- a/WebCore/bindings/js/JSArrayBufferViewHelper.h
+++ b/WebCore/bindings/js/JSArrayBufferViewHelper.h
@@ -86,16 +86,33 @@ JSC::JSValue setWebGLArrayHelper(JSC::ExecState* exec, T* impl, T* (*conversionF
 // Template function used by XXXArrayConstructors.
 // If this returns 0, it will already have thrown a JavaScript exception.
 template<class C, typename T>
-PassRefPtr<ArrayBufferView> constructArrayBufferView(JSC::ExecState* exec)
+PassRefPtr<C> constructArrayBufferViewWithArrayBufferArgument(JSC::ExecState* exec)
+{
+    RefPtr<ArrayBuffer> buffer = toArrayBuffer(exec->argument(0));
+    if (!buffer)
+        return 0;
+
+    unsigned offset = (exec->argumentCount() > 1) ? exec->argument(1).toUInt32(exec) : 0;
+    if ((buffer->byteLength() - offset) % sizeof(T))
+        throwError(exec, createRangeError(exec, "ArrayBuffer length minus the byteOffset is not a multiple of the element size."));
+    unsigned int length = (buffer->byteLength() - offset) / sizeof(T);
+    if (exec->argumentCount() > 2)
+        length = exec->argument(2).toUInt32(exec);
+    RefPtr<C> array = C::create(buffer, offset, length);
+    if (!array)
+        setDOMException(exec, INDEX_SIZE_ERR);
+    return array;
+}
+
+template<class C, typename T>
+PassRefPtr<C> constructArrayBufferView(JSC::ExecState* exec)
 {
     // There are 3 constructors:
     //
     //  1) (in int size)
     //  2) (in ArrayBuffer buffer, [Optional] in int offset, [Optional] in unsigned int length)
     //  3) (in sequence<T>) - This ends up being a JS "array-like" object
-    //
-    RefPtr<C> arrayObject;
-    
+    //    
     // For the 0 args case, just create a zero-length view. We could
     // consider raising a SyntaxError for this case, but not all
     // JavaScript DOM bindings can distinguish between "new
@@ -112,20 +129,10 @@ PassRefPtr<ArrayBufferView> constructArrayBufferView(JSC::ExecState* exec)
     }
 
     if (exec->argument(0).isObject()) {
-        RefPtr<ArrayBuffer> buffer = toArrayBuffer(exec->argument(0));
-        if (buffer) {
-            unsigned offset = (exec->argumentCount() > 1) ? exec->argument(1).toUInt32(exec) : 0;
-            if ((buffer->byteLength() - offset) % sizeof(T))
-                throwError(exec, createRangeError(exec, "ArrayBuffer length minus the byteOffset is not a multiple of the element size."));
-            unsigned int length = (buffer->byteLength() - offset) / sizeof(T);
-            if (exec->argumentCount() > 2)
-                length = exec->argument(2).toUInt32(exec);
-            PassRefPtr<ArrayBufferView> array = C::create(buffer, offset, length);
-            if (!array)
-                setDOMException(exec, INDEX_SIZE_ERR);
-            return array;
-        }
-        
+        RefPtr<C> view = constructArrayBufferViewWithArrayBufferArgument<C, T>(exec);
+        if (view)
+            return view;
+    
         JSC::JSObject* array = asObject(exec->argument(0));
         unsigned length = array->get(exec, JSC::Identifier(exec, "length")).toUInt32(exec);
         void* tempValues;
@@ -142,14 +149,14 @@ PassRefPtr<ArrayBufferView> constructArrayBufferView(JSC::ExecState* exec)
             values.get()[i] = static_cast<T>(v.toNumber(exec));
         }
         
-        PassRefPtr<ArrayBufferView> result = C::create(values.get(), length);
+        RefPtr<C> result = C::create(values.get(), length);
         if (!result)
             setDOMException(exec, INDEX_SIZE_ERR);
         return result;
     }
-    
+
     int length = exec->argument(0).toInt32(exec);
-    PassRefPtr<ArrayBufferView> result;
+    RefPtr<C> result;
     if (length >= 0)
         result = C::create(static_cast<unsigned>(length));
     if (!result)
diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp
index 7119ea6..95fcdc1 100644
--- a/WebCore/bindings/js/JSDOMWindowCustom.cpp
+++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp
@@ -53,6 +53,7 @@
 
 #if ENABLE(3D_CANVAS) || ENABLE(BLOB)
 #include "JSArrayBuffer.h"
+#include "JSDataView.h"
 #include "JSInt8Array.h"
 #include "JSUint8Array.h"
 #include "JSInt32Array.h"
@@ -606,6 +607,10 @@ JSValue JSDOMWindow::float32Array(ExecState* exec) const
     return getDOMConstructor<JSFloat32ArrayConstructor>(exec, this);
 }
 
+JSValue JSDOMWindow::dataView(ExecState* exec) const
+{
+    return getDOMConstructor<JSDataViewConstructor>(exec, this);
+}
 #endif
  
 JSValue JSDOMWindow::xmlHttpRequest(ExecState* exec) const
diff --git a/WebCore/bindings/js/JSDataViewCustom.cpp b/WebCore/bindings/js/JSDataViewCustom.cpp
new file mode 100644
index 0000000..f17e0e1
--- /dev/null
+++ b/WebCore/bindings/js/JSDataViewCustom.cpp
@@ -0,0 +1,174 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
+
+#include "JSDataView.h"
+
+#include "DataView.h"
+#include "ExceptionCode.h"
+#include "JSArrayBufferViewHelper.h"
+#include <wtf/MathExtras.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+enum DataViewAccessType {
+    AccessDataViewMemberAsInt8,
+    AccessDataViewMemberAsUint8,
+    AccessDataViewMemberAsFloat32,
+    AccessDataViewMemberAsFloat64
+};
+
+JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, DataView* object)
+{
+    return getDOMObjectWrapper<JSDataView>(exec, globalObject, object);
+}
+
+EncodedJSValue JSC_HOST_CALL JSDataViewConstructor::constructJSDataView(ExecState* exec)
+{
+    if (exec->argument(0).isNull() || !exec->argument(0).isObject())
+        return throwVMTypeError(exec);
+
+    RefPtr<DataView> view = constructArrayBufferViewWithArrayBufferArgument<DataView, char>(exec);
+    if (!view.get()) {
+        setDOMException(exec, INDEX_SIZE_ERR);
+        return JSValue::encode(jsUndefined());
+    }
+
+    JSDataViewConstructor* jsConstructor = static_cast<JSDataViewConstructor*>(exec->callee());
+    return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), view.get())));
+}
+
+static JSValue getDataViewMember(ExecState* exec, DataViewAccessType type)
+{
+    JSValue thisValue = exec->hostThisValue();
+    if (!thisValue.inherits(&JSDataView::s_info))
+        return throwTypeError(exec);
+    JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
+    DataView* imp = static_cast<DataView*>(castedThis->impl());
+    if (exec->argumentCount() < 1)
+        return throwError(exec, createSyntaxError(exec, "Not enough arguments"));
+    ExceptionCode ec = 0;
+    unsigned byteOffset = exec->argument(0).toUInt32(exec);
+    if (exec->hadException())
+        return jsUndefined();
+
+    bool littleEndian = false;
+    if (exec->argumentCount() > 1 && (type == AccessDataViewMemberAsFloat32 || type == AccessDataViewMemberAsFloat64)) {
+        littleEndian = exec->argument(1).toBoolean(exec);
+        if (exec->hadException())
+            return jsUndefined();
+    }
+
+    JSC::JSValue result;
+    switch (type) {
+    case AccessDataViewMemberAsInt8:
+        result = jsNumber(imp->getInt8(byteOffset, ec));
+        break;
+    case AccessDataViewMemberAsUint8:
+        result = jsNumber(imp->getUint8(byteOffset, ec));
+        break;
+    case AccessDataViewMemberAsFloat32:
+    case AccessDataViewMemberAsFloat64: {
+        double value = (type == AccessDataViewMemberAsFloat32) ? imp->getFloat32(byteOffset, littleEndian, ec) : imp->getFloat64(byteOffset, littleEndian, ec);
+        result = isnan(value) ? JSValue(nonInlineNaN()) : jsNumber(value);
+        break;
+    } default:
+        ASSERT_NOT_REACHED();
+        break;
+    }
+    setDOMException(exec, ec);
+    return result;
+}
+
+JSValue JSC_HOST_CALL JSDataView::getInt8(ExecState* exec)
+{
+    return getDataViewMember(exec, AccessDataViewMemberAsInt8);
+}
+
+JSValue JSC_HOST_CALL JSDataView::getUint8(ExecState* exec)
+{
+    return getDataViewMember(exec, AccessDataViewMemberAsUint8);
+}
+
+JSValue JSC_HOST_CALL JSDataView::getFloat32(ExecState* exec)
+{
+    return getDataViewMember(exec, AccessDataViewMemberAsFloat32);
+}
+
+JSValue JSC_HOST_CALL JSDataView::getFloat64(ExecState* exec)
+{
+    return getDataViewMember(exec, AccessDataViewMemberAsFloat64);
+}
+
+static JSValue setDataViewMember(ExecState* exec, DataViewAccessType type)
+{
+    JSValue thisValue = exec->hostThisValue();
+    if (!thisValue.inherits(&JSDataView::s_info))
+        return throwTypeError(exec);
+    JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
+    DataView* imp = static_cast<DataView*>(castedThis->impl());
+    if (exec->argumentCount() < 2)
+        return throwError(exec, createSyntaxError(exec, "Not enough arguments"));
+    ExceptionCode ec = 0;
+    unsigned byteOffset = exec->argument(0).toUInt32(exec);
+    if (exec->hadException())
+        return jsUndefined();
+    int value = exec->argument(1).toInt32(exec);
+    if (exec->hadException())
+        return jsUndefined();
+        
+    switch (type) {
+    case AccessDataViewMemberAsInt8:
+        imp->setInt8(byteOffset, static_cast<char>(value), ec);
+        break;
+    case AccessDataViewMemberAsUint8:
+        imp->setUint8(byteOffset, static_cast<unsigned char>(value), ec);
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        break;
+    }
+    setDOMException(exec, ec);
+    return jsUndefined();
+}
+
+JSValue JSC_HOST_CALL JSDataView::setInt8(ExecState* exec)
+{
+    return setDataViewMember(exec, AccessDataViewMemberAsInt8);
+}
+
+JSValue JSC_HOST_CALL JSDataView::setUint8(ExecState* exec)
+{
+    return setDataViewMember(exec, AccessDataViewMemberAsUint8);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/bindings/js/JSFloat32ArrayCustom.cpp b/WebCore/bindings/js/JSFloat32ArrayCustom.cpp
index 671ee68..880d68c 100644
--- a/WebCore/bindings/js/JSFloat32ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSFloat32ArrayCustom.cpp
@@ -27,10 +27,10 @@
 
 #if ENABLE(3D_CANVAS) || ENABLE(BLOB)
 
-#include "JSArrayBufferViewHelper.h"
 #include "JSFloat32Array.h"
 
 #include "Float32Array.h"
+#include "JSArrayBufferViewHelper.h"
 
 using namespace JSC;
 
@@ -54,7 +54,7 @@ JSC::JSValue JSFloat32Array::set(JSC::ExecState* exec)
 EncodedJSValue JSC_HOST_CALL JSFloat32ArrayConstructor::constructJSFloat32Array(ExecState* exec)
 {
     JSFloat32ArrayConstructor* jsConstructor = static_cast<JSFloat32ArrayConstructor*>(exec->callee());
-    RefPtr<Float32Array> array = static_cast<Float32Array*>(constructArrayBufferView<Float32Array, float>(exec).get());
+    RefPtr<Float32Array> array = constructArrayBufferView<Float32Array, float>(exec);
     if (!array.get())
         // Exception has already been thrown.
         return JSValue::encode(JSValue());
diff --git a/WebCore/bindings/js/JSInt16ArrayCustom.cpp b/WebCore/bindings/js/JSInt16ArrayCustom.cpp
index 797568c..e08da8a 100644
--- a/WebCore/bindings/js/JSInt16ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSInt16ArrayCustom.cpp
@@ -27,10 +27,10 @@
 
 #if ENABLE(3D_CANVAS) || ENABLE(BLOB)
 
-#include "JSArrayBufferViewHelper.h"
 #include "JSInt16Array.h"
 
 #include "Int16Array.h"
+#include "JSArrayBufferViewHelper.h"
 
 using namespace JSC;
 
@@ -54,7 +54,7 @@ JSC::JSValue JSInt16Array::set(JSC::ExecState* exec)
 EncodedJSValue JSC_HOST_CALL JSInt16ArrayConstructor::constructJSInt16Array(ExecState* exec)
 {
     JSInt16ArrayConstructor* jsConstructor = static_cast<JSInt16ArrayConstructor*>(exec->callee());
-    RefPtr<Int16Array> array = static_cast<Int16Array*>(constructArrayBufferView<Int16Array, short>(exec).get());
+    RefPtr<Int16Array> array = constructArrayBufferView<Int16Array, short>(exec);
     if (!array.get())
         // Exception has already been thrown.
         return JSValue::encode(JSValue());
diff --git a/WebCore/bindings/js/JSInt32ArrayCustom.cpp b/WebCore/bindings/js/JSInt32ArrayCustom.cpp
index 53e6ec6..5aa64bb 100644
--- a/WebCore/bindings/js/JSInt32ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSInt32ArrayCustom.cpp
@@ -27,10 +27,10 @@
 
 #if ENABLE(3D_CANVAS) || ENABLE(BLOB)
 
-#include "JSArrayBufferViewHelper.h"
 #include "JSInt32Array.h"
 
 #include "Int32Array.h"
+#include "JSArrayBufferViewHelper.h"
 
 using namespace JSC;
 
@@ -54,7 +54,7 @@ JSC::JSValue JSInt32Array::set(JSC::ExecState* exec)
 EncodedJSValue JSC_HOST_CALL JSInt32ArrayConstructor::constructJSInt32Array(ExecState* exec)
 {
     JSInt32ArrayConstructor* jsConstructor = static_cast<JSInt32ArrayConstructor*>(exec->callee());
-    RefPtr<Int32Array> array = static_cast<Int32Array*>(constructArrayBufferView<Int32Array, int>(exec).get());
+    RefPtr<Int32Array> array = constructArrayBufferView<Int32Array, int>(exec);
     if (!array.get())
         // Exception has already been thrown.
         return JSValue::encode(JSValue());
diff --git a/WebCore/bindings/js/JSInt8ArrayCustom.cpp b/WebCore/bindings/js/JSInt8ArrayCustom.cpp
index 7556d6a..b63de54 100644
--- a/WebCore/bindings/js/JSInt8ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSInt8ArrayCustom.cpp
@@ -27,10 +27,10 @@
 
 #if ENABLE(3D_CANVAS) || ENABLE(BLOB)
 
-#include "JSArrayBufferViewHelper.h"
 #include "JSInt8Array.h"
 
 #include "Int8Array.h"
+#include "JSArrayBufferViewHelper.h"
 #include <runtime/Error.h>
 
 using namespace JSC;
@@ -55,7 +55,7 @@ JSC::JSValue JSInt8Array::set(JSC::ExecState* exec)
 EncodedJSValue JSC_HOST_CALL JSInt8ArrayConstructor::constructJSInt8Array(ExecState* exec)
 {
     JSInt8ArrayConstructor* jsConstructor = static_cast<JSInt8ArrayConstructor*>(exec->callee());
-    RefPtr<Int8Array> array = static_cast<Int8Array*>(constructArrayBufferView<Int8Array, signed char>(exec).get());
+    RefPtr<Int8Array> array = constructArrayBufferView<Int8Array, signed char>(exec);
     if (!array.get())
         // Exception has already been thrown.
         return JSValue::encode(JSValue());
diff --git a/WebCore/bindings/js/JSUint16ArrayCustom.cpp b/WebCore/bindings/js/JSUint16ArrayCustom.cpp
index 9f12fa7..6a024ee 100644
--- a/WebCore/bindings/js/JSUint16ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSUint16ArrayCustom.cpp
@@ -27,9 +27,9 @@
 
 #if ENABLE(3D_CANVAS) || ENABLE(BLOB)
 
-#include "JSArrayBufferViewHelper.h"
 #include "JSUint16Array.h"
 
+#include "JSArrayBufferViewHelper.h"
 #include "Uint16Array.h"
 
 using namespace JSC;
@@ -54,7 +54,7 @@ JSC::JSValue JSUint16Array::set(JSC::ExecState* exec)
 EncodedJSValue JSC_HOST_CALL JSUint16ArrayConstructor::constructJSUint16Array(ExecState* exec)
 {
     JSUint16ArrayConstructor* jsConstructor = static_cast<JSUint16ArrayConstructor*>(exec->callee());
-    RefPtr<Uint16Array> array = static_cast<Uint16Array*>(constructArrayBufferView<Uint16Array, unsigned short>(exec).get());
+    RefPtr<Uint16Array> array = constructArrayBufferView<Uint16Array, unsigned short>(exec);
     if (!array.get())
         // Exception has already been thrown.
         return JSValue::encode(JSValue());
diff --git a/WebCore/bindings/js/JSUint32ArrayCustom.cpp b/WebCore/bindings/js/JSUint32ArrayCustom.cpp
index c757786..34eb8de 100644
--- a/WebCore/bindings/js/JSUint32ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSUint32ArrayCustom.cpp
@@ -27,9 +27,9 @@
 
 #if ENABLE(3D_CANVAS) || ENABLE(BLOB)
 
-#include "JSArrayBufferViewHelper.h"
 #include "JSUint32Array.h"
 
+#include "JSArrayBufferViewHelper.h"
 #include "Uint32Array.h"
 
 using namespace JSC;
@@ -54,7 +54,7 @@ JSC::JSValue JSUint32Array::set(JSC::ExecState* exec)
 EncodedJSValue JSC_HOST_CALL JSUint32ArrayConstructor::constructJSUint32Array(ExecState* exec)
 {
     JSUint32ArrayConstructor* jsConstructor = static_cast<JSUint32ArrayConstructor*>(exec->callee());
-    RefPtr<Uint32Array> array = static_cast<Uint32Array*>(constructArrayBufferView<Uint32Array, unsigned int>(exec).get());
+    RefPtr<Uint32Array> array = constructArrayBufferView<Uint32Array, unsigned int>(exec);
     if (!array.get())
         // Exception has already been thrown.
         return JSValue::encode(JSValue());
diff --git a/WebCore/bindings/js/JSUint8ArrayCustom.cpp b/WebCore/bindings/js/JSUint8ArrayCustom.cpp
index adf60a9..a9ed73f 100644
--- a/WebCore/bindings/js/JSUint8ArrayCustom.cpp
+++ b/WebCore/bindings/js/JSUint8ArrayCustom.cpp
@@ -27,9 +27,9 @@
 
 #if ENABLE(3D_CANVAS) || ENABLE(BLOB)
 
-#include "JSArrayBufferViewHelper.h"
 #include "JSUint8Array.h"
 
+#include "JSArrayBufferViewHelper.h"
 #include "Uint8Array.h"
 
 using namespace JSC;
@@ -54,7 +54,7 @@ JSC::JSValue JSUint8Array::set(JSC::ExecState* exec)
 EncodedJSValue JSC_HOST_CALL JSUint8ArrayConstructor::constructJSUint8Array(ExecState* exec)
 {
     JSUint8ArrayConstructor* jsConstructor = static_cast<JSUint8ArrayConstructor*>(exec->callee());
-    RefPtr<Uint8Array> array = static_cast<Uint8Array*>(constructArrayBufferView<Uint8Array, unsigned char>(exec).get());
+    RefPtr<Uint8Array> array = constructArrayBufferView<Uint8Array, unsigned char>(exec);
     if (!array.get())
         // Exception has already been thrown.
         return JSValue::encode(JSValue());
diff --git a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h b/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h
index 2566b67..6881a01 100644
--- a/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h
+++ b/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h
@@ -28,27 +28,64 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
+#ifndef V8ArrayBufferViewCustom_h
+#define V8ArrayBufferViewCustom_h
 
 #if ENABLE(3D_CANVAS) || ENABLE(BLOB)
 
 #include "ArrayBuffer.h"
 
-#include "V8Binding.h"
 #include "V8ArrayBuffer.h"
+#include "V8Binding.h"
 #include "V8Proxy.h"
 
 namespace WebCore {
 
 // Template function used by the ArrayBufferView*Constructor callbacks.
 template<class ArrayClass, class ElementType>
+v8::Handle<v8::Value> constructWebGLArrayWithArrayBufferArgument(const v8::Arguments& args, WrapperTypeInfo* type, v8::ExternalArrayType arrayType, bool hasIndexer)
+{
+    ArrayBuffer* buf = V8ArrayBuffer::toNative(args[0]->ToObject());
+    if (!buf)
+        return throwError("Could not convert argument 0 to a ArrayBuffer");
+    bool ok;
+    uint32_t offset = 0;
+    int argLen = args.Length();
+    if (argLen > 1) {
+        offset = toUInt32(args[1], ok);
+        if (!ok)
+            return throwError("Could not convert argument 1 to a number");
+    }
+    if ((buf->byteLength() - offset) % sizeof(ElementType))
+        return throwError("ArrayBuffer length minus the byteOffset is not a multiple of the element size.", V8Proxy::RangeError);
+    uint32_t length = (buf->byteLength() - offset) / sizeof(ElementType);
+    if (argLen > 2) {
+        length = toUInt32(args[2], ok);
+        if (!ok)
+            return throwError("Could not convert argument 2 to a number");
+    }
+
+    RefPtr<ArrayClass> array = ArrayClass::create(buf, offset, length);
+    if (!array) {
+        V8Proxy::setDOMException(INDEX_SIZE_ERR);
+        return notHandledByInterceptor();
+    }
+    // Transform the holder into a wrapper object for the array.
+    V8DOMWrapper::setDOMWrapper(args.Holder(), type, array.get());
+    if (hasIndexer)
+        args.Holder()->SetIndexedPropertiesToExternalArrayData(array.get()->baseAddress(), arrayType, array.get()->length());
+    return toV8(array.release(), args.Holder());
+}
+
+// Template function used by the ArrayBufferView*Constructor callbacks.
+template<class ArrayClass, class ElementType>
 v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args, WrapperTypeInfo* type, v8::ExternalArrayType arrayType)
 {
     if (!args.IsConstructCall())
         return throwError("DOM object constructor cannot be called as a function.");
 
     int argLen = args.Length();
-    if (argLen == 0) {
+    if (!argLen) {
         // This happens when we return a previously constructed
         // ArrayBufferView, e.g. from the call to <Type>Array.slice().
         // The V8DOMWrapper will set the internal pointer in the
@@ -83,36 +120,8 @@ v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args, WrapperType
     }
 
     // See whether the first argument is a ArrayBuffer.
-    if (V8ArrayBuffer::HasInstance(args[0])) {
-        ArrayBuffer* buf = V8ArrayBuffer::toNative(args[0]->ToObject());
-        if (!buf)
-            return throwError("Could not convert argument 0 to a ArrayBuffer");
-        bool ok;
-        uint32_t offset = 0;
-        if (argLen > 1) {
-            offset = toUInt32(args[1], ok);
-            if (!ok)
-                return throwError("Could not convert argument 1 to a number");
-        }
-        if ((buf->byteLength() - offset) % sizeof(ElementType))
-            return throwError("ArrayBuffer length minus the byteOffset is not a multiple of the element size.", V8Proxy::RangeError);
-        uint32_t length = (buf->byteLength() - offset) / sizeof(ElementType);
-        if (argLen > 2) {
-            length = toUInt32(args[2], ok);
-            if (!ok)
-                return throwError("Could not convert argument 2 to a number");
-        }
-
-        RefPtr<ArrayClass> array = ArrayClass::create(buf, offset, length);
-        if (!array) {
-            V8Proxy::setDOMException(INDEX_SIZE_ERR);
-            return notHandledByInterceptor();
-        }
-        // Transform the holder into a wrapper object for the array.
-        V8DOMWrapper::setDOMWrapper(args.Holder(), type, array.get());
-        args.Holder()->SetIndexedPropertiesToExternalArrayData(array.get()->baseAddress(), arrayType, array.get()->length());
-        return toV8(array.release(), args.Holder());
-    }
+    if (V8ArrayBuffer::HasInstance(args[0]))
+      return constructWebGLArrayWithArrayBufferArgument<ArrayClass, ElementType>(args, type, arrayType, true);
 
     uint32_t len = 0;
     v8::Handle<v8::Object> srcArray;
@@ -201,3 +210,5 @@ v8::Handle<v8::Value> setWebGLArrayHelper(const v8::Arguments& args)
 }
 
 #endif // ENABLE(3D_CANVAS)
+
+#endif // V8ArrayBufferViewCustom_h
diff --git a/WebCore/bindings/v8/custom/V8DataViewCustom.cpp b/WebCore/bindings/v8/custom/V8DataViewCustom.cpp
new file mode 100755
index 0000000..16bd4a5
--- /dev/null
+++ b/WebCore/bindings/v8/custom/V8DataViewCustom.cpp
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
+
+#include "DataView.h"
+
+#include "V8ArrayBufferViewCustom.h"
+#include "V8Binding.h"
+#include "V8BindingMacros.h"
+#include "V8DataView.h"
+#include "V8Proxy.h"
+
+namespace WebCore {
+
+v8::Handle<v8::Value> V8DataView::constructorCallback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.ArrayBuffer.Constructor");
+
+    if (args[0]->IsNull() || !V8ArrayBuffer::HasInstance(args[0]))
+        return V8Proxy::throwTypeError();
+    return constructWebGLArrayWithArrayBufferArgument<DataView, char>(args, &info, v8::kExternalByteArray, false);
+}
+
+v8::Handle<v8::Value> toV8(DataView* impl)
+{
+    if (!impl)
+        return v8::Null();
+    return V8DataView::wrap(impl);
+}
+
+v8::Handle<v8::Value> V8DataView::getInt8Callback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.DataView.getInt8");
+    if (args.Length() < 1)
+        return throwError("Not enough arguments", V8Proxy::SyntaxError);
+
+    DataView* imp = V8DataView::toNative(args.Holder());
+    ExceptionCode ec = 0;
+    EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));
+    char result = imp->getInt8(byteOffset, ec);
+    if (UNLIKELY(ec)) {
+        V8Proxy::setDOMException(ec);
+        return v8::Handle<v8::Value>();
+    }
+    return v8::Integer::New(result);
+}
+
+v8::Handle<v8::Value> V8DataView::getUint8Callback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.DataView.getUint8");
+    if (args.Length() < 1)
+        return throwError("Not enough arguments", V8Proxy::SyntaxError);
+
+    DataView* imp = V8DataView::toNative(args.Holder());
+    ExceptionCode ec = 0;
+    EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));
+    unsigned char result = imp->getUint8(byteOffset, ec);
+    if (UNLIKELY(ec)) {
+        V8Proxy::setDOMException(ec);
+        return v8::Handle<v8::Value>();
+    }
+    return v8::Integer::New(result);
+}
+
+v8::Handle<v8::Value> V8DataView::setInt8Callback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.DataView.setInt8");
+    if (args.Length() < 2)
+        return throwError("Not enough arguments", V8Proxy::SyntaxError);
+
+    DataView* imp = V8DataView::toNative(args.Holder());
+    ExceptionCode ec = 0;
+    EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));
+    EXCEPTION_BLOCK(int, value, toInt32(args[1]));
+    imp->setInt8(byteOffset, static_cast<char>(value), ec);
+    if (UNLIKELY(ec))
+        V8Proxy::setDOMException(ec);
+    return v8::Handle<v8::Value>();
+}
+
+v8::Handle<v8::Value> V8DataView::setUint8Callback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.DataView.setUint8");
+    if (args.Length() < 2)
+        return throwError("Not enough arguments", V8Proxy::SyntaxError);
+
+    DataView* imp = V8DataView::toNative(args.Holder());
+    ExceptionCode ec = 0;
+    EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));
+    EXCEPTION_BLOCK(int, value, toInt32(args[1]));
+    imp->setUint8(byteOffset, static_cast<unsigned char>(value), ec);
+    if (UNLIKELY(ec))
+        V8Proxy::setDOMException(ec);
+    return v8::Handle<v8::Value>();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/html/canvas/ArrayBufferView.h b/WebCore/html/canvas/ArrayBufferView.h
index d37bada..701abbc 100644
--- a/WebCore/html/canvas/ArrayBufferView.h
+++ b/WebCore/html/canvas/ArrayBufferView.h
@@ -46,6 +46,7 @@ class ArrayBufferView : public RefCounted<ArrayBufferView> {
     virtual bool isIntArray() const { return false; }
     virtual bool isUnsignedIntArray() const { return false; }
     virtual bool isFloatArray() const { return false; }
+    virtual bool isDataView() const { return false; }
 
     PassRefPtr<ArrayBuffer> buffer() const
     {
diff --git a/WebCore/html/canvas/DataView.cpp b/WebCore/html/canvas/DataView.cpp
new file mode 100755
index 0000000..d030211
--- /dev/null
+++ b/WebCore/html/canvas/DataView.cpp
@@ -0,0 +1,228 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
+
+#include "DataView.h"
+
+namespace {
+
+template<typename T>
+union Value {
+    T data;
+    char bytes[sizeof(T)];
+};
+
+}
+
+namespace WebCore {
+
+PassRefPtr<DataView> DataView::create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned byteLength)
+{
+    if (byteOffset + byteLength > buffer->byteLength())
+        return 0;
+    return adoptRef(new DataView(buffer, byteOffset, byteLength));
+}
+
+DataView::DataView(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned byteLength)
+    : ArrayBufferView(buffer, byteOffset)
+    , m_byteLength(byteLength)
+{
+}
+
+static bool needToFlipBytes(bool littleEndian)
+{
+#if CPU(BIG_ENDIAN)
+    return littleEndian;
+#else
+    return !littleEndian;
+#endif
+}
+
+inline void swapBytes(char* p, char* q)
+{
+    char temp = *p;
+    *p = *q;
+    *q = temp;
+}
+
+static void flipBytesFor16Bits(char* p)
+{
+    swapBytes(p, p + 1);
+}
+
+static void flipBytesFor32Bits(char* p)
+{
+    swapBytes(p, p + 3);
+    swapBytes(p + 1, p + 2);
+}
+
+static void flipBytesFor64Bits(char* p)
+{
+    swapBytes(p, p + 7);
+    swapBytes(p + 1, p + 6);
+    swapBytes(p + 2, p + 5);
+    swapBytes(p + 3, p + 4);
+}
+
+static void flipBytesIfNeeded(char* value, size_t size, bool littleEndian)
+{
+    if (!needToFlipBytes(littleEndian))
+        return;
+
+    switch (size) {
+    case 1:
+        // Nothing to do.
+        break;
+    case 2:
+        flipBytesFor16Bits(value);
+        break;
+    case 4:
+        flipBytesFor32Bits(value);
+        break;
+    case 8:
+        flipBytesFor64Bits(value);
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        break;
+    }
+}
+
+template<typename T>
+T DataView::getData(unsigned byteOffset, bool littleEndian, ExceptionCode& ec) const
+{
+    if (beyondRange<T>(byteOffset)) {
+        ec = INDEX_SIZE_ERR;
+        return 0;
+    }
+
+    // We do not want to load the data directly since it would cause a bus error on architectures that don't support unaligned loads.
+    Value<T> value;
+    memcpy(value.bytes, static_cast<const char*>(m_baseAddress) + byteOffset, sizeof(T));
+    flipBytesIfNeeded(value.bytes, sizeof(T), littleEndian);
+    return value.data;
+}
+
+template<typename T>
+void DataView::setData(unsigned byteOffset, T value, bool littleEndian, ExceptionCode& ec)
+{
+    if (beyondRange<T>(byteOffset)) {
+        ec = INDEX_SIZE_ERR;
+        return;
+    }
+
+    // We do not want to store the data directly since it would cause a bus error on architectures that don't support unaligned stores.
+    Value<T> tempValue;
+    tempValue.data = value;
+    flipBytesIfNeeded(tempValue.bytes, sizeof(T), littleEndian);
+    memcpy(static_cast<char*>(m_baseAddress) + byteOffset, tempValue.bytes, sizeof(T));
+}
+
+char DataView::getInt8(unsigned byteOffset, ExceptionCode& ec)
+{
+    return getData<char>(byteOffset, false, ec);
+}
+
+unsigned char DataView::getUint8(unsigned byteOffset, ExceptionCode& ec)
+{
+    return getData<unsigned char>(byteOffset, false, ec);
+}
+
+short DataView::getInt16(unsigned byteOffset, bool littleEndian, ExceptionCode& ec)
+{
+    return getData<short>(byteOffset, littleEndian, ec);
+}
+
+unsigned short DataView::getUint16(unsigned byteOffset, bool littleEndian, ExceptionCode& ec)
+{
+    return getData<unsigned short>(byteOffset, littleEndian, ec);
+}
+
+int DataView::getInt32(unsigned byteOffset, bool littleEndian, ExceptionCode& ec)
+{
+    return getData<int>(byteOffset, littleEndian, ec);
+}
+
+unsigned DataView::getUint32(unsigned byteOffset, bool littleEndian, ExceptionCode& ec)
+{
+    return getData<unsigned>(byteOffset, littleEndian, ec);
+}
+
+float DataView::getFloat32(unsigned byteOffset, bool littleEndian, ExceptionCode& ec)
+{
+    return getData<float>(byteOffset, littleEndian, ec);
+}
+
+double DataView::getFloat64(unsigned byteOffset, bool littleEndian, ExceptionCode& ec)
+{
+    return getData<double>(byteOffset, littleEndian, ec);
+}
+
+void DataView::setInt8(unsigned byteOffset, char value, ExceptionCode& ec)
+{
+    setData<char>(byteOffset, value, false, ec);
+}
+
+void DataView::setUint8(unsigned byteOffset, unsigned char value, ExceptionCode& ec)
+{
+    setData<unsigned char>(byteOffset, value, false, ec);
+}
+
+void DataView::setInt16(unsigned byteOffset, short value, bool littleEndian, ExceptionCode& ec)
+{
+    setData<short>(byteOffset, value, littleEndian, ec);
+}
+
+void DataView::setUint16(unsigned byteOffset, unsigned short value, bool littleEndian, ExceptionCode& ec)
+{
+    setData<unsigned short>(byteOffset, value, littleEndian, ec);
+}
+
+void DataView::setInt32(unsigned byteOffset, int value, bool littleEndian, ExceptionCode& ec)
+{
+    setData<int>(byteOffset, value, littleEndian, ec);
+}
+
+void DataView::setUint32(unsigned byteOffset, unsigned value, bool littleEndian, ExceptionCode& ec)
+{
+    setData<unsigned>(byteOffset, value, littleEndian, ec);
+}
+
+void DataView::setFloat32(unsigned byteOffset, float value, bool littleEndian, ExceptionCode& ec)
+{
+    setData<float>(byteOffset, value, littleEndian, ec);
+}
+
+void DataView::setFloat64(unsigned byteOffset, double value, bool littleEndian, ExceptionCode& ec)
+{
+    setData<double>(byteOffset, value, littleEndian, ec);
+}
+
+}
+
+#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/WebCore/html/canvas/DataView.h b/WebCore/html/canvas/DataView.h
new file mode 100755
index 0000000..0681341
--- /dev/null
+++ b/WebCore/html/canvas/DataView.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DataView_h
+#define DataView_h
+
+#include "ArrayBufferView.h"
+#include "ExceptionCode.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class DataView : public ArrayBufferView {
+public:
+    static PassRefPtr<DataView> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned byteLength);
+
+    virtual bool isDataView() const { return true; }
+    virtual unsigned length() const { return m_byteLength; }
+    virtual unsigned byteLength() const { return m_byteLength; }
+    virtual PassRefPtr<ArrayBufferView> slice(int, int) const { return 0; }
+
+    char getInt8(unsigned byteOffset, ExceptionCode&);
+    unsigned char getUint8(unsigned byteOffset, ExceptionCode&);
+    short getInt16(unsigned byteOffset, ExceptionCode& ec) { return getInt16(byteOffset, false, ec); }
+    short getInt16(unsigned byteOffset, bool littleEndian, ExceptionCode&);
+    unsigned short getUint16(unsigned byteOffset, ExceptionCode& ec) { return getUint16(byteOffset, false, ec); }
+    unsigned short getUint16(unsigned byteOffset, bool littleEndian, ExceptionCode&);
+    int getInt32(unsigned byteOffset, ExceptionCode& ec) { return getInt32(byteOffset, false, ec); }
+    int getInt32(unsigned byteOffset, bool littleEndian, ExceptionCode&);
+    unsigned getUint32(unsigned byteOffset, ExceptionCode& ec) { return getUint32(byteOffset, false, ec); }
+    unsigned getUint32(unsigned byteOffset, bool littleEndian, ExceptionCode&);
+    float getFloat32(unsigned byteOffset, ExceptionCode& ec) { return getFloat32(byteOffset, false, ec); }
+    float getFloat32(unsigned byteOffset, bool littleEndian, ExceptionCode&);
+    double getFloat64(unsigned byteOffset, ExceptionCode& ec) { return getFloat64(byteOffset, false, ec); }
+    double getFloat64(unsigned byteOffset, bool littleEndian, ExceptionCode&);
+
+    void setInt8(unsigned byteOffset, char value, ExceptionCode&);
+    void setUint8(unsigned byteOffset, unsigned char value, ExceptionCode&);
+    void setInt16(unsigned byteOffset, short value, ExceptionCode& ec) { setInt16(byteOffset, value, false, ec); }
+    void setInt16(unsigned byteOffset, short value, bool littleEndian, ExceptionCode&);
+    void setUint16(unsigned byteOffset, unsigned short value, ExceptionCode& ec) { setUint16(byteOffset, value, false, ec); }
+    void setUint16(unsigned byteOffset, unsigned short value, bool littleEndian, ExceptionCode&);
+    void setInt32(unsigned byteOffset, int value, ExceptionCode& ec) { setInt32(byteOffset, value, false, ec); } 
+    void setInt32(unsigned byteOffset, int value, bool littleEndian, ExceptionCode&);
+    void setUint32(unsigned byteOffset, unsigned value, ExceptionCode& ec) { setUint32(byteOffset, value, false, ec); }
+    void setUint32(unsigned byteOffset, unsigned value, bool littleEndian, ExceptionCode&);
+    void setFloat32(unsigned byteOffset, float value, ExceptionCode& ec) { setFloat32(byteOffset, value, false, ec); }
+    void setFloat32(unsigned byteOffset, float value, bool littleEndian, ExceptionCode&);
+    void setFloat64(unsigned byteOffset, double value, ExceptionCode& ec) { setFloat64(byteOffset, value, false, ec); }
+    void setFloat64(unsigned byteOffset, double value, bool littleEndian, ExceptionCode&);
+
+private:
+    DataView(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned byteLength);
+
+    template<typename T>
+    inline bool beyondRange(unsigned byteOffset) const { return byteOffset + sizeof(T) > m_byteLength; }
+
+    template<typename T>
+    T getData(unsigned byteOffset, bool littleEndian, ExceptionCode&) const;
+
+    template<typename T>
+    void setData(unsigned byteOffset, T value, bool littleEndian, ExceptionCode&);
+
+    unsigned m_byteLength;
+};
+
+
+} // namespace WebCore
+
+#endif // DataView_h
diff --git a/WebCore/html/canvas/DataView.idl b/WebCore/html/canvas/DataView.idl
new file mode 100755
index 0000000..bef8805
--- /dev/null
+++ b/WebCore/html/canvas/DataView.idl
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module html {
+
+    interface [
+        Conditional=3D_CANVAS|BLOB,
+        CanBeConstructed,
+        CustomConstructFunction,
+        CustomToJS,
+        NoStaticTables,
+        V8CustomConstructor
+    ] DataView : ArrayBufferView {
+        // All these methods raise an exception if they would read or write beyond the end of the view.
+
+        // We have to use custom code because our code generator does not support char type.
+        // char getInt8(in unsigned long byteOffset);
+        // unsigned char getUint8(in unsigned long byteOffset);
+        [Custom] DOMObject getInt8()
+            raises (DOMException);
+        [Custom] DOMObject getUint8()
+            raises (DOMException);
+
+        [StrictTypeChecking, RequiresAllArguments=Raise] short getInt16(in unsigned long byteOffset, in [Optional] boolean littleEndian)
+            raises (DOMException);
+        [StrictTypeChecking, RequiresAllArguments=Raise] unsigned short getUint16(in unsigned long byteOffset, in [Optional] boolean littleEndian)
+            raises (DOMException);
+        [StrictTypeChecking, RequiresAllArguments=Raise] long getInt32(in unsigned long byteOffset, in [Optional] boolean littleEndian)
+            raises (DOMException);
+        [StrictTypeChecking, RequiresAllArguments=Raise] unsigned long getUint32(in unsigned long byteOffset, in [Optional] boolean littleEndian)
+            raises (DOMException);
+
+        // Use custom code to handle NaN case for JSC.
+        [JSCCustom, StrictTypeChecking, RequiresAllArguments=Raise] float getFloat32(in unsigned long byteOffset, in [Optional] boolean littleEndian)
+            raises (DOMException);
+        [JSCCustom, StrictTypeChecking, RequiresAllArguments=Raise] double getFloat64(in unsigned long byteOffset, in [Optional] boolean littleEndian)
+            raises (DOMException);
+
+        // We have to use custom code because our code generator does not support char type.
+        // void setInt8(in unsigned long byteOffset, in byte value);
+        // void setUint8(in unsigned long byteOffset, in unsigned byte value);
+        [Custom] void setInt8()
+            raises (DOMException);
+        [Custom] void setUint8()
+            raises (DOMException);
+
+        [StrictTypeChecking, RequiresAllArguments=Raise] void setInt16(in unsigned long byteOffset, in short value, in [Optional] boolean littleEndian)
+            raises (DOMException);
+        [StrictTypeChecking, RequiresAllArguments=Raise] void setUint16(in unsigned long byteOffset, in unsigned short value, in [Optional] boolean littleEndian)
+            raises (DOMException);
+        [StrictTypeChecking, RequiresAllArguments=Raise] void setInt32(in unsigned long byteOffset, in long value, in [Optional] boolean littleEndian)
+            raises (DOMException);
+        [StrictTypeChecking, RequiresAllArguments=Raise] void setUint32(in unsigned long byteOffset, in unsigned long value, in [Optional] boolean littleEndian)
+            raises (DOMException);
+        [StrictTypeChecking, RequiresAllArguments=Raise] void setFloat32(in unsigned long byteOffset, in float value, in [Optional] boolean littleEndian)
+            raises (DOMException);
+        [StrictTypeChecking, RequiresAllArguments=Raise] void setFloat64(in unsigned long byteOffset, in double value, in [Optional] boolean littleEndian)
+            raises (DOMException);
+    };
+
+}
diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl
index 0b9f5ed..e32cb79 100644
--- a/WebCore/page/DOMWindow.idl
+++ b/WebCore/page/DOMWindow.idl
@@ -498,6 +498,7 @@ module window {
         attribute [JSCCustomGetter,Conditional=3D_CANVAS|BLOB,EnabledAtRuntime] Int32ArrayConstructor Int32Array; // Usable with new operator
         attribute [JSCCustomGetter,Conditional=3D_CANVAS|BLOB,EnabledAtRuntime] Uint32ArrayConstructor Uint32Array; // Usable with new operator
         attribute [JSCCustomGetter,Conditional=3D_CANVAS|BLOB,EnabledAtRuntime] Float32ArrayConstructor Float32Array; // Usable with new operator
+        attribute [JSCCustomGetter,Conditional=3D_CANVAS|BLOB,EnabledAtRuntime] DataViewConstructor DataView; // Usable with new operator
 
         attribute EventConstructor Event;
         attribute BeforeLoadEventConstructor BeforeLoadEvent;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list