Bug 1251368 - add originAttributes to cookie remove call r=Ratty
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Thu, 07 Apr 2016 03:06:06 +0800
changeset 21698 dd86a1b531eeb33a89de9161a3472201de129adf
parent 21697 2a59860f2ee09a5cc3f6e544d202fe867141e1e8
child 21699 7d7b4275989563498e225748ac20b77660ed601e
push id1693
push userphilip.chee@gmail.com
push dateSat, 16 Apr 2016 23:49:41 +0000
treeherdercomm-aurora@7d7b42759895 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersRatty
bugs1251368, 1245184
Bug 1251368 - add originAttributes to cookie remove call r=Ratty The api was changed in Bug 1245184
suite/common/dataman/dataman.js
suite/common/permissions/cookieViewer.js
--- a/suite/common/dataman/dataman.js
+++ b/suite/common/dataman/dataman.js
@@ -895,16 +895,17 @@ var gCookies = {
   _makeCookieObject: function cookies__makeCookieObject(aCookie) {
       return {name: aCookie.name,
               value: aCookie.value,
               isDomain: aCookie.isDomain,
               host: aCookie.host,
               rawHost: aCookie.rawHost,
               displayHost: gLocSvc.idn.convertToDisplayIDN(aCookie.rawHost, {}),
               path: aCookie.path,
+              originAttributes: aCookie.originAttributes,
               isSecure: aCookie.isSecure,
               isSession: aCookie.isSession,
               isHttpOnly: aCookie.isHttpOnly,
               expires: this._getExpiresString(aCookie.expires),
               expiresSortValue: aCookie.expires};
   },
 
   _getObjID: function cookies__getObjID(aIdx) {
@@ -1060,17 +1061,17 @@ var gCookies = {
     this.tree.view.selection.clearSelection();
     // Loop backwards so later indexes in the list don't change.
     for (let i = selections.length - 1; i >= 0; i--) {
       let delCookie = this.displayedCookies[selections[i]];
       this.cookies.splice(this.cookies.indexOf(this.displayedCookies[selections[i]]), 1);
       this.displayedCookies.splice(selections[i], 1);
       this.tree.treeBoxObject.rowCountChanged(selections[i], -1);
       Services.cookies.remove(delCookie.host, delCookie.name, delCookie.path,
-                              this.blockOnRemove.checked);
+                              delCookie.originAttributes, this.blockOnRemove.checked);
     }
     if (!this.displayedCookies.length)
       gDomains.removeDomainOrFlag(gDomains.selectedDomain.title, "hasCookies");
     // Select the entry after the first deleted one or the last of all entries.
     if (selections.length && this.displayedCookies.length)
       this.tree.view.selection.toggleSelect(selections[0] < this.displayedCookies.length ?
                                             selections[0] :
                                             this.displayedCookies.length - 1);
--- a/suite/common/permissions/cookieViewer.js
+++ b/suite/common/permissions/cookieViewer.js
@@ -124,42 +124,46 @@ var cookiesTreeView = {
   isContainer : function(index) {return false;},
   cycleHeader : function(aCol) {},
   getRowProperties : function(row) { return ""; },
   getColumnProperties : function(column) { return ""; },
   getCellProperties : function(row, column) { return ""; }
  };
 var cookiesTree;
 
-function Cookie(id,name,value,isDomain,host,rawHost,path,isSecure,expires) {
+function Cookie(id, name, value, isDomain, host, rawHost, path,
+                originAttributes, isSecure, expires) {
   this.id = id;
   this.name = name;
   this.value = value;
   this.isDomain = isDomain;
   this.host = host;
   this.rawHost = rawHost;
   this.path = path;
+  this.originAttributes = originAttributes;
   this.isSecure = isSecure;
   this.expires = GetExpiresString(expires);
   this.expiresSortValue = expires;
 }
 
 function loadCookies() {
   // load cookies into a table
   var enumerator = cookiemanager.enumerator;
   var count = 0;
   while (enumerator.hasMoreElements()) {
     var nextCookie = enumerator.getNext();
     if (!nextCookie) break;
     nextCookie = nextCookie.QueryInterface(Components.interfaces.nsICookie);
     var host = nextCookie.host;
     allCookies[count] =
-      new Cookie(count++, nextCookie.name, nextCookie.value, nextCookie.isDomain, host,
-                 (host.charAt(0)==".") ? host.substring(1,host.length) : host,
-                 nextCookie.path, nextCookie.isSecure, nextCookie.expires);
+      new Cookie(count++, nextCookie.name, nextCookie.value,
+                 nextCookie.isDomain, host,
+                 host.charAt(0)=="." ? host.slice(1) : host,
+                 nextCookie.path, nextCookie.originAttributes,
+                 nextCookie.isSecure, nextCookie.expires);
   }
 
   // filter, sort and display the table
   cookiesTree.view = cookiesTreeView;
   filter(document.getElementById("filter").value);
 }
 
 function GetExpiresString(expires) {
@@ -285,16 +289,17 @@ function DeleteAllCookies() {
 }
 
 function FinalizeCookieDeletions() {
   gUpdatingBatch = "cookie-changed";
   for (var c=0; c<deletedCookies.length; c++) {
     cookiemanager.remove(deletedCookies[c].host,
                          deletedCookies[c].name,
                          deletedCookies[c].path,
+                         delCookie.originAttributes,
                          document.getElementById("checkbox").checked);
   }
   deletedCookies.length = 0;
   gUpdatingBatch = "";
 }
 
 function HandleCookieKeyPress(e) {
   if (e.keyCode == KeyEvent.DOM_VK_DELETE) {