Phabricator will be unavailable due to database maintenance from 14:00 UTC until 18:00 UTC on Saturday, October 13, 2018.
Bugzilla will remain up during this time. All users have been logged out of Bugzilla

"name" property of Proxy revocation functions set incorrectly

RESOLVED DUPLICATE of bug 1296236

Status

()

RESOLVED DUPLICATE of bug 1296236
10 months ago
9 months ago

People

(Reporter: timothygu99, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

10 months ago
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36

Steps to reproduce:

Object.getOwnPropertyDescriptor(Proxy.revocable({}, {}).revoke, 'name');


Actual results:

({value:"revoke", writable:false, enumerable:false, configurable:true})


Expected results:

undefined

----

Per [1], Proxy revocation functions are anonymous functions, which should not have a "name" property in accordance with [2]. Other anonymous functions in SpiderMonkey all do not have "name" properties:

- Promise resolve/reject functions
  new Promise((resolve, reject) => { print(resolve.name); print(reject.name); });

- GetCapabilitiesExecutor functions
  class PromiseSub extends Promise { constructor(executor) { print(executor.name); super(executor); } } PromiseSub.resolve();

- Promise.all resolve element functions
  class PromiseSub extends Promise { then(onResolve, onReject) { print(onResolve.name); super.then(onResolve, onReject); } } PromiseSub.all([PromiseSub.resolve()]);

The cause for this bug seems to be https://searchfox.org/mozilla-central/rev/7c67b86074cbc1b63c8beccfb06d2ab9295140b8/js/src/proxy/ScriptedProxyHandler.cpp#1412, where the "name" property of the function is explicitly set to |cx->names().revoke|. Compare that with e.g. Promise resolve/reject functions (https://searchfox.org/mozilla-central/rev/7c67b86074cbc1b63c8beccfb06d2ab9295140b8/js/src/builtin/Promise.cpp#480), which use |cx->names().empty| as the name.

V8 has the same bug as SpiderMonkey (https://crbug.com/v8/7245), but ChakraCore does not. I do not have a Mac so I cannot test what JSC does at the moment.

[1]: https://tc39.github.io/ecma262/#sec-proxy-revocation-functions
[2]: https://tc39.github.io/ecma262/#sec-ecmascript-standard-built-in-objects

Updated

9 months ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 9 months ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1296236
You need to log in before you can comment on or make changes to this bug.