Backed out changeset c2bfe9667d82 (Bug 1371898) for causing a test failure (bug 1416549). rs=backout
authoraceman <acelists@atlas.sk>
Sun, 12 Nov 2017 23:38:13 +0100
changeset 29368 32a2cee5b0713085c06bb6ca8dd14eef9d1dae54
parent 29367 00400455524ead02c0c11611f2844768016215d4
child 29369 f57390a5d6ddef0380e5be087fa4b96b340501bd
push id2068
push userclokep@gmail.com
push dateMon, 13 Nov 2017 19:02:14 +0000
treeherdercomm-beta@9c7e7ce8672b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1371898, 1416549
backs outc2bfe9667d82e4bf2ea04e07762140dac8a4ed4c
Backed out changeset c2bfe9667d82 (Bug 1371898) for causing a test failure (bug 1416549). rs=backout
mail/base/modules/mailMigrator.js
mail/test/mozmill/migration-to-rdf-ui-2/localstore.rdf
mail/test/mozmill/migration-to-rdf-ui-2/test-migrate-to-rdf-ui-2.js
mail/test/mozmill/migration-to-rdf-ui-2/wrapper.py
mail/test/mozmill/migration-to-rdf-ui-3/localstore.rdf
mail/test/mozmill/migration-to-rdf-ui-3/test-migrate-to-rdf-ui-3.js
mail/test/mozmill/migration-to-rdf-ui-3/wrapper.py
mail/test/mozmill/migration-to-rdf-ui-5/localstore.rdf
mail/test/mozmill/migration-to-rdf-ui-5/test-migrate-to-rdf-ui-5.js
mail/test/mozmill/migration-to-rdf-ui-5/wrapper.py
mail/test/mozmill/mozmilltests.list
--- a/mail/base/modules/mailMigrator.js
+++ b/mail/base/modules/mailMigrator.js
@@ -112,20 +112,119 @@ var MailMigrator = {
     } catch(ex) {}
 
     if (currentUIVersion >= UI_VERSION)
       return;
 
     let xulStore = Cc["@mozilla.org/xul/xulstore;1"].getService(Ci.nsIXULStore);
 
     try {
-      // UI versions below 5 could only exist in an old profile with localstore.rdf
-      // file used for the XUL store. Since TB55 this file is no longer read.
-      // Since UI version 5, the xulstore.json file is being used, so we only
-      // support those version here, see bug 1371898.
+      // Initially, we checked if currentUIVersion < 1, and stripped the
+      // persisted "collapsed" property from folderPaneBox if it wasn't.
+      // However, the inital implementation of migrateUI swallowed up
+      // exceptions, and bumped the value of UI_VERSION_PREF regardless.
+      // Now, instead, we fail to bump the UI_VERSION_PREF if something goes
+      // wrong, and we've moved the folderPaneBox operation into
+      // currentUIVersion < 2 just in case the operation failed for some of
+      // our users the first time.
+      if (currentUIVersion < 2) {
+        // We want to remove old settings that collapse the folderPaneBox
+        if (xulStore.hasValue(MESSENGER_DOCURL, "folderPaneBox", "collapsed")) {
+          // We want to override this, and set it to false.  We should really
+          // be ignoring this persist attribute, anyhow.
+          xulStore.removeValue(MESSENGER_DOCURL, "folderPaneBox", "collapsed");
+        }
+
+        // We want to remove the throbber from the menubar on Linux and
+        // Windows, and from the mail-toolbar on OSX.
+        let mailBarId = (Services.appinfo.OS == "Darwin") ?
+          "mail-bar3" : "mail-toolbar-menubar2";
+        let cs = xulStore.getValue(MESSENGER_DOCURL, mailBarId, "currentset");
+
+        if (cs && cs.includes("throbber-box")) {
+          cs = cs.replace(/(^|,)throbber-box($|,)/, "$1$2");
+          xulStore.setValue(MESSENGER_DOCURL, mailBarId, "currentset", cs);
+        }
+      }
+
+      // In UI version 3, we move the QFB button from the tabbar toolbar to
+      // to the mail toolbar.
+      if (currentUIVersion < 3) {
+        let cs = xulStore.getValue(MESSENGER_DOCURL, "tabbar-toolbar", "currentset");
+        if (cs && cs.includes("qfb-show-filter-bar")) {
+          cs = cs.replace(/(^|,)qfb-show-filter-bar($|,)/, "$1$2");
+          xulStore.setValue(MESSENGER_DOCURL, "tabbar-toolbar", "currentset", cs);
+        }
+
+        let cs3 = xulStore.getValue(MESSENGER_DOCURL, "mail-bar3", "currentset");
+        if (cs3 && !cs3.includes("qfb-show-filter-bar")) {
+          if (cs3.includes("gloda-search")) {
+            // Put the QFB toggle before the gloda-search and any of
+            // spring / spacer / separator.
+            cs3 = cs3.replace(/(^|,)([spring,|spacer,|separator,]*)gloda-search($|,)/,
+                             "$1qfb-show-filter-bar,$2gloda-search$3");
+          } else {
+            // If there's no gloda-search, just put the QFB toggle at the end
+            cs3 += ",qfb-show-filter-bar";
+          }
+          xulStore.setValue(MESSENGER_DOCURL, "mail-bar3", "currentset", cs3);
+        }
+      }
+
+      // In UI version 4, we add the chat button to the mail toolbar.
+      if (currentUIVersion < 4) {
+        let cs = xulStore.getValue(MESSENGER_DOCURL, "mail-bar3", "currentset");
+        if (cs && !cs.includes("button-chat")) {
+          if (cs.includes("button-newmsg")) {
+            // Put the chat button after the newmsg button.
+            cs = cs.replace(/(^|,)button-newmsg($|,)/,
+                            "$1button-newmsg,button-chat$2");
+          } else if (cs.includes("button-address")) {
+            // If there's no newmsg button, put the chat button before the address book button.
+            cs = cs.replace(/(^|,)button-address($|,)/,
+                            "$1button-chat,button-address$2");
+          } else {
+            // Otherwise, just put the chat button at the end.
+            cs += ",button-chat";
+          }
+          xulStore.setValue(MESSENGER_DOCURL, "mail-bar3", "currentset", cs);
+        }
+      }
+
+      // In UI version 5, we add the AppMenu button to the mail toolbar and
+      // collapse the main menu by default if the user has no accounts
+      // set up (and the override pref "mail.main_menu.collapse_by_default"
+      // is set to true). Checking for 0 accounts is a hack, because we can't
+      // think of any better way of determining whether this profile is new
+      // or not.
+      if (currentUIVersion < 5) {
+        /**
+         * Helper function that attempts to add the AppMenu button to the
+         * end of a toolbar with ID aToolbarID. Fails silently if this is
+         * not possible, as is typical within our UI migration code.
+         *
+         * @param aToolbarID the ID of the toolbar to add the AppMenu to.
+         */
+        let addButtonToEnd = function(aToolbarID, aButtonID) {
+          let cs = xulStore.getValue(MESSENGER_DOCURL, aToolbarID, "currentset");
+          if (cs && !cs.includes(aButtonID)) {
+            // Put the AppMenu button at the end.
+            cs += "," + aButtonID;
+            xulStore.setValue(MESSENGER_DOCURL, aToolbarID, "currentset", cs);
+          }
+        }.bind(this);
+
+        addButtonToEnd("mail-bar3", "button-appmenu");
+        addButtonToEnd("chat-toobar", "button-chat-appmenu");
+
+        if (Services.prefs.getBoolPref("mail.main_menu.collapse_by_default") &&
+            MailServices.accounts.accounts.length == 0) {
+          xulStore.setValue(MESSENGER_DOCURL, "mail-toolbar-menubar2", "autohide", "true");
+        }
+      }
 
       // In UI version 6, we move the otherActionsButton button to the
       // header-view-toolbar.
       if (currentUIVersion < 6) {
         let cs = xulStore.getValue(MESSENGER_DOCURL, "header-view-toolbar", "currentset");
         if (cs && !cs.includes("otherActionsButton")) {
           // Put the otherActionsButton button at the end.
           cs = cs + "," + "otherActionsButton";
new file mode 100644
--- /dev/null
+++ b/mail/test/mozmill/migration-to-rdf-ui-2/localstore.rdf
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
+         xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#attachment-view-toolbar"
+                   iconsize="small" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#attachment-view-toolbox"
+                   mode="full"
+                   iconsize="small"
+                   labelalign="end" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#header-view-toolbar"
+                   iconsize="small"
+                   currentset="hdrReplyToSenderButton,hdrSmartReplyButton,hdrForwardButton,hdrArchiveButton,hdrJunkButton,hdrTrashButton,abp-toolbarbutton" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#header-view-toolbox"
+                   mode="full"
+                   iconsize="small"
+                   labelalign="end" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#messengerWindow"
+                   width="1024"
+                   height="1160"
+                   screenX="0"
+                   screenY="0"
+                   sizemode="normal" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#mail-toolbar-menubar2"
+                   mode="full"
+                   iconsize="large"
+                   currentset="menubar-items,spring,throbber-box" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#mail-bar3"
+                   collapsed="false"
+                   mode="full"
+                   iconsize="large"
+                   currentset="button-getmsg,button-newmsg,button-address,separator,button-tag,spring,gloda-search,throbber-box" />
+
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul">
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#messengerWindow"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#messagepaneboxwrapper"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#header-view-toolbox"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#header-view-toolbar"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#attachment-view-toolbox"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#attachment-view-toolbar"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#abp-hooks"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#folderPaneBox"/>
+  </RDF:Description>
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#folderPaneBox"
+                   width="500"
+                   collapsed="true" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#abp-hooks"
+                   currentVersion="2.0.2" />
+</RDF:RDF>
new file mode 100644
--- /dev/null
+++ b/mail/test/mozmill/migration-to-rdf-ui-2/test-migrate-to-rdf-ui-2.js
@@ -0,0 +1,68 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/**
+ * When moving from ui-rdf 0 to 1, we ensure that we've removed the collapsed
+ * property from the folderPaneBox, but that we still persist width.
+ */
+
+// make SOLO_TEST=migration-to-rdf-ui-2/test-migrate-to-rdf-ui-2.js mozmill-one
+
+var MODULE_NAME = "test-migrate-to-rdf-ui-2";
+var RELATIVE_ROOT = "../shared-modules";
+var MODULE_REQUIRES = ["folder-display-helpers"];
+
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cu = Components.utils;
+
+Cu.import("resource://gre/modules/Services.jsm");
+
+function setupModule(module) {
+  collector.getModule("folder-display-helpers").installInto(module);
+}
+
+/**
+ * Test that the "collapsed" property for the folderPaneBox resource was
+ * successfully unasserted.
+ */
+function test_collapsed_removed() {
+  // We can't actually detect this visually (at least, not deterministically)
+  // so we'll use xulStore to see if the collapsed property has been
+  // excised from folderPaneBox.
+  const MESSENGER_DOCURL = "chrome://messenger/content/messenger.xul";
+
+  let xulStore = Cc["@mozilla.org/xul/xulstore;1"].getService(Ci.nsIXULStore);
+  if (xulStore.hasValue(MESSENGER_DOCURL, "folderPaneBox", "collapsed"))
+    throw Error("The collapsed property still seems to exist for folderPaneBox.");
+}
+
+/**
+ * Test that the "width" property of the folderPaneBox resource was persisted.
+ * We do this simply be checking that the width of the folderPaneBox matches
+ * the width defined in localstore.rdf (which, in this case, is 500px).
+ * localstore.rdf was converted to XULStore.json in bug 559505
+ */
+// Temporarily disabled, see bug 1371898.
+function disabled_width_persisted() {
+  const EXPECTED_WIDTH = 500; // Set in localstore.rdf, found in this directory
+  let fpbWidth = mc.e("folderPaneBox").width;
+  assert_equals(EXPECTED_WIDTH, fpbWidth,
+                "The width of the folderPaneBox was not persisted.");
+}
+
+/**
+ * Test that the throbber in the main menu (or the mailbar on OSX) was removed.
+ */
+function test_throbber_removed() {
+  let currentSet;
+
+  if (mc.mozmillModule.isMac)
+    currentSet = mc.e("mail-bar3").getAttribute("currentset");
+  else
+    currentSet = mc.e("mail-toolbar-menubar2").getAttribute("currentset");
+
+  assert_false(currentSet.includes("throbber-box"),
+               "We found a throbber-box where we shouldn't have.");
+}
new file mode 100644
--- /dev/null
+++ b/mail/test/mozmill/migration-to-rdf-ui-2/wrapper.py
@@ -0,0 +1,16 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import os
+import shutil
+
+def on_profile_created(profiledir):
+    """
+    On profile creation, this copies localstore.rdf from the current folder to
+    the profile_dir.
+    """
+    # The localstore.rdf file is in the same directory this script is in
+    localstore = os.path.join(os.path.dirname(__file__),
+                              "localstore.rdf")
+    shutil.copy(localstore, profiledir)
new file mode 100644
--- /dev/null
+++ b/mail/test/mozmill/migration-to-rdf-ui-3/localstore.rdf
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
+         xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#attachment-view-toolbar"
+                   iconsize="small" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#attachment-view-toolbox"
+                   mode="full"
+                   iconsize="small"
+                   labelalign="end" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#header-view-toolbar"
+                   iconsize="small"
+                   currentset="hdrReplyToSenderButton,hdrSmartReplyButton,hdrForwardButton,hdrArchiveButton,hdrJunkButton,hdrTrashButton,abp-toolbarbutton" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#header-view-toolbox"
+                   mode="full"
+                   iconsize="small"
+                   labelalign="end" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#messengerWindow"
+                   width="1024"
+                   height="1160"
+                   screenX="0"
+                   screenY="0"
+                   sizemode="normal" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#mail-toolbar-menubar2"
+                   mode="full"
+                   iconsize="large"
+                   currentset="menubar-items,spring,throbber-box" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#tabbar-toolbar"
+                   currentset="qfb-show-filter-bar" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#mail-bar3"
+                   currentset="button-getmsg,button-newmsg,button-address,separator,button-tag,spring,separator,spring,spacer,gloda-search" />
+
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul">
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#messengerWindow"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#messagepaneboxwrapper"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#header-view-toolbox"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#header-view-toolbar"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#attachment-view-toolbox"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#attachment-view-toolbar"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#abp-hooks"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#folderPaneBox"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#mail-bar3"/>
+  </RDF:Description>
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#folderPaneBox"
+                   width="500"
+                   collapsed="true" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#abp-hooks"
+                   currentVersion="2.0.2" />
+</RDF:RDF>
new file mode 100644
--- /dev/null
+++ b/mail/test/mozmill/migration-to-rdf-ui-3/test-migrate-to-rdf-ui-3.js
@@ -0,0 +1,39 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/**
+ * When moving from ui-rdf 0 to 1, we ensure that we've removed the collapsed
+ * property from the folderPaneBox, but that we still persist width.
+ */
+
+var MODULE_NAME = "test-migrate-to-rdf-ui-3";
+var RELATIVE_ROOT = "../shared-modules";
+var MODULE_REQUIRES = ["folder-display-helpers"];
+
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cu = Components.utils;
+
+Cu.import("resource://gre/modules/Services.jsm");
+
+function setupModule(module) {
+  collector.getModule("folder-display-helpers").installInto(module);
+}
+
+/**
+ * Test that the QFB toggle was moved from the tabbar-toolbar to the
+ * mail-bar3.
+ */
+function test_qfb_button_moved() {
+  let currentSet = mc.e("tabbar-toolbar").currentSet;
+  assert_false(currentSet.includes("qfb-show-filter-bar"),
+                "We found the QFB filter toggle where we shouldn't have.");
+
+  // Now make sure that we've got the QFB filter toggle in the mail bar,
+  // and that it is placed before the gloda-search and any spring, spacer,
+  // or separator items.
+  currentSet = mc.e("mail-bar3").currentSet;
+  assert_true(currentSet.includes("button-tag,qfb-show-filter-bar,spring"),
+                "We didn't find the QFB filter toggle where we should have.");
+}
new file mode 100644
--- /dev/null
+++ b/mail/test/mozmill/migration-to-rdf-ui-3/wrapper.py
@@ -0,0 +1,16 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import os
+import shutil
+
+def on_profile_created(profiledir):
+    """
+    On profile creation, this copies localstore.rdf from the current folder to
+    the profile_dir.
+    """
+    # The localstore.rdf file is in the same directory this script is in
+    localstore = os.path.join(os.path.dirname(__file__),
+                              "localstore.rdf")
+    shutil.copy(localstore, profiledir)
new file mode 100644
--- /dev/null
+++ b/mail/test/mozmill/migration-to-rdf-ui-5/localstore.rdf
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
+         xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#attachment-view-toolbar"
+                   iconsize="small" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#attachment-view-toolbox"
+                   mode="full"
+                   iconsize="small"
+                   labelalign="end" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#header-view-toolbar"
+                   iconsize="small"
+                   currentset="hdrReplyToSenderButton,hdrSmartReplyButton,hdrForwardButton,hdrArchiveButton,hdrJunkButton,hdrTrashButton,abp-toolbarbutton" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#header-view-toolbox"
+                   mode="full"
+                   iconsize="small"
+                   labelalign="end" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#messengerWindow"
+                   width="1024"
+                   height="1160"
+                   screenX="0"
+                   screenY="0"
+                   sizemode="normal" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#mail-toolbar-menubar2"
+                   mode="full"
+                   iconsize="large"
+                   currentset="menubar-items,spring,throbber-box" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#tabbar-toolbar"
+                   currentset="qfb-show-filter-bar" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#mail-bar3"
+                   currentset="button-getmsg,button-newmsg,button-chat,button-address,separator,button-tag,spring,separator,spring,spacer,gloda-search" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#chat-toobar"
+                   currentset="button-add-buddy,button-chat-accounts,spacer,gloda-im-search" />
+
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul">
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#messengerWindow"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#messagepaneboxwrapper"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#header-view-toolbox"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#header-view-toolbar"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#attachment-view-toolbox"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#attachment-view-toolbar"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#abp-hooks"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#folderPaneBox"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#mail-bar3"/>
+    <NC:persist RDF:resource="chrome://messenger/content/messenger.xul#chat-toobar"/>
+  </RDF:Description>
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#folderPaneBox"
+                   width="500"
+                   collapsed="true" />
+  <RDF:Description RDF:about="chrome://messenger/content/messenger.xul#abp-hooks"
+                   currentVersion="2.0.2" />
+</RDF:RDF>
new file mode 100644
--- /dev/null
+++ b/mail/test/mozmill/migration-to-rdf-ui-5/test-migrate-to-rdf-ui-5.js
@@ -0,0 +1,57 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/**
+ * When moving from ui-rdf 4 to 5, we ensure that we've added the App Menu
+ * button to the mail toolbar, and that we've collapsed the main menu.
+ */
+
+var MODULE_NAME = "test-migrate-to-rdf-ui-5";
+var RELATIVE_ROOT = "../shared-modules";
+var MODULE_REQUIRES = ["folder-display-helpers"];
+
+var kAppMenuButton = "button-appmenu";
+
+function setupModule(module) {
+  collector.getModule("folder-display-helpers").installInto(module);
+}
+
+/**
+ * Ensures that the button with ID aButtonID exists at the end of a
+ * toolbar with ID aToolbarID.
+ *
+ * @param aToolbarID the ID of the toolbar to check.
+ * @param aButtonID the ID of the button to look for.
+ */
+function assert_button_at_end_of_toolbar(aToolbarID, aButtonID) {
+  let currentSet = mc.e(aToolbarID).currentSet;
+  assert_true(currentSet.includes(aButtonID),
+                   "We didn't find the button with ID " + aButtonID +
+                   "where we should have for the toolbar with ID " +
+                   aToolbarID);
+
+  let lastChars = currentSet.substring(currentSet.length -
+                                       aButtonID.length);
+  assert_equals(lastChars, aButtonID,
+                "We didn't find the button with ID " + aButtonID + " at the " +
+                "end of the toolbar with ID " + aToolbarID);
+}
+
+/**
+ * Test that the App Menu button was added to the mail toolbar, and the main
+ * menu is not collapsed (since this Mozmill test starts with a pre-existing
+ * account).
+ */
+function test_appmenu_button_added() {
+  assert_button_at_end_of_toolbar("mail-bar3", "button-appmenu");
+  assert_button_at_end_of_toolbar("chat-toobar", "button-chat-appmenu");
+  // Skip the next test for OSX, since it never exposes the main menu.
+  if (!mc.mozmillModule.isMac) {
+    // Since we started with a pre-existing account, the main menu should
+    // NOT be collapsed.
+    let mainMenu = mc.e("mail-toolbar-menubar2");
+    assert_false(mainMenu.hasAttribute("autohide"),
+                 "The main menu should not have the autohide attribute set.");
+  }
+}
new file mode 100644
--- /dev/null
+++ b/mail/test/mozmill/migration-to-rdf-ui-5/wrapper.py
@@ -0,0 +1,16 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import os
+import shutil
+
+def on_profile_created(profiledir):
+    """
+    On profile creation, this copies localstore.rdf from the current folder to
+    the profile_dir.
+    """
+    # The localstore.rdf file is in the same directory this script is in
+    localstore = os.path.join(os.path.dirname(__file__),
+                              "localstore.rdf")
+    shutil.copy(localstore, profiledir)
--- a/mail/test/mozmill/mozmilltests.list
+++ b/mail/test/mozmill/mozmilltests.list
@@ -13,16 +13,19 @@ folder-tree-modes
 folder-widget
 im
 instrumentation
 junk-commands
 keyboard
 message-header
 message-reader
 message-window
+migration-to-rdf-ui-2
+migration-to-rdf-ui-3
+migration-to-rdf-ui-5
 multiple-identities
 newmailaccount
 notification
 override-main-menu-collapse
 pref-window
 quick-filter-bar
 search-window
 session-store