|
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 Blob Worker Crash 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 |
|
12 <script type="text/javascript;version=1.7"> |
|
13 /* |
|
14 * This tests ensures that if the last live reference to a Blob is on the |
|
15 * worker and the database has already been shutdown, that there is no crash |
|
16 * when the owning page gets cleaned up which causes the termination of the |
|
17 * worker which in turn garbage collects during its shutdown. |
|
18 * |
|
19 * We do the IndexedDB stuff in the iframe so we can kill it as part of our |
|
20 * test. Doing it out here is no good. |
|
21 */ |
|
22 |
|
23 function testSteps() |
|
24 { |
|
25 info("Open iframe, wait for it to do its IndexedDB stuff."); |
|
26 |
|
27 let iframe = document.getElementById("iframe1"); |
|
28 window.addEventListener("message", grabEventAndContinueHandler, false); |
|
29 // Put it in a different origin to be safe |
|
30 //allowUnlimitedQuota("http://example.org/"); |
|
31 iframe.src = //"http://example.org" + |
|
32 window.location.pathname.replace( |
|
33 "test_blob_worker_crash.html", |
|
34 "blob_worker_crash_iframe.html"); |
|
35 |
|
36 let event = yield unexpectedSuccessHandler; |
|
37 is(event.data.result, "ready", "worker initialized correctly"); |
|
38 |
|
39 info("Trigger a GC to clean-up the iframe's main-thread IndexedDB"); |
|
40 scheduleGC(); |
|
41 yield undefined; |
|
42 |
|
43 info("Kill the iframe, forget about it, trigger a GC."); |
|
44 iframe.parentNode.removeChild(iframe); |
|
45 iframe = null; |
|
46 scheduleGC(); |
|
47 yield undefined; |
|
48 |
|
49 info("If we are still alive, then we win!"); |
|
50 ok('Did not crash / trigger an assert!'); |
|
51 |
|
52 finishTest(); |
|
53 yield undefined; |
|
54 } |
|
55 </script> |
|
56 <script type="text/javascript;version=1.7" src="helpers.js"></script> |
|
57 |
|
58 </head> |
|
59 |
|
60 <body onload="runTest();"></body> |
|
61 <iframe id="iframe1"></iframe> |
|
62 </html> |