chromium/third_party/blink/web_tests/storage/indexeddb/pending-version-change-on-exit.html

<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>