Bug 1403593 - Change containers preference page to use command instead of click r?jaws draft
authorJonathan Kingston <jkt@mozilla.com>
Tue, 07 Nov 2017 16:46:11 +0000
changeset 694318 d51b6b505a1be8473cd545014046e2e8bcec6a58
parent 693830 c2fe4b3b1b930b3e7fdb84eae44cec165394f322
child 739318 393e269c496fa5e1079b13f6881ee1bd5be6e038
push id88110
push userbmo:jkt@mozilla.com
push dateTue, 07 Nov 2017 17:48:40 +0000
reviewersjaws
bugs1403593
milestone58.0a1
Bug 1403593 - Change containers preference page to use command instead of click r?jaws MozReview-Commit-ID: 95f9yOLVof5
browser/components/preferences/handlers.xml
browser/components/preferences/in-content/containers.js
browser/components/preferences/in-content/containers.xul
browser/components/preferences/in-content/tests/browser_containers_name_input.js
--- a/browser/components/preferences/handlers.xml
+++ b/browser/components/preferences/handlers.xml
@@ -77,22 +77,22 @@
         <xul:hbox flex="1" align="center">
           <xul:hbox xbl:inherits="data-identity-icon=containerIcon,data-identity-color=containerColor" height="24" width="24" class="userContext-icon"/>
           <xul:label flex="1" crop="end" xbl:inherits="xbl:text=containerName,highlightable"/>
         </xul:hbox>
         <xul:hbox flex="1" align="right">
           <xul:button anonid="preferencesButton"
                       label="&preferencesButton.label;"
                       xbl:inherits="value=userContextId"
-                      onclick="gContainersPane.onPreferenceClick(event.originalTarget)">
+                      oncommand="gContainersPane.onPreferenceCommand(event.originalTarget)">
           </xul:button>
           <xul:button anonid="removeButton"
                       label="&removeButton.label;"
                       xbl:inherits="value=userContextId"
-                      onclick="gContainersPane.onRemoveClick(event.originalTarget)">
+                      oncommand="gContainersPane.onRemoveCommand(event.originalTarget)">
           </xul:button>
         </xul:hbox>
       </xul:hbox>
     </content>
   </binding>
 
   <binding id="offlineapp"
 	   extends="chrome://global/content/bindings/listbox.xml#listitem">
--- a/browser/components/preferences/in-content/containers.js
+++ b/browser/components/preferences/in-content/containers.js
@@ -35,17 +35,17 @@ let gContainersPane = {
       item.setAttribute("containerIcon", container.icon);
       item.setAttribute("containerColor", container.color);
       item.setAttribute("userContextId", container.userContextId);
 
       this._list.appendChild(item);
     }
   },
 
-  async onRemoveClick(button) {
+  async onRemoveCommand(button) {
     let userContextId = parseInt(button.getAttribute("value"), 10);
 
     let count = ContextualIdentityService.countContainerTabs(userContextId);
     if (count > 0) {
       let bundlePreferences = document.getElementById("bundlePreferences");
 
       let title = bundlePreferences.getString("removeContainerAlertTitle");
       let message = PluralForm.get(count, bundlePreferences.getString("removeContainerMsg"))
@@ -64,21 +64,21 @@ let gContainersPane = {
 
       await ContextualIdentityService.closeContainerTabs(userContextId);
     }
 
     ContextualIdentityService.remove(userContextId);
     this._rebuildView();
   },
 
-  onPreferenceClick(button) {
+  onPreferenceCommand(button) {
     this.openPreferenceDialog(button.getAttribute("value"));
   },
 
-  onAddButtonClick(button) {
+  onAddButtonCommand(button) {
     this.openPreferenceDialog(null);
   },
 
   openPreferenceDialog(userContextId) {
     let identity = {
       name: "",
       icon: defaultContainerIcon,
       color: defaultContainerColor
--- a/browser/components/preferences/in-content/containers.xul
+++ b/browser/components/preferences/in-content/containers.xul
@@ -34,12 +34,12 @@
   <vbox id="browserContainersbox">
 
     <richlistbox id="containersView" orient="vertical" persist="lastSelectedType"
                  flex="1">
     </richlistbox>
   </vbox>
   <vbox>
     <hbox flex="1">
-      <button id="containersAdd" onclick="gContainersPane.onAddButtonClick();" accesskey="&addButton.accesskey;" label="&addButton.label;"/>
+      <button id="containersAdd" oncommand="gContainersPane.onAddButtonCommand();" accesskey="&addButton.accesskey;" label="&addButton.label;"/>
     </hbox>
   </vbox>
 </groupbox>
--- a/browser/components/preferences/in-content/tests/browser_containers_name_input.js
+++ b/browser/components/preferences/in-content/tests/browser_containers_name_input.js
@@ -9,17 +9,17 @@ add_task(async function setup() {
 
 add_task(async function() {
   async function openDialog() {
     let doc = gBrowser.selectedBrowser.contentDocument;
 
     let dialogPromise = promiseLoadSubDialog(CONTAINERS_URL);
 
     let addButton = doc.getElementById("containersAdd");
-    addButton.click();
+    addButton.doCommand();
 
     let dialog = await dialogPromise;
 
     return dialog.document;
   }
 
   let doc = await openDialog();