|
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 doIs(evt.data, "start", "Unexpected message"); |
|
17 $("target").focus(); |
|
18 sendString("Test"); |
|
19 var t = $("target"); |
|
20 doIs(t.value, "Test", "Typing should work"); |
|
21 (function() { |
|
22 SpecialPowers.wrap(t).QueryInterface(SpecialPowers.Ci.nsIDOMNSEditableElement).editor.undo(1); |
|
23 })() |
|
24 doIs(t.value, "", "Undo should work"); |
|
25 (function() { |
|
26 SpecialPowers.wrap(t).QueryInterface(SpecialPowers.Ci.nsIDOMNSEditableElement).editor.redo(1); |
|
27 })() |
|
28 doIs(t.value, "Test", "Redo should work"); |
|
29 window.parent.postMessage("f", "*"); |
|
30 }, |
|
31 "false"); |
|
32 |
|
33 </script> |
|
34 </head> |
|
35 <body> |
|
36 <input id="target"> |
|
37 </body> |
|
38 </html> |
|
39 |