Revision control

1
2
<!DOCTYPE html>
3
<script src='../resources/testharness.js'></script>
4
<script src='../resources/testharnessreport.js'></script>
5
<script>
6
'use strict';
7
8
const CloneArrayBuffer = internals.cloneArrayBuffer.bind(internals);
9
10
test(function() {
11
const typedArray = new Uint8Array([3, 5, 7]);
12
const clonedBuffer = CloneArrayBuffer(typedArray.buffer, 1, 1);
13
const otherArray = new Uint8Array(clonedBuffer);
14
assert_equals(otherArray.byteLength, 1);
15
assert_equals(otherArray.byteOffset, 0);
16
assert_equals(otherArray.buffer.byteLength, 1);
17
assert_equals(otherArray[0], 5);
18
// Check that when typedArray is modified, otherArray is not modified.
19
typedArray[1] = 0;
20
assert_equals(otherArray[0], 5);
21
}, "Test cloneArrayBuffer implementation");
22
</script>