Bug 1676842 - OpenPGP key manager cannot import from clipboard. r=mkmelin
authorKai Engert <kaie@kuix.de>
Thu, 12 Nov 2020 13:33:51 +0100
changeset 40394 31475c37d0bbd27ecdf3b6fe6fb41a8851786059
parent 40393 3c5467fab8b1b413eac77437bde73ad8cd315408
child 40395 4b19adc64fc28ff6fe9aff18cb6f43b6ef3e7032
push id2849
push userthunderbird@calypsoblue.org
push dateMon, 16 Nov 2020 19:06:44 +0000
treeherdercomm-beta@1cf7ad0dcfa6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1676842
Bug 1676842 - OpenPGP key manager cannot import from clipboard. r=mkmelin Differential Revision: https://phabricator.services.mozilla.com/D96825
mail/extensions/openpgp/content/modules/clipboard.jsm
--- a/mail/extensions/openpgp/content/modules/clipboard.jsm
+++ b/mail/extensions/openpgp/content/modules/clipboard.jsm
@@ -19,17 +19,17 @@ const nsTransferable = Components.Constr
 );
 
 // Create a wrapper to construct an nsITransferable instance and set its source to the given window, when necessary
 function Transferable(source) {
   let res = nsTransferable();
   if ("init" in res) {
     // When passed a Window object, find a suitable privacy context for it.
     if (source instanceof Ci.nsIDOMWindow) {
-      source = source
+      source = source.docShell
         .QueryInterface(Ci.nsIInterfaceRequestor)
         .getInterface(Ci.nsIWebNavigation);
     }
 
     res.init(source);
   }
   return res;
 }
@@ -59,17 +59,19 @@ var EnigmailClipboard = {
     ) {
       try {
         let transferable = Transferable(window);
         transferable.addDataFlavor("text/unicode");
         clipBoard.getData(transferable, clipBoardType);
         let flavour = {};
         transferable.getAnyTransferData(flavour, data);
         cBoardContent = data.value.QueryInterface(Ci.nsISupportsString).data;
-      } catch (ex) {}
+      } catch (ex) {
+        console.debug(ex);
+      }
     }
     return cBoardContent;
   },
 
   /**
    * Set the global (and if available, the selection clipboard)
    *
    * @param str: String - data to set