| class A extends Array { } |
| Object.defineProperty(Array, Symbol.species, { value: A, configurable: true }); |
| result = foo.concat([1]); |
| if (!(result instanceof A)) |
| if (!(result instanceof A)) |
| if (!(result instanceof A)) |
| Object.defineProperty(Array, Symbol.species, { value: Int32Array, configurable: true }); |
| // We can't write to the length property on a typed array by default. |
| Object.defineProperty(Int32Array.prototype, "length", { value: 0, writable: true }); |
| function shouldThrow(f, m) { |
| if (err.toString() !== m) |
| throw new Error("Wrong error: " + err); |
| const message = "TypeError: Attempting to configure non-configurable property on a typed array at index: 0"; |
| shouldThrow(() => foo.concat([1]), message); |
| shouldThrow(() => foo.slice(0), message); |
| if (!(r instanceof Int32Array)) |
| shouldThrow(() => foo.splice(0), message); |
| for (let i = 0; i < 3000; ++i) |