Closed EricTherrien closed 1 year ago
Hi Eric,
This appears to be a scope issue or something to do with the Object.defineProperty method implementation. If you call Object,keys(obj) in a scope you can see it still only returns the "a" property. I've also confirmed the same result in background script. I don't think there is anything I can do here so will close this issue.
Thanks, James
If it may be useful to anyone, I found a way to bypass the issue of properties defined by Object.defineProperty not being displayed in Xplore.
var obj = { "a" : "A" };
obj[ "b" ] = "not my b";
Object.defineProperty( obj, "b", { get: function() { return "B"; } } );
obj;
Doing obj[ "b" ] = "not my b" sort of "force' the definition of "b" so that Xplore know about "b" and display it with the value define in the getter. In my case, I do it prior to Object.defineProperty.
Hi James,
Take this example:
When you run it in Global, you get the expected result, i.e. the "a" and "b" property get displayed in the Output tab.
When you run it in a scope, you only get the "a" property displayed in the Output tab, the "b" property created using Object.defineProperty does not get displayed. The property exist, you can display it's value, but only if you ask for it specifically (i.e. end with obj.b).