Bug 1203280 - Back out all non-test changes from changeset 064a1ae9f3d4 (bug 1199790);r=MattN
authorBrian Grinstead <bgrinstead@mozilla.com>
Wed, 09 Sep 2015 15:19:34 -0700
changeset 294197 017ff4f3fea09c40f225d9105e515cf9a89e15cd
parent 294196 e831db739c399020480c11042c1815b6fb132656
child 294198 a92f1dd74ec093dc87923097f60756c252cfc4db
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)
reviewersMattN
bugs1203280, 1199790
milestone43.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 1203280 - Back out all non-test changes from changeset 064a1ae9f3d4 (bug 1199790);r=MattN
browser/base/content/browser.js
browser/base/content/test/general/browser_permissions.js
browser/components/controlcenter/content/panel.inc.xul
browser/locales/en-US/chrome/browser/browser.dtd
browser/modules/SitePermissions.jsm
browser/modules/test/xpcshell/test_SitePermissions.js
browser/themes/shared/controlcenter/panel.inc.css
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6806,23 +6806,19 @@ var gIdentityHandler = {
   get _permissionsContainer () {
     delete this._permissionsContainer;
     return this._permissionsContainer = document.getElementById("identity-popup-permissions");
   },
   get _permissionList () {
     delete this._permissionList;
     return this._permissionList = document.getElementById("identity-popup-permission-list");
   },
-  get _permissionSubviewListPageFunctionality () {
-    delete this._permissionSubviewListPageFunctionality;
-    return this._permissionSubviewListPageFunctionality = document.getElementById("permission-subview-list-page-functionality");
-  },
-  get _permissionSubviewListSystemAccess () {
-    delete this._permissionSubviewListSystemAccess;
-    return this._permissionSubviewListSystemAccess = document.getElementById("permission-subview-list-system-access");
+  get _permissionSubviewList () {
+    delete this._permissionSubviewList;
+    return this._permissionSubviewList = document.getElementById("identity-popup-permission-subview-list");
   },
 
   /**
    * Rebuild cache of the elements that may or may not exist depending
    * on whether there's a location bar.
    */
   _cacheElements : function() {
     delete this._identityBox;
@@ -6834,18 +6830,17 @@ var gIdentityHandler = {
     delete this._permissionList;
     this._identityBox = document.getElementById("identity-box");
     this._identityIcons = document.getElementById("identity-icons");
     this._identityIconLabel = document.getElementById("identity-icon-label");
     this._identityIconCountryLabel = document.getElementById("identity-icon-country-label");
     this._identityIcon = document.getElementById("page-proxy-favicon");
     this._permissionsContainer = document.getElementById("identity-popup-permissions");
     this._permissionList = document.getElementById("identity-popup-permission-list");
-    this._permissionSubviewListPageFunctionality = document.getElementById("permission-subview-list-page-functionality");
-    this._permissionSubviewListSystemAccess = document.getElementById("permission-subview-list-system-access");
+    this._permissionSubviewList = document.getElementById("identity-popup-permission-subview-list");
   },
 
   /**
    * Handler for mouseclicks on the "More Information" button in the
    * "identity-popup" panel.
    */
   handleMoreInfoClick : function(event) {
     displaySecurityInfo();
@@ -7306,43 +7301,36 @@ var gIdentityHandler = {
     dt.setData("text/x-moz-url", urlString);
     dt.setData("text/uri-list", value);
     dt.setData("text/plain", value);
     dt.setData("text/html", htmlString);
     dt.setDragImage(gProxyFavIcon, 16, 16);
   },
 
   updateSitePermissions: function () {
-    // Clear all lists and then repopulate them.
-    this._permissionList.textContent = "";
-    this._permissionSubviewListPageFunctionality.textContent = "";
-    this._permissionSubviewListSystemAccess.textContent = "";
+    while (this._permissionList.hasChildNodes())
+      this._permissionList.removeChild(this._permissionList.lastChild);
+
+    while (this._permissionSubviewList.hasChildNodes())
+      this._permissionSubviewList.removeChild(this._permissionSubviewList.lastChild);
 
     let uri = gBrowser.currentURI;
 
-    for (let permission of SitePermissions.listPageFunctionalityPermissions()) {
+    for (let permission of SitePermissions.listPermissions()) {
       let state = SitePermissions.get(uri, permission);
       let item = this._createPermissionItem(permission, state);
-      this._permissionSubviewListPageFunctionality.appendChild(item);
-    }
-
-    for (let permission of SitePermissions.listSystemAccessPermissions()) {
-      let state = SitePermissions.get(uri, permission);
-      let item = this._createPermissionItem(permission, state);
-      this._permissionSubviewListSystemAccess.appendChild(item);
-    }
-
-    for (let permission of SitePermissions.listPermissions()) {
+
       // Add to the main view only if there is a known / non-default
       // value for the permission for this site.
-      let state = SitePermissions.get(uri, permission);
       if (state != SitePermissions.UNKNOWN) {
-        let item = this._createPermissionItem(permission, state);
-        this._permissionList.appendChild(item);
+        this._permissionList.appendChild(item.cloneNode(true));
       }
+
+      // Add all permissions to the subview.
+      this._permissionSubviewList.appendChild(item);
     }
 
     this._permissionsContainer.hidden = !this._permissionList.hasChildNodes();
   },
 
   setPermission: function (aPermission, aState) {
     if (aState == SitePermissions.getDefault(aPermission))
       SitePermissions.remove(gBrowser.currentURI, aPermission);
--- a/browser/base/content/test/general/browser_permissions.js
+++ b/browser/base/content/test/general/browser_permissions.js
@@ -41,44 +41,26 @@ add_task(function* testMainViewVisible()
 
 add_task(function* testSubviewListing() {
   let {gIdentityHandler} = gBrowser.ownerGlobal;
   gIdentityHandler.setPermission("install", 1);
 
   info("Opening control center and expanding permissions subview");
   gIdentityHandler._identityBox.click();
 
-  info("Checking 'Page Functionality' permissions");
-  let pageFunctionalityMenulists = gIdentityHandler._permissionSubviewListPageFunctionality.querySelectorAll("menulist");
-  let pageFunctionalityPerms = SitePermissions.listPageFunctionalityPermissions();
-  is(pageFunctionalityMenulists.length, pageFunctionalityPerms.length, "One menulist for each permission");
+  let menulists = gIdentityHandler._permissionSubviewList.querySelectorAll("menulist");
+  let perms = SitePermissions.listPermissions();
 
-  for (let i = 0; i < pageFunctionalityMenulists.length; i++) {
-    let menulist = pageFunctionalityMenulists[i];
-    let perm = pageFunctionalityPerms[i];
+  is(menulists.length, perms.length, "One menulist for each permission");
+
+  for (let i = 0; i < menulists.length; i++) {
+    let menulist = menulists[i];
+    let perm = perms[i];
     let expectedValue = SitePermissions.get(gBrowser.currentURI, perm);
     if (expectedValue == SitePermissions.UNKNOWN) {
       expectedValue = SitePermissions.getDefault(perm);
     }
 
     is(menulist.id, "identity-popup-permission:" + perm, "Correct id for menulist: " + perm);
     is(menulist.value, expectedValue, "Correct value on menulist: " + perm);
   }
-
-  info("Checking 'System Access' permissions");
-  let systemAccessMenulists = gIdentityHandler._permissionSubviewListSystemAccess.querySelectorAll("menulist");
-  let systemAccessPerms = SitePermissions.listSystemAccessPermissions();
-  is(systemAccessMenulists.length, systemAccessPerms.length, "One menulist for each permission");
-
-  for (let i = 0; i < systemAccessMenulists.length; i++) {
-    let menulist = systemAccessMenulists[i];
-    let perm = systemAccessPerms[i];
-    let expectedValue = SitePermissions.get(gBrowser.currentURI, perm);
-    if (expectedValue == SitePermissions.UNKNOWN) {
-      expectedValue = SitePermissions.getDefault(perm);
-    }
-
-    is(menulist.id, "identity-popup-permission:" + perm, "Correct id for menulist: " + perm);
-    is(menulist.value, expectedValue, "Correct value on menulist: " + perm);
-  }
-
   gIdentityHandler._identityPopup.hidden = true;
 });
--- a/browser/components/controlcenter/content/panel.inc.xul
+++ b/browser/components/controlcenter/content/panel.inc.xul
@@ -167,22 +167,13 @@
     <panelview id="identity-popup-permissionsView" flex="1">
       <vbox id="identity-popup-permissionsView-header">
         <label class="identity-popup-headline"
                value="&identity.permissions;"
                crop="end"/>
       </vbox>
 
       <vbox id="identity-popup-permissionsView-body">
-        <vbox id="identity-popup-permission-subview-list">
-          <label class="identity-popup-subheadline"
-                 value="&identity.permissionsPageFunctionality;"
-                 crop="end"/>
-          <vbox id="permission-subview-list-page-functionality"></vbox>
-          <label class="identity-popup-subheadline"
-                 value="&identity.permissionsSystemAccess;"
-                 crop="end"/>
-          <vbox id="permission-subview-list-system-access"></vbox>
-        </vbox>
+        <vbox id="identity-popup-permission-subview-list"/>
       </vbox>
     </panelview>
   </panelmultiview>
 </panel>
--- a/browser/locales/en-US/chrome/browser/browser.dtd
+++ b/browser/locales/en-US/chrome/browser/browser.dtd
@@ -728,18 +728,16 @@ you can use these alternative items. Oth
 <!ENTITY identity.enableMixedContentBlocking.accesskey "E">
 <!ENTITY identity.disableMixedContentBlocking.label "Disable protection for now">
 <!ENTITY identity.disableMixedContentBlocking.accesskey "D">
 <!ENTITY identity.learnMore "Learn More">
 
 <!ENTITY identity.moreInfoLinkText2 "More Information">
 
 <!ENTITY identity.permissions "Permissions">
-<!ENTITY identity.permissionsPageFunctionality "Page Functionality">
-<!ENTITY identity.permissionsSystemAccess "System Access">
 
 <!-- Name for the tabs toolbar as spoken by screen readers.
      The word "toolbar" is appended automatically and should not be contained below! -->
 <!ENTITY tabsToolbar.label "Browser tabs">
 
 <!-- LOCALIZATION NOTE (syncTabsMenu2.label): This appears in the history menu -->
 <!ENTITY syncTabsMenu2.label     "Tabs From Other Devices">
 
--- a/browser/modules/SitePermissions.jsm
+++ b/browser/modules/SitePermissions.jsm
@@ -1,18 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 this.EXPORTED_SYMBOLS = [ "SitePermissions" ];
 
 Components.utils.import("resource://gre/modules/Services.jsm");
 
-const GROUP_PAGE_FUNCTIONALITY = "pagefunctionality";
-const GROUP_SYSTEM_ACCESS = "systemaccess";
 let gStringBundle =
   Services.strings.createBundle("chrome://browser/locale/sitePermissions.properties");
 
 this.SitePermissions = {
 
   UNKNOWN: Services.perms.UNKNOWN_ACTION,
   ALLOW: Services.perms.ALLOW_ACTION,
   BLOCK: Services.perms.DENY_ACTION,
@@ -21,44 +19,19 @@ this.SitePermissions = {
   /* Checks whether a UI for managing permissions should be exposed for a given
    * URI. This excludes file URIs, for instance, as they don't have a host,
    * even though nsIPermissionManager can still handle them.
    */
   isSupportedURI: function (aURI) {
     return aURI.schemeIs("http") || aURI.schemeIs("https");
   },
 
-  /* Returns an array of permission IDs that match a given
-   * group identifier
-   */
-  _listPermissionsByGroup(group) {
-    let array = Object.keys(gPermissionObject).filter(p=> {
-      return gPermissionObject[p].group == group;
-    });
-    array.sort((a, b) => {
-      return this.getPermissionLabel(a).localeCompare(this.getPermissionLabel(b));
-    });
-    return array;
-  },
-
-  /* Returns an array of 'page functionality' permission IDs
-   */
-  listPageFunctionalityPermissions() {
-    return this._listPermissionsByGroup(GROUP_PAGE_FUNCTIONALITY);
-  },
-
-  /* Returns an array of 'system access' permission IDs
-   */
-  listSystemAccessPermissions() {
-    return this._listPermissionsByGroup(GROUP_SYSTEM_ACCESS);
-  },
-
   /* Returns an array of all permission IDs.
    */
-  listPermissions () {
+  listPermissions: function () {
     let array = Object.keys(gPermissionObject);
     array.sort((a, b) => {
       return this.getPermissionLabel(a).localeCompare(this.getPermissionLabel(b));
     });
     return array;
   },
 
   /* Returns an array of permission states to be exposed to the user for a
@@ -158,85 +131,66 @@ let gPermissionObject = {
    *    Allows sub domains to have their own permissions.
    *    Defaults to false.
    *
    *  - getDefault
    *    Called to get the permission's default state.
    *    Defaults to UNKNOWN, indicating that the user will be asked each time
    *    a page asks for that permissions.
    *
-   *  - group
-   *    A string, either 'systemacces' or 'pagefunctionality'.
-   *    Indicates what group this should be listed with in the UI
-   *
    *  - states
    *    Array of permission states to be exposed to the user.
    *    Defaults to ALLOW, BLOCK and the default state (see getDefault).
    */
 
   "image": {
-    group: GROUP_PAGE_FUNCTIONALITY,
     getDefault: function () {
       return Services.prefs.getIntPref("permissions.default.image") == 2 ?
                SitePermissions.BLOCK : SitePermissions.ALLOW;
     }
   },
 
   "cookie": {
-    group: GROUP_PAGE_FUNCTIONALITY,
     states: [ SitePermissions.ALLOW, SitePermissions.SESSION, SitePermissions.BLOCK ],
     getDefault: function () {
       if (Services.prefs.getIntPref("network.cookie.cookieBehavior") == 2)
         return SitePermissions.BLOCK;
 
       if (Services.prefs.getIntPref("network.cookie.lifetimePolicy") == 2)
         return SitePermissions.SESSION;
 
       return SitePermissions.ALLOW;
     }
   },
 
-  "desktop-notification": {
-    group: GROUP_PAGE_FUNCTIONALITY,
-  },
+  "desktop-notification": {},
 
-  "camera": {
-    group: GROUP_SYSTEM_ACCESS,
-  },
-  "microphone": {
-    group: GROUP_SYSTEM_ACCESS,
-  },
+  "camera": {},
+  "microphone": {},
 
   "popup": {
-    group: GROUP_PAGE_FUNCTIONALITY,
     getDefault: function () {
       return Services.prefs.getBoolPref("dom.disable_open_during_load") ?
                SitePermissions.BLOCK : SitePermissions.ALLOW;
     }
   },
 
   "install": {
-    group: GROUP_PAGE_FUNCTIONALITY,
     getDefault: function () {
       return Services.prefs.getBoolPref("xpinstall.whitelist.required") ?
                SitePermissions.BLOCK : SitePermissions.ALLOW;
     }
   },
 
   "geo": {
-    group: GROUP_SYSTEM_ACCESS,
     exactHostMatch: true
   },
 
-  "indexedDB": {
-    group: GROUP_SYSTEM_ACCESS,
-  },
+  "indexedDB": {},
 
   "pointerLock": {
-    group: GROUP_SYSTEM_ACCESS,
     exactHostMatch: true
   },
 
   "push": {
-    group: GROUP_SYSTEM_ACCESS,
     exactHostMatch: true
   }
 };
--- a/browser/modules/test/xpcshell/test_SitePermissions.js
+++ b/browser/modules/test/xpcshell/test_SitePermissions.js
@@ -6,17 +6,9 @@
 Components.utils.import("resource:///modules/SitePermissions.jsm");
 
 add_task(function* testPermissionsListing() {
   Assert.deepEqual(SitePermissions.listPermissions().sort(),
     ["camera","cookie","desktop-notification","geo","image",
      "indexedDB","install","microphone","pointerLock","popup",
      "push"],
     "Correct list of all permissions");
-
-  Assert.deepEqual(SitePermissions.listPageFunctionalityPermissions().sort(),
-    ["cookie","desktop-notification","image","install","popup"],
-    "Correct list of 'page functionality' permissions");
-
-  Assert.deepEqual(SitePermissions.listSystemAccessPermissions().sort(),
-    ["camera","geo","indexedDB","microphone","pointerLock","push"],
-    "Correct list of 'page functionality' permissions");
 });
--- a/browser/themes/shared/controlcenter/panel.inc.css
+++ b/browser/themes/shared/controlcenter/panel.inc.css
@@ -165,21 +165,16 @@
   margin: 0;
 }
 
 .identity-popup-headline {
   margin: 3px 0 4px;
   font-size: 150%;
 }
 
-.identity-popup-subheadline {
-  margin: 0;
-  font-weight: bold;
-}
-
 .identity-popup-warning-gray {
   -moz-padding-start: 24px;
   background: url(chrome://browser/skin/controlcenter/warning-gray.svg) no-repeat 0 50%;
 }
 
 .identity-popup-warning-yellow {
   -moz-padding-start: 24px;
   background: url(chrome://browser/skin/controlcenter/warning-yellow.svg) no-repeat 0 50%;
@@ -297,22 +292,16 @@ description#identity-popup-content-verif
   padding: 0.5em 1em;
 }
 
 #identity-popup-permission-list,
 #identity-popup-permission-subview-list {
   margin-top: 5px;
 }
 
-#permission-subview-list-page-functionality,
-#permission-subview-list-system-access {
-  margin: 3px 0;
-  -moz-margin-start: 3px;
-}
-
 #identity-popup-permission-list menulist.identity-popup-permission,
 #identity-popup-permission-subview-list menulist.identity-popup-permission {
   max-width: 10em;
 }
 
 .identity-popup-permission-label {
   -moz-margin-start: 0;
 }