Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix to be compat with the JS override mistake
JavaScript has a misfeature often called the "override mistake". In an assignment such as ```js res.constructor = true; ``` if `res` does not yet have its own `constructor` property, but inherits one that this assignment would override (as is the intention here), but the property that would be overridden is a non-writable data property, then the assignment fails. Hardened JS and similar frameworks for securing JS routinely freeze all the primordial objects, which causes their data properties to become non-configurable, non-writable. Also, the TC53 JS standard for embedded devices standardizes on Hardened JS, which will also cause this problem. The XS JS engine for embedded devices use the Hardened JS configuration by default on embedded devices. Object literals and classes override inherited properties without problem because they use JS's "define" semantics rather than JS's peculiar "assign" semantics. You can also do so manually via `Object.defineProperty`, as this PR does to repair this issue. See also tapjs#70 Agoric/agoric-sdk#6451
- Loading branch information