Ignore:
Timestamp:
Feb 22, 2016, 2:24:51 PM (10 years ago)
Author:
[email protected]
Message:

JSValue::isConstructor and JSValue::isFunction should check getConstructData and getCallData
https://bugs.webkit.org/show_bug.cgi?id=154552

Reviewed by Mark Lam.

ES6 Proxy breaks our isFunction() and isConstructor() JSValue methods.
They return false on a Proxy with internal Call and Construct
properties. It seems safest, most forward looking, and most adherent
to the specification to check getCallData() and getConstructData() to
implement these functions.

  • runtime/InternalFunction.cpp:

(JSC::InternalFunction::createSubclassStructure):

  • runtime/JSCJSValueInlines.h:

(JSC::JSValue::isFunction):
(JSC::JSValue::isConstructor):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/InternalFunction.cpp

    r194863 r196959  
    8585    // We allow newTarget == JSValue() because the API needs to be able to create classes without having a real JS frame.
    8686    // Since we don't allow subclassing in the API we just treat newTarget == JSValue() as newTarget == exec->callee()
    87     ASSERT(!newTarget || newTarget.isFunction());
     87    ASSERT(!newTarget || newTarget.isConstructor());
    8888
    8989    if (newTarget && newTarget != exec->callee()) {
Note: See TracChangeset for help on using the changeset viewer.