mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 795203 - B2g: clear private data: cookies. r=mconnor,jduell
This commit is contained in:
parent
bdbebf04d9
commit
a54c38a647
@ -257,7 +257,7 @@ nsLayoutStatics::Initialize()
|
||||
InitProcessPriorityManager();
|
||||
|
||||
nsPermissionManager::AppUninstallObserverInit();
|
||||
nsCookieService::AppUninstallObserverInit();
|
||||
nsCookieService::AppClearDataObserverInit();
|
||||
nsApplicationCacheService::AppClearDataObserverInit();
|
||||
|
||||
nsDOMStorageBaseDB::Init();
|
||||
|
@ -545,7 +545,7 @@ NS_IMPL_ISUPPORTS1(CloseCookieDBListener, mozIStorageCompletionCallback)
|
||||
|
||||
namespace {
|
||||
|
||||
class AppUninstallObserver MOZ_FINAL : public nsIObserver {
|
||||
class AppClearDataObserver MOZ_FINAL : public nsIObserver {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
@ -553,24 +553,22 @@ public:
|
||||
NS_IMETHODIMP
|
||||
Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *data)
|
||||
{
|
||||
MOZ_ASSERT(!nsCRT::strcmp(aTopic, "webapps-uninstall"));
|
||||
MOZ_ASSERT(!nsCRT::strcmp(aTopic, TOPIC_WEB_APP_CLEAR_DATA));
|
||||
|
||||
nsCOMPtr<nsIAppsService> appsService = do_GetService("@mozilla.org/AppsService;1");
|
||||
nsCOMPtr<mozIApplication> app;
|
||||
uint32_t appId = NECKO_UNKNOWN_APP_ID;
|
||||
bool browserOnly = false;
|
||||
nsresult rv = NS_GetAppInfoFromClearDataNotification(aSubject, &appId,
|
||||
&browserOnly);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
appsService->GetAppFromObserverMessage(nsAutoString(data), getter_AddRefs(app));
|
||||
NS_ENSURE_TRUE(app, NS_ERROR_UNEXPECTED);
|
||||
|
||||
uint32_t appId;
|
||||
app->GetLocalId(&appId);
|
||||
MOZ_ASSERT(appId != NECKO_NO_APP_ID);
|
||||
|
||||
nsCOMPtr<nsICookieManager2> cookieManager = do_GetService(NS_COOKIEMANAGER_CONTRACTID);
|
||||
return cookieManager->RemoveCookiesForApp(appId, false);
|
||||
nsCOMPtr<nsICookieManager2> cookieManager
|
||||
= do_GetService(NS_COOKIEMANAGER_CONTRACTID);
|
||||
MOZ_ASSERT(cookieManager);
|
||||
return cookieManager->RemoveCookiesForApp(appId, browserOnly);
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(AppUninstallObserver, nsIObserver)
|
||||
NS_IMPL_ISUPPORTS1(AppClearDataObserver, nsIObserver)
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
@ -616,10 +614,12 @@ nsCookieService::GetSingleton()
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsCookieService::AppUninstallObserverInit()
|
||||
nsCookieService::AppClearDataObserverInit()
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1");
|
||||
observerService->AddObserver(new AppUninstallObserver(), "webapps-uninstall", /* holdsWeak= */ false);
|
||||
nsCOMPtr<AppClearDataObserver> obs = new AppClearDataObserver();
|
||||
observerService->AddObserver(obs, TOPIC_WEB_APP_CLEAR_DATA,
|
||||
/* holdsWeak= */ false);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -245,7 +245,7 @@ class nsCookieService : public nsICookieService
|
||||
* (thus instantiating it, if necessary) and clear all the cookies for that
|
||||
* app.
|
||||
*/
|
||||
static void AppUninstallObserverInit();
|
||||
static void AppClearDataObserverInit();
|
||||
|
||||
protected:
|
||||
void PrefChanged(nsIPrefBranch *aPrefBranch);
|
||||
|
Loading…
Reference in New Issue
Block a user