Bug 1212610 - Fix sorting permissions by site due a legacy property name being referenced. r=jaws
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Tue, 20 Oct 2015 09:49:06 -0700
changeset 303845 d0b65ea823489d9794cadb15cffde2f05cf4eafa
parent 303844 2e1cf6a3b3f5a7907220b841fb973eada38fbde0
child 303846 bb1a2ca11712e3b4e390d62a399bf3e8e47cf64e
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1212610
milestone44.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 1212610 - Fix sorting permissions by site due a legacy property name being referenced. r=jaws 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>