dom/indexedDB/test/test_leaving_page.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/indexedDB/test/test_leaving_page.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,56 @@
     1.4 +<!--
     1.5 +  Any copyright is dedicated to the Public Domain.
     1.6 +  http://creativecommons.org/publicdomain/zero/1.0/
     1.7 +-->
     1.8 +<html>
     1.9 +<head>
    1.10 +  <title>Indexed Database Leaving Page Test</title>
    1.11 +
    1.12 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +</head>
    1.15 +
    1.16 +<body onload="runTest();">
    1.17 +  <iframe id="inner"></iframe>
    1.18 +  <a id="a" href="leaving_page_iframe.html"></a>
    1.19 +
    1.20 +  <script type="text/javascript;version=1.7">
    1.21 +    if (!SpecialPowers.isMainProcess()) {
    1.22 +      window.runTest = function() {
    1.23 +        todo(false, "Figure out this test for child processes!");
    1.24 +        finishTest();
    1.25 +      }
    1.26 +    }
    1.27 +
    1.28 +    onmessage = function(e) {
    1.29 +      ok(false, "gotmessage: " + e.data);
    1.30 +    }
    1.31 +
    1.32 +    function testSteps()
    1.33 +    {
    1.34 +      var iframe = $("inner");
    1.35 +      iframe.src = "leaving_page_iframe.html";
    1.36 +      iframe.onload = continueToNextStep;
    1.37 +      yield undefined;
    1.38 +      is(iframe.contentWindow.location.href, $("a").href,
    1.39 +         "should navigate to iframe page");
    1.40 +      yield undefined;
    1.41 +      is(iframe.contentWindow.location.href, "about:blank",
    1.42 +         "should nagivate to about:blank");
    1.43 +         
    1.44 +      let request = indexedDB.open(location, 1);
    1.45 +      request.onsuccess = grabEventAndContinueHandler;
    1.46 +      let event = yield undefined;
    1.47 +
    1.48 +      let db = event.target.result;
    1.49 +      db.transaction(["mystore"]).objectStore("mystore").get(42).onsuccess =
    1.50 +        grabEventAndContinueHandler;
    1.51 +      event = yield undefined;
    1.52 +      is(event.target.result.hello, "world", "second modification rolled back");
    1.53 +
    1.54 +      finishTest();
    1.55 +      yield undefined;
    1.56 +    }
    1.57 +  </script>
    1.58 +  <script type="text/javascript;version=1.7" src="helpers.js"></script>
    1.59 +</html>

mercurial