Bug 1317031 - Scrollbar of folder pane can be detached from UI element after viewing message with embedded image. r=jorgk
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Sat, 12 Nov 2016 14:12:38 +0200
changeset 20693 82f47febc327f5487158ed2a09331e195ba71ae2
parent 20692 49fa2869738366a84d2d2182b7e641379a948cb7
child 20694 330fade4b94b549426eed14f6f9b44f65b7ef858
push id12521
push usermkmelin@iki.fi
push dateSat, 12 Nov 2016 12:15:06 +0000
treeherdercomm-central@82f47febc327 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk
bugs1317031
Bug 1317031 - Scrollbar of folder pane can be detached from UI element after viewing message with embedded image. r=jorgk
mail/base/content/mailWindow.js
--- a/mail/base/content/mailWindow.js
+++ b/mail/base/content/mailWindow.js
@@ -54,23 +54,28 @@ 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 sourceDoc = getBrowser().contentDocument;
+  if (e.target.ownerDocument != sourceDoc) {
+    return; // We're only interested if this is in the message content.
+  }
+
   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.
-  let sourceDoc = getBrowser().contentDocument;
+
   let selection = sourceDoc.getSelection();
   let draggedImg = selection.isCollapsed ? e.target : null;
   for (let img of sourceDoc.images) {
     if (/^(https?|data):/.test(img.src)) {
       continue;
     }
 
     if (img.naturalWidth == 0) { // Broken/inaccessible image then...