| <!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> |