Changeset 241722 in webkit
- Timestamp:
- Feb 18, 2019 9:30:18 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r241719 r241722 1 2019-02-18 Sihui Liu <sihui_liu@apple.com> 2 3 IndexedDB: leak IDBDatabase and IDBTransacstion in layout tests 4 https://bugs.webkit.org/show_bug.cgi?id=194709 5 6 Reviewed by Geoffrey Garen. 7 8 * storage/indexeddb/IDBObject-leak.html: Added. 9 1 10 2019-02-18 Megan Gardner <megan_gardner@apple.com> 2 11 -
trunk/Source/WebCore/ChangeLog
r241721 r241722 1 2019-02-18 Sihui Liu <sihui_liu@apple.com> 2 3 IndexedDB: leak IDBDatabase and IDBTransacstion in layout tests 4 https://bugs.webkit.org/show_bug.cgi?id=194709 5 6 Reviewed by Geoffrey Garen. 7 8 When connection to IDB server is closed, IDBTransaction would abort without notifying IDBDatabase, so 9 IDBDatabase didn't clear its reference to IDBTransaction which created a reference cycle. 10 11 Also IDBTransaction didn't clear its reference to IDBRequest in this case and it led to another reference cycle 12 between IDBOpenDBRequest and IDBTransaction. 13 14 Test: storage/indexeddb/IDBObject-leak.html 15 16 * Modules/indexeddb/IDBDatabase.cpp: 17 (WebCore::IDBDatabase::connectionToServerLost): 18 * Modules/indexeddb/IDBTransaction.cpp: 19 (WebCore::IDBTransaction::IDBTransaction): 20 (WebCore::IDBTransaction::~IDBTransaction): 21 (WebCore::IDBTransaction::finishedDispatchEventForRequest): 22 (WebCore::IDBTransaction::connectionClosedFromServer): 23 * Modules/indexeddb/IDBTransaction.h: 24 * testing/Internals.cpp: 25 (WebCore::Internals::numberOfIDBTransactions const): 26 * testing/Internals.h: 27 * testing/Internals.idl: 28 1 29 2019-02-18 Chris Fleizach <cfleizach@apple.com> 2 30 -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp
r239535 r241722 265 265 m_closedInServer = true; 266 266 267 for (auto& transaction : m_activeTransactions.values()) 267 auto transactions = copyToVector(m_activeTransactions.values()); 268 for (auto& transaction : transactions) 268 269 transaction->connectionClosedFromServer(error); 269 270 -
trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp
r240658 r241722 80 80 81 81 { 82 auto addResult = allIDBTransactions().add(this); 83 ASSERT_UNUSED(addResult, addResult.isNewEntry); 84 82 85 LOG(IndexedDB, "IDBTransaction::IDBTransaction - %s", m_info.loggingString().utf8().data()); 83 86 ASSERT(&m_database->originThread() == &Thread::current()); … … 107 110 { 108 111 ASSERT(&m_database->originThread() == &Thread::current()); 112 ASSERT(allIDBTransactions().contains(this)); 113 allIDBTransactions().remove(this); 114 } 115 116 HashSet<IDBTransaction*>& IDBTransaction::allIDBTransactions() 117 { 118 static NeverDestroyed<HashSet<IDBTransaction*>> transactions; 119 return transactions; 109 120 } 110 121 … … 1435 1446 LOG(IndexedDB, "IDBTransaction::connectionClosedFromServer - %s", error.message().utf8().data()); 1436 1447 1437 m_state = IndexedDB::TransactionState::Aborting; 1448 m_database->willAbortTransaction(*this); 1449 transitionedToFinishing(IndexedDB::TransactionState::Aborting); 1438 1450 1439 1451 abortInProgressOperations(error); … … 1446 1458 operation->doComplete(IDBResultData::error(operation->identifier(), error)); 1447 1459 } 1460 m_currentlyCompletingRequest = nullptr; 1448 1461 1449 1462 connectionProxy().forgetActiveOperations(operations); … … 1455 1468 m_idbError = error; 1456 1469 m_domError = error.toDOMException(); 1470 m_database->didAbortTransaction(*this); 1457 1471 fireOnAbort(); 1458 1472 } -
trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h
r240658 r241722 153 153 void visitReferencedObjectStores(JSC::SlotVisitor&) const; 154 154 155 WEBCORE_EXPORT static HashSet<IDBTransaction*>& allIDBTransactions(); 156 155 157 private: 156 158 IDBTransaction(IDBDatabase&, const IDBTransactionInfo&, IDBOpenDBRequest*); -
trunk/Source/WebCore/testing/Internals.cpp
r241480 r241722 94 94 #include "HistoryItem.h" 95 95 #include "HitTestResult.h" 96 #include "IDBRequest.h" 97 #include "IDBTransaction.h" 96 98 #include "InspectorClient.h" 97 99 #include "InspectorController.h" … … 2384 2386 } 2385 2387 2388 unsigned Internals::numberOfIDBTransactions() const 2389 { 2390 return IDBTransaction::allIDBTransactions().size(); 2391 } 2392 2386 2393 unsigned Internals::numberOfLiveNodes() const 2387 2394 { -
trunk/Source/WebCore/testing/Internals.h
r241480 r241722 379 379 ExceptionOr<void> insertUserCSS(const String&) const; 380 380 381 unsigned numberOfIDBTransactions() const; 382 381 383 unsigned numberOfLiveNodes() const; 382 384 unsigned numberOfLiveDocuments() const; -
trunk/Source/WebCore/testing/Internals.idl
r241480 r241722 406 406 void endSimulatedMemoryPressure(); 407 407 408 unsigned long numberOfIDBTransactions(); 409 408 410 unsigned long numberOfLiveNodes(); 409 411 unsigned long numberOfLiveDocuments();
Note: See TracChangeset
for help on using the changeset viewer.