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 7843 2d4177a29472
parent 7842 e38f37788a49
child 7844 4e789e5a01e5
push id3
push userCallek@gmail.com
push dateWed, 06 Jul 2011 05:21:19 +0000
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