Bug 1525730 - Fix the chat copy controller (was broken after the convbrowser.xml -> conversation-browser.js refactoring). r=clokep a=jorgk
authorFlorian Quèze <florian@queze.net>
Thu, 07 Feb 2019 10:10:16 +0100
changeset 34321 bd1158d19cdf2eaac8e7e8448ed49ebc9cb9d488
parent 34320 a7c0ece1f2274bf442e9e764aaa07e980d89befe
child 34322 7b3232d39834e897c97c00a9cfab2506b3d661cd
push id389
push userclokep@gmail.com
push dateMon, 18 Mar 2019 19:01:53 +0000
reviewersclokep, jorgk
bugs1525730
Bug 1525730 - Fix the chat copy controller (was broken after the convbrowser.xml -> conversation-browser.js refactoring). r=clokep a=jorgk
chat/content/conversation-browser.js
--- a/chat/content/conversation-browser.js
+++ b/chat/content/conversation-browser.js
@@ -202,25 +202,25 @@ class MozConversationBrowser extends cus
       if (this.magicCopyEnabled) {
         this.enableMagicCopy();
       } else {
         this.disableMagicCopy();
       }
     };
 
     // @implements {nsIController}
-    this.conversationController = {
+    this.copyController = {
       supportsCommand(command) {
         return command == "cmd_copy" || command == "cmd_cut";
       },
-      isCommandEnabled(command) {
+      isCommandEnabled: command => {
         return command == "cmd_copy" &&
           !this.contentWindow.getSelection().isCollapsed;
       },
-      doCommand(command) {
+      doCommand: command => {
         let selection = this.contentWindow.getSelection();
         if (selection.isCollapsed)
           return;
 
         Cc["@mozilla.org/widget/clipboardhelper;1"]
           .getService(Ci.nsIClipboardHelper)
           .copyString(serializeSelection(selection));
       },
@@ -284,26 +284,26 @@ class MozConversationBrowser extends cus
     return this.contentDocument.getElementById("Chat");
   }
 
   get magicCopyEnabled() {
     return Services.prefs.getBoolPref(this.magicCopyPref);
   }
 
   enableMagicCopy() {
-    this.contentWindow.controllers.insertControllerAt(0, this.chatController);
+    this.contentWindow.controllers.insertControllerAt(0, this.copyController);
     this.autoCopyEnabled = Services.clipboard.supportsSelectionClipboard() &&
       Services.prefs.getBoolPref("clipboard.autocopy");
     if (this.autoCopyEnabled) {
       this.contentWindow.getSelection().addSelectionListener(this.chatSelectionListener);
     }
   }
 
   disableMagicCopy() {
-    this.contentWindow.controllers.removeController(this.chatController);
+    this.contentWindow.controllers.removeController(this.copyController);
     if (this.autoCopyEnabled) {
       this.contentWindow.getSelection().removeSelectionListener(this.chatSelectionListener);
     }
   }
 
   initMagicCopy() {
     if (this.magicCopyInitialized)
       return;