blob: 93f68c617be18c8c7ad0a669851bf1528db21bc7 [file] [log] [blame]
<!-- webkit-test-runner [ useEphemeralSession=true ] -->
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="resources/shared.js"></script>
</head>
<body>
<script>
if (window.internals)
window.internals.settings.setIndexedDBWorkersEnabled(true);
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>