Bug 321355 - Backed out changeset e7e79f9aaf79 due to incorrect merge. Will reland in same push. a=jorgk
authorJorg K
Wed, 16 Mar 2016 23:27:32 +0100
changeset 26825 fb34bc19b35fe27a48982021b442a4efc66094c5
parent 26824 2a9653d2c944a6e664b6d57060eff6ca02f4cd05
child 26826 3a386f9a75b59f603672bf33f2421a6de82e1880
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk
bugs321355
Bug 321355 - Backed out changeset e7e79f9aaf79 due to incorrect merge. Will reland in same push. a=jorgk
mail/test/mozmill/composition/test-charset-edit.js
mail/test/mozmill/composition/test-drafts.js
mailnews/mime/src/mimedrft.cpp
--- a/mail/test/mozmill/composition/test-charset-edit.js
+++ b/mail/test/mozmill/composition/test-charset-edit.js
@@ -7,18 +7,17 @@
  * replying to messages.
  */
 
 // make SOLO_TEST=composition/test-charset-edit.js mozmill-one
 
 var MODULE_NAME = "test-charset-upgrade";
 
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers",
-                       "window-helpers", "notificationbox-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers", "compose-helpers"];
 
 var os = {};
 Cu.import("resource://mozmill/stdlib/os.js", os);
 Cu.import('resource://gre/modules/Services.jsm');
 Cu.import("resource:///modules/mailServices.js");
 Cu.import("resource:///modules/mimeParser.jsm");
 var elib = {};
 Cu.import("resource://mozmill/modules/elementslib.js", elib);
@@ -110,22 +109,18 @@ function test_wrong_reply_charset() {
   close_compose_window(rwc);
 
   let draftMsg = select_click_row(1);
   assert_equals(getMsgHeaders(draftMsg).get("").charset, "windows-1252");
   press_delete(mc); // Delete message
 
   // Edit the original message. Charset should be windows-1252 now.
   msg = select_click_row(0);
-
-  // Wait for the notification with the Edit button.
-  wait_for_notification_to_show(mc, "msgNotificationBar", "draftMsgContent");
-
   plan_for_new_window("msgcompose");
-  mc.click(mc.eid("msgNotificationBar", {tagName: "button", label: "Edit"}));
+  mc.click(mc.eid("menu_editMsgAsNew"));
   rwc = wait_for_compose_window();
   rwc.keypress(null, "s", {shiftKey: false, accelKey: true});
   close_compose_window(rwc);
   msg = select_click_row(0);
   assert_equals(getMsgHeaders(msg).get("").charset, "windows-1252");
   press_delete(mc); // Delete message
 }
 
@@ -155,22 +150,18 @@ function test_no_mojibake() {
   assert_equals(getMsgHeaders(draftMsg).get("").charset, "UTF-8");
   let text = getMsgHeaders(draftMsg, true).get("");
   if (!text.includes(nonASCII))
     throw new Error("Expected to find " + nonASCII + " in " + text);
   press_delete(mc); // Delete message
 
   // Edit the original message. Charset should be UTF-8 now.
   msg = select_click_row(0);
-
-  // Wait for the notification with the Edit button.
-  wait_for_notification_to_show(mc, "msgNotificationBar", "draftMsgContent");
-
   plan_for_new_window("msgcompose");
-  mc.click(mc.eid("msgNotificationBar", {tagName: "button", label: "Edit"}));
+  mc.click(mc.eid("menu_editMsgAsNew"));
   rwc = wait_for_compose_window();
   rwc.keypress(null, "s", {shiftKey: false, accelKey: true});
   close_compose_window(rwc);
   msg = select_click_row(0);
   assert_equals(getMsgHeaders(msg).get("").charset, "UTF-8");
   assert_equals(getMsgHeaders(msg, true).get("").trim(), nonASCII);
   press_delete(mc); // Delete message
 }
--- a/mail/test/mozmill/composition/test-drafts.js
+++ b/mail/test/mozmill/composition/test-drafts.js
@@ -63,54 +63,27 @@ function test_open_draft_again() {
   // click edit in main win again
   mc.click(mc.eid(kBoxId, {tagName: "button", label: "Edit"}));
 
   mc.sleep(1000); // wait a sec to see if it caused a new window
 
   assert_true(Services.ww.activeWindow == cwc.window,
     "the original draft composition window should have got focus (again)");
 
+  let cwins2 = 0;
+  let e2 = Services.wm.getEnumerator("msgcompose");
+  while (e2.hasMoreElements()) {
+    e2.getNext();
+    cwins2++;
+  }
+
   assert_true(cwins2 > 0, "No compose window open!");
   assert_equals(cwins, cwins2, "The number of compose windows changed!");
- 
-  // Type something and save, then check that we only have one draft.
-  cwc.type(cwc.eid("content-frame"), "Hello!");
-  cwc.keypress(null, "s", {shiftKey: false, accelKey: true});
-  close_compose_window(cwc);
-  assert_equals(draftsFolder.getTotalMessages(false), 1);
+
+  close_compose_window(cwc); // close compose window
 
   press_delete(mc); // clean up after ourselves
 }
 
-/**
- * Tests that 'Edit as New' leaves the original message in drafts folder.
- */
-function test_edit_as_new_in_draft() {
-  make_new_sets_in_folder(draftsFolder, [{count: 1}]);
-  be_in_folder(draftsFolder);
-
-  assert_equals(draftsFolder.getTotalMessages(false), 1);
-
-  let draftMsg = select_click_row(0);
-
-  // Wait for the notification with the Edit button.
-  wait_for_notification_to_show(mc, kBoxId, "draftMsgContent");
-
-  plan_for_new_window("msgcompose");
-  mc.keypress(null, "e", {shiftKey: false, accelKey: true});
-  let cwc = wait_for_compose_window();
-
-  cwc.type(cwc.eid("content-frame"), "Hello!");
-  cwc.keypress(null, "s", {shiftKey: false, accelKey: true});
-
-  close_compose_window(cwc);
-  assert_equals(draftsFolder.getTotalMessages(false), 2);
-
-  // Clean up the created drafts and count again.
-  press_delete(mc);
-  press_delete(mc);
-  assert_equals(draftsFolder.getTotalMessages(false), 0);
-}
-
 function teardownModule() {
   MailServices.accounts.localFoldersServer.rootFolder
               .propagateDelete(draftsFolder, true, null);
 }
--- a/mailnews/mime/src/mimedrft.cpp
+++ b/mailnews/mime/src/mimedrft.cpp
@@ -1443,16 +1443,17 @@ mime_parse_stream_complete (nsMIMESessio
 
       //
       // At this point, we need to create a message compose window or editor
       // window via XP-COM with the information that we have retrieved from
       // the message store.
       //
       if (mdd->format_out == nsMimeOutput::nsMimeMessageEditorTemplate)
       {
+        fields->SetDraftId(mdd->url_name);
         MSG_ComposeType msgComposeType = PL_strstr(mdd->url_name,
                                                    "&redirect=true") ?
                                          nsIMsgCompType::Redirect :
                                          nsIMsgCompType::Template;
         CreateTheComposeWindow(fields, newAttachData, msgComposeType,
                                composeFormat, mdd->identity,
                                mdd->originalMsgURI, mdd->origMsgHdr);
       }