Bug 1524200 - Add more debugging message to Sanitizer.jsm, r=mak
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 01 Apr 2019 13:46:56 +0000
changeset 467041 a1d82278bf83c250901f7b29b2adbabffa86714b
parent 467040 468f0646a149f56c779d2cadde819130135f985b
child 467042 ec0b9bfa65646a96e0b3a7da3eb8dd9ce81ef085
push id35795
push usercsabou@mozilla.com
push dateMon, 01 Apr 2019 21:54:51 +0000
treeherdermozilla-central@5a85cf971fef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1524200
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1524200 - Add more debugging message to Sanitizer.jsm, r=mak Differential Revision: https://phabricator.services.mozilla.com/D25289
browser/modules/Sanitizer.jsm
--- a/browser/modules/Sanitizer.jsm
+++ b/browser/modules/Sanitizer.jsm
@@ -673,17 +673,16 @@ async function sanitizeInternal(items, a
 class PrincipalsCollector {
   constructor() {
     this.principals = null;
   }
 
   async getAllPrincipals(progress) {
     if (this.principals == null) {
       // Here is the list of principals with site data.
-      progress.advancement = "get-principals";
       this.principals = await this.getAllPrincipalsInternal(progress);
     }
 
     return this.principals;
   }
 
   async getAllPrincipalsInternal(progress) {
     progress.step = "principals-quota-manager";
@@ -779,16 +778,18 @@ async function sanitizeOnShutdown(progre
   // the logic below currently does!
   if (Services.prefs.getIntPref(PREF_COOKIE_LIFETIME,
                                 Ci.nsICookieService.ACCEPT_NORMALLY) == Ci.nsICookieService.ACCEPT_SESSION) {
     log("Session-only configuration detected");
     progress.advancement = "session-only";
 
     let principals = await principalsCollector.getAllPrincipals(progress);
     await maybeSanitizeSessionPrincipals(progress, principals);
+
+    progress.advancement = "done";
     return;
   }
 
   progress.advancement = "session-permission";
 
   // Let's see if we have to forget some particular site.
   for (let permission of Services.perms.enumerator) {
     if (permission.type != "cookie" ||
@@ -845,17 +846,18 @@ async function maybeSanitizeSessionPrinc
     progress.step = "principal-checked:" + cookieAllowed;
 
     if (!cookieAllowed) {
       promises.push(sanitizeSessionPrincipal(progress, principal));
     }
   });
 
   progress.step = "promises:" + promises.length;
-  return Promise.all(promises);
+  await Promise.all(promises);
+  progress.step = "promises resolved";
 }
 
 function cookiesAllowedForDomainOrSubDomain(principal) {
   log("Checking principal: " + principal.URI.spec);
 
   // If we have the 'cookie' permission for this principal, let's return
   // immediately.
   let p = Services.perms.testPermissionFromPrincipal(principal, "cookie");
@@ -896,24 +898,24 @@ function cookiesAllowedForDomainOrSubDom
 
   log("Cookie not allowed.");
   return false;
 }
 
 async function sanitizeSessionPrincipal(progress, principal) {
   log("Sanitizing principal: " + principal.URI.spec);
 
-  progress.step = "sanitizing";
   await new Promise(resolve => {
+    progress.sanitizePrincipal = "started";
     Services.clearData.deleteDataFromPrincipal(principal, true /* user request */,
                                                Ci.nsIClearDataService.CLEAR_DOM_STORAGES |
                                                Ci.nsIClearDataService.CLEAR_COOKIES,
                                                resolve);
   });
-  progress.step = "sanitized";
+  progress.sanitizePrincipal = "completed";
 }
 
 function sanitizeNewTabSegregation() {
   let identity = ContextualIdentityService.getPrivateIdentity("userContextIdInternal.thumbnail");
   if (identity) {
     Services.clearData.deleteDataFromOriginAttributesPattern({ userContextId: identity.userContextId });
   }
 }