diff --git a/dom/apps/src/Webapps.jsm b/dom/apps/src/Webapps.jsm index d7fad34c91b..89ca64c4e77 100644 --- a/dom/apps/src/Webapps.jsm +++ b/dom/apps/src/Webapps.jsm @@ -314,7 +314,7 @@ this.DOMApplicationRegistry = { let localId = this.webapps[id].localId; let permMgr = Cc["@mozilla.org/permissionmanager;1"] .getService(Ci.nsIPermissionManager); - permMgr.RemovePermissionsForApp(localId, false); + permMgr.RemovePermissionsForApp(localId); Services.cookies.removeCookiesForApp(localId, false); this._clearPrivateData(localId, false); } diff --git a/extensions/cookie/nsPermissionManager.cpp b/extensions/cookie/nsPermissionManager.cpp index b2971d44377..72de9c382db 100644 --- a/extensions/cookie/nsPermissionManager.cpp +++ b/extensions/cookie/nsPermissionManager.cpp @@ -126,7 +126,7 @@ GetHostForPrincipal(nsIPrincipal* aPrincipal, nsACString& aHost) return NS_OK; } -class AppClearDataObserver MOZ_FINAL : public nsIObserver { +class AppUninstallObserver MOZ_FINAL : public nsIObserver { public: NS_DECL_ISUPPORTS @@ -134,29 +134,24 @@ public: NS_IMETHODIMP Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *data) { - MOZ_ASSERT(!nsCRT::strcmp(aTopic, "webapps-clear-data")); + MOZ_ASSERT(!nsCRT::strcmp(aTopic, "webapps-uninstall")); - nsCOMPtr params = - do_QueryInterface(aSubject); - if (!params) { - NS_ERROR("'webapps-clear-data' notification's subject should be a mozIApplicationClearPrivateDataParams"); - return NS_ERROR_UNEXPECTED; - } + nsCOMPtr appsService = do_GetService("@mozilla.org/AppsService;1"); + nsCOMPtr app; + + appsService->GetAppFromObserverMessage(nsAutoString(data), getter_AddRefs(app)); + NS_ENSURE_TRUE(app, NS_ERROR_UNEXPECTED); uint32_t appId; - nsresult rv = params->GetAppId(&appId); - NS_ENSURE_SUCCESS(rv, rv); - - bool browserOnly; - rv = params->GetBrowserOnly(&browserOnly); - NS_ENSURE_SUCCESS(rv, rv); + app->GetLocalId(&appId); + MOZ_ASSERT(appId != nsIScriptSecurityManager::NO_APP_ID); nsCOMPtr permManager = do_GetService("@mozilla.org/permissionmanager;1"); - return permManager->RemovePermissionsForApp(appId, browserOnly); + return permManager->RemovePermissionsForApp(appId); } }; -NS_IMPL_ISUPPORTS1(AppClearDataObserver, nsIObserver) +NS_IMPL_ISUPPORTS1(AppUninstallObserver, nsIObserver) } // anonymous namespace @@ -276,10 +271,10 @@ NS_IMETHODIMP DeleteFromMozHostListener::HandleCompletion(uint16_t aReason) } /* static */ void -nsPermissionManager::AppClearDataObserverInit() +nsPermissionManager::AppUninstallObserverInit() { nsCOMPtr observerService = do_GetService("@mozilla.org/observer-service;1"); - observerService->AddObserver(new AppClearDataObserver(), "webapps-clear-data", /* holdsWeak= */ false); + observerService->AddObserver(new AppUninstallObserver(), "webapps-uninstall", /* holdsWeak= */ false); } //////////////////////////////////////////////////////////////////////////////// @@ -1167,7 +1162,7 @@ nsPermissionManager::GetPermissionsForApp(nsPermissionManager::PermissionHashKey } NS_IMETHODIMP -nsPermissionManager::RemovePermissionsForApp(uint32_t aAppId, bool aBrowserOnly) +nsPermissionManager::RemovePermissionsForApp(uint32_t aAppId) { ENSURE_NOT_CHILD_PROCESS; NS_ENSURE_ARG(aAppId != nsIScriptSecurityManager::NO_APP_ID); @@ -1184,10 +1179,6 @@ nsPermissionManager::RemovePermissionsForApp(uint32_t aAppId, bool aBrowserOnly) sql.AppendLiteral("DELETE FROM moz_hosts WHERE appId="); sql.AppendInt(aAppId); - if (aBrowserOnly) { - sql.AppendLiteral(" AND isInBrowserElement=1"); - } - nsCOMPtr removeStmt; nsresult rv = mDBConn->CreateAsyncStatement(sql, getter_AddRefs(removeStmt)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/extensions/cookie/nsPermissionManager.h b/extensions/cookie/nsPermissionManager.h index 3a68c4a005b..f5bdcedae7e 100644 --- a/extensions/cookie/nsPermissionManager.h +++ b/extensions/cookie/nsPermissionManager.h @@ -202,7 +202,7 @@ public: * That way, we can prevent have nsPermissionManager created at startup just * to be able to clear data when an application is uninstalled. */ - static void AppClearDataObserverInit(); + static void AppUninstallObserverInit(); private: int32_t GetTypeIndex(const char *aTypeString, diff --git a/extensions/cookie/test/Makefile.in b/extensions/cookie/test/Makefile.in index 8d0eca8e25f..9b86a0c8e06 100644 --- a/extensions/cookie/test/Makefile.in +++ b/extensions/cookie/test/Makefile.in @@ -54,10 +54,8 @@ MOCHITEST_FILES = \ MOCHITEST_CHROME_FILES = \ test_permissionmanager_app_isolation.html \ - test_app_cleardata_permissions.html \ test_app_uninstall_permissions.html \ test_app_uninstall_cookies.html \ - frame_clear_browser_data.html \ channel_utils.js \ $(NULL) diff --git a/extensions/cookie/test/frame_clear_browser_data.html b/extensions/cookie/test/frame_clear_browser_data.html deleted file mode 100644 index 9d06e24e894..00000000000 --- a/extensions/cookie/test/frame_clear_browser_data.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - diff --git a/extensions/cookie/test/test_app_cleardata_permissions.html b/extensions/cookie/test/test_app_cleardata_permissions.html deleted file mode 100644 index 3388b291740..00000000000 --- a/extensions/cookie/test/test_app_cleardata_permissions.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - Tests that clearing mozbrowser private data removes the onlyInBrowser permissions - - - - -

