Closed
Bug 1427058
Opened 6 years ago
Closed 6 years ago
"name" property of Proxy revocation functions set incorrectly
Categories
(Core :: JavaScript: Standard Library, defect)
Core
JavaScript: Standard Library
Tracking
()
RESOLVED
DUPLICATE
of bug 1296236
People
(Reporter: TimothyGu, Unassigned)
Details
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•6 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•