mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-27 19:07:31 +09:00
Prevent potential leak of IndexedDB mDatabaseActor
This commit is contained in:
parent
9c5e5745ee
commit
a583989bb4
2 changed files with 42 additions and 0 deletions
|
|
@ -254,6 +254,20 @@ class BackgroundFactoryRequestChild final
|
|||
friend class PermissionRequestParent;
|
||||
|
||||
RefPtr<IDBFactory> mFactory;
|
||||
|
||||
// Normally when opening of a database is successful, we receive a database
|
||||
// actor in request response, so we can use it to call ReleaseDOMObject()
|
||||
// which clears temporary strong reference to IDBDatabase.
|
||||
// However, when there's an error, we don't receive a database actor and
|
||||
// IDBRequest::mTransaction is already cleared (must be). So the only way how
|
||||
// to call ReleaseDOMObject() is to have a back-reference to database actor.
|
||||
// This creates a weak ref cycle between
|
||||
// BackgroundFactoryRequestChild (using mDatabaseActor member) and
|
||||
// BackgroundDatabaseChild actor (using mOpenRequestActor member).
|
||||
// mDatabaseActor is set in EnsureDOMObject() and cleared in
|
||||
// ReleaseDOMObject().
|
||||
BackgroundDatabaseChild* mDatabaseActor;
|
||||
|
||||
const uint64_t mRequestedVersion;
|
||||
const bool mIsDeleteOp;
|
||||
|
||||
|
|
@ -271,6 +285,9 @@ private:
|
|||
// Only destroyed by BackgroundFactoryChild.
|
||||
~BackgroundFactoryRequestChild();
|
||||
|
||||
void
|
||||
SetDatabaseActor(BackgroundDatabaseChild* aActor);
|
||||
|
||||
bool
|
||||
HandleResponse(nsresult aResponse);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue