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