2013-11-19 15:00:20 +04:00
|
|
|
<!--
|
|
|
|
Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/
|
|
|
|
-->
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Indexed Database Blob Worker Crash Test</title>
|
|
|
|
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
|
2017-02-23 00:10:07 +03:00
|
|
|
<script type="text/javascript">
|
2017-05-10 19:05:18 +03:00
|
|
|
/* import-globals-from helpers.js */
|
2013-11-19 15:00:20 +04:00
|
|
|
/*
|
|
|
|
* This tests ensures that if the last live reference to a Blob is on the
|
|
|
|
* worker and the database has already been shutdown, that there is no crash
|
|
|
|
* when the owning page gets cleaned up which causes the termination of the
|
|
|
|
* worker which in turn garbage collects during its shutdown.
|
|
|
|
*
|
|
|
|
* We do the IndexedDB stuff in the iframe so we can kill it as part of our
|
|
|
|
* test. Doing it out here is no good.
|
|
|
|
*/
|
|
|
|
|
2016-12-01 12:11:32 +03:00
|
|
|
function* testSteps()
|
2013-11-19 15:00:20 +04:00
|
|
|
{
|
|
|
|
info("Open iframe, wait for it to do its IndexedDB stuff.");
|
|
|
|
|
|
|
|
let iframe = document.getElementById("iframe1");
|
2017-01-17 13:50:25 +03:00
|
|
|
window.addEventListener("message", grabEventAndContinueHandler);
|
2013-11-19 15:00:20 +04:00
|
|
|
// Put it in a different origin to be safe
|
2017-05-10 19:19:34 +03:00
|
|
|
iframe.src = // "http://example.org" +
|
2013-11-19 15:00:20 +04:00
|
|
|
window.location.pathname.replace(
|
|
|
|
"test_blob_worker_crash.html",
|
|
|
|
"blob_worker_crash_iframe.html");
|
|
|
|
|
|
|
|
let event = yield unexpectedSuccessHandler;
|
|
|
|
is(event.data.result, "ready", "worker initialized correctly");
|
|
|
|
|
|
|
|
info("Trigger a GC to clean-up the iframe's main-thread IndexedDB");
|
|
|
|
scheduleGC();
|
|
|
|
yield undefined;
|
|
|
|
|
|
|
|
info("Kill the iframe, forget about it, trigger a GC.");
|
2017-01-30 10:10:22 +03:00
|
|
|
iframe.remove();
|
2013-11-19 15:00:20 +04:00
|
|
|
iframe = null;
|
|
|
|
scheduleGC();
|
|
|
|
yield undefined;
|
|
|
|
|
|
|
|
info("If we are still alive, then we win!");
|
2017-05-10 19:19:34 +03:00
|
|
|
ok("Did not crash / trigger an assert!");
|
2013-11-19 15:00:20 +04:00
|
|
|
|
|
|
|
finishTest();
|
|
|
|
}
|
|
|
|
</script>
|
2017-02-23 00:10:07 +03:00
|
|
|
<script type="text/javascript" src="helpers.js"></script>
|
2013-11-19 15:00:20 +04:00
|
|
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body onload="runTest();"></body>
|
|
|
|
<iframe id="iframe1"></iframe>
|
|
|
|
</html>
|