blob: d5616375fe6321a4d55c6537a1e7083ea95c42ff [file] [log] [blame]
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="resources/shared.js"></script>
</head>
<body>
<script>
description("No crashes when there are event listeners in a worker on shutdown");
if (self.location.search == "?second") {
testPassed("Didn't crash!");
finishJSTest();
} else {
evalAndLog("workerGotBlocked = false");
evalAndLog("gotVersionChangeEvent = false");
indexedDBTest(prepareDatabase, startTheWorker);
}
function prepareDatabase()
{
debug("inside prepareDatabase");
preamble();
db = event.target.result;
db.onversionchange = onVersionChange;
}
function startTheWorker()
{
worker = startWorker("resources/pending-version-change-on-exit.js?" + encodeURIComponent(dbname));
realFinishJSTest = finishJSTest;
worker.onerror = function(e) {
testFailed(e.message);
realFinishJSTest();
};
finishJSTest = function() {
workerGotBlocked = true;
maybeReload();
}
}
function onVersionChange(e)
{
gotVersionChangeEvent = true;
maybeReload();
};
function maybeReload()
{
if (gotVersionChangeEvent && workerGotBlocked)
self.location = self.location + "?second";
};
</script>
</body>
</html>