| <script src='../resources/testharness.js'></script> |
| <script src='../resources/testharnessreport.js'></script> |
| const CloneArrayBuffer = internals.cloneArrayBuffer.bind(internals); |
| const typedArray = new Uint8Array([3, 5, 7]); |
| const clonedBuffer = CloneArrayBuffer(typedArray.buffer, 1, 1); |
| const otherArray = new Uint8Array(clonedBuffer); |
| assert_equals(otherArray.byteLength, 1); |
| assert_equals(otherArray.byteOffset, 0); |
| assert_equals(otherArray.buffer.byteLength, 1); |
| assert_equals(otherArray[0], 5); |
| // Check that when typedArray is modified, otherArray is not modified. |
| assert_equals(otherArray[0], 5); |
| }, "Test cloneArrayBuffer implementation"); |