1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/forms/test/bug287446_subframe.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,39 @@ 1.4 +<!DOCTYPE html> 1.5 +<html> 1.6 + <head> 1.7 + <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> 1.8 + <script> 1.9 + function doIs(arg1, arg2, arg3) { 1.10 + window.parent.postMessage("t " + encodeURIComponent(arg1) + " " + 1.11 + encodeURIComponent(arg2) + " " + 1.12 + encodeURIComponent(arg3), "*"); 1.13 + } 1.14 + 1.15 + function $(arg) { return document.getElementById(arg); } 1.16 + 1.17 + window.addEventListener("message", 1.18 + function(evt) { 1.19 + var t = $("target"); 1.20 + if (evt.data == "start") { 1.21 + doIs(t.value, "Test", "Shouldn't have lost our initial value"); 1.22 + t.focus(); 1.23 + sendString("Foo"); 1.24 + doIs(t.value, "FooTest", "Typing should work"); 1.25 + window.parent.postMessage("c", "*"); 1.26 + } else { 1.27 + doIs(evt.data, "continue", "Unexpected message"); 1.28 + doIs(t.value, "FooTest", "Shouldn't have lost our typed value"); 1.29 + sendString("Bar"); 1.30 + doIs(t.value, "BarFooTest", "Typing should still work"); 1.31 + window.parent.postMessage("f", "*"); 1.32 + } 1.33 + }, 1.34 + "false"); 1.35 + 1.36 + </script> 1.37 + </head> 1.38 + <body> 1.39 + <input id="target" value="Test"> 1.40 + </body> 1.41 +</html> 1.42 +