Bug 680680 - Renaming attachments during composition broken (does not update display name in the pane); r=bwinton a=Standard8
authorMark Banner <bugzilla@standard8.plus.com>
Mon, 26 Sep 2011 13:41:07 +0100
changeset 8859 e1882338158d11903339df2bbbef0ba4709fea1c
parent 8858 c1fdf33063f283f8887ed37a53715f91572fcb19
child 8860 82bbc61f708ba74cdef72ff1ec961e4fd22a63b0
push idunknown
push userunknown
push dateunknown
reviewersbwinton, Standard8
bugs680680
Bug 680680 - Renaming attachments during composition broken (does not update display name in the pane); r=bwinton a=Standard8
mail/components/compose/content/MsgComposeCommands.js
mail/test/mozmill/composition/test-attachment.js
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -3112,31 +3112,21 @@ function RenameSelectedAttachment()
   if (gPromptService.prompt(
                      window,
                      gComposeBundle.getString("renameAttachmentTitle"),
                      gComposeBundle.getString("renameAttachmentMessage"),
                      attachmentName,
                      null,
                      {value: 0}))
   {
-    var modifiedAttachmentName = attachmentName.value;
-    if (modifiedAttachmentName == "")
+    if (attachmentName.value == "")
       return; // name was not filled, bail out
 
-    var nameAndSize = modifiedAttachmentName;
-    if (item.attachment.size != -1)
-    {
-      var size = gMessenger.formatFileSize(item.attachment.size);
-      item.label = gComposeBundle.getFormattedString(
-          "attachmentNameAndSize", [modifiedAttachmentName, size]);
-    }
-    else
-      item.label = modifiedAttachmentName;
-
-    item.attachment.name = modifiedAttachmentName;
+    item.attachment.name = attachmentName.value;
+    item.setAttribute("name", attachmentName.value);
     gContentChanged = true;
   }
 }
 
 function FocusOnFirstAttachment()
 {
   var bucketList = document.getElementById("attachmentBucket");
 
--- a/mail/test/mozmill/composition/test-attachment.js
+++ b/mail/test/mozmill/composition/test-attachment.js
@@ -253,16 +253,18 @@ function test_rename_attachment() {
   // Now, rename the attachment.
   let bucket = cwc.e("attachmentBucket");
   let node = bucket.getElementsByTagName("attachmentitem")[0];
   cwc.click(new elib.Elem(node));
   plan_for_modal_dialog("commonDialog", subtest_rename_attachment);
   cwc.window.RenameSelectedAttachment();
   wait_for_modal_dialog("commonDialog");
 
+  assert_equals(node.getAttribute("name"), "renamed.txt");
+
   check_attachment_size(cwc, 0, size);
   check_total_attachment_size(cwc, 1);
 
   close_compose_window(cwc);
 }
 
 function test_forward_raw_attachment() {
   be_in_folder(folder);