test_leaving_page.html 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <!--
  2. Any copyright is dedicated to the Public Domain.
  3. http://creativecommons.org/publicdomain/zero/1.0/
  4. -->
  5. <html>
  6. <head>
  7. <title>Indexed Database Leaving Page Test</title>
  8. <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  9. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  10. </head>
  11. <body onload="runTest();">
  12. <iframe id="inner"></iframe>
  13. <a id="a" href="leaving_page_iframe.html"></a>
  14. <script type="text/javascript;version=1.7">
  15. onmessage = function(e) {
  16. ok(false, "gotmessage: " + e.data);
  17. }
  18. function testSteps()
  19. {
  20. var iframe = $("inner");
  21. iframe.src = "leaving_page_iframe.html";
  22. iframe.onload = continueToNextStep;
  23. yield undefined;
  24. is(iframe.contentWindow.location.href, $("a").href,
  25. "should navigate to iframe page");
  26. yield undefined;
  27. is(iframe.contentWindow.location.href, "about:blank",
  28. "should nagivate to about:blank");
  29. let request = indexedDB.open(location, 1);
  30. request.onsuccess = grabEventAndContinueHandler;
  31. let event = yield undefined;
  32. let db = event.target.result;
  33. db.transaction(["mystore"]).objectStore("mystore").get(42).onsuccess =
  34. grabEventAndContinueHandler;
  35. event = yield undefined;
  36. is(event.target.result.hello, "world", "second modification rolled back");
  37. finishTest();
  38. yield undefined;
  39. }
  40. </script>
  41. <script type="text/javascript;version=1.7" src="helpers.js"></script>
  42. </html>