Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/wasm/wasm_remote_postMessage_test.html

Issue 2847063002: [wasm] Ensure postMessage doesn't work cross process. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/wasm/wasm_remote_postMessage_test.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/wasm/wasm_remote_postMessage_test.html b/third_party/WebKit/LayoutTests/http/tests/wasm/wasm_remote_postMessage_test.html
new file mode 100644
index 0000000000000000000000000000000000000000..5733f9ddad4e0fa1d6160762fad4722b2b32d6a8
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/wasm/wasm_remote_postMessage_test.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../resources/get-host-info.js"></script>
+<script src="resources/load_wasm.js"></script>
+<script>
+ if (window.location.origin != get_host_info().HTTPS_REMOTE_ORIGIN) {
jochen (gone - plz use gerrit) 2017/05/02 09:15:12 just name the file wasm_remote_postMessge_test.htt
+ window.location = get_host_info().HTTPS_REMOTE_ORIGIN + window.location.pathname;
+ } else {
+ promise_test(async function() {
+ var remote_loc = get_host_info().AUTHENTICATED_ORIGIN + "/wasm/resources/remote_frame.html";
+ var mod = await createWasmModule();
+ assert_true(mod instanceof WebAssembly.Module);
+ var remote;
+ await new Promise((resolve, reject) => {
+ var i = setInterval(()=>{
+ try {
+ remote.document;
+ } catch(e) {
+ clearInterval(i);
+ resolve();
+ }
+ }, 100);
+ remote = window.open("about:blank");
+ remote.opener = null;
+ remote.location = remote_loc;
+ });
+ var ans = await new Promise((resolve, reject) => {
+ remote.postMessage(mod, '*');
+ window.addEventListener("message",
+ function f(reply) {
+ resolve(reply.data);
+ window.removeEventListener("message", f);
+ }, false);
+ });
+ assert_equals(ans, "didn't make it");
+
+ ans = await new Promise((resolve, reject) => {
+ remote.postMessage("hi!", '*');
+ window.addEventListener("message", (reply) => resolve(reply.data), false);
+ });
+ assert_equals(ans, "hi!");
+ }, "cannot send wasm module to remote iframe");
+ }
+</script>

Powered by Google App Engine
This is Rietveld 408576698