Hello! This is very minor and is only an issue with Show Runtime Values - Experimental checked, but I thought it would be worth reporting, mostly in case others come across it.
The conditions I've encountered may not be everything, but are fairly specific:
Show Runtime Values - Experimental is checked.
Object.defineProperty modifies a global value (e.g. Array.prototype)
defineProperty uses a getter, setter, or explicitly sets writable: false.
Any valid syntax follows the defineProperty call, even if it would throw an error.
When using defineProperty on a global like Array.prototype I encounter TypeError: Cannot redefine property: and execution stops, but only if there is code following the defineProperty call:
// Code before executes as expected and displays output
a = 2;
Object.defineProperty(Array.prototype, 'not', {
get() { return false; },
});
// TypeError: Cannot redefine property: not
// happens and execution stops if any code is after define
// with valid syntax, even if it would throw an error
b;
The error does not happen with a local variable:
const a = { is: true };
// No error when defineProperty is on a local variable
Object.defineProperty(a, 'not', {
get() { return !this.is; },
});
a.is; // true
a.not; // false
And an image demonstrating the error for completeness:
I'm not sure if this is a worth further research as it works properly when you turn off Show Runtime Values.
Thank you so much for making this amazing tool. I love it and regularly recommend it to others.
Hello! This is very minor and is only an issue with Show Runtime Values - Experimental checked, but I thought it would be worth reporting, mostly in case others come across it.
The conditions I've encountered may not be everything, but are fairly specific:
Object.defineProperty
modifies a global value (e.g. Array.prototype)defineProperty
uses a getter, setter, or explicitly setswritable: false
.defineProperty
call, even if it would throw an error.When using
defineProperty
on a global likeArray.prototype
I encounterTypeError: Cannot redefine property:
and execution stops, but only if there is code following the defineProperty call:The error does not happen with a local variable:
And an image demonstrating the error for completeness:![image](https://github.com/lukehaas/RunJS/assets/1731657/025e6f3e-f3a0-4cf0-86dc-680ceae01565)
I'm not sure if this is a worth further research as it works properly when you turn off Show Runtime Values.
Thank you so much for making this amazing tool. I love it and regularly recommend it to others.