Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
IndexedDB: leak IDBDatabase and IDBTransacstion in layout tests
https://bugs.webkit.org/show_bug.cgi?id=194709 Reviewed by Geoffrey Garen. Source/WebCore: When connection to IDB server is closed, IDBTransaction would abort without notifying IDBDatabase, so IDBDatabase didn't clear its reference to IDBTransaction which created a reference cycle. Also IDBTransaction didn't clear its reference to IDBRequest in this case and it led to another reference cycle between IDBOpenDBRequest and IDBTransaction. Test: storage/indexeddb/IDBObject-leak.html * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::connectionToServerLost): * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::IDBTransaction): (WebCore::IDBTransaction::~IDBTransaction): (WebCore::IDBTransaction::finishedDispatchEventForRequest): (WebCore::IDBTransaction::connectionClosedFromServer): * Modules/indexeddb/IDBTransaction.h: * testing/Internals.cpp: (WebCore::Internals::numberOfIDBTransactions const): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * storage/indexeddb/IDBObject-leak.html: Added. Canonical link: https://commits.webkit.org/209157@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241722 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
9 changed files
with
105 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,38 @@ | ||
<!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.'); | ||
|
||
function test() { | ||
if (!window.internals || !internals.numberOfIDBTransactions) { | ||
testFailed('This test requires access to the Internals object'); | ||
finishJSTest(); | ||
return; | ||
} | ||
|
||
if (sessionStorage.doneFirstLoad) { | ||
gc(); | ||
shouldBeEqualToNumber("internals.numberOfIDBTransactions()", 0); | ||
finishJSTest(); | ||
return; | ||
} | ||
|
||
var dbname = setDBNameFromPath() + Date(); | ||
var request = window.indexedDB.open(dbname); | ||
request.onupgradeneeded = function(evt) { | ||
sessionStorage.doneFirstLoad = true; | ||
if (window.testRunner) { | ||
testRunner.waitUntilDone(); | ||
testRunner.terminateNetworkProcess(); | ||
} else { | ||
testFailed('This test requires access to the TestRunner object'); | ||
} | ||
setTimeout((()=> { | ||
location.reload(); | ||
}), 0); | ||
} | ||
} | ||
|
||
test(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters