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 31018 31475c37d0bbd27ecdf3b6fe6fb41a8851786059
parent 31017 3c5467fab8b1b413eac77437bde73ad8cd315408
child 31019 4b19adc64fc28ff6fe9aff18cb6f43b6ef3e7032
push id18168
push userkaie@kuix.de
push dateFri, 13 Nov 2020 10:54:19 +0000
treeherdercomm-central@31475c37d0bb [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