Bug 665313 - Opening message attachment does not work r=mnyromyr a=iann for CLOSED TREE COMM50_20110703_RELBRANCH
authorNeil Rashbrook <neil@httl.net>
Sun, 26 Jun 2011 22:13:25 +0100
branchCOMM50_20110703_RELBRANCH
changeset 30612 2d4177a294729af2fe4ac95869e1e66d4d9a9863
parent 30611 e38f37788a49558ae8d97bae8081586c657ca0db
child 30613 4e789e5a01e598695563a07ee4f8aef529af986e
push id1
push userclokep@gmail.com
push dateMon, 07 May 2018 22:45:56 +0000
treeherdercomm-esr60@57eacde5ef40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmnyromyr, iann
bugs665313
Bug 665313 - Opening message attachment does not work r=mnyromyr a=iann for CLOSED TREE
suite/mailnews/msgHdrViewOverlay.js
--- a/suite/mailnews/msgHdrViewOverlay.js
+++ b/suite/mailnews/msgHdrViewOverlay.js
@@ -1220,18 +1220,30 @@ createNewAttachmentInfo.prototype.viewAt
   if (!this.isExternalAttachment)
     url += "&filename=" + encodeURIComponent(this.displayName);
   openDialog("chrome://global/content/viewSource.xul",
              "_blank", "all,dialog=no", url);
 }
 
 createNewAttachmentInfo.prototype.openAttachment = function openAttachment()
 {
-  if (this.contentType == "text/x-moz-deleted")
-    return;
+  switch (this.contentType)
+  {
+    // As of bug 599119, isTypeSupported returns true for messages, but
+    // attached messages don't open reliably in the browser, so pretend
+    // they're not supported and open a message window for them instead.
+    case "message/rfc822":
+      var url = this.url + "&type=application/x-message-display";
+      window.openDialog("chrome://messenger/content/messageWindow.xul",
+                        "_blank", "all,dialog=no",
+                        Services.io.newURI(url, null, null));
+      return;
+    case "text/x-moz-deleted":
+      return;
+  }
 
   var webNavigationInfo =
         Components.classes["@mozilla.org/webnavigation-info;1"]
                   .getService(Components.interfaces.nsIWebNavigationInfo);
 
   if (webNavigationInfo.isTypeSupported(this.contentType, null))
     openAsExternal(this.url);
   else