- From: Michael[tm] Smith <web-platform-tests-notifications@w3.org>
- Date: Thu, 20 Oct 2016 12:57:00 GMT
- To: public-web-platform-tests-notifications@w3.org
> > I cannot get the BroadcastChannel tests to work in Chrome or Firefox---they timeout instead > You need to have at least two `BroadcastChannel` objects I think. Ideally in separate globals. The following works (though not sure it’s the best way to do it…) ```diff diff --git a/webmessaging/MessageEvent-trusted.html b/webmessaging/MessageEvent-trusted.html index e3d26f8..502cd51 100644 --- a/webmessaging/MessageEvent-trusted.html +++ b/webmessaging/MessageEvent-trusted.html @@ -1,3 +1,8 @@ +<!-- +const channel = new BroadcastChannel("name"); +channel.postMessage("ping"); +/* +--> <!DOCTYPE html> <title>MessagePort message events are trusted</title> <script src="/resources/testharness.js"></script> @@ -26,13 +31,13 @@ async_test(t => { async_test(t => { assert_true("BroadcastChannel" in self, "The browser must support BroadcastChannel"); + const worker = new Worker("#"); const channel = new BroadcastChannel("name"); channel.onmessage = t.step_func_done(e => { assert_equals(e.isTrusted, true); }); - channel.postMessage("ping"); }, "With a BroadcastChannel"); async_test(t => { @@ -43,3 +48,6 @@ async_test(t => { window.postMessage("ping", "*"); }, "With window"); </script> +<!-- +*/ +--> ``` (btw would be nice if we could just use template literals in WPT tests but I’m told we shouldn’t yet) View on GitHub: https://github.com/w3c/web-platform-tests/pull/4025#issuecomment-255098010
Received on Thursday, 20 October 2016 12:57:07 UTC