-
- -
-
-
-
- - diff --git a/layout/build/nsLayoutStatics.cpp b/layout/build/nsLayoutStatics.cpp index 4ffe9757694..8b384a2366a 100644 --- a/layout/build/nsLayoutStatics.cpp +++ b/layout/build/nsLayoutStatics.cpp @@ -265,7 +265,7 @@ nsLayoutStatics::Initialize() InitProcessPriorityManager(); - nsPermissionManager::AppClearDataObserverInit(); + nsPermissionManager::AppUninstallObserverInit(); nsCookieService::AppClearDataObserverInit(); nsApplicationCacheService::AppClearDataObserverInit(); diff --git a/netwerk/base/public/nsIPermissionManager.idl b/netwerk/base/public/nsIPermissionManager.idl index db285c2c42c..fea60aa1232 100644 --- a/netwerk/base/public/nsIPermissionManager.idl +++ b/netwerk/base/public/nsIPermissionManager.idl @@ -36,7 +36,7 @@ interface nsIObserver; interface nsIPrincipal; interface nsIDOMWindow; -[scriptable, uuid(9b6ffbb9-5536-4216-afcf-1b7cd7b54005)] +[scriptable, uuid(6c68cd87-4569-4695-8bc8-ad609f624b96)] interface nsIPermissionManager : nsISupports { /** @@ -192,12 +192,8 @@ interface nsIPermissionManager : nsISupports /** * Remove all permissions associated with a given app id. - * @param aAppId The appId of the app - * @param aBrowserOnly Whether we should remove permissions associated with - * a browser element (true) or all permissions (false). */ - void removePermissionsForApp(in unsigned long appId, - in boolean browserOnly); + void removePermissionsForApp(in unsigned long appId); }; %{ C++ diff --git a/netwerk/test/unit/test_auth_jar.js b/netwerk/test/unit/test_auth_jar.js index a8276b064ec..c91251ad490 100644 --- a/netwerk/test/unit/test_auth_jar.js +++ b/netwerk/test/unit/test_auth_jar.js @@ -10,9 +10,6 @@ function createURI(s) { } function run_test() { - // Set up a profile. - do_get_profile(); - var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager); const kURI1 = "http://example.com"; var app1 = secMan.getAppCodebasePrincipal(createURI(kURI1), 1, false); @@ -52,4 +49,4 @@ function run_test() { do_check_eq(domain.value, "example.com"); do_check_eq(user.value, "user2"); do_check_eq(pass.value, "pass2"); -} +} \ No newline at end of file diff --git a/netwerk/test/unit/test_cache_jar.js b/netwerk/test/unit/test_cache_jar.js index fdd3d7df12c..fc2b88b8346 100644 --- a/netwerk/test/unit/test_cache_jar.js +++ b/netwerk/test/unit/test_cache_jar.js @@ -84,7 +84,6 @@ function run_all_tests() { let gTests; function run_test() { - do_get_profile(); do_test_pending(); httpserv = new HttpServer(); httpserv.registerPathHandler("/cached", cached_handler); @@ -106,4 +105,4 @@ function doneSecondLoad(req, buffer, expected) { } catch (x) { do_test_finished(); } -} +} \ No newline at end of file