OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Flags: --allow-natives-syntax |
| 6 var buffer = new ArrayBuffer(0x100); |
| 7 var array = new Uint8Array(buffer).fill(55); |
| 8 var tmp = {}; |
| 9 tmp[Symbol.toPrimitive] = function () { |
| 10 %ArrayBufferNeuter(array.buffer) |
| 11 return 0; |
| 12 }; |
| 13 |
| 14 |
| 15 assertEquals(-1, Array.prototype.indexOf.call(array, 0x00, tmp)); |
| 16 |
| 17 buffer = new ArrayBuffer(0x100); |
| 18 array = new Uint8Array(buffer).fill(55); |
| 19 tmp = {}; |
| 20 tmp[Symbol.toPrimitive] = function () { |
| 21 %ArrayBufferNeuter(array.buffer) |
| 22 return 0; |
| 23 }; |
| 24 |
| 25 |
| 26 assertEquals(false, Array.prototype.includes.call(array, 0x00, tmp)); |
| 27 |
| 28 buffer = new ArrayBuffer(0x100); |
| 29 array = new Uint8Array(buffer).fill(55); |
| 30 tmp = {}; |
| 31 tmp[Symbol.toPrimitive] = function () { |
| 32 %ArrayBufferNeuter(array.buffer) |
| 33 return 0; |
| 34 }; |
| 35 assertEquals(true, Array.prototype.includes.call(array, undefined, tmp)); |
OLD | NEW |