blob: 6aa8ab6103823b7c97bfa77ef556d819c9aaa0cc [file] [log] [blame]
<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>
<script src="resources/shared.js"></script>
<script>
description('This test verifies that IDBTransaction objects are freed.');
jsTestIsAsync = true;
function test() {
if (!window.internals || !internals.numberOfIDBTransactions) {
testFailed('This test requires access to the Internals object');
finishJSTest();
return;
}
if (localStorage.doneFirstLoad) {
gc();
shouldBeEqualToNumber("internals.numberOfIDBTransactions()", 0);
finishJSTest();
return;
}
var dbname = setDBNameFromPath() + Date();
var request = window.indexedDB.open(dbname);
request.onupgradeneeded = function(evt) {
localStorage.doneFirstLoad = true;
if (!window.testRunner || !testRunner.terminateNetworkProcess) {
testFailed('This test requires access to the TestRunner object and terminateNetworkProcess() function');
finishJSTest();
return;
}
// Make sure localStorage is flushed to disk before crashing network process.
testRunner.syncLocalStorage();
testRunner.terminateNetworkProcess();
evt.target.result.onerror = function(e) {
setTimeout((()=> {
location.reload();
}), 0);
}
}
}
test();
</script>