Changeset 207347 in webkit


Ignore:
Timestamp:
Oct 14, 2016 11:14:03 AM (8 years ago)
Author:
commit-queue@webkit.org
Message:

test262: @isConstructor incorrectly thinks Math.cos is a constructor
https://bugs.webkit.org/show_bug.cgi?id=163437

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2016-10-14
Reviewed by Saam Barati.

JSTests:

  • stress/is-constructor.js: Added.

(assert):
(prototype.assert):
New test to cover the @isConstructor builtin.

  • test262.yaml:

Test now passes.

Source/JavaScriptCore:

  • runtime/JSFunction.cpp:

(JSC::JSFunction::getConstructData):
By default, Host JSFunctions are not constructable. They get
the default callHostFunctionAsConstructor native constructor.
When getting construct data we can return ConstructType::None
in these cases instead of indicating it might be constructable
and later throwing an exception when construction is attempted.

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r207344 r207347  
     12016-10-14  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        test262: @isConstructor incorrectly thinks Math.cos is a constructor
     4        https://bugs.webkit.org/show_bug.cgi?id=163437
     5
     6        Reviewed by Saam Barati.
     7
     8        * stress/is-constructor.js: Added.
     9        (assert):
     10        (prototype.assert):
     11        New test to cover the @isConstructor builtin.
     12
     13        * test262.yaml:
     14        Test now passes.
     15
    1162016-10-14  Ryan Haddad  <ryanhaddad@apple.com>
    217
  • trunk/JSTests/test262.yaml

    r207334 r207347  
    30553055  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    30563056- path: test262/test/built-ins/Array/of/return-a-new-array-object.js
    3057   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
     3057  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
    30583058- path: test262/test/built-ins/Array/of/return-a-new-array-object.js
    3059   cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
     3059  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
    30603060- path: test262/test/built-ins/Array/of/return-abrupt-from-contructor.js
    30613061  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
  • trunk/Source/JavaScriptCore/ChangeLog

    r207344 r207347  
     12016-10-14  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        test262: @isConstructor incorrectly thinks Math.cos is a constructor
     4        https://bugs.webkit.org/show_bug.cgi?id=163437
     5
     6        Reviewed by Saam Barati.
     7
     8        * runtime/JSFunction.cpp:
     9        (JSC::JSFunction::getConstructData):
     10        By default, Host JSFunctions are not constructable. They get
     11        the default callHostFunctionAsConstructor native constructor.
     12        When getting construct data we can return ConstructType::None
     13        in these cases instead of indicating it might be constructable
     14        and later throwing an exception when construction is attempted.
     15
    1162016-10-14  Ryan Haddad  <ryanhaddad@apple.com>
    217
  • trunk/Source/JavaScriptCore/runtime/JSFunction.cpp

    r207023 r207347  
    574574
    575575    if (thisObject->isHostFunction()) {
     576        if (thisObject->nativeConstructor() == callHostFunctionAsConstructor)
     577            return ConstructType::None;
    576578        constructData.native.function = thisObject->nativeConstructor();
    577579        return ConstructType::Host;
Note: See TracChangeset for help on using the changeset viewer.