mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1173573 - Fix possible crash initializing sessionstorage. r=honzab
This commit is contained in:
parent
785d7bcf18
commit
c32149f142
@ -771,8 +771,11 @@ DOMStorageCache::StartDatabase()
|
||||
|
||||
sDatabase = db.forget();
|
||||
} else {
|
||||
// Use DOMLocalStorageManager::Ensure in case we're called from
|
||||
// DOMSessionStorageManager's initializer and we haven't yet initialized the
|
||||
// local storage manager.
|
||||
nsRefPtr<DOMStorageDBChild> db = new DOMStorageDBChild(
|
||||
DOMLocalStorageManager::Self());
|
||||
DOMLocalStorageManager::Ensure());
|
||||
|
||||
nsresult rv = db->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -628,6 +628,21 @@ DOMLocalStorageManager::~DOMLocalStorageManager()
|
||||
sSelf = nullptr;
|
||||
}
|
||||
|
||||
DOMLocalStorageManager*
|
||||
DOMLocalStorageManager::Ensure()
|
||||
{
|
||||
if (sSelf) {
|
||||
return sSelf;
|
||||
}
|
||||
|
||||
// Cause sSelf to be populated.
|
||||
nsCOMPtr<nsIDOMStorageManager> initializer =
|
||||
do_GetService("@mozilla.org/dom/localStorage-manager;1");
|
||||
MOZ_ASSERT(sSelf, "Didn't initialize?");
|
||||
|
||||
return sSelf;
|
||||
}
|
||||
|
||||
// DOMSessionStorageManager
|
||||
|
||||
DOMSessionStorageManager::DOMSessionStorageManager()
|
||||
|
@ -126,6 +126,9 @@ public:
|
||||
// Global getter of localStorage manager service
|
||||
static DOMLocalStorageManager* Self() { return sSelf; }
|
||||
|
||||
// Like Self, but creates an instance if we're not yet initialized.
|
||||
static DOMLocalStorageManager* Ensure();
|
||||
|
||||
private:
|
||||
static DOMLocalStorageManager* sSelf;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user