1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/indexedDB/test/test_blob_worker_crash.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,62 @@ 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 Blob Worker Crash 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 + 1.15 + <script type="text/javascript;version=1.7"> 1.16 + /* 1.17 + * This tests ensures that if the last live reference to a Blob is on the 1.18 + * worker and the database has already been shutdown, that there is no crash 1.19 + * when the owning page gets cleaned up which causes the termination of the 1.20 + * worker which in turn garbage collects during its shutdown. 1.21 + * 1.22 + * We do the IndexedDB stuff in the iframe so we can kill it as part of our 1.23 + * test. Doing it out here is no good. 1.24 + */ 1.25 + 1.26 + function testSteps() 1.27 + { 1.28 + info("Open iframe, wait for it to do its IndexedDB stuff."); 1.29 + 1.30 + let iframe = document.getElementById("iframe1"); 1.31 + window.addEventListener("message", grabEventAndContinueHandler, false); 1.32 + // Put it in a different origin to be safe 1.33 + //allowUnlimitedQuota("http://example.org/"); 1.34 + iframe.src = //"http://example.org" + 1.35 + window.location.pathname.replace( 1.36 + "test_blob_worker_crash.html", 1.37 + "blob_worker_crash_iframe.html"); 1.38 + 1.39 + let event = yield unexpectedSuccessHandler; 1.40 + is(event.data.result, "ready", "worker initialized correctly"); 1.41 + 1.42 + info("Trigger a GC to clean-up the iframe's main-thread IndexedDB"); 1.43 + scheduleGC(); 1.44 + yield undefined; 1.45 + 1.46 + info("Kill the iframe, forget about it, trigger a GC."); 1.47 + iframe.parentNode.removeChild(iframe); 1.48 + iframe = null; 1.49 + scheduleGC(); 1.50 + yield undefined; 1.51 + 1.52 + info("If we are still alive, then we win!"); 1.53 + ok('Did not crash / trigger an assert!'); 1.54 + 1.55 + finishTest(); 1.56 + yield undefined; 1.57 + } 1.58 + </script> 1.59 + <script type="text/javascript;version=1.7" src="helpers.js"></script> 1.60 + 1.61 +</head> 1.62 + 1.63 +<body onload="runTest();"></body> 1.64 + <iframe id="iframe1"></iframe> 1.65 +</html>