Ignore:
Timestamp:
Aug 27, 2020, 9:41:27 AM (5 years ago)
Author:
[email protected]
Message:

JSClassRef should work with JS class syntax.
https://bugs.webkit.org/show_bug.cgi?id=215047

Reviewed by Darin Adler.

This is done by checking if value returned by the
callAsConstructor parameter to JSObjectMakeConstructor returns an
object allocated as the jsClass parameter. When that happens we
replace the prototype of the returned object with the prototype of
the new.target. Ideally we would have passed the derived classes
constructor from the beginning of our support for JS subclassing
but at this point that's probably not compatible with too many
applications.

  • API/APICallbackFunction.h:

(JSC::APICallbackFunction::construct):

  • API/JSObjectRef.h:
  • API/tests/testapi.cpp:

(APIString::APIString):
(TestAPI::markedJSValueArrayAndGC):
(TestAPI::classDefinitionWithJSSubclass):
(testCAPIViaCpp):

  • API/tests/testapi.mm:

(testObjectiveCAPI):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r266223 r266236  
     12020-08-27  Keith Miller  <[email protected]>
     2
     3        JSClassRef should work with JS class syntax.
     4        https://bugs.webkit.org/show_bug.cgi?id=215047
     5
     6        Reviewed by Darin Adler.
     7
     8        This is done by checking if value returned by the
     9        callAsConstructor parameter to JSObjectMakeConstructor returns an
     10        object allocated as the jsClass parameter. When that happens we
     11        replace the prototype of the returned object with the prototype of
     12        the new.target. Ideally we would have passed the derived classes
     13        constructor from the beginning of our support for JS subclassing
     14        but at this point that's probably not compatible with too many
     15        applications.
     16
     17        * API/APICallbackFunction.h:
     18        (JSC::APICallbackFunction::construct):
     19        * API/JSObjectRef.h:
     20        * API/tests/testapi.cpp:
     21        (APIString::APIString):
     22        (TestAPI::markedJSValueArrayAndGC):
     23        (TestAPI::classDefinitionWithJSSubclass):
     24        (testCAPIViaCpp):
     25        * API/tests/testapi.mm:
     26        (testObjectiveCAPI):
     27
    1282020-08-26  Alexey Shvayka  <[email protected]>
    229
Note: See TracChangeset for help on using the changeset viewer.