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: IDBDatabase and IDBTransaction are leaked 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::connectionClosedFromServer): * Modules/indexeddb/IDBTransaction.h: * testing/Internals.cpp: (WebCore::Internals::numberOfIDBTransactions const): * testing/Internals.h: * testing/Internals.idl: LayoutTests: * TestExpectations: * platform/wk2/TestExpectations: * storage/indexeddb/IDBObject-leak-expected.txt: Added. * storage/indexeddb/IDBObject-leak.html: Added. Canonical link: https://commits.webkit.org/209367@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242043 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
12 changed files
with
115 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
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,10 @@ | ||
This test verifies that IDBTransaction objects are freed. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS internals.numberOfIDBTransactions() is 0 | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
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,40 @@ | ||
<!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 (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.terminateNetworkProcess) { | ||
testFailed('This test requires access to the TestRunner object and terminateNetworkProcess() function'); | ||
finishJSTest(); | ||
return; | ||
} | ||
testRunner.terminateNetworkProcess(); | ||
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