|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <head> |
|
4 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
|
5 <script> |
|
6 function doIs(arg1, arg2, arg3) { |
|
7 window.parent.postMessage("t " + encodeURIComponent(arg1) + " " + |
|
8 encodeURIComponent(arg2) + " " + |
|
9 encodeURIComponent(arg3), "*"); |
|
10 } |
|
11 |
|
12 function $(arg) { return document.getElementById(arg); } |
|
13 |
|
14 window.addEventListener("message", |
|
15 function(evt) { |
|
16 var t = $("target"); |
|
17 if (evt.data == "start") { |
|
18 doIs(t.value, "Test", "Shouldn't have lost our initial value"); |
|
19 t.focus(); |
|
20 sendString("Foo"); |
|
21 doIs(t.value, "FooTest", "Typing should work"); |
|
22 window.parent.postMessage("c", "*"); |
|
23 } else { |
|
24 doIs(evt.data, "continue", "Unexpected message"); |
|
25 doIs(t.value, "FooTest", "Shouldn't have lost our typed value"); |
|
26 sendString("Bar"); |
|
27 doIs(t.value, "BarFooTest", "Typing should still work"); |
|
28 window.parent.postMessage("f", "*"); |
|
29 } |
|
30 }, |
|
31 "false"); |
|
32 |
|
33 </script> |
|
34 </head> |
|
35 <body> |
|
36 <input id="target" value="Test"> |
|
37 </body> |
|
38 </html> |
|
39 |