bug287446_subframe.html 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. function $(arg) { return document.getElementById(arg); }
  12. window.addEventListener("message",
  13. function(evt) {
  14. var t = $("target");
  15. if (evt.data == "start") {
  16. doIs(t.value, "Test", "Shouldn't have lost our initial value");
  17. t.focus();
  18. sendString("Foo");
  19. doIs(t.value, "FooTest", "Typing should work");
  20. window.parent.postMessage("c", "*");
  21. } else {
  22. doIs(evt.data, "continue", "Unexpected message");
  23. doIs(t.value, "FooTest", "Shouldn't have lost our typed value");
  24. sendString("Bar");
  25. doIs(t.value, "FooBarTest", "Typing should still work");
  26. window.parent.postMessage("f", "*");
  27. }
  28. },
  29. "false");
  30. </script>
  31. </head>
  32. <body>
  33. <input id="target" value="Test">
  34. </body>
  35. </html>