On Wed Oct 16 15:31:44 2024 +0000, Jacek Caban wrote:
For ES5, the JS global object is "window", so any properties redefined on window will impact all the JS globals since it's the same object. This isn't just a matter of the window object "shadowing" the JS global object; deleting a JS global prop from window also deletes it from the JS global object.
Isn't support for deleting JS global objects a matter of implementing `dispex_static_data_vtbl_t`'s `delete` for `GLOBAL_SCRIPTVAR` properties?
How would you delete something that's not on the window itself? I mean if you delete a GLOBAL_SCRIPTVAR, it will just get re-created when accessed, so it still "exists" (since it's just a reference to the one in the js global). Well, unless we add a new type like GLOBAL_DELETED to override it.
By the way, the current approach with find_dispid doesn't work with getOwnPropertyNames (not just in window and document, but also in stuff like prototypes and constructors and wherever else it is used). If they haven't been looked up yet, they aren't created, and thus won't be enumerated. I think it's easier to make them closer to actual js objects and avoid corner cases like this since the jscript code will handle it normally.