mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 870460 - Part 2: Close syncconn for edge cases. r=nwgh
--HG-- extra : source : b0ddf460db0712431c4bfd8d6590eb69a23ecf4e
This commit is contained in:
parent
51ac771e2d
commit
68d3cbb372
@ -458,8 +458,9 @@ function* run_test_5(generator)
|
||||
do_check_eq(do_count_cookies(), 0);
|
||||
|
||||
// Close the profile. We do not need to wait for completion, because the
|
||||
// database has already been closed.
|
||||
do_close_profile();
|
||||
// database has already been closed. Ensure the cookie file is unlocked.
|
||||
do_close_profile(sub_generator);
|
||||
yield;
|
||||
|
||||
// Clean up.
|
||||
do_get_cookie_file(profile).remove(false);
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "mozilla/storage.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/FileUtils.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "nsIConsoleService.h"
|
||||
#include "nsVariant.h"
|
||||
@ -894,6 +895,10 @@ nsCookieService::TryInitDB(bool aRecreateDB)
|
||||
NS_ENSURE_SUCCESS(rv, RESULT_RETRY);
|
||||
}
|
||||
|
||||
auto guard = MakeScopeExit([&] {
|
||||
mDefaultDBState->syncConn = nullptr;
|
||||
});
|
||||
|
||||
bool tableExists = false;
|
||||
mDefaultDBState->syncConn->TableExists(NS_LITERAL_CSTRING("moz_cookies"),
|
||||
&tableExists);
|
||||
@ -1747,7 +1752,6 @@ nsCookieService::CleanupDefaultDBConnection()
|
||||
// asynchronous operations yet, this will synchronously close it; otherwise,
|
||||
// it's expected that the caller has performed an AsyncClose prior.
|
||||
mDefaultDBState->dbConn = nullptr;
|
||||
mDefaultDBState->syncConn = nullptr;
|
||||
|
||||
// Manually null out our listeners. This is necessary because they hold a
|
||||
// strong ref to the DBState itself. They'll stay alive until whatever
|
||||
@ -2840,8 +2844,6 @@ nsCookieService::Read()
|
||||
tuple->cookie = GetCookieFromRow(stmt, attrs);
|
||||
}
|
||||
|
||||
mDefaultDBState->syncConn = nullptr;
|
||||
|
||||
COOKIE_LOGSTRING(LogLevel::Debug, ("Read(): %zu cookies read", mReadArray.Length()));
|
||||
|
||||
return RESULT_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user