RESOLVED FIXED 205983
Object.keys should throw if called on module namespace object with uninitialized binding
https://bugs.webkit.org/show_bug.cgi?id=205983
Summary Object.keys should throw if called on module namespace object with uninitiali...
Alexey Shvayka
Reported 2020-01-08 19:48:56 PST
ECMA262: call stack is quite deep, please see "info" meta of the test ↓ Test262: https://test262.report/browse/language/module-code/namespace/internals/object-keys-binding-uninit.js
Attachments
Patch (4.68 KB, patch)
2020-01-08 21:15 PST, Alexey Shvayka
no flags
Patch (4.76 KB, patch)
2020-01-10 15:18 PST, Alexey Shvayka
no flags
Alexey Shvayka
Comment 1 2020-01-08 21:15:27 PST
Alexey Shvayka
Comment 2 2020-01-08 21:25:15 PST
(In reply to Alexey Shvayka from comment #1) > Created attachment 387186 [details] > Patch All credit goes to Caitlin Potter: this patch was nicely extracted from her solution to https://bugs.webkit.org/show_bug.cgi?id=189034.
Ross Kirsling
Comment 3 2020-01-09 09:58:16 PST
Comment on attachment 387186 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=387186&action=review > Source/JavaScriptCore/ChangeLog:1 > +2020-01-08 Caitlin Potter <caitp@igalia.com> I recently learned (from r253987) that it's valid to insert two authors separated by "and" here -- might make sense in a case like this? > Source/JavaScriptCore/ChangeLog:10 > + If [[OwnPropertyKeys]] method of module namespace object is called by > + Object.keys or for/in loop, it should invoke [[GetOwnProperty]] on > + every binding so a ReferenceError is thrown if the binding is uninitialized. Wait, is [[OwnPropertyKeys]] directly relevant? It doesn't throw. Seems like [[GetOwnProperty]] is called from EnumerableOwnPropertyNames *after* [[OwnPropertyKeys]], no? https://tc39.es/ecma262/#sec-enumerableownpropertynames
Alexey Shvayka
Comment 4 2020-01-10 15:18:09 PST
Created attachment 387383 [details] Patch Add myself as co-author and fix method name in ChangeLog.
Alexey Shvayka
Comment 5 2020-01-10 15:31:37 PST
(In reply to Ross Kirsling from comment #3) > > I recently learned (from r253987) that it's valid to insert two authors > separated by "and" here -- might make sense in a case like this? Thank you for the tip. I think it makes sense to add myself there for bookkeeping purposes or so I could be contacted regarding the change. > Seems like [[GetOwnProperty]] is called from EnumerableOwnPropertyNames > *after* [[OwnPropertyKeys]], no? > https://tc39.es/ecma262/#sec-enumerableownpropertynames Nice catch! Indeed, throwing occurs after [[OwnPropertyKeys]]. I've replaced [[OwnPropertyKeys]] with JSModuleNamespaceObject::getOwnPropertyNames.
Yusuke Suzuki
Comment 6 2020-01-10 15:31:54 PST
Comment on attachment 387383 [details] Patch r=me
Yusuke Suzuki
Comment 7 2020-01-10 15:32:53 PST
(In reply to Yusuke Suzuki from comment #6) > Comment on attachment 387383 [details] > Patch > > r=me Land it after resolving Ross's comment :)
Ross Kirsling
Comment 8 2020-01-10 15:35:08 PST
Comment on attachment 387383 [details] Patch Alexey's comment came after his new patch, so it should be okay :D
WebKit Commit Bot
Comment 9 2020-01-10 19:18:06 PST
Comment on attachment 387383 [details] Patch Clearing flags on attachment: 387383 Committed r254390: <https://trac.webkit.org/changeset/254390>
WebKit Commit Bot
Comment 10 2020-01-10 19:18:08 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 11 2020-01-10 19:19:16 PST
Note You need to log in before you can comment on or make changes to this bug.