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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/webmessaging/support/ChildWindowPostMessage.htm

Issue 2558423002: Import wpt/webmessaging tests (Closed)
Patch Set: rebase again Created 3 years, 11 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title> Child window for Web Messaging tests </title>
5 </head>
6 <body>
7 <script>
8 if (window.opener)
9 {
10 window.onload = function()
11 {
12 try
13 {
14 window.opener.postMessage("MSG_ONLOAD_FIRED", "*");
15 }
16 catch(ex)
17 {
18 window.close();
19 }
20 }
21 }
22
23 window.onmessage = function(e)
24 {
25 try
26 {
27 if (typeof(e.data) == "object" && typeof(e.data.test) == "string ")
28 {
29 eval(e.data.test);
30 }
31 else if (e.data == "*" || e.data == "/")
32 {
33 e.source.postMessage(e.data, e.data);
34 }
35 else
36 {
37 e.source.postMessage(e.data, e.origin);
38 }
39
40 if (e.data == "ports")
41 {
42 var total = e.ports.length;
43 for (var i=0; i<total; i++)
44 {
45 e.ports[i].onmessage = function (evt)
46 {
47 evt.target.postMessage(evt.data);
48 }
49 }
50 }
51 }
52 catch(ex)
53 {
54 }
55 }
56 </script>
57 </body>
58 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698