[webkit-reviews] review granted: [Bug 205654] Make _callAsyncFunction:withArguments: work with promises : [Attachment 386888] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 6 14:57:20 PST 2020


Saam Barati <sbarati at apple.com> has granted Brady Eidson <beidson at apple.com>'s
request for review:
Bug 205654: Make _callAsyncFunction:withArguments: work with promises
https://bugs.webkit.org/show_bug.cgi?id=205654

Attachment 386888: Patch

https://bugs.webkit.org/attachment.cgi?id=386888&action=review




--- Comment #2 from Saam Barati <sbarati at apple.com> ---
Comment on attachment 386888
  --> https://bugs.webkit.org/attachment.cgi?id=386888
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=386888&action=review

r=me

> Source/WTF/wtf/SharedFunction.h:36
> +class SharedFunction<Out(In...)> : public
RefCounted<SharedFunction<Out(In...)>> {

I think instead of this we can just use SharedTask

> Source/WebCore/bindings/js/ScriptController.cpp:715
> +    auto thenIdentifier =
world.vm().propertyNames->builtinNames().thenPrivateName();

this should be: "world.vm().propertyNames->then".

A test that would catch this is using your own "thenable"

> Source/WebCore/bindings/js/ScriptController.cpp:719
> +    if (!thenFunction.isFunction(world.vm())) {

The right check here is:

CallData ignoredCallData;
if (thenFunction.isObject &&
asObject(thenFunction)->methodTable(vm)->getCallData(asObject(thenFunction),
ignoredCallData) != CallType::None)

I think a test for a callable which does not pass the isFunction() query would
be something like this with a Proxy as the "thenFunction":
let p = new Proxy(function() { 
    print("this should be called");
}, { });
let thenable = {then: p};

> Source/WebCore/bindings/js/ScriptController.cpp:740
> +    auto finalizeCount = makeUniqueWithoutFastMallocCheck<unsigned>(0);

nit: can you change makeUnique to just check if T is a primitive?

> Source/WebCore/bindings/js/ScriptController.cpp:747
> +    if (heap) {

these branches are not needed.

> Source/WebCore/bindings/js/ScriptController.cpp:754
> +    if (heap) {

ditto.

> Source/WebCore/bindings/js/ScriptController.cpp:756
> +	       finalizeGuard.get()();

instead of getting the heap pointer here, you can just do:

world.vm().heap


More information about the webkit-reviews mailing list