summaryrefslogtreecommitdiffstats
path: root/dom/broadcastchannel/tests/test_broadcastchannel_self.html
blob: 32df390be1b7605c2aee2990d3b10d1a71e506e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE HTML>
<html>
<head>
  <title>Test for BroadcastChannel</title>
  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>

<div id="content"></div>

<script type="application/javascript">

function runTest() {
  x = new BroadcastChannel('foo');
  y = new BroadcastChannel('foo');

  function func(e) {
    is(e.target, y, "The target is !x");

    SimpleTest.executeSoon(function() {
      SimpleTest.finish();
    });
  }

  x.onmessage = func;
  y.onmessage = func;

  x.postMessage('foo');
}

SimpleTest.waitForExplicitFinish();
runTest();

</script>
</body>
</html>