[Webkit-unassigned] [Bug 205654] Make _callAsyncFunction:withArguments: work with promises

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


https://bugs.webkit.org/show_bug.cgi?id=205654

Saam Barati <sbarati at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #386888|review?                     |review+
              Flags|                            |

--- 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

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200106/18ab24b0/attachment.htm>


More information about the webkit-unassigned mailing list