diff --git a/mail/base/modules/mailMigrator.js b/mail/base/modules/mailMigrator.js index 3614c953ae..c3f75980be 100644 --- a/mail/base/modules/mailMigrator.js +++ b/mail/base/modules/mailMigrator.js @@ -117,109 +117,10 @@ var MailMigrator = { let xulStore = Cc["@mozilla.org/xul/xulstore;1"].getService(Ci.nsIXULStore); try { - // 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"); - } - } + // 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. // In UI version 6, we move the otherActionsButton button to the // header-view-toolbar. diff --git a/mail/test/mozmill/migration-to-rdf-ui-2/localstore.rdf b/mail/test/mozmill/migration-to-rdf-ui-2/localstore.rdf deleted file mode 100644 index 3bb5c1e4e7..0000000000 --- a/mail/test/mozmill/migration-to-rdf-ui-2/localstore.rdf +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mail/test/mozmill/migration-to-rdf-ui-2/test-migrate-to-rdf-ui-2.js b/mail/test/mozmill/migration-to-rdf-ui-2/test-migrate-to-rdf-ui-2.js deleted file mode 100644 index 66d608fcc3..0000000000 --- a/mail/test/mozmill/migration-to-rdf-ui-2/test-migrate-to-rdf-ui-2.js +++ /dev/null @@ -1,68 +0,0 @@ -/* 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."); -} diff --git a/mail/test/mozmill/migration-to-rdf-ui-2/wrapper.py b/mail/test/mozmill/migration-to-rdf-ui-2/wrapper.py deleted file mode 100644 index 009f6868b9..0000000000 --- a/mail/test/mozmill/migration-to-rdf-ui-2/wrapper.py +++ /dev/null @@ -1,16 +0,0 @@ -# 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) diff --git a/mail/test/mozmill/migration-to-rdf-ui-3/localstore.rdf b/mail/test/mozmill/migration-to-rdf-ui-3/localstore.rdf deleted file mode 100644 index 8a9f32feb5..0000000000 --- a/mail/test/mozmill/migration-to-rdf-ui-3/localstore.rdf +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mail/test/mozmill/migration-to-rdf-ui-3/test-migrate-to-rdf-ui-3.js b/mail/test/mozmill/migration-to-rdf-ui-3/test-migrate-to-rdf-ui-3.js deleted file mode 100644 index c6a8505bdd..0000000000 --- a/mail/test/mozmill/migration-to-rdf-ui-3/test-migrate-to-rdf-ui-3.js +++ /dev/null @@ -1,39 +0,0 @@ -/* 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."); -} diff --git a/mail/test/mozmill/migration-to-rdf-ui-3/wrapper.py b/mail/test/mozmill/migration-to-rdf-ui-3/wrapper.py deleted file mode 100644 index eb8a184a04..0000000000 --- a/mail/test/mozmill/migration-to-rdf-ui-3/wrapper.py +++ /dev/null @@ -1,16 +0,0 @@ -# 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) diff --git a/mail/test/mozmill/migration-to-rdf-ui-5/localstore.rdf b/mail/test/mozmill/migration-to-rdf-ui-5/localstore.rdf deleted file mode 100644 index 84f4790895..0000000000 --- a/mail/test/mozmill/migration-to-rdf-ui-5/localstore.rdf +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mail/test/mozmill/migration-to-rdf-ui-5/test-migrate-to-rdf-ui-5.js b/mail/test/mozmill/migration-to-rdf-ui-5/test-migrate-to-rdf-ui-5.js deleted file mode 100644 index fb1190059d..0000000000 --- a/mail/test/mozmill/migration-to-rdf-ui-5/test-migrate-to-rdf-ui-5.js +++ /dev/null @@ -1,57 +0,0 @@ -/* 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."); - } -} diff --git a/mail/test/mozmill/migration-to-rdf-ui-5/wrapper.py b/mail/test/mozmill/migration-to-rdf-ui-5/wrapper.py deleted file mode 100644 index eb8a184a04..0000000000 --- a/mail/test/mozmill/migration-to-rdf-ui-5/wrapper.py +++ /dev/null @@ -1,16 +0,0 @@ -# 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) diff --git a/mail/test/mozmill/mozmilltests.list b/mail/test/mozmill/mozmilltests.list index 03ad329063..835e49c354 100644 --- a/mail/test/mozmill/mozmilltests.list +++ b/mail/test/mozmill/mozmilltests.list @@ -18,9 +18,6 @@ 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