IndexedDB: IDBDatabase and IDBTransaction are leaked in layout tests
authorsihui_liu@apple.com <sihui_liu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Feb 2019 16:50:20 +0000 (16:50 +0000)
committersihui_liu@apple.com <sihui_liu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Feb 2019 16:50:20 +0000 (16:50 +0000)
commitd47be744d7b9857dd1bf3a9af12c4912c29badbc
tree68c1d452d04a00cb7d8fa9496daeb5e0800b0026
parenteb7de026ca410e2f0a77a5911a688c27a1340c8b
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242043 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/platform/wk2/TestExpectations
LayoutTests/storage/indexeddb/IDBObject-leak-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/IDBObject-leak.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBDatabase.cpp
Source/WebCore/Modules/indexeddb/IDBTransaction.cpp
Source/WebCore/Modules/indexeddb/IDBTransaction.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl