Bug 739639 - Fix regression where cursor was not at the beginning of composer when forwarding inline. r+a=bienvenu.
authorMike Conley <mconley@mozilla.com>
Wed, 02 May 2012 12:08:10 -0400
changeset 11288 ba9ff38469ba8600e44dce2afbad34d5ae06b0c8
parent 11287 f8c824d8c2cf4d1b9b6cf1d99ea2fad36d026ecc
child 11289 6c022d9e7c653ae9799bf293250f07f07fcf0101
push id476
push usermconley@mozilla.com
push dateWed, 02 May 2012 16:09:20 +0000
treeherdercomm-beta@ba9ff38469ba [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs739639
Bug 739639 - Fix regression where cursor was not at the beginning of composer when forwarding inline. r+a=bienvenu.
mail/components/compose/content/cloudAttachmentLinkManager.js
mail/test/mozmill/composition/test-forward-headers.js
--- a/mail/components/compose/content/cloudAttachmentLinkManager.js
+++ b/mail/components/compose/content/cloudAttachmentLinkManager.js
@@ -50,21 +50,21 @@ var gCloudAttachmentLinkManager = {
     container.setAttribute("class", "moz-forward-container");
 
     if (mailBody.hasChildNodes()) {
       while (mailBody.childNodes.length > 0) {
         let removedChild = mailBody.removeChild(mailBody.firstChild);
         container.appendChild(removedChild);
       }
     }
-    editor.beginningOfDocument();
     editor.insertLineBreak();
     selection.collapse(mailBody, 1);
     editor.insertElementAtSelection(container, false);
     editor.insertLineBreak();
+    editor.beginningOfDocument();
   },
   ComposeProcessDone: function() {},
   SaveInFolderDone: function() {},
 
   handleEvent: function(event) {
     let mailDoc = document.getElementById("content-frame").contentDocument;
 
     if (event.type == "attachment-uploaded") {
--- a/mail/test/mozmill/composition/test-forward-headers.js
+++ b/mail/test/mozmill/composition/test-forward-headers.js
@@ -63,19 +63,23 @@ var setupModule = function (module) {
   mh.installInto(module);
 
   folder = create_folder("Test");
   thread1 = create_thread(10);
   add_sets_to_folders([folder], [thread1]);
 };
 
 function forward_selected_messages_and_go_to_drafts_folder(f) {
+  const kText = "Hey check out this megalol link";
   // opening a new compose window
   cwc = f(mc);
-  cwc.type(cwc.eid("content-frame"), "Hey check out this megalol link");
+  cwc.type(cwc.eid("content-frame"), kText);
+
+  let mailBody = get_compose_body(cwc);
+  assert_previous_text(mailBody.firstChild, [kText]);
 
   plan_for_window_close(cwc);
   // mwc is modal window controller
   plan_for_modal_dialog("commonDialog", function click_save (mwc) {
       //accept saving
       mwc.window.document.documentElement.getButton('accept').doCommand();
     });