bug 1441131 - TRR: proxy storage removal to the mainthread r?valentin
MozReview-Commit-ID: K4Ar0RbSRzS
--- a/netwerk/dns/TRRService.cpp
+++ b/netwerk/dns/TRRService.cpp
@@ -406,18 +406,29 @@ TRRService::IsTRRBlacklisted(const nsACS
nsresult code;
int32_t until = val.ToInteger(&code) + mTRRBlacklistExpireTime;
int32_t expire = NowInSeconds();
if (NS_SUCCEEDED(code) && (until > expire)) {
LOG(("Host [%s] is TRR blacklisted\n", nsCString(aHost).get()));
return true;
} else {
// the blacklisted entry has expired
- mTRRBLStorage->Remove(hashkey, privateBrowsing ?
- DataStorage_Private : DataStorage_Persistent);
+ RefPtr<DataStorage> storage = mTRRBLStorage;
+ nsCOMPtr<nsIRunnable> runnable =
+ NS_NewRunnableFunction("proxyStorageRemove",
+ [storage, hashkey, privateBrowsing]() {
+ storage->Remove(hashkey, privateBrowsing ?
+ DataStorage_Private :
+ DataStorage_Persistent);
+ });
+ if (!NS_IsMainThread()) {
+ NS_DispatchToMainThread(runnable);
+ } else {
+ runnable->Run();
+ }
}
}
return false;
}
class ProxyBlacklist : public Runnable
{
public: