Bug 1489302 - Follow-up from Bug 1488084. Restore accidentally removed sourceDoc. r=IanN
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Sun, 16 Sep 2018 12:31:02 +0200
changeset 33164 553c535bc354e1276a66d299ba3efd2d76b49674
parent 33163 13445f1444562f2e4ed891c91c68eb26d2e3c744
child 33165 e385d269fb2511eb0c3299f72d07903c3c230e0c
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersIanN
bugs1489302, 1488084
Bug 1489302 - Follow-up from Bug 1488084. Restore accidentally removed sourceDoc. r=IanN
suite/mailnews/mailWindow.js
--- a/suite/mailnews/mailWindow.js
+++ b/suite/mailnews/mailWindow.js
@@ -62,19 +62,23 @@ function OnMailWindowUnload()
 }
 
 /**
  * When copying/dragging, convert imap/mailbox URLs of images into data URLs so
  * that the images can be accessed in a paste elsewhere.
  */
 function onCopyOrDragStart(e) {
   let browser = getBrowser();
-  if (!browser || e.target.ownerDocument != browser.contentDocument) {
+  if (!browser) {
+    return;
+  }
+  let sourceDoc = browser.contentDocument;
+  if (e.target.ownerDocument != sourceDoc) {
     // We're only interested if this is in the message content.
-    return; 
+    return;
   }
 
   let imgMap = new Map(); // Mapping img.src -> dataURL.
 
   // For copy, the data of what is to be copied is not accessible at this point.
   // Figure out what images are a) part of the selection and b) visible in
   // the current document. If their source isn't http or data already, convert
   // them to data URLs.