dom/indexedDB/test/test_leaving_page.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial