Changeset 161789 in webkit


Ignore:
Timestamp:
Jan 11, 2014 6:51:19 PM (10 years ago)
Author:
Brent Fulgham
Message:

[JSC] Revise typed array implementations to match ECMAScript and WebGL Specification
https://bugs.webkit.org/show_bug.cgi?id=126754

Patch by Dean Jackson <dino@apple.com> on 2014-01-11
Reviewed by Filip Pizlo.

Source/JavaScriptCore:

The ECMAScript specification forbids calling the typed array
constructors without using "new". Change the call data to return
none so we throw and exception in these cases.

  • runtime/JSGenericTypedArrayViewConstructorInlines.h:

(JSC::JSGenericTypedArrayViewConstructor<ViewClass>::getCallData):

LayoutTests:

New test which checks that we throw an exception when calling
any of the typed array constructors without using "new".

  • js/script-tests/typedarray-constructors.js: Added.
  • js/typedarray-constructors-expected.txt: Added.
  • js/typedarray-constructors.html: Added.
  • resources/standalone-pre.js: Add missing 'shouldNotThrow'

method (duplicated from resources/js-test-pre.js)

Location:
trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r161722 r161789  
     12014-01-11  Dean Jackson  <dino@apple.com>
     2
     3        [JSC] Revise typed array implementations to match ECMAScript and WebGL Specification
     4        https://bugs.webkit.org/show_bug.cgi?id=126754
     5
     6        Reviewed by Filip Pizlo.
     7
     8        New test which checks that we throw an exception when calling
     9        any of the typed array constructors without using "new".
     10
     11        * js/script-tests/typedarray-constructors.js: Added.
     12        * js/typedarray-constructors-expected.txt: Added.
     13        * js/typedarray-constructors.html: Added.
     14        * resources/standalone-pre.js: Add missing 'shouldNotThrow'
     15        method (duplicated from resources/js-test-pre.js)
     16
    1172014-01-10  Commit Queue  <commit-queue@webkit.org>
    218
  • trunk/LayoutTests/fast/canvas/webgl/data-view-test-expected.txt

    r154132 r161789  
    55
    66Test for constructor not called as a function
    7 FAIL DataView(new ArrayBuffer) does not throw exception
     7PASS DataView(new ArrayBuffer) threw exception
    88
    99Test for constructor taking 1 argument
  • trunk/LayoutTests/resources/standalone-pre.js

    r155250 r161789  
    207207}
    208208
     209function shouldNotThrow(_a) {
     210    try {
     211        eval(_a);
     212        testPassed(_a + " did not throw exception.");
     213    } catch (e) {
     214        testFailed(_a + " should not throw exception. Threw exception " + e + ".");
     215    }
     216}
    209217
    210218function shouldThrow(_a, _e)
  • trunk/Source/JavaScriptCore/ChangeLog

    r161788 r161789  
     12014-01-11  Dean Jackson  <dino@apple.com>
     2
     3        [JSC] Revise typed array implementations to match ECMAScript and WebGL Specification
     4        https://bugs.webkit.org/show_bug.cgi?id=126754
     5
     6        Reviewed by Filip Pizlo.
     7
     8        The ECMAScript specification forbids calling the typed array
     9        constructors without using "new". Change the call data to return
     10        none so we throw and exception in these cases.
     11
     12        * runtime/JSGenericTypedArrayViewConstructorInlines.h:
     13        (JSC::JSGenericTypedArrayViewConstructor<ViewClass>::getCallData):
     14
    1152014-01-11  Anders Carlsson  <andersca@apple.com>
    216
  • trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h

    r161722 r161789  
    158158{
    159159    callData.native.function = constructGenericTypedArrayView<ViewClass>;
    160     return CallTypeHost;
     160    return CallTypeNone;
    161161}
    162162
Note: See TracChangeset for help on using the changeset viewer.