runtime - class inheritance pattern not compatible with frozen intrinsics
kumavis opened this issue · 1 comments
it is becoming increasingly common to freeze javascript intrinsics (Object, Array...) (see nodejs, endo/ses, xs)
while this is generally not an issue for packages that do not extend intrinsics, there are a few unfortunate side effects due to javascript's "override mistake", namely obj.constructor = ...
fails due to the inherited property "constructor" being read-only on Object.prototype
here is the inheritance pattern at fault
regenerator/packages/regenerator-runtime/runtime.js
Lines 105 to 106 in 0c2aba1
here is a compatible inheritance pattern
https://github.com/isaacs/inherits/blob/9a2c29400c6d491e0b7beefe0c32efa3b462545d/inherits_browser.js#L6-L13
alternatively you can just use defineProperty instead of assignment
reproduction steps:
Object.freeze(Object.prototype)
require('./runtime.js')