ajvincent / es-membrane

An ECMAScript implementation of a Membrane, allowing users to dynamically hide, override, or extend objects in JavaScript with controlled effects on the original objects.
ISC License
109 stars 13 forks source link

Array.prototype.splice.apply(wrappedArray, ...) throws in setting wrappedArray.length #176

Closed ajvincent closed 6 years ago

ajvincent commented 6 years ago
      Array.prototype.splice.apply(parts.dry.array, [
        1, 1, parts.dry.delta, parts.dry.epsilon
      ]);

TypeError: proxy set handler returned false for property '"length"' in file:///home/ajvincent/verbosio/es-membrane/spec/containers/Array/tc39.js (line 205)

Digging deeper, I found ObjectGraphHandler.prototype.defineProperty receives configurable: true in the descriptor to set for "length", but the existing property descriptor says configurable is false. This forces defineProperty to return false, so the set trap also returns false, which causes the TypeError.