blob: b06603521a9dc2d4c9f92314e512733d086acf3d [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<script>
description("Checks that window.postMessage clones SharedArrayBuffers");
jsTestIsAsync = true;
var sab = new SharedArrayBuffer(4);
var memory = new Int32Array(sab);
var otherMemory;
window.addEventListener("message", function (event) {
otherMemory = event.data;
memory[0] = 42;
shouldBe("memory[0]", "42");
shouldBe("otherMemory[0]", "0");
otherMemory[0] = 43;
shouldBe("memory[0]", "42");
shouldBe("otherMemory[0]", "43");
finishJSTest();
});
window.postMessage(memory, "*");
</script>
</body>
</html>