test_blob_worker_crash.html (1934B)
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 src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 12 <script type="text/javascript"> 13 /* import-globals-from helpers.js */ 14 /* 15 * This tests ensures that if the last live reference to a Blob is on the 16 * worker and the database has already been shutdown, that there is no crash 17 * when the owning page gets cleaned up which causes the termination of the 18 * worker which in turn garbage collects during its shutdown. 19 * 20 * We do the IndexedDB stuff in the iframe so we can kill it as part of our 21 * test. Doing it out here is no good. 22 */ 23 24 function* testSteps() 25 { 26 info("Open iframe, wait for it to do its IndexedDB stuff."); 27 28 let iframe = document.getElementById("iframe1"); 29 window.addEventListener("message", grabEventAndContinueHandler); 30 // Put it in a different origin to be safe 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.remove(); 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 } 54 </script> 55 <script type="text/javascript" src="helpers.js"></script> 56 57 </head> 58 59 <body onload="runTest();"></body> 60 <iframe id="iframe1"></iframe> 61 </html>