Bug 1212610 - Fix sorting permissions by site due a legacy property name being referenced. r=jaws, a=sylvestre
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Tue, 20 Oct 2015 09:49:06 -0700
changeset 296537 9ef311abacc4f06c0c871f6bd67f156d2d8ec6b7
parent 296536 4018d92c9f2aa35ad0e9395f5bb7c79693a30b8f
child 296538 0b7656e9f3b17123b3a587aab59726d8aeff89ee
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, sylvestre
bugs1212610
milestone43.0a2
Bug 1212610 - Fix sorting permissions by site due a legacy property name being referenced. r=jaws, a=sylvestre A reference to `rawHost` wasn't updated to `origin`.
browser/components/preferences/in-content/tests/browser_cookies_exceptions.js
browser/components/preferences/permissions.xul
--- a/browser/components/preferences/in-content/tests/browser_cookies_exceptions.js
+++ b/browser/components/preferences/in-content/tests/browser_cookies_exceptions.js
@@ -168,16 +168,57 @@ var testRunner = {
         test: function(params) {
           params.url.value = "localhost:12345";
           params.btnRemove.doCommand();
           is(params.tree.view.rowCount, 0, "exception should be removed");
           params.btnApplyChanges.doCommand();
         },
         observances: [{ type: "cookie", origin: "http://localhost:12345", data: "deleted" }],
       },
+      {
+        expectPermObservancesDuringTestFunction: true,
+        test(params) {
+          for (let URL of ["http://a", "http://z", "http://b"]) {
+            let URI = params.ioService.newURI(URL, null, null);
+            params.pm.add(URI, "cookie", Ci.nsIPermissionManager.ALLOW_ACTION);
+          }
+
+          is(params.tree.view.rowCount, 3, "Three permissions should be present");
+          is(params.tree.view.getCellText(0, params.nameCol), "http://a",
+             "site should be sorted. 'a' should be first");
+          is(params.tree.view.getCellText(1, params.nameCol), "http://b",
+             "site should be sorted. 'b' should be second");
+          is(params.tree.view.getCellText(2, params.nameCol), "http://z",
+             "site should be sorted. 'z' should be third");
+
+          // Sort descending then check results in cleanup since sorting isn't synchronous.
+          EventUtils.synthesizeMouseAtCenter(params.doc.getElementById("siteCol"), {},
+                                             params.doc.defaultView);
+          params.btnApplyChanges.doCommand();
+        },
+        observances: [{ type: "cookie", origin: "http://a", data: "added",
+                        capability: Ci.nsIPermissionManager.ALLOW_ACTION },
+                      { type: "cookie", origin: "http://z", data: "added",
+                        capability: Ci.nsIPermissionManager.ALLOW_ACTION },
+                      { type: "cookie", origin: "http://b", data: "added",
+                        capability: Ci.nsIPermissionManager.ALLOW_ACTION }],
+        cleanUp(params) {
+          is(params.tree.view.getCellText(0, params.nameCol), "http://z",
+             "site should be sorted. 'z' should be first");
+          is(params.tree.view.getCellText(1, params.nameCol), "http://b",
+             "site should be sorted. 'b' should be second");
+          is(params.tree.view.getCellText(2, params.nameCol), "http://a",
+             "site should be sorted. 'a' should be third");
+
+          for (let URL of ["http://a", "http://z", "http://b"]) {
+            let uri = params.ioService.newURI(URL, null, null);
+            params.pm.remove(uri, "cookie");
+          }
+        },
+      },
     ],
 
   _currentTest: -1,
 
   runTests: function() {
     this._currentTest++;
 
     info("Running test #" + (this._currentTest + 1) + "\n");
--- a/browser/components/preferences/permissions.xul
+++ b/browser/components/preferences/permissions.xul
@@ -48,17 +48,17 @@
     </hbox>
     <separator class="thin"/>
     <tree id="permissionsTree" flex="1" style="height: 18em;"
           hidecolumnpicker="true"
           onkeypress="gPermissionManager.onPermissionKeyPress(event)"
           onselect="gPermissionManager.onPermissionSelected();">
       <treecols>
         <treecol id="siteCol" label="&treehead.sitename.label;" flex="3"
-                 data-field-name="rawHost" persist="width"/>
+                 data-field-name="origin" persist="width"/>
         <splitter class="tree-splitter"/>
         <treecol id="statusCol" label="&treehead.status.label;" flex="1"
                  data-field-name="capability" persist="width"/>
       </treecols>
       <treechildren/>
     </tree>
   </vbox>
   <vbox>