Changeset 138393 in webkit


Ignore:
Timestamp:
Dec 21, 2012, 11:38:28 AM (12 years ago)
Author:
kbr@google.com
Message:

Expose ArrayBufferView constructor on DOMWindow
https://bugs.webkit.org/show_bug.cgi?id=105605

Reviewed by Sam Weinig.

Source/WebCore:

Update IDL to track recent spec change exposing ArrayBufferView
constructor on DOMWindow for instanceof checks. There are no
constructors exposed in the Web IDL, however, so calling it via
operator new throws TypeError.

Test (updated): fast/canvas/webgl/array-unit-tests.html

  • html/canvas/ArrayBufferView.idl:

Removed OmitConstructor attribute.

  • page/DOMWindow.idl:

Exposed ArrayBufferView constructor function attribute.

LayoutTests:

Updated test from Khronos repository.

  • fast/canvas/webgl/array-unit-tests-expected.txt:
  • fast/canvas/webgl/array-unit-tests.html:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r138392 r138393  
     12012-12-21  Kenneth Russell  <kbr@google.com>
     2
     3        Expose ArrayBufferView constructor on DOMWindow
     4        https://bugs.webkit.org/show_bug.cgi?id=105605
     5
     6        Reviewed by Sam Weinig.
     7
     8        Updated test from Khronos repository.
     9
     10        * fast/canvas/webgl/array-unit-tests-expected.txt:
     11        * fast/canvas/webgl/array-unit-tests.html:
     12
    1132012-12-21  Csaba Osztrogonác  <ossy@webkit.org>
    214
  • trunk/LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt

    r109918 r138393  
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
     5PASS testSlice
     6test inheritance hierarchy of typed array views
     7PASS ArrayBufferView does not have [NoInterfaceObject] extended attribute and should be defined
     8PASS new Int8Array(1) instanceof ArrayBufferView is true
     9PASS new Uint8Array(1) instanceof ArrayBufferView is true
     10PASS new Uint8ClampedArray(1) instanceof ArrayBufferView is true
     11PASS new Int16Array(1) instanceof ArrayBufferView is true
     12PASS new Uint16Array(1) instanceof ArrayBufferView is true
     13PASS new Int32Array(1) instanceof ArrayBufferView is true
     14PASS new Uint32Array(1) instanceof ArrayBufferView is true
     15PASS new Float32Array(1) instanceof ArrayBufferView is true
     16PASS new Float64Array(1) instanceof ArrayBufferView is true
     17PASS new DataView(new ArrayBuffer(8)) instanceof ArrayBufferView is true
     18PASS new ArrayBufferView() threw TypeError
     19PASS new Uint8ClampedArray(1) instanceof Uint8Array is true
    520PASS test Float32Array SetAndGetPos10ToNeg10
    621PASS test Float32Array ConstructWithArrayOfSignedValues
  • trunk/LayoutTests/fast/canvas/webgl/array-unit-tests.html

    r109918 r138393  
    7171
    7272  try {
     73    running('testSlice');
    7374    var buffer = new ArrayBuffer(32);
    7475    var array = new Int8Array(buffer);
     
    103104    test("buffer.slice(-40, 16)", 0, 16);
    104105    test("buffer.slice(-40, 40)", 0, 32);
     106    pass();
    105107  } catch (e) {
    106108    fail(e);
     
    219221
    220222  if (unsigned) {
    221     sourceData = [0.6, 10.6];
     223    sourceData = [0.6, 10.6, 0.2, 10.2, 10.5, 11.5];
    222224    if (type === Uint8ClampedArray) {
    223       expectedResults = [1, 11];
     225      expectedResults = [1, 11, 0, 10, 10, 12];
    224226    } else {
    225       expectedResults = [0, 10];
     227      expectedResults = [0, 10, 0, 10, 10, 11];
    226228    }
    227229  } else {
     
    550552    } catch (e) {
    551553        testPassed(text + " threw an exception");
     554    }
     555}
     556
     557function shouldThrowTypeError(func, text) {
     558    var ok = false;
     559    try {
     560        func();
     561    } catch (e) {
     562        if (e instanceof TypeError) {
     563            ok = true;
     564        }
     565    }
     566    if (ok) {
     567        testPassed(text + " threw TypeError");
     568    } else {
     569        testFailed(text + " should throw TypeError");
    552570    }
    553571}
     
    902920}
    903921
     922function testInheritanceHierarchy() {
     923  debug('test inheritance hierarchy of typed array views');
     924
     925  try {
     926    var foo = ArrayBufferView;
     927    testPassed('ArrayBufferView does not have [NoInterfaceObject] extended attribute and should be defined');
     928
     929    shouldBe('new Int8Array(1) instanceof ArrayBufferView', 'true');
     930    shouldBe('new Uint8Array(1) instanceof ArrayBufferView', 'true');
     931    shouldBe('new Uint8ClampedArray(1) instanceof ArrayBufferView', 'true');
     932    shouldBe('new Int16Array(1) instanceof ArrayBufferView', 'true');
     933    shouldBe('new Uint16Array(1) instanceof ArrayBufferView', 'true');
     934    shouldBe('new Int32Array(1) instanceof ArrayBufferView', 'true');
     935    shouldBe('new Uint32Array(1) instanceof ArrayBufferView', 'true');
     936    shouldBe('new Float32Array(1) instanceof ArrayBufferView', 'true');
     937    shouldBe('new Float64Array(1) instanceof ArrayBufferView', 'true');
     938    shouldBe('new DataView(new ArrayBuffer(8)) instanceof ArrayBufferView', 'true');
     939
     940    shouldThrowTypeError(function() { new ArrayBufferView() }, "new ArrayBufferView()");
     941  } catch (e) {
     942    testFailed('ArrayBufferView does not have [NoInterfaceObject] extended attribute but was not defined');
     943  }
     944
     945  // There is currently only one kind of view that inherits from another
     946  shouldBe('new Uint8ClampedArray(1) instanceof Uint8Array', 'true');
     947}
     948
     949
    904950//
    905951// Test driver
     
    910956
    911957  testSlice();
     958  testInheritanceHierarchy();
    912959
    913960  // The "name" attribute is a concession to browsers which don't
  • trunk/Source/WebCore/ChangeLog

    r138391 r138393  
     12012-12-21  Kenneth Russell  <kbr@google.com>
     2
     3        Expose ArrayBufferView constructor on DOMWindow
     4        https://bugs.webkit.org/show_bug.cgi?id=105605
     5
     6        Reviewed by Sam Weinig.
     7
     8        Update IDL to track recent spec change exposing ArrayBufferView
     9        constructor on DOMWindow for instanceof checks. There are no
     10        constructors exposed in the Web IDL, however, so calling it via
     11        operator new throws TypeError.
     12
     13        Test (updated): fast/canvas/webgl/array-unit-tests.html
     14
     15        * html/canvas/ArrayBufferView.idl:
     16            Removed OmitConstructor attribute.
     17        * page/DOMWindow.idl:
     18            Exposed ArrayBufferView constructor function attribute.
     19
    1202012-12-21  Brady Eidson  <beidson@apple.com>
    221
  • trunk/Source/WebCore/html/canvas/ArrayBufferView.idl

    r131172 r138393  
    2626[
    2727    CustomToJSObject,
    28     JSNoStaticTables,
    29     OmitConstructor
     28    JSNoStaticTables
    3029] interface ArrayBufferView {
    3130    readonly attribute ArrayBuffer buffer;
  • trunk/Source/WebCore/page/DOMWindow.idl

    r138165 r138393  
    530530
    531531    attribute ArrayBufferConstructor ArrayBuffer; // Usable with new operator
     532    attribute ArrayBufferViewConstructor ArrayBufferView;
    532533    attribute Int8ArrayConstructor Int8Array; // Usable with new operator
    533534    attribute Uint8ArrayConstructor Uint8Array; // Usable with new operator
Note: See TracChangeset for help on using the changeset viewer.