Bug 1582056 part 2 - Convert test-window-helpers.js to a JSM; r=mkmelin
authorGeoff Lankow <geoff@darktrojan.net>
Wed, 25 Sep 2019 20:59:49 +1200
changeset 36944 19ae7a021b57cc3d81b5f95a8aa3f911c4301348
parent 36943 0ee0e21ccb1b19e9b54f2d50c1e1895a2d711187
child 36945 284f2743822fb496e79f927afcfa23dc4ee7c5cb
push id395
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:38:57 +0000
reviewersmkmelin
bugs1582056
Bug 1582056 part 2 - Convert test-window-helpers.js to a JSM; r=mkmelin
calendar/test/mozmill/Makefile.in
calendar/test/mozmill/cal-recurrence/testLastDayOfMonthRecurrence.js
calendar/test/mozmill/cal-recurrence/testWeeklyNRecurrence.js
calendar/test/mozmill/cal-recurrence/testWeeklyUntilRecurrence.js
calendar/test/mozmill/cal-recurrence/testWeeklyWithExceptionRecurrence.js
calendar/test/mozmill/eventDialog/testAlarmDialog.js
calendar/test/mozmill/eventDialog/testEventDialog.js
calendar/test/mozmill/eventDialog/testEventDialogModificationPrompt.js
calendar/test/mozmill/eventDialog/testEventDialogSize.js
calendar/test/mozmill/invitations/test-imip-bar-eml.js
calendar/test/mozmill/preferences/testAlarmDefaultValue.js
calendar/test/mozmill/preferences/testCategoryColors.js
calendar/test/mozmill/recurrenceRotated/testLastDayOfMonthRecurrence.js
calendar/test/mozmill/recurrenceRotated/testWeeklyNRecurrence.js
calendar/test/mozmill/recurrenceRotated/testWeeklyUntilRecurrence.js
calendar/test/mozmill/recurrenceRotated/testWeeklyWithExceptionRecurrence.js
calendar/test/mozmill/shared-modules/test-calendar-utils.js
calendar/test/mozmill/shared-modules/test-item-editing-helpers.js
calendar/test/mozmill/testBasicFunctionality.js
calendar/test/mozmill/testLocalICS.js
calendar/test/mozmill/testTimezones.js
mail/test/mozmill/account/test-ab-whitelist.js
mail/test/mozmill/account/test-account-actions.js
mail/test/mozmill/account/test-account-deletion.js
mail/test/mozmill/account/test-account-port-setting.js
mail/test/mozmill/account/test-account-settings-infrastructure.js
mail/test/mozmill/account/test-account-tree.js
mail/test/mozmill/account/test-account-values.js
mail/test/mozmill/account/test-archive-options.js
mail/test/mozmill/account/test-mail-account-setup-wizard.js
mail/test/mozmill/account/test-retest-config.js
mail/test/mozmill/addrbook/test-address-book.js
mail/test/mozmill/attachment/test-attachment-events.js
mail/test/mozmill/attachment/test-attachment-in-plain-msg.js
mail/test/mozmill/attachment/test-attachment-menus.js
mail/test/mozmill/attachment/test-attachment-size.js
mail/test/mozmill/attachment/test-attachment.js
mail/test/mozmill/cloudfile/test-cloudfile-attachment-urls.js
mail/test/mozmill/cloudfile/test-cloudfile-manager.js
mail/test/mozmill/composition/test-address-widgets.js
mail/test/mozmill/composition/test-attachment-reminder.js
mail/test/mozmill/composition/test-attachment.js
mail/test/mozmill/composition/test-base64-display.js
mail/test/mozmill/composition/test-blocked-content.js
mail/test/mozmill/composition/test-charset-edit.js
mail/test/mozmill/composition/test-charset-upgrade.js
mail/test/mozmill/composition/test-cp932-display.js
mail/test/mozmill/composition/test-draft-identity.js
mail/test/mozmill/composition/test-drafts.js
mail/test/mozmill/composition/test-eml-actions.js
mail/test/mozmill/composition/test-focus.js
mail/test/mozmill/composition/test-forward-headers.js
mail/test/mozmill/composition/test-forward-rfc822-attach.js
mail/test/mozmill/composition/test-forward-utf8.js
mail/test/mozmill/composition/test-forwarded-content.js
mail/test/mozmill/composition/test-forwarded-eml-actions.js
mail/test/mozmill/composition/test-image-display.js
mail/test/mozmill/composition/test-image-insertion-dialog.js
mail/test/mozmill/composition/test-multipart-related.js
mail/test/mozmill/composition/test-newmsg-compose-identity.js
mail/test/mozmill/composition/test-reply-addresses.js
mail/test/mozmill/composition/test-reply-format-flowed.js
mail/test/mozmill/composition/test-reply-multipart-charset.js
mail/test/mozmill/composition/test-reply-signature.js
mail/test/mozmill/composition/test-save-changes-on-quit.js
mail/test/mozmill/composition/test-send-button.js
mail/test/mozmill/composition/test-send-format.js
mail/test/mozmill/composition/test-signature-updating.js
mail/test/mozmill/content-policy/test-compose-mailto.js
mail/test/mozmill/content-policy/test-general-content-policy.js
mail/test/mozmill/content-policy/test-js-content-policy.js
mail/test/mozmill/content-policy/test-plugins-policy.js
mail/test/mozmill/content-policy/test-view-source.js
mail/test/mozmill/content-tabs/test-about-support.js
mail/test/mozmill/content-tabs/test-addons-mgr.js
mail/test/mozmill/content-tabs/test-content-tab.js
mail/test/mozmill/content-tabs/test-install-xpi.js
mail/test/mozmill/cookies/test-cookies.js
mail/test/mozmill/downloads/test-about-downloads.js
mail/test/mozmill/folder-display/test-archive-messages.js
mail/test/mozmill/folder-display/test-close-window-on-delete.js
mail/test/mozmill/folder-display/test-columns.js
mail/test/mozmill/folder-display/test-deletion-from-virtual-folders.js
mail/test/mozmill/folder-display/test-deletion-with-multiple-displays.js
mail/test/mozmill/folder-display/test-displaying-messages-in-folder-tabs.js
mail/test/mozmill/folder-display/test-folder-pane-visibility.js
mail/test/mozmill/folder-display/test-folder-toolbar.js
mail/test/mozmill/folder-display/test-invalid-db-folder-load.js
mail/test/mozmill/folder-display/test-mail-views.js
mail/test/mozmill/folder-display/test-message-commands-on-msgstore.js
mail/test/mozmill/folder-display/test-message-commands.js
mail/test/mozmill/folder-display/test-message-pane-visibility.js
mail/test/mozmill/folder-display/test-message-window.js
mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js
mail/test/mozmill/folder-display/test-opening-messages.js
mail/test/mozmill/folder-display/test-recent-menu.js
mail/test/mozmill/folder-display/test-right-click-middle-click-folders.js
mail/test/mozmill/folder-display/test-right-click-middle-click-messages.js
mail/test/mozmill/folder-display/test-savedsearch-reload-after-compact.js
mail/test/mozmill/folder-display/test-tabs-simple.js
mail/test/mozmill/folder-pane/test-folder-pane-consumers.js
mail/test/mozmill/folder-tree-modes/test-custom-folder-tree-mode.js
mail/test/mozmill/folder-tree-modes/test-custom-smart-folder.js
mail/test/mozmill/folder-tree-modes/test-mode-switching.js
mail/test/mozmill/folder-widget/test-message-filters.js
mail/test/mozmill/instrumentation/test-instrument-setup.js
mail/test/mozmill/message-header/test-message-header.js
mail/test/mozmill/message-header/test-phishing-bar.js
mail/test/mozmill/message-header/test-reply-identity.js
mail/test/mozmill/message-header/test-reply-to-list-from-address-selection.js
mail/test/mozmill/message-header/test-return-receipt.js
mail/test/mozmill/message-reader/test-bug594646.js
mail/test/mozmill/message-window/test-commands.js
mail/test/mozmill/message-window/test-eml-subject.js
mail/test/mozmill/message-window/test-message-sidebar.js
mail/test/mozmill/message-window/test-vcard-actions.js
mail/test/mozmill/message-window/test-view-plaintext.js
mail/test/mozmill/newmailaccount/test-newmailaccount.js
mail/test/mozmill/notification/test-notification.js
mail/test/mozmill/override-main-menu-collapse/test-override-mainmenu-collapse.js
mail/test/mozmill/pref-window/test-font-chooser.js
mail/test/mozmill/quick-filter-bar/test-display-issues.js
mail/test/mozmill/quick-filter-bar/test-filter-logic.js
mail/test/mozmill/quick-filter-bar/test-keyboard-interface.js
mail/test/mozmill/quick-filter-bar/test-sticky-filter-logic.js
mail/test/mozmill/quick-filter-bar/test-toggle-bar.js
mail/test/mozmill/search-window/test-search-window.js
mail/test/mozmill/session-store/test-session-store.js
mail/test/mozmill/shared-modules/WindowHelpers.jsm
mail/test/mozmill/shared-modules/moz.build
mail/test/mozmill/shared-modules/test-account-manager-helpers.js
mail/test/mozmill/shared-modules/test-address-book-helpers.js
mail/test/mozmill/shared-modules/test-cloudfile-backend-helpers.js
mail/test/mozmill/shared-modules/test-compose-helpers.js
mail/test/mozmill/shared-modules/test-content-tab-helpers.js
mail/test/mozmill/shared-modules/test-customization-helpers.js
mail/test/mozmill/shared-modules/test-folder-display-helpers.js
mail/test/mozmill/shared-modules/test-nntp-helpers.js
mail/test/mozmill/shared-modules/test-search-window-helpers.js
mail/test/mozmill/shared-modules/test-subscribe-window-helpers.js
mail/test/mozmill/shared-modules/test-window-helpers.js
mail/test/mozmill/startup-firstrun/test-menubar-collapsed.js
mail/test/mozmill/tabmail/test-tabmail-closing.js
mail/test/mozmill/tabmail/test-tabmail-customize.js
mail/test/mozmill/tabmail/test-tabmail-dragndrop.js
--- a/calendar/test/mozmill/Makefile.in
+++ b/calendar/test/mozmill/Makefile.in
@@ -28,21 +28,21 @@ find-solo-test = $(if $(and $(SOLO_TEST)
 include $(moztopsrcdir)/config/rules.mk
 
 mozmill:
 	unset PYTHONHOME && cd $(MOZMILLDIR) && unset MACOSX_DEPLOYMENT_TARGET && \
 	$(MOZMILLPYTHON) runtestlist.py --list=$(srcdir)/mozmilltests.list \
 	--binary="$(MOZMILLPROGRAM)" \
 	--dir=$(abspath $(MOZMILLDIR))/stage \
 	--symbols-path=$(ABS_DIST)/crashreporter-symbols \
-	--plugins-path=$(ABS_DIST)/plugins \
+	--testing-modules-dir=$(topobjdir)/_tests/modules \
 	$(MOZMILL_EXTRA)
 
 mozmill-one: solo-test = $(find-solo-test)
 mozmill-one:
 	unset PYTHONHOME && cd $(MOZMILLDIR) && unset MACOSX_DEPLOYMENT_TARGET && \
 	$(MOZMILLPYTHON) runtest.py \
 	--test=$(abspath $(MOZMILLDIR))/stage/$(solo-test) \
 	--binary="$(MOZMILLPROGRAM)" \
 	--symbols-path=$(ABS_DIST)/crashreporter-symbols \
-	--plugins-path=$(ABS_DIST)/plugins \
+	--testing-modules-dir=$(topobjdir)/_tests/modules \
 	$(MOZMILL_EXTRA)
 
--- a/calendar/test/mozmill/cal-recurrence/testLastDayOfMonthRecurrence.js
+++ b/calendar/test/mozmill/cal-recurrence/testLastDayOfMonthRecurrence.js
@@ -1,21 +1,24 @@
 /* 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/. */
 
 var MODULE_NAME = "testLastDayOfMonthRecurrence";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers"];
+
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var TIMEOUT_MODAL_DIALOG, CALENDARNAME, EVENTPATH, EVENT_BOX, CANVAS_BOX;
 var helpersForController, handleOccurrencePrompt, switchToView, goToDate;
 var invokeEventDialog, closeAllEventDialogs, deleteCalendars, createCalendar, menulistSelect;
 var REC_DLG_ACCEPT;
-var plan_for_modal_dialog, wait_for_modal_dialog;
 
 const HOUR = 8;
 
 function setupModule(module) {
   controller = mozmill.getMail3PaneController();
   ({
     TIMEOUT_MODAL_DIALOG,
     CALENDARNAME,
@@ -33,18 +36,16 @@ function setupModule(module) {
     menulistSelect,
   } = collector.getModule("calendar-utils"));
   collector.getModule("calendar-utils").setupModule(controller);
   Object.assign(module, helpersForController(controller));
 
   ({ REC_DLG_ACCEPT } = collector.getModule("item-editing-helpers"));
   collector.getModule("item-editing-helpers").setupModule(module);
 
-  ({ plan_for_modal_dialog, wait_for_modal_dialog } = collector.getModule("window-helpers"));
-
   createCalendar(controller, CALENDARNAME);
 }
 
 function testLastDayOfMonthRecurrence() {
   goToDate(controller, 2008, 1, 31); // Start with a leap year.
 
   // Create monthly recurring event.
   let eventBox = lookupEventBox("day", CANVAS_BOX, null, 1, HOUR);
--- a/calendar/test/mozmill/cal-recurrence/testWeeklyNRecurrence.js
+++ b/calendar/test/mozmill/cal-recurrence/testWeeklyNRecurrence.js
@@ -1,23 +1,26 @@
 /* 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/. */
 
 var MODULE_NAME = "testWeeklyNRecurrence";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers"];
+
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
 
 var TIMEOUT_MODAL_DIALOG, CALENDARNAME, EVENTPATH, EVENT_BOX, CANVAS_BOX;
 var helpersForController, handleOccurrencePrompt, switchToView, goToDate, invokeEventDialog;
 var viewForward, deleteCalendars, closeAllEventDialogs, createCalendar, menulistSelect;
 var REC_DLG_ACCEPT, REC_DLG_DAYS;
-var plan_for_modal_dialog, wait_for_modal_dialog;
 
 const HOUR = 8;
 
 function setupModule(module) {
   controller = mozmill.getMail3PaneController();
   ({
     TIMEOUT_MODAL_DIALOG,
     CALENDARNAME,
@@ -36,18 +39,16 @@ function setupModule(module) {
     menulistSelect,
   } = collector.getModule("calendar-utils"));
   collector.getModule("calendar-utils").setupModule(controller);
   Object.assign(module, helpersForController(controller));
 
   ({ REC_DLG_ACCEPT, REC_DLG_DAYS } = collector.getModule("item-editing-helpers"));
   collector.getModule("item-editing-helpers").setupModule(module);
 
-  ({ plan_for_modal_dialog, wait_for_modal_dialog } = collector.getModule("window-helpers"));
-
   createCalendar(controller, CALENDARNAME);
 }
 
 function testWeeklyNRecurrence() {
   goToDate(controller, 2009, 1, 5);
 
   // Create weekly recurring event.
   let eventBox = lookupEventBox("day", CANVAS_BOX, null, 1, HOUR);
--- a/calendar/test/mozmill/cal-recurrence/testWeeklyUntilRecurrence.js
+++ b/calendar/test/mozmill/cal-recurrence/testWeeklyUntilRecurrence.js
@@ -1,23 +1,26 @@
 /* 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/. */
 
 var MODULE_NAME = "testWeeklyUntilRecurrence";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers"];
+
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
 
 var SHORT_SLEEP, TIMEOUT_MODAL_DIALOG, CALENDARNAME, EVENTPATH, EVENT_BOX, CANVAS_BOX;
 var helpersForController, handleOccurrencePrompt, switchToView, goToDate, invokeEventDialog;
 var viewForward, closeAllEventDialogs, deleteCalendars, createCalendar, menulistSelect;
 var REC_DLG_DAYS, REC_DLG_ACCEPT, REC_DLG_UNTIL_INPUT;
-var plan_for_modal_dialog, wait_for_modal_dialog;
 
 const ENDDATE = new Date(2009, 0, 26); // Last Monday in month.
 const HOUR = 8;
 
 function setupModule(module) {
   controller = mozmill.getMail3PaneController();
   ({
     SHORT_SLEEP,
@@ -40,18 +43,16 @@ function setupModule(module) {
   collector.getModule("calendar-utils").setupModule(controller);
   Object.assign(module, helpersForController(controller));
 
   ({ REC_DLG_DAYS, REC_DLG_ACCEPT, REC_DLG_UNTIL_INPUT } = collector.getModule(
     "item-editing-helpers"
   ));
   collector.getModule("item-editing-helpers").setupModule(module);
 
-  ({ plan_for_modal_dialog, wait_for_modal_dialog } = collector.getModule("window-helpers"));
-
   createCalendar(controller, CALENDARNAME);
 }
 
 function testWeeklyUntilRecurrence() {
   goToDate(controller, 2009, 1, 5); // Monday
 
   // Create weekly recurring event.
   let eventBox = lookupEventBox("day", CANVAS_BOX, null, 1, HOUR);
--- a/calendar/test/mozmill/cal-recurrence/testWeeklyWithExceptionRecurrence.js
+++ b/calendar/test/mozmill/cal-recurrence/testWeeklyWithExceptionRecurrence.js
@@ -1,24 +1,27 @@
 /* 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/. */
 
 var MODULE_NAME = "testWeeklyWithExceptionRecurrence";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers"];
+
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var TIMEOUT_MODAL_DIALOG, CALENDARNAME, EVENT_BOX, CANVAS_BOX;
 var DAY_VIEW, WEEK_VIEW, EVENTPATH;
 var helpersForController, handleOccurrencePrompt, switchToView, goToDate;
 var invokeEventDialog, viewForward, closeAllEventDialogs, deleteCalendars, createCalendar;
 var menulistSelect;
 var REPEAT_DETAILS, REC_DLG_ACCEPT, REC_DLG_DAYS;
 var helpersForEditUI, setData;
-var plan_for_modal_dialog, wait_for_modal_dialog;
 
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
 
 const HOUR = 8;
 const STARTDATE = new Date(2009, 0, 6);
 
 function setupModule(module) {
   controller = mozmill.getMail3PaneController();
@@ -48,18 +51,16 @@ function setupModule(module) {
     REPEAT_DETAILS,
     REC_DLG_ACCEPT,
     REC_DLG_DAYS,
     helpersForEditUI,
     setData,
   } = collector.getModule("item-editing-helpers"));
   collector.getModule("item-editing-helpers").setupModule(module);
 
-  ({ plan_for_modal_dialog, wait_for_modal_dialog } = collector.getModule("window-helpers"));
-
   createCalendar(controller, CALENDARNAME);
 }
 
 function testWeeklyWithExceptionRecurrence() {
   goToDate(controller, 2009, 1, 5);
 
   // Create weekly recurring event.
   let eventBox = lookupEventBox("day", CANVAS_BOX, null, 1, HOUR);
--- a/calendar/test/mozmill/eventDialog/testAlarmDialog.js
+++ b/calendar/test/mozmill/eventDialog/testAlarmDialog.js
@@ -1,26 +1,28 @@
 /* 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/. */
 
 var MODULE_NAME = "testAlarmDialog";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers"];
+
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var TIMEOUT_MODAL_DIALOG, CALENDARNAME, EVENTPATH, ALLDAY;
 var helpersForController, switchToView, goToDate, lookupEventBox;
 var invokeEventDialog, viewForward, closeAllEventDialogs, deleteCalendars;
 var createCalendar;
 var setData;
-var plan_for_modal_dialog, wait_for_modal_dialog;
 
 function setupModule(module) {
   controller = mozmill.getMail3PaneController();
-  ({ plan_for_modal_dialog, wait_for_modal_dialog } = collector.getModule("window-helpers"));
   ({
     TIMEOUT_MODAL_DIALOG,
     CALENDARNAME,
     EVENTPATH,
     ALLDAY,
     helpersForController,
     switchToView,
     goToDate,
--- a/calendar/test/mozmill/eventDialog/testEventDialog.js
+++ b/calendar/test/mozmill/eventDialog/testEventDialog.js
@@ -1,36 +1,38 @@
 /* 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/. */
 
 var MODULE_NAME = "testEventDialog";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers"];
+
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
 
 var TIMEOUT_MODAL_DIALOG, CALENDARNAME, EVENTPATH, EVENT_BOX, CANVAS_BOX;
 var helpersForController, handleOccurrencePrompt, switchToView, goToDate, lookupEventBox;
 var invokeEventDialog, checkAlarmIcon, viewBack, closeAllEventDialogs, deleteCalendars;
 var createCalendar;
 var EVENT_TABPANELS, ATTENDEES_ROW;
 var helpersForEditUI, setData;
-var plan_for_modal_dialog, wait_for_modal_dialog;
 
 const EVENTTITLE = "Event";
 const EVENTLOCATION = "Location";
 const EVENTDESCRIPTION = "Event Description";
 const EVENTATTENDEE = "foo@bar.com";
 const EVENTURL = "http://mozilla.org/";
 var firstDay;
 
 function setupModule(module) {
   controller = mozmill.getMail3PaneController();
-  ({ plan_for_modal_dialog, wait_for_modal_dialog } = collector.getModule("window-helpers"));
   ({
     TIMEOUT_MODAL_DIALOG,
     CALENDARNAME,
     EVENTPATH,
     EVENT_BOX,
     CANVAS_BOX,
     helpersForController,
     handleOccurrencePrompt,
--- a/calendar/test/mozmill/eventDialog/testEventDialogModificationPrompt.js
+++ b/calendar/test/mozmill/eventDialog/testEventDialogModificationPrompt.js
@@ -1,28 +1,26 @@
 /* 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/. */
 
 var MODULE_NAME = "testEventDialogModificationPrompt";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "calendar-utils",
-  "item-editing-helpers",
-  "window-helpers",
-  "folder-display-helpers",
-];
+var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers", "folder-display-helpers"];
+
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
 
 var CALENDARNAME, EVENT_BOX, CANVAS_BOX, EVENTPATH;
 var helpersForController, invokeEventDialog, createCalendar, closeAllEventDialogs, deleteCalendars;
 var goToDate;
 var setData;
-var plan_for_modal_dialog, wait_for_modal_dialog;
 var mark_failure;
 
 const TIMEOUT_COMMON_DIALOG = 3000;
 var savePromptAppeared = false;
 var failPoints = {
   first: "no change",
   second: "change all and back",
   third: ["1st pass", "2nd pass", "3rd pass", "4th pass", "5th pass"],
@@ -45,18 +43,16 @@ function setupModule(module) {
     goToDate,
   } = collector.getModule("calendar-utils"));
   collector.getModule("calendar-utils").setupModule(controller);
   Object.assign(module, helpersForController(controller));
 
   ({ setData } = collector.getModule("item-editing-helpers"));
   collector.getModule("item-editing-helpers").setupModule(module);
 
-  ({ plan_for_modal_dialog, wait_for_modal_dialog } = collector.getModule("window-helpers"));
-
   ({ mark_failure } = collector.getModule("folder-display-helpers"));
 
   createCalendar(controller, CALENDARNAME);
 }
 
 // Test that closing an event dialog with no changes does not prompt for save.
 function testEventDialogModificationPrompt() {
   goToDate(controller, 2009, 1, 1);
--- a/calendar/test/mozmill/eventDialog/testEventDialogSize.js
+++ b/calendar/test/mozmill/eventDialog/testEventDialogSize.js
@@ -1,15 +1,15 @@
 /* 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/. */
 
 var MODULE_NAME = "testEventDialogSize";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["calendar-utils", "window-helpers"];
+var MODULE_REQUIRES = ["calendar-utils"];
 
 var helpersForController, invokeEventDialog, createCalendar, closeAllEventDialogs, deleteCalendars;
 var CALENDARNAME;
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 const SMALL_TOLERANCE = 5;
 const LARGE_TOLERANCE = 10;
--- a/calendar/test/mozmill/invitations/test-imip-bar-eml.js
+++ b/calendar/test/mozmill/invitations/test-imip-bar-eml.js
@@ -1,26 +1,25 @@
 /* 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/. */
 
 /**
  * Test that the IMIP bar behaves properly for eml files.
  */
 
-// make -C calendar/test/mozmill SOLO_TEST=invitations/test-imip-bar-eml.js mozmill-one
+/* import-globals-from ../../../../mail/test/mozmill/shared-modules/test-folder-display-helpers.js */
 
 var MODULE_NAME = "testInvitations";
-
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 
-/* globals open_message_from_file, close_window */
+var { close_window } = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
 
 function setupModule(module) {
   for (let dep of MODULE_REQUIRES) {
     collector.getModule(dep).installInto(module);
   }
 }
 
 /**
--- a/calendar/test/mozmill/preferences/testAlarmDefaultValue.js
+++ b/calendar/test/mozmill/preferences/testAlarmDefaultValue.js
@@ -5,42 +5,43 @@
 /**
  * Test default alarm settings for events and tasks
  */
 
 var MODULE_NAME = "testAlarmDefaultValue";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = ["calendar-utils", "content-tab-helpers"];
 
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
 var { PluralForm } = ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 const DEFVALUE = 43;
 
 var helpersForController, invokeEventDialog, openLightningPrefs, closeLightningPrefs;
 var menulistSelect;
-var plan_for_modal_dialog, wait_for_modal_dialog;
 var content_tab_e, content_tab_eid;
 
 var prefTab = null;
 
 function setupModule(module) {
   controller = mozmill.getMail3PaneController();
   ({
     helpersForController,
     invokeEventDialog,
     openLightningPrefs,
     closeLightningPrefs,
     menulistSelect,
   } = collector.getModule("calendar-utils"));
   collector.getModule("calendar-utils").setupModule(controller);
 
-  ({ plan_for_modal_dialog, wait_for_modal_dialog } = collector.getModule("window-helpers"));
-
   ({ content_tab_e, content_tab_eid } = collector.getModule("content-tab-helpers"));
   collector.getModule("content-tab-helpers").setupModule();
 }
 
 function testDefaultAlarms() {
   let localeUnitString = cal.l10n.getCalString("unitDays");
   let unitString = PluralForm.get(DEFVALUE, localeUnitString).replace("#1", DEFVALUE);
   let alarmString = (...args) => cal.l10n.getString("calendar-alarms", ...args);
--- a/calendar/test/mozmill/preferences/testCategoryColors.js
+++ b/calendar/test/mozmill/preferences/testCategoryColors.js
@@ -1,31 +1,32 @@
 /* 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/. */
 
 var MODULE_NAME = "testCategoryColors";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = ["calendar-utils", "content-tab-helpers"];
 
+var { wait_for_frame_load } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var helpersForController, openLightningPrefs, closeLightningPrefs;
-var wait_for_frame_load;
 var content_tab_e, content_tab_eid;
 
 var prefTab = null;
 
 function setupModule(module) {
   controller = mozmill.getMail3PaneController();
   ({ helpersForController, openLightningPrefs, closeLightningPrefs } = collector.getModule(
     "calendar-utils"
   ));
   collector.getModule("calendar-utils").setupModule(controller);
 
-  ({ wait_for_frame_load } = collector.getModule("window-helpers"));
-
   ({ content_tab_e, content_tab_eid } = collector.getModule("content-tab-helpers"));
   collector.getModule("content-tab-helpers").setupModule();
 }
 
 function testCategoryColors() {
   openLightningPrefs(tab => {
     prefTab = tab;
 
--- a/calendar/test/mozmill/recurrenceRotated/testLastDayOfMonthRecurrence.js
+++ b/calendar/test/mozmill/recurrenceRotated/testLastDayOfMonthRecurrence.js
@@ -1,21 +1,24 @@
 /* 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/. */
 
 var MODULE_NAME = "testLastDayOfMonthRecurrenceRotated";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers"];
+
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var TIMEOUT_MODAL_DIALOG, CALENDARNAME, EVENTPATH, EVENT_BOX, CANVAS_BOX;
 var helpersForController, handleOccurrencePrompt, switchToView, goToDate;
 var invokeEventDialog, closeAllEventDialogs, deleteCalendars, createCalendar, menulistSelect;
 var REC_DLG_ACCEPT;
-var plan_for_modal_dialog, wait_for_modal_dialog;
 
 const HOUR = 8;
 
 function setupModule(module) {
   controller = mozmill.getMail3PaneController();
   ({
     TIMEOUT_MODAL_DIALOG,
     CALENDARNAME,
@@ -33,18 +36,16 @@ function setupModule(module) {
     menulistSelect,
   } = collector.getModule("calendar-utils"));
   collector.getModule("calendar-utils").setupModule(controller);
   Object.assign(module, helpersForController(controller));
 
   ({ REC_DLG_ACCEPT } = collector.getModule("item-editing-helpers"));
   collector.getModule("item-editing-helpers").setupModule(module);
 
-  ({ plan_for_modal_dialog, wait_for_modal_dialog } = collector.getModule("window-helpers"));
-
   createCalendar(controller, CALENDARNAME);
   // Rotate view.
   switchToView(controller, "day");
   controller.mainMenu.click("#ltnViewRotated");
   controller.waitFor(() => eid("day-view").getNode().orient == "horizontal");
 }
 
 function testLastDayOfMonthRecurrence() {
--- a/calendar/test/mozmill/recurrenceRotated/testWeeklyNRecurrence.js
+++ b/calendar/test/mozmill/recurrenceRotated/testWeeklyNRecurrence.js
@@ -1,28 +1,31 @@
 /* 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/. */
 
 var MODULE_NAME = "testWeeklyNRecurrenceRotated";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers"];
+
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
 
 var TIMEOUT_MODAL_DIALOG, CALENDARNAME, EVENTPATH, EVENT_BOX, CANVAS_BOX;
 var helpersForController, handleOccurrencePrompt, switchToView, goToDate;
 var invokeEventDialog,
   viewForward,
   closeAllEventDialogs,
   deleteCalendars,
   createCalendar,
   menulistSelect;
 var REC_DLG_ACCEPT, REC_DLG_DAYS;
-var plan_for_modal_dialog, wait_for_modal_dialog;
 
 const HOUR = 8;
 
 function setupModule(module) {
   controller = mozmill.getMail3PaneController();
   ({
     TIMEOUT_MODAL_DIALOG,
     CALENDARNAME,
@@ -41,18 +44,16 @@ function setupModule(module) {
     menulistSelect,
   } = collector.getModule("calendar-utils"));
   collector.getModule("calendar-utils").setupModule(controller);
   Object.assign(module, helpersForController(controller));
 
   ({ REC_DLG_ACCEPT, REC_DLG_DAYS } = collector.getModule("item-editing-helpers"));
   collector.getModule("item-editing-helpers").setupModule(module);
 
-  ({ plan_for_modal_dialog, wait_for_modal_dialog } = collector.getModule("window-helpers"));
-
   createCalendar(controller, CALENDARNAME);
   // Rotate view.
   controller.mainMenu.click("#ltnViewRotated");
   controller.waitFor(() => eid("day-view").getNode().orient == "horizontal");
 }
 
 function testWeeklyNRecurrence() {
   goToDate(controller, 2009, 1, 5);
--- a/calendar/test/mozmill/recurrenceRotated/testWeeklyUntilRecurrence.js
+++ b/calendar/test/mozmill/recurrenceRotated/testWeeklyUntilRecurrence.js
@@ -1,28 +1,31 @@
 /* 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/. */
 
 var MODULE_NAME = "testWeeklyUntilRecurrenceRotated";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers"];
+
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
 
 var SHORT_SLEEP, TIMEOUT_MODAL_DIALOG, CALENDARNAME, EVENTPATH, EVENT_BOX, CANVAS_BOX;
 var helpersForController, handleOccurrencePrompt, switchToView, goToDate;
 var invokeEventDialog,
   viewForward,
   closeAllEventDialogs,
   deleteCalendars,
   createCalendar,
   menulistSelect;
 var REC_DLG_DAYS, REC_DLG_ACCEPT, REC_DLG_UNTIL_INPUT;
-var plan_for_modal_dialog, wait_for_modal_dialog;
 
 const ENDDATE = new Date(2009, 0, 26); // last Monday in month
 const HOUR = 8;
 
 function setupModule(module) {
   controller = mozmill.getMail3PaneController();
   ({
     SHORT_SLEEP,
@@ -45,18 +48,16 @@ function setupModule(module) {
   collector.getModule("calendar-utils").setupModule(controller);
   Object.assign(module, helpersForController(controller));
 
   ({ REC_DLG_DAYS, REC_DLG_ACCEPT, REC_DLG_UNTIL_INPUT } = collector.getModule(
     "item-editing-helpers"
   ));
   collector.getModule("item-editing-helpers").setupModule(module);
 
-  ({ plan_for_modal_dialog, wait_for_modal_dialog } = collector.getModule("window-helpers"));
-
   createCalendar(controller, CALENDARNAME);
   // Rotate view.
   controller.mainMenu.click("#ltnViewRotated");
   controller.waitFor(() => eid("day-view").getNode().orient == "horizontal");
 }
 
 function testWeeklyUntilRecurrence() {
   goToDate(controller, 2009, 1, 5); // Monday
--- a/calendar/test/mozmill/recurrenceRotated/testWeeklyWithExceptionRecurrence.js
+++ b/calendar/test/mozmill/recurrenceRotated/testWeeklyWithExceptionRecurrence.js
@@ -1,24 +1,27 @@
 /* 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/. */
 
 var MODULE_NAME = "testWeeklyWithExceptionRecurrenceRotated";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers"];
+
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var TIMEOUT_MODAL_DIALOG, CALENDARNAME, EVENT_BOX, CANVAS_BOX;
 var DAY_VIEW, WEEK_VIEW, EVENTPATH;
 var helpersForController, handleOccurrencePrompt, switchToView, goToDate;
 var invokeEventDialog, viewForward, closeAllEventDialogs, deleteCalendars, createCalendar;
 var menulistSelect;
 var REPEAT_DETAILS, REC_DLG_ACCEPT, REC_DLG_DAYS;
 var helpersForEditUI, setData;
-var plan_for_modal_dialog, wait_for_modal_dialog;
 
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
 
 const HOUR = 8;
 const STARTDATE = new Date(2009, 0, 6);
 
 function setupModule(module) {
   controller = mozmill.getMail3PaneController();
@@ -48,18 +51,16 @@ function setupModule(module) {
     REPEAT_DETAILS,
     REC_DLG_ACCEPT,
     REC_DLG_DAYS,
     helpersForEditUI,
     setData,
   } = collector.getModule("item-editing-helpers"));
   collector.getModule("item-editing-helpers").setupModule(module);
 
-  ({ plan_for_modal_dialog, wait_for_modal_dialog } = collector.getModule("window-helpers"));
-
   createCalendar(controller, CALENDARNAME);
   // Rotate view.
   controller.mainMenu.click("#ltnViewRotated");
   controller.waitFor(() => eid("day-view").getNode().orient == "horizontal");
 }
 
 function testWeeklyWithExceptionRecurrence() {
   goToDate(controller, 2009, 1, 5);
--- a/calendar/test/mozmill/shared-modules/test-calendar-utils.js
+++ b/calendar/test/mozmill/shared-modules/test-calendar-utils.js
@@ -1,15 +1,19 @@
 /* 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/. */
 
 var MODULE_NAME = "calendar-utils";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["window-helpers", "folder-display-helpers", "pref-window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers", "pref-window-helpers"];
+
+var { close_window, plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var utils = ChromeUtils.import("chrome://mozmill/content/modules/utils.jsm");
 
 var SHORT_SLEEP = 100;
 var MID_SLEEP = 500;
 var TIMEOUT_MODAL_DIALOG = 30000;
 var CALENDARNAME = "Mozmill";
@@ -65,24 +69,19 @@ var EVENTPATH = `
     /{"tooltip":"itemTooltip","calendar":"${CALENDARNAME.toLowerCase()}"}
 `;
 // Used after "${EVENTPATH}/${getEventDetails([view])}/".
 var ALARM_ICON_PATH = `
     anon({"class":"category-box-stack"})/anon({"align":"center"})/
     anon({"class":"alarm-icons-box"})/anon({"class":"reminder-icon"})
 `;
 
-var plan_for_modal_dialog, wait_for_modal_dialog, close_window;
 var open_pref_tab, close_pref_tab;
 
 function setupModule(controller) {
-  ({ plan_for_modal_dialog, wait_for_modal_dialog, close_window } = collector.getModule(
-    "window-helpers"
-  ));
-
   // This setup is needed for pref-win-helpers. For some reason, the automatic
   // loading of modules in shared modules does not setup the module correctly.
   collector.getModule("folder-display-helpers").setupModule();
 
   ({ open_pref_tab, close_pref_tab } = collector.getModule("pref-window-helpers"));
   collector.getModule("pref-window-helpers").setupModule();
 
   // For our tests, we assume that Sunday is start of week.
--- a/calendar/test/mozmill/shared-modules/test-item-editing-helpers.js
+++ b/calendar/test/mozmill/shared-modules/test-item-editing-helpers.js
@@ -1,37 +1,36 @@
 /* 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/. */
 
 var MODULE_NAME = "item-editing-helpers";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["calendar-utils", "window-helpers"];
+var MODULE_REQUIRES = ["calendar-utils"];
+
+var { augment_controller, plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
 
 var SHORT_SLEEP, TIMEOUT_MODAL_DIALOG;
 var helpersForController, menulistSelect;
-var plan_for_modal_dialog, wait_for_modal_dialog, augment_controller;
 var mark_failure;
 
 function setupModule(module) {
   controller = mozmill.getMail3PaneController();
   ({
     SHORT_SLEEP,
     TIMEOUT_MODAL_DIALOG,
     helpersForController,
     menulistSelect,
   } = collector.getModule("calendar-utils"));
   Object.assign(module, helpersForController(controller));
 
-  ({ plan_for_modal_dialog, wait_for_modal_dialog, augment_controller } = collector.getModule(
-    "window-helpers"
-  ));
-
   ({ mark_failure } = collector.getModule("folder-display-helpers"));
 }
 // Lookup paths and path-snippets.
 // These 5 have to be used with itemEditLookup().
 var CATEGORY_LIST = `
     id("event-grid")/id("event-grid-category-color-row")/id("event-grid-category-color-td")
     /id("item-categories")/id("item-categories-popup")
 `;
--- a/calendar/test/mozmill/testBasicFunctionality.js
+++ b/calendar/test/mozmill/testBasicFunctionality.js
@@ -1,21 +1,24 @@
 /* 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/. */
 
 var MODULE_NAME = "testBasicFunctionality";
 var RELATIVE_ROOT = "./shared-modules";
-var MODULE_REQUIRES = ["calendar-utils", "window-helpers"];
+var MODULE_REQUIRES = ["calendar-utils"];
+
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { cal } = ChromeUtils.import("resource://calendar/modules/calUtils.jsm");
 
 var TIMEOUT_MODAL_DIALOG, CALENDARNAME, CALENDAR_PANEL, DAY_VIEW, DAYBOX, MINIMONTH, CALENDARLIST;
 var helpersForController, switchToView, deleteCalendars, handleNewCalendarWizard;
-var plan_for_modal_dialog, wait_for_modal_dialog;
 
 function setupModule(module) {
   controller = mozmill.getMail3PaneController();
   ({
     TIMEOUT_MODAL_DIALOG,
     CALENDARNAME,
     CALENDAR_PANEL,
     DAY_VIEW,
@@ -24,18 +27,16 @@ function setupModule(module) {
     CALENDARLIST,
     helpersForController,
     switchToView,
     deleteCalendars,
     handleNewCalendarWizard,
   } = collector.getModule("calendar-utils"));
   collector.getModule("calendar-utils").setupModule(controller);
   Object.assign(module, helpersForController(controller));
-
-  ({ plan_for_modal_dialog, wait_for_modal_dialog } = collector.getModule("window-helpers"));
 }
 
 function testSmokeTest() {
   let dateFormatter = cal.getDateFormatter();
 
   // Check for minimonth.
   controller.waitForElement(eid("calMinimonth"));
   // Every month has a first.
--- a/calendar/test/mozmill/testLocalICS.js
+++ b/calendar/test/mozmill/testLocalICS.js
@@ -1,22 +1,25 @@
 /* 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/. */
 
 var MODULE_NAME = "testLocalICS";
 var RELATIVE_ROOT = "./shared-modules";
-var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers"];
+
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var TIMEOUT_MODAL_DIALOG, CANVAS_BOX, EVENT_BOX;
 var helpersForController, invokeEventDialog, deleteCalendars, handleNewCalendarWizard;
 var setData;
-var plan_for_modal_dialog, wait_for_modal_dialog;
 
 const HOUR = 8;
 var calendarName, calendarTitle, calendarFile;
 
 function setupModule(module) {
   controller = mozmill.getMail3PaneController();
 
   ({
@@ -29,18 +32,16 @@ function setupModule(module) {
     handleNewCalendarWizard,
   } = collector.getModule("calendar-utils"));
   collector.getModule("calendar-utils").setupModule(controller);
   Object.assign(module, helpersForController(controller));
 
   ({ setData } = collector.getModule("item-editing-helpers"));
   collector.getModule("item-editing-helpers").setupModule(module);
 
-  ({ plan_for_modal_dialog, wait_for_modal_dialog } = collector.getModule("window-helpers"));
-
   // Unique name needed as deleting a calendar only unsubscribes from it and
   // if same file were used on next testrun then previously created event
   // would show up.
   calendarName = calendarTitle = new Date().getTime() + "";
   calendarFile = Services.dirsvc.get("TmpD", Ci.nsIFile);
   calendarFile.append(calendarName + ".ics");
 }
 
--- a/calendar/test/mozmill/testTimezones.js
+++ b/calendar/test/mozmill/testTimezones.js
@@ -1,15 +1,15 @@
 /* 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/. */
 
 var MODULE_NAME = "testTimezones";
 var RELATIVE_ROOT = "./shared-modules";
-var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["calendar-utils", "item-editing-helpers"];
 
 var CANVAS_BOX, DAY_VIEW;
 var helpersForController, invokeEventDialog, switchToView, goToDate;
 var findEventsInNode, viewForward, viewBack;
 var setData;
 
 var DATES = [
   [2009, 1, 1],
--- a/mail/test/mozmill/account/test-ab-whitelist.js
+++ b/mail/test/mozmill/account/test-ab-whitelist.js
@@ -1,25 +1,20 @@
 /* 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-account-manager-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-ab-whitelist";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "account-manager-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "account-manager-helpers"];
 
 var mozmill = ChromeUtils.import(
   "chrome://mozmill/content/modules/mozmill.jsm"
 );
 var controller = ChromeUtils.import(
   "chrome://mozmill/content/modules/controller.jsm"
 );
 var elib = ChromeUtils.import(
@@ -27,18 +22,16 @@ var elib = ChromeUtils.import(
 );
 
 var gOldWhiteList = null;
 var gKeyString = null;
 
 var gAccount = null;
 
 function setupModule(module) {
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
   let amh = collector.getModule("account-manager-helpers");
   amh.installInto(module);
 
   let server = MailServices.accounts.FindServer(
     "tinderbox",
     FAKE_SERVER_HOSTNAME,
--- a/mail/test/mozmill/account/test-account-actions.js
+++ b/mail/test/mozmill/account/test-account-actions.js
@@ -1,30 +1,24 @@
 /* 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-account-manager-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-account-actions";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "account-manager-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "account-manager-helpers"];
 
 var imapAccount, nntpAccount, originalAccountCount;
 
 function setupModule(module) {
-  collector.getModule("window-helpers").installInto(module);
   collector.getModule("folder-display-helpers").installInto(module);
   collector.getModule("account-manager-helpers").installInto(module);
 
   // There may be pre-existing accounts from other tests.
   originalAccountCount = MailServices.accounts.allServers.length;
   // There already should be a Local Folders account created.
   // It is needed for this test.
   assert_true(MailServices.accounts.localFoldersServer);
--- a/mail/test/mozmill/account/test-account-deletion.js
+++ b/mail/test/mozmill/account/test-account-deletion.js
@@ -5,25 +5,20 @@
 /**
  * This test checks proper deletion of an account from the Account manager.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-account-manager-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-account-deletion";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "account-manager-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "account-manager-helpers"];
 
 var gPopAccount, gImapAccount, gOriginalAccountCount;
 
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
   }
 
--- a/mail/test/mozmill/account/test-account-port-setting.js
+++ b/mail/test/mozmill/account/test-account-port-setting.js
@@ -1,25 +1,20 @@
 /* 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-account-manager-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-account-port-setting";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "account-manager-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "account-manager-helpers"];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 
 var { input_value, delete_all_existing } = ChromeUtils.import(
   "resource://testing-common/mozmill/KeyboardHelpers.jsm"
 );
--- a/mail/test/mozmill/account/test-account-settings-infrastructure.js
+++ b/mail/test/mozmill/account/test-account-settings-infrastructure.js
@@ -9,34 +9,28 @@
  *
  * New checks can be added to it as needed.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-account-manager-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-account-settings-infrastructure";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "account-manager-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "account-manager-helpers"];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 
 var gPopAccount, gImapAccount, gOriginalAccountCount;
 
 function setupModule(module) {
-  collector.getModule("window-helpers").installInto(module);
   collector.getModule("folder-display-helpers").installInto(module);
   collector.getModule("account-manager-helpers").installInto(module);
 
   // There may be pre-existing accounts from other tests.
   gOriginalAccountCount = MailServices.accounts.allServers.length;
 
   // Create a POP server
   let popServer = MailServices.accounts
--- a/mail/test/mozmill/account/test-account-tree.js
+++ b/mail/test/mozmill/account/test-account-tree.js
@@ -5,30 +5,24 @@
 /**
  * This test checks proper operation of the account tree in the Account manager.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-account-manager-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-account-tree";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "account-manager-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "account-manager-helpers"];
 
 var gPopAccount, gOriginalAccountCount;
 
 function setupModule(module) {
-  collector.getModule("window-helpers").installInto(module);
   collector.getModule("folder-display-helpers").installInto(module);
   collector.getModule("account-manager-helpers").installInto(module);
 
   // There may be pre-existing accounts from other tests.
   gOriginalAccountCount = MailServices.accounts.allServers.length;
 
   // Create a POP server
   let popServer = MailServices.accounts
--- a/mail/test/mozmill/account/test-account-values.js
+++ b/mail/test/mozmill/account/test-account-values.js
@@ -6,33 +6,31 @@
  * This test checks proper operation of the account settings panes
  * when certain special or invalid values are entered into the fields.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-account-manager-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-account-values";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "account-manager-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "account-manager-helpers"];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 
 var { input_value, delete_all_existing } = ChromeUtils.import(
   "resource://testing-common/mozmill/KeyboardHelpers.jsm"
 );
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var gPopAccount, gOriginalAccountCount;
 
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
   }
 
--- a/mail/test/mozmill/account/test-archive-options.js
+++ b/mail/test/mozmill/account/test-archive-options.js
@@ -1,41 +1,41 @@
 /* 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-account-manager-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-archive-options";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "account-manager-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "account-manager-helpers"];
 
 var mozmill = ChromeUtils.import(
   "chrome://mozmill/content/modules/mozmill.jsm"
 );
 var controller = ChromeUtils.import(
   "chrome://mozmill/content/modules/controller.jsm"
 );
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 
+var {
+  plan_for_modal_dialog,
+  plan_for_window_close,
+  wait_for_modal_dialog,
+  wait_for_window_close,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
+
 var defaultIdentity;
 
 function setupModule(module) {
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
   let amh = collector.getModule("account-manager-helpers");
   amh.installInto(module);
 
   defaultIdentity = MailServices.accounts.defaultAccount.defaultIdentity;
 }
 
--- a/mail/test/mozmill/account/test-mail-account-setup-wizard.js
+++ b/mail/test/mozmill/account/test-mail-account-setup-wizard.js
@@ -1,25 +1,20 @@
 /* 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-account-manager-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-mail-account-setup-wizard";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "account-manager-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "account-manager-helpers"];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 
 var { input_value, delete_all_existing } = ChromeUtils.import(
   "resource://testing-common/mozmill/KeyboardHelpers.jsm"
 );
--- a/mail/test/mozmill/account/test-retest-config.js
+++ b/mail/test/mozmill/account/test-retest-config.js
@@ -1,33 +1,31 @@
 /* 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-account-manager-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-retest-config";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "account-manager-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "account-manager-helpers"];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 
 var { input_value, delete_all_existing } = ChromeUtils.import(
   "resource://testing-common/mozmill/KeyboardHelpers.jsm"
 );
+var { close_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var user = {
   name: "test",
   email: "test@momo.invalid",
   altEmail: "test2@momo.invalid",
 };
--- a/mail/test/mozmill/addrbook/test-address-book.js
+++ b/mail/test/mozmill/addrbook/test-address-book.js
@@ -6,30 +6,31 @@
  * Tests for the address book.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-address-book-helpers.js */
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-address-book";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = [
   "folder-display-helpers",
   "address-book-helpers",
   "compose-helpers",
-  "window-helpers",
 ];
 
 var { gMockPromptService } = ChromeUtils.import(
   "resource://testing-common/mozmill/PromptHelpers.jsm"
 );
+var { plan_for_new_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
--- a/mail/test/mozmill/attachment/test-attachment-events.js
+++ b/mail/test/mozmill/attachment/test-attachment-events.js
@@ -5,25 +5,20 @@
 /**
  * Ensures that attachment events are fired properly
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-attachment-events";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 
 var { select_attachments } = ChromeUtils.import(
   "resource://testing-common/mozmill/AttachmentHelpers.jsm"
 );
 var { gMockPromptService } = ChromeUtils.import(
   "resource://testing-common/mozmill/PromptHelpers.jsm"
--- a/mail/test/mozmill/attachment/test-attachment-in-plain-msg.js
+++ b/mail/test/mozmill/attachment/test-attachment-in-plain-msg.js
@@ -1,28 +1,27 @@
 /* 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-dom-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-attachment-in-plain-msg";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "dom-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "dom-helpers"];
 
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 
+var { close_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
   }
 }
 
 /**
  * Bug 1358565
--- a/mail/test/mozmill/attachment/test-attachment-menus.js
+++ b/mail/test/mozmill/attachment/test-attachment-menus.js
@@ -1,20 +1,19 @@
 /* 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-attachment-menus";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var folder;
 var messenger;
 var epsilon;
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
@@ -176,18 +175,16 @@ var messages = [
     ],
     allMenuStates: { open: false, save: false, detach: false, delete_: false },
   },
 ];
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   messenger = Cc["@mozilla.org/messenger;1"].createInstance(Ci.nsIMessenger);
 
   /* Today's gory details (thanks to Jonathan Protzenko): libmime somehow
    * counts the trailing newline for an attachment MIME part. Most of the time,
    * assuming attachment has N bytes (no matter what's inside, newlines or
    * not), libmime will return N + 1 bytes. On Linux and Mac, this always
    * holds. However, on Windows, if the attachment is not encoded (that is, is
--- a/mail/test/mozmill/attachment/test-attachment-size.js
+++ b/mail/test/mozmill/attachment/test-attachment-size.js
@@ -1,20 +1,19 @@
 /* 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-attachment-size";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var folder;
 var messenger;
 var epsilon;
 
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 var controller = ChromeUtils.import(
   "chrome://mozmill/content/modules/controller.jsm"
--- a/mail/test/mozmill/attachment/test-attachment.js
+++ b/mail/test/mozmill/attachment/test-attachment.js
@@ -5,32 +5,36 @@
 /**
  * Checks various attachments display correctly
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-attachment";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 var EventUtils = ChromeUtils.import(
   "chrome://mozmill/content/stdlib/EventUtils.jsm"
 );
+
+var {
+  close_window,
+  plan_for_modal_dialog,
+  plan_for_new_window,
+  wait_for_modal_dialog,
+  wait_for_new_window,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
+
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var folder;
 var messages;
 
 var textAttachment =
   "One of these days... people like me will rise up and overthrow you, and " +
   "the end of tyranny by the homeostatic machine will have arrived. The day " +
--- a/mail/test/mozmill/cloudfile/test-cloudfile-attachment-urls.js
+++ b/mail/test/mozmill/cloudfile/test-cloudfile-attachment-urls.js
@@ -7,35 +7,36 @@
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-cloudfile-helpers.js */
 /* import-globals-from ../shared-modules/test-dom-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-cloudfile-attachment-urls";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = [
   "folder-display-helpers",
   "compose-helpers",
   "cloudfile-helpers",
   "dom-helpers",
-  "window-helpers",
 ];
 
 var {
   gMockFilePicker,
   gMockFilePickReg,
   select_attachments,
 } = ChromeUtils.import(
   "resource://testing-common/mozmill/AttachmentHelpers.jsm"
 );
+var { close_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 var kUploadedFile = "attachment-uploaded";
 var kHtmlPrefKey = "mail.identity.default.compose_html";
--- a/mail/test/mozmill/cloudfile/test-cloudfile-manager.js
+++ b/mail/test/mozmill/cloudfile/test-cloudfile-manager.js
@@ -8,28 +8,30 @@
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-cloudfile-helpers.js */
 /* import-globals-from ../shared-modules/test-content-tab-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
 /* import-globals-from ../shared-modules/test-pref-window-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-cloudfile-manager";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = [
   "folder-display-helpers",
   "pref-window-helpers",
   "content-tab-helpers",
   "cloudfile-helpers",
-  "window-helpers",
 ];
 
+var { wait_for_frame_load } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var kTestAccountType = "mock";
 var kRootURL = collector.addHttpResource("../cloudfile/html", "");
 var kSettingsWithLink = kRootURL + "settings-with-link.xhtml";
 
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
--- a/mail/test/mozmill/composition/test-address-widgets.js
+++ b/mail/test/mozmill/composition/test-address-widgets.js
@@ -5,25 +5,20 @@
 /**
  * Tests proper enabling of addressing widgets.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-address-widgets";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var { fixIterator } = ChromeUtils.import(
   "resource:///modules/iteratorUtils.jsm"
 );
 
 var cwc = null; // compose window controller
 var accountPOP3 = null;
 var accountNNTP = null;
--- a/mail/test/mozmill/composition/test-attachment-reminder.js
+++ b/mail/test/mozmill/composition/test-attachment-reminder.js
@@ -5,38 +5,42 @@
 /**
  * Tests that the attachment reminder works properly.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-attachment-reminder";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var { delete_all_existing } = ChromeUtils.import(
   "resource://testing-common/mozmill/KeyboardHelpers.jsm"
 );
 var {
   assert_notification_displayed,
   check_notification_displayed,
   get_notification_button,
   wait_for_notification_to_show,
   wait_for_notification_to_stop,
 } = ChromeUtils.import(
   "resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
 );
+var {
+  close_window,
+  plan_for_modal_dialog,
+  plan_for_new_window,
+  plan_for_window_close,
+  wait_for_modal_dialog,
+  wait_for_window_close,
+  wait_for_window_focused,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 var kBoxId = "compose-notification-bottom";
 var kNotificationId = "attachmentReminder";
--- a/mail/test/mozmill/composition/test-attachment.js
+++ b/mail/test/mozmill/composition/test-attachment.js
@@ -5,41 +5,40 @@
 /**
  * Tests attachment handling functionality of the message compose window.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-attachment";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
+var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
+
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
+var { AppConstants } = ChromeUtils.import(
+  "resource://gre/modules/AppConstants.jsm"
+);
 
 var messenger;
 var folder;
 var epsilon;
 var isWindows;
 var filePrefix;
 
-var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
-var { AppConstants } = ChromeUtils.import(
-  "resource://gre/modules/AppConstants.jsm"
-);
-
 var rawAttachment =
   "Can't make the frug contest, Helen; stomach's upset. I'll fix you, " +
   "Ubik! Ubik drops you back in the thick of things fast. Taken as " +
   "directed, Ubik speeds relief to head and stomach. Remember: Ubik is " +
   "only seconds away. Avoid prolonged use.";
 
 var b64Attachment =
   "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAABHNCSVQICAgIfAhkiAAAAAlwS" +
--- a/mail/test/mozmill/composition/test-base64-display.js
+++ b/mail/test/mozmill/composition/test-base64-display.js
@@ -4,24 +4,27 @@
 
 /**
  * Tests that messages with "broken" base64 are correctly displayed.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-base64-display.js";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 
+var { close_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
   }
 }
 
 function test_base64_display() {
   let file = os.getFileForPath(
--- a/mail/test/mozmill/composition/test-blocked-content.js
+++ b/mail/test/mozmill/composition/test-blocked-content.js
@@ -5,31 +5,29 @@
 /**
  * Tests that we do the right thing wrt. blocked resources during composition.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-blocked-content";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "compose-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 
 var { wait_for_notification_to_show } = ChromeUtils.import(
   "resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
 );
+var { plan_for_window_close, wait_for_window_close } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
 
 var gOutboxFolder;
--- a/mail/test/mozmill/composition/test-charset-edit.js
+++ b/mail/test/mozmill/composition/test-charset-edit.js
@@ -6,35 +6,33 @@
  * Tests that we do the right thing wrt. message encoding when editing or
  * replying to messages.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-charset-edit";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 var utils = ChromeUtils.import("chrome://mozmill/content/modules/utils.jsm");
 
 var { wait_for_notification_to_show } = ChromeUtils.import(
   "resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
 );
+var { plan_for_new_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var { MimeParser } = ChromeUtils.import("resource:///modules/mimeParser.jsm");
 
 var gDrafts;
--- a/mail/test/mozmill/composition/test-charset-upgrade.js
+++ b/mail/test/mozmill/composition/test-charset-upgrade.js
@@ -6,25 +6,24 @@
  * Tests that we do the right thing wrt. message encoding, especially when
  * all characters doesn't fit the selected charset.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-charset-upgrade";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "compose-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
+
+var { plan_for_window_close, wait_for_window_close } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 var gDrafts;
 var gOutbox;
--- a/mail/test/mozmill/composition/test-cp932-display.js
+++ b/mail/test/mozmill/composition/test-cp932-display.js
@@ -4,24 +4,27 @@
 
 /**
  * Tests that messages in cp932, Thunderbirds alias for Shift_JIS, are correctly displayed.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-cp932-display.js";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 
+var { close_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
   }
 }
 
 function test_cp932_display() {
   let file = os.getFileForPath(
--- a/mail/test/mozmill/composition/test-draft-identity.js
+++ b/mail/test/mozmill/composition/test-draft-identity.js
@@ -6,25 +6,20 @@
  * Tests that compose new message chooses the correct initial identity when
  * called from the context of an open composer.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-draft-identity";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "compose-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var {
   assert_notification_displayed,
   wait_for_notification_to_show,
 } = ChromeUtils.import(
   "resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
 );
 
--- a/mail/test/mozmill/composition/test-drafts.js
+++ b/mail/test/mozmill/composition/test-drafts.js
@@ -6,29 +6,27 @@
  * Tests draft related functionality:
  * - that we don't allow opening multiple copies of a draft.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-drafts";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var { wait_for_notification_to_show } = ChromeUtils.import(
   "resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
 );
+var { plan_for_new_window, wait_for_window_focused } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 var kBoxId = "mail-notification-top";
 var draftsFolder;
--- a/mail/test/mozmill/composition/test-eml-actions.js
+++ b/mail/test/mozmill/composition/test-eml-actions.js
@@ -5,33 +5,33 @@
 /**
  * Tests that actions such as replying to an .eml works properly.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-eml-actions";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "compose-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
+var elib = ChromeUtils.import(
+  "chrome://mozmill/content/modules/elementslib.jsm"
+);
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
+
+var { close_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
-var elib = ChromeUtils.import(
-  "chrome://mozmill/content/modules/elementslib.jsm"
-);
 
 var gDrafts;
 
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
   }
 
--- a/mail/test/mozmill/composition/test-focus.js
+++ b/mail/test/mozmill/composition/test-focus.js
@@ -5,25 +5,20 @@
 /*
  * Test that cycling through the focus of the 3pane's panes works correctly.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-focus";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
   }
 }
 
 /**
--- a/mail/test/mozmill/composition/test-forward-headers.js
+++ b/mail/test/mozmill/composition/test-forward-headers.js
@@ -6,43 +6,42 @@
  * Tests that headers like References and X-Forwarded-Message-Id are
  * set properly when forwarding messages.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-forward-headers";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var { to_mime_message } = ChromeUtils.import(
   "resource://testing-common/mozmill/MessageHelpers.jsm"
 );
+var {
+  plan_for_modal_dialog,
+  plan_for_window_close,
+  wait_for_modal_dialog,
+  wait_for_window_close,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var cwc = null; // compose window controller
 var folder;
 var gDrafts;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
   let composeHelper = collector.getModule("compose-helpers");
   composeHelper.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   folder = create_folder("Test");
   let thread1 = create_thread(10);
   add_sets_to_folders([folder], [thread1]);
 
   gDrafts = get_special_folder(Ci.nsMsgFolderFlags.Drafts, true);
 
   // Don't create paragraphs in the test.
--- a/mail/test/mozmill/composition/test-forward-rfc822-attach.js
+++ b/mail/test/mozmill/composition/test-forward-rfc822-attach.js
@@ -6,31 +6,31 @@
  * Tests that attached messages (message/rfc822) are correctly sent.
  * It's easiest to test the forward case.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-forward-rfc822-attach";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
+
+var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
+
+var { close_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
-var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 
 var gDrafts;
 
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
   }
 
--- a/mail/test/mozmill/composition/test-forward-utf8.js
+++ b/mail/test/mozmill/composition/test-forward-utf8.js
@@ -5,34 +5,34 @@
 /**
  * Tests that UTF-8 messages are correctly forwarded.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-forward-utf8";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
+
+var elib = ChromeUtils.import(
+  "chrome://mozmill/content/modules/elementslib.jsm"
+);
+var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
+
+var { close_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
-var elib = ChromeUtils.import(
-  "chrome://mozmill/content/modules/elementslib.jsm"
-);
-var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 
 var folderToSendFrom;
 
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
   }
 
--- a/mail/test/mozmill/composition/test-forwarded-content.js
+++ b/mail/test/mozmill/composition/test-forwarded-content.js
@@ -5,25 +5,20 @@
 /**
  * Tests that forwarded content is ok.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-forwarded-content";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "compose-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var folder = null;
 
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
   }
 
--- a/mail/test/mozmill/composition/test-forwarded-eml-actions.js
+++ b/mail/test/mozmill/composition/test-forwarded-eml-actions.js
@@ -6,42 +6,43 @@
  * Tests that actions such as replying and forwarding works correctly from
  * an .eml message that's attached to another mail.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-forwarded-eml-actions";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "compose-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
+
+var elib = ChromeUtils.import(
+  "chrome://mozmill/content/modules/elementslib.jsm"
+);
+
+var {
+  close_window,
+  plan_for_new_window,
+  wait_for_new_window,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
 
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
-var elib = ChromeUtils.import(
-  "chrome://mozmill/content/modules/elementslib.jsm"
-);
 
 var folder;
 
 var msgsubject = "mail client suggestions";
 var msgbodyA = "know of a good email client?";
 var msgbodyB = "hi, i think you may know of an email client to recommend?";
 
 var setupModule = function(module) {
   collector.getModule("folder-display-helpers").installInto(module);
-  collector.getModule("window-helpers").installInto(module);
   collector.getModule("compose-helpers").installInto(module);
 
   folder = create_folder("FwdedEmlTest");
 
   let source =
     "From - Mon Apr  16 22:55:33 2012\n" +
     "Date: Mon, 16 Apr 2012 22:55:33 +0300\n" +
     "From: Mr Example <example@invalid>\n" +
--- a/mail/test/mozmill/composition/test-image-display.js
+++ b/mail/test/mozmill/composition/test-image-display.js
@@ -5,30 +5,30 @@
 /**
  * Tests that we load and display embedded images in messages.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-image-display";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "compose-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
+
+var { close_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var { IOUtils } = ChromeUtils.import("resource:///modules/IOUtils.js");
 
 var gImageFolder;
 
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
   }
--- a/mail/test/mozmill/composition/test-image-insertion-dialog.js
+++ b/mail/test/mozmill/composition/test-image-insertion-dialog.js
@@ -5,43 +5,39 @@
 /**
  * Tests the image insertion dialog functionality.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-image-insertion-dialog";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 
 var { input_value } = ChromeUtils.import(
   "resource://testing-common/mozmill/KeyboardHelpers.jsm"
 );
+var wh = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
-var fdh, ch, wh;
+var fdh, ch;
 
 function setupModule(module) {
   fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
   ch = collector.getModule("compose-helpers");
   ch.installInto(module);
-  wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 }
 
 function test_image_insertion_dialog_persist() {
   let cwc = open_compose_new_mail();
 
   // First focus on the editor element
   cwc.e("content-frame").focus();
 
@@ -56,58 +52,58 @@ function test_image_insertion_dialog_per
 
     // Don't add alternate text
     mwc.click(mwc.eid("noAltTextRadio"));
 
     mwc.window.document.documentElement.acceptDialog();
   });
   cwc.click(cwc.eid("insertImage"));
   wh.wait_for_modal_dialog();
-  wait_for_window_close();
+  wh.wait_for_window_close();
 
   // Check that the radio option persists
   wh.plan_for_modal_dialog("imageDlg", function insert_image(mwc) {
     assert_true(
       mwc.window.document.getElementById("noAltTextRadio").selected,
       "We should persist the previously selected value"
     );
     // We change to "use alt text"
     mwc.click(mwc.eid("altTextRadio"));
     mwc.window.document.documentElement.cancelDialog();
   });
   cwc.click(cwc.eid("insertImage"));
   wh.wait_for_modal_dialog();
-  wait_for_window_close();
+  wh.wait_for_window_close();
 
   // Check that the radio option still persists (be really sure)
   wh.plan_for_modal_dialog("imageDlg", function insert_image(mwc) {
     assert_true(
       mwc.window.document.getElementById("altTextRadio").selected,
       "We should persist the previously selected value"
     );
     // Accept the dialog
     mwc.window.document.documentElement.cancelDialog();
   });
   cwc.click(cwc.eid("insertImage"));
   wh.wait_for_modal_dialog();
-  wait_for_window_close();
+  wh.wait_for_window_close();
 
   // Get the inserted image, double-click it, make sure we switch to "no alt
   // text", despite the persisted value being "use alt text"
   let img = cwc.e("content-frame").contentDocument.querySelector("img");
   wh.plan_for_modal_dialog("imageDlg", function insert_image(mwc) {
     assert_true(
       mwc.window.document.getElementById("noAltTextRadio").selected,
       "We shouldn't use the persisted value because the insert image has no alt text"
     );
     mwc.window.document.documentElement.cancelDialog();
   });
   cwc.doubleClick(new elib.Elem(img));
   wh.wait_for_modal_dialog();
-  wait_for_window_close();
+  wh.wait_for_window_close();
   // It's not clear why we have to wait here to avoid test failures,
   // see bug 1246094.
   cwc.sleep(500);
 
   // Now use some alt text for the edit image dialog
   wh.plan_for_modal_dialog("imageDlg", function insert_image(mwc) {
     assert_true(
       mwc.window.document.getElementById("noAltTextRadio").selected,
@@ -119,29 +115,29 @@ function test_image_insertion_dialog_per
     srcloc.focus();
     input_value(mwc, "some alt text");
     mwc.sleep(0);
     // Accept the dialog
     mwc.window.document.documentElement.acceptDialog();
   });
   cwc.doubleClick(new elib.Elem(img));
   wh.wait_for_modal_dialog();
-  wait_for_window_close();
+  wh.wait_for_window_close();
   // It's not clear why we have to wait here to avoid test failures,
   // see bug 1246094.
   cwc.sleep(500);
 
   // Make sure next time we edit it, we still have "use alt text" selected.
   img = cwc.e("content-frame").contentDocument.querySelector("img");
   wh.plan_for_modal_dialog("imageDlg", function insert_image(mwc) {
     assert_true(
       mwc.window.document.getElementById("altTextRadio").selected,
       "We edited the image to make it have alt text, we should keep it selected"
     );
     // Accept the dialog
     mwc.window.document.documentElement.cancelDialog();
   });
   cwc.doubleClick(new elib.Elem(img));
   wh.wait_for_modal_dialog();
-  wait_for_window_close();
+  wh.wait_for_window_close();
 
   close_compose_window(cwc);
 }
--- a/mail/test/mozmill/composition/test-multipart-related.js
+++ b/mail/test/mozmill/composition/test-multipart-related.js
@@ -5,36 +5,38 @@
 /**
  * Tests that multipart/related messages are handled properly.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-multipart-related";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "compose-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
+var elib = ChromeUtils.import(
+  "chrome://mozmill/content/modules/elementslib.jsm"
+);
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
+var utils = ChromeUtils.import("chrome://mozmill/content/modules/utils.jsm");
+
+var {
+  plan_for_modal_dialog,
+  wait_for_modal_dialog,
+  wait_for_window_close,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
+
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var { MimeParser } = ChromeUtils.import("resource:///modules/mimeParser.jsm");
-var elib = ChromeUtils.import(
-  "chrome://mozmill/content/modules/elementslib.jsm"
-);
-var utils = ChromeUtils.import("chrome://mozmill/content/modules/utils.jsm");
 
 var gDrafts;
 
 function setupModule(module) {
   for (let req of MODULE_REQUIRES) {
     collector.getModule(req).installInto(module);
   }
   gDrafts = get_special_folder(Ci.nsMsgFolderFlags.Drafts, true);
--- a/mail/test/mozmill/composition/test-newmsg-compose-identity.js
+++ b/mail/test/mozmill/composition/test-newmsg-compose-identity.js
@@ -6,25 +6,24 @@
  * Tests that compose new message chooses the correct initial identity when
  * called from the context of an open composer.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-newmsg-compose-identity";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "compose-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
+
+var { plan_for_new_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 var gInbox;
 var gDrafts;
 var account;
--- a/mail/test/mozmill/composition/test-reply-addresses.js
+++ b/mail/test/mozmill/composition/test-reply-addresses.js
@@ -7,42 +7,36 @@
  * reply to sender, reply to all, reply to list, mail-followup-tp,
  * mail-reply-to, and reply to self.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-reply-addresses";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "compose-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var folder;
 var i = 0;
 
 var myEmail = "me@example.com";
 var myEmail2 = "otherme@example.com";
 
 var identity;
 var identity2;
 
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 function setupModule(module) {
   collector.getModule("folder-display-helpers").installInto(module);
-  collector.getModule("window-helpers").installInto(module);
   collector.getModule("compose-helpers").installInto(module);
 
   // Now set up an account with some identities.
   let acctMgr = MailServices.accounts;
   let account = acctMgr.createAccount();
   account.incomingServer = acctMgr.createIncomingServer(
     "nobody",
     "Reply Addresses Testing",
--- a/mail/test/mozmill/composition/test-reply-format-flowed.js
+++ b/mail/test/mozmill/composition/test-reply-format-flowed.js
@@ -5,33 +5,32 @@
 /**
  * Tests that the reply to a format=flowed message is also flowed.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-reply-format-flowed";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
+
+var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
+
+var { close_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
-var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
-
 var gDrafts;
 
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
   }
 
   gDrafts = get_special_folder(Ci.nsMsgFolderFlags.Drafts, true);
--- a/mail/test/mozmill/composition/test-reply-multipart-charset.js
+++ b/mail/test/mozmill/composition/test-reply-multipart-charset.js
@@ -19,31 +19,30 @@
  * For good measure some tests are included for charset overriding
  * and enforcing the charset default.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-reply-multipart-charset";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 
+var { close_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var folderToStoreMessages;
 
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
   }
 
   folderToStoreMessages = create_folder("FolderWithMessages");
--- a/mail/test/mozmill/composition/test-reply-signature.js
+++ b/mail/test/mozmill/composition/test-reply-signature.js
@@ -5,25 +5,20 @@
 /**
  * Tests the mail.strip_sig_on_reply pref.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-reply-signature";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var sig = "roses are red";
 var folder;
 
 function setupModule(module) {
   for (let req of MODULE_REQUIRES) {
--- a/mail/test/mozmill/composition/test-save-changes-on-quit.js
+++ b/mail/test/mozmill/composition/test-save-changes-on-quit.js
@@ -7,25 +7,20 @@
  * try to quit/close with an open compose window with unsaved changes, and
  * that we don't prompt if there are no changes.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-save-changes-on-quit";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var SAVE = 0;
 var CANCEL = 1;
 var DONT_SAVE = 2;
 
 var { gMockPromptService } = ChromeUtils.import(
   "resource://testing-common/mozmill/PromptHelpers.jsm"
 );
--- a/mail/test/mozmill/composition/test-send-button.js
+++ b/mail/test/mozmill/composition/test-send-button.js
@@ -6,41 +6,42 @@
  * Tests proper enabling of send buttons depending on addresses input.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-address-book-helpers.js */
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-send-button";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = [
   "folder-display-helpers",
   "compose-helpers",
-  "window-helpers",
   "address-book-helpers",
 ];
 
+var elib = ChromeUtils.import(
+  "chrome://mozmill/content/modules/elementslib.jsm"
+);
+
+var { wait_for_frame_load } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
 
-var elib = ChromeUtils.import(
-  "chrome://mozmill/content/modules/elementslib.jsm"
-);
-
 var account = null;
 
 function setupModule(module) {
   collector.getModule("folder-display-helpers").installInto(module);
   collector.getModule("compose-helpers").installInto(module);
-  collector.getModule("window-helpers").installInto(module);
   collector.getModule("address-book-helpers").installInto(module);
 
   // Ensure we're in the tinderbox account as that has the right identities set
   // up for this test.
   let server = MailServices.accounts.FindServer(
     "tinderbox",
     FAKE_SERVER_HOSTNAME,
     "pop3"
--- a/mail/test/mozmill/composition/test-send-format.js
+++ b/mail/test/mozmill/composition/test-send-format.js
@@ -6,28 +6,27 @@
  * Tests resulting send format of a message dependent on using HTML features
  * in the composition.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-send-format";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 
+var { close_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
   }
 }
 
 function checkMsgFile(aFilePath, aConvertibility) {
   let file = os.getFileForPath(
--- a/mail/test/mozmill/composition/test-signature-updating.js
+++ b/mail/test/mozmill/composition/test-signature-updating.js
@@ -11,25 +11,20 @@
 
 // mail.identity.id2.htmlSigFormat = true
 // mail.identity.id2.htmlSigText   = "Tinderboxpushlog is the new <b>hotness!</b>"
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-signature-updating";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var cwc = null; // compose window controller
 
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
--- a/mail/test/mozmill/content-policy/test-compose-mailto.js
+++ b/mail/test/mozmill/content-policy/test-compose-mailto.js
@@ -2,50 +2,50 @@
  * 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-content-tab-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-compose-mailto";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = [
   "folder-display-helpers",
   "compose-helpers",
-  "window-helpers",
   "content-tab-helpers",
 ];
 
 var { input_value } = ChromeUtils.import(
   "resource://testing-common/mozmill/KeyboardHelpers.jsm"
 );
+var {
+  plan_for_modal_dialog,
+  wait_for_modal_dialog,
+  wait_for_window_close,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
 
 var folder = null;
 var composeHelper = null;
-var windowHelper = null;
 var gMsgNo = 0;
 var gComposeWin;
 var gNewTab;
 var gPreCount;
 
 // RELATIVE_ROOT messes with the collector, so we have to bring the path back
 // so we get the right path for the resources.
 var url = collector.addHttpResource("../content-policy/html", "content");
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
   composeHelper = collector.getModule("compose-helpers");
   composeHelper.installInto(module);
-  windowHelper = collector.getModule("window-helpers");
-  windowHelper.installInto(module);
   let cth = collector.getModule("content-tab-helpers");
   cth.installInto(module);
 }
 
 function test_openComposeFromMailToLink() {
   // Open a content tab with the mailto link in it.
   // To open a tab we're going to have to cheat and use tabmail so we can load
   // in the data of what we want.
@@ -56,33 +56,33 @@ function test_openComposeFromMailToLink(
   );
 }
 
 function test_checkInsertImage() {
   // First focus on the editor element
   gComposeWin.e("content-frame").focus();
 
   // Now open the image window
-  windowHelper.plan_for_modal_dialog("imageDlg", function insert_image(mwc) {
+  plan_for_modal_dialog("imageDlg", function insert_image(mwc) {
     // Insert the url of the image.
     let srcloc = mwc.window.document.getElementById("srcInput");
     srcloc.focus();
 
     input_value(mwc, url + "pass.png");
     mwc.sleep(0);
 
     // Don't add alternate text
     mwc.click(mwc.eid("noAltTextRadio"));
 
     // Accept the dialog
     mwc.window.document.getElementById("imageDlg").acceptDialog();
   });
   gComposeWin.click(gComposeWin.eid("insertImage"));
 
-  windowHelper.wait_for_modal_dialog();
+  wait_for_modal_dialog();
   wait_for_window_close();
 
   //  gComposeWin.sleep(500);
 
   // Test that the image load has not been denied
   let childImages = gComposeWin
     .e("content-frame")
     .contentDocument.getElementsByTagName("img");
--- a/mail/test/mozmill/content-policy/test-general-content-policy.js
+++ b/mail/test/mozmill/content-policy/test-general-content-policy.js
@@ -17,23 +17,21 @@
  * - Feed message
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-content-tab-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-general-content-policy";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = [
   "folder-display-helpers",
-  "window-helpers",
   "compose-helpers",
   "content-tab-helpers",
 ];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
@@ -43,16 +41,23 @@ var { input_value } = ChromeUtils.import
 );
 var {
   get_notification_button,
   wait_for_notification_to_show,
   wait_for_notification_to_stop,
 } = ChromeUtils.import(
   "resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
 );
+var {
+  plan_for_modal_dialog,
+  plan_for_new_window,
+  wait_for_modal_dialog,
+  wait_for_new_window,
+  wait_for_window_close,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 var folder = null;
 var gMsgNo = 0;
--- a/mail/test/mozmill/content-policy/test-js-content-policy.js
+++ b/mail/test/mozmill/content-policy/test-js-content-policy.js
@@ -7,21 +7,20 @@
  *
  * @note This assumes an existing local account, and will cause the Trash
  * folder of that account to be emptied multiple times.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-js-content-policy";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var folder = null;
 
 // RELATIVE_ROOT messes with the collector, so we have to bring the path back
 // so we get the right path for the resources.
 var url = collector.addHttpResource("../content-policy/html", "content");
 
 function setupModule(module) {
--- a/mail/test/mozmill/content-policy/test-plugins-policy.js
+++ b/mail/test/mozmill/content-policy/test-plugins-policy.js
@@ -7,27 +7,29 @@
  * As of bug 1508942, plugins are no longer enabled in any context.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-content-tab-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-plugins-policy";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = [
   "folder-display-helpers",
-  "window-helpers",
   "compose-helpers",
   "content-tab-helpers",
 ];
 
+var { plan_for_new_window, wait_for_new_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var folder = null;
 var composeHelper = null;
 var gMsgNo = 0;
 
 // RELATIVE_ROOT messes with the collector, so we have to bring the path back
 // so we get the right path for the resources.
@@ -43,18 +45,16 @@ var msgBody =
   "</head>\n" +
   '<body bgcolor="#ffffff" text="#000000">\n' +
   '<embed id="testelement" type="application/x-test" width="400" height="400" border="1"></embed>\n' +
   "</body>\n</html>\n";
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
   composeHelper = collector.getModule("compose-helpers");
   composeHelper.installInto(module);
   let cth = collector.getModule("content-tab-helpers");
   cth.installInto(module);
 
   folder = create_folder("pluginPolicy");
 }
 
--- a/mail/test/mozmill/content-policy/test-view-source.js
+++ b/mail/test/mozmill/content-policy/test-view-source.js
@@ -4,26 +4,31 @@
 
 /**
  * Test that view-source content can be reloaded to change encoding.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-view-source";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 
+var {
+  close_window,
+  plan_for_new_window,
+  wait_for_new_window,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
+
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var folder = null;
 
 function setupModule(module) {
   for (let dep of MODULE_REQUIRES) {
     collector.getModule(dep).installInto(module);
   }
--- a/mail/test/mozmill/content-tabs/test-about-support.js
+++ b/mail/test/mozmill/content-tabs/test-about-support.js
@@ -2,27 +2,29 @@
  * 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-content-tab-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-about-support";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = [
   "folder-display-helpers",
   "content-tab-helpers",
   "compose-helpers",
-  "window-helpers",
 ];
 
+var { plan_for_new_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 // eslint-disable-next-line mozilla/reject-importGlobalProperties
 Cu.importGlobalProperties(["DOMParser"]);
 
 var warningText = new Map();
 
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
--- a/mail/test/mozmill/content-tabs/test-addons-mgr.js
+++ b/mail/test/mozmill/content-tabs/test-addons-mgr.js
@@ -1,30 +1,31 @@
 /* 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-content-tab-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-addons-mgr";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "content-tab-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "content-tab-helpers"];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 
+var {
+  plan_for_modal_dialog,
+  wait_for_modal_dialog,
+  wait_for_window_close,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
+
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
   }
 }
 
 function test_open_addons_with_url() {
   mc.window.openAddonsMgr("addons://list/theme");
--- a/mail/test/mozmill/content-tabs/test-content-tab.js
+++ b/mail/test/mozmill/content-tabs/test-content-tab.js
@@ -2,36 +2,39 @@
  * 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-content-tab-helpers.js */
 /* import-globals-from ../shared-modules/test-dom-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-content-tab";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = [
   "folder-display-helpers",
   "content-tab-helpers",
   "dom-helpers",
-  "window-helpers",
 ];
 
 var controller = ChromeUtils.import(
   "chrome://mozmill/content/modules/controller.jsm"
 );
 var mozmill = ChromeUtils.import(
   "chrome://mozmill/content/modules/mozmill.jsm"
 );
 var elementslib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
+
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 // RELATIVE_ROOT messes with the collector, so we have to bring the path back
 // so we get the right path for the resources.
 // Note: this one adds to '' as we need to make sure that favicon.ico is in the
 // root directory.
 var url = collector.addHttpResource("../content-tabs/html", "");
 var whatsUrl = url + "whatsnew.html";
--- a/mail/test/mozmill/content-tabs/test-install-xpi.js
+++ b/mail/test/mozmill/content-tabs/test-install-xpi.js
@@ -1,25 +1,20 @@
 /* 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-content-tab-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-install-xpi";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "window-helpers",
-  "folder-display-helpers",
-  "content-tab-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "content-tab-helpers"];
 
 var controller = ChromeUtils.import(
   "chrome://mozmill/content/modules/controller.jsm"
 );
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 var mozmill = ChromeUtils.import(
@@ -30,18 +25,16 @@ var { Services } = ChromeUtils.import("r
 // RELATIVE_ROOT messes with the collector, so we have to bring the path back
 // so we get the right path for the resources.
 var url = collector.addHttpResource("../content-tabs/html", "content-tabs");
 
 var gDocument;
 var gNewTab;
 
 function setupModule(module) {
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
   let cth = collector.getModule("content-tab-helpers");
   cth.installInto(module);
 
   gDocument = mc.window.document;
   gNewTab = open_content_tab_with_url(
     url + "installxpi.html",
--- a/mail/test/mozmill/cookies/test-cookies.js
+++ b/mail/test/mozmill/cookies/test-cookies.js
@@ -7,35 +7,28 @@
  *
  * XXX: Still need to check remote content in messages.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-content-tab-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-cookies";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "window-helpers",
-  "content-tab-helpers",
-  "folder-display-helpers",
-];
+var MODULE_REQUIRES = ["content-tab-helpers", "folder-display-helpers"];
 
 // RELATIVE_ROOT messes with the collector, so we have to bring the path back
 // so we get the right path for the resources.
 var url = collector.addHttpResource("../cookies/html", "cookies");
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
   let cth = collector.getModule("content-tab-helpers");
   cth.installInto(module);
 }
 
 /**
  * Test deleting junk messages with no messages marked as junk.
  */
 function test_load_cookie_page() {
--- a/mail/test/mozmill/downloads/test-about-downloads.js
+++ b/mail/test/mozmill/downloads/test-about-downloads.js
@@ -6,31 +6,33 @@
  * Test about:downloads.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-content-tab-helpers.js */
 /* import-globals-from ../shared-modules/test-dom-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-about-downloads";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = [
   "content-tab-helpers",
   "dom-helpers",
   "folder-display-helpers",
-  "window-helpers",
 ];
 
 var elementslib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 
+var { wait_for_browser_load } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var { gMockFilePicker, gMockFilePickReg } = ChromeUtils.import(
   "resource://testing-common/mozmill/AttachmentHelpers.jsm"
 );
 
 var downloads = ChromeUtils.import("resource://gre/modules/Downloads.jsm");
 
 var downloadsTab;
 
--- a/mail/test/mozmill/folder-display/test-archive-messages.js
+++ b/mail/test/mozmill/folder-display/test-archive-messages.js
@@ -1,33 +1,30 @@
 /* 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-archive-messages";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var folder;
 
 /**
  * The number of messages in the thread we use to test.
  */
 var NUM_MESSAGES_IN_THREAD = 6;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   folder = create_folder("ThreadedMessages");
   let thread = create_thread(NUM_MESSAGES_IN_THREAD);
   add_sets_to_folders([folder], [thread]);
   thread = create_thread(NUM_MESSAGES_IN_THREAD);
   add_sets_to_folders([folder], [thread]);
 }
 
--- a/mail/test/mozmill/folder-display/test-close-window-on-delete.js
+++ b/mail/test/mozmill/folder-display/test-close-window-on-delete.js
@@ -4,29 +4,32 @@
 
 /*
  * Test that the close message window on delete option works.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-close-window-on-delete";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
+
+var {
+  close_window,
+  plan_for_window_close,
+  wait_for_window_close,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
 
 var folder;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   folder = create_folder("CloseWindowOnDeleteA");
 
   make_new_sets_in_folder(folder, [{ count: 10 }]);
 }
 
 /**
  * Delete a message and check that the message window is closed
--- a/mail/test/mozmill/folder-display/test-columns.js
+++ b/mail/test/mozmill/folder-display/test-columns.js
@@ -6,26 +6,32 @@
  * Test column default logic and persistence logic.  Persistence comes in both
  *  tab-switching (because of the multiplexed implementation) and
  *  folder-switching forms.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-columns";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 
+var {
+  plan_for_modal_dialog,
+  plan_for_observable_event,
+  wait_for_modal_dialog,
+  wait_for_observable_event,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
+
 // needed to zero inter-folder processing delay
 var { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
 var folderInbox, folderSent, folderVirtual, folderA, folderB;
 // INBOX_DEFAULTS sans 'dateCol' but gains 'tagsCol'
 var columnsB;
 // GLODA_DEFAULTS sans 'locationCol' but gains 'accountCol'
 var glodaColumns;
@@ -39,18 +45,16 @@ var useCorrespondent;
 var INBOX_DEFAULTS;
 var SENT_DEFAULTS;
 var VIRTUAL_DEFAULTS;
 var GLODA_DEFAULTS;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   useCorrespondent = Services.prefs.getBoolPref(
     "mail.threadpane.use_correspondents"
   );
   INBOX_DEFAULTS = [
     "threadCol",
     "flaggedCol",
     "attachmentCol",
--- a/mail/test/mozmill/folder-display/test-deletion-from-virtual-folders.js
+++ b/mail/test/mozmill/folder-display/test-deletion-from-virtual-folders.js
@@ -4,38 +4,42 @@
 
 /*
  * Test that deleting messages works from a virtual folder.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-deletion-from-virtual-folders";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
+
+var {
+  plan_for_modal_dialog,
+  plan_for_window_close,
+  wait_for_modal_dialog,
+  wait_for_window_close,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
 
 var baseFolder, folder, lastMessageFolder;
 
 var tabFolder, tabMessage, tabMessageBackground, curMessage, nextMessage;
 
 var setNormal;
 
 /**
  * The message window controller.
  */
 var msgc;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   baseFolder = create_folder("DeletionFromVirtualFoldersA");
   // For setTagged, we want exactly as many messages as we plan to delete, so
   // that we can test that the message window and tabs close when they run out
   // of things to display.
   let [, setTagged] = make_new_sets_in_folder(baseFolder, [
     { count: 4 },
     { count: 4 },
--- a/mail/test/mozmill/folder-display/test-deletion-with-multiple-displays.js
+++ b/mail/test/mozmill/folder-display/test-deletion-with-multiple-displays.js
@@ -8,36 +8,37 @@
  *  message tab title updates appropriately through all of this. We do all of
  *  this both for tabs that have ever been opened in the foreground, and tabs
  *  that haven't (and thus might have fake selections).
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-deletion-with-multiple-displays";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
+
+var { plan_for_window_close, wait_for_window_close } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var folder,
   lastMessageFolder,
   oneBeforeFolder,
   oneAfterFolder,
   multipleDeletionFolder1,
   multipleDeletionFolder2,
   multipleDeletionFolder3,
   multipleDeletionFolder4;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   folder = create_folder("DeletionA");
   lastMessageFolder = create_folder("DeletionB");
   oneBeforeFolder = create_folder("DeletionC");
   oneAfterFolder = create_folder("DeletionD");
   multipleDeletionFolder1 = create_folder("DeletionE");
   multipleDeletionFolder2 = create_folder("DeletionF");
   multipleDeletionFolder3 = create_folder("DeletionG");
--- a/mail/test/mozmill/folder-display/test-displaying-messages-in-folder-tabs.js
+++ b/mail/test/mozmill/folder-display/test-displaying-messages-in-folder-tabs.js
@@ -8,25 +8,24 @@
  * - dropping view filters to select the message
  * - displaying the message in an existing folder tab
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
 /* import-globals-from ../shared-modules/test-search-window-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-displaying-messages-in-folder-tabs";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "search-window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "search-window-helpers"];
+
+var { plan_for_window_close, wait_for_window_close } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var folderA;
 var folderB;
 var folderC;
 
 var folderTab;
 
 var msgHdrsInFolderA = [],
@@ -43,18 +42,16 @@ function* _generateIndexes() {
     index = (index + 1) % NUM_MESSAGES_IN_FOLDER;
   }
 }
 var indexes = _generateIndexes();
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
   let sh = collector.getModule("search-window-helpers");
   sh.installInto(module);
 
   folderA = create_folder("DisplayMessageFolderTabA");
   folderB = create_folder("DisplayMessageFolderTabB");
   folderC = create_folder("DisplayMessageFolderTabC");
   make_new_sets_in_folder(folderA, [{ count: NUM_MESSAGES_IN_FOLDER }]);
   let [, taggedMsg] = make_new_sets_in_folder(folderB, [
--- a/mail/test/mozmill/folder-display/test-folder-pane-visibility.js
+++ b/mail/test/mozmill/folder-display/test-folder-pane-visibility.js
@@ -5,29 +5,26 @@
 /*
  * Test that the folder pane collapses properly, stays collapsed amongst tab
  * changes, and that persistence works (to a first approximation).
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-folder-pane-visibility";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var folder;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   folder = create_folder("FolderPaneVisibility");
   make_new_sets_in_folder(folder, [{ count: 3 }]);
 }
 
 /**
  * When displaying a folder, assert that the folder pane is visible and all the
  * menus, splitters, etc. are set up right.
--- a/mail/test/mozmill/folder-display/test-folder-toolbar.js
+++ b/mail/test/mozmill/folder-display/test-folder-toolbar.js
@@ -5,29 +5,26 @@
 /*
  * Test that opening new folder and message tabs has the expected result and
  *  that closing them doesn't break anything.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-folder-toolbar";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var folderA, folderB;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   folderA = create_folder("FolderToolbarA");
   // we need one message to select and open
   folderB = create_folder("FolderToolbarB");
   make_new_sets_in_folder(folderB, [{ count: 1 }]);
 }
 
 function test_add_folder_toolbar() {
--- a/mail/test/mozmill/folder-display/test-invalid-db-folder-load.js
+++ b/mail/test/mozmill/folder-display/test-invalid-db-folder-load.js
@@ -6,17 +6,16 @@
  * Test that clicking on a folder with an invalid or missing .msf file
  * regenerates the.msf file and loads the view.
  * Also, check that rebuilding the index on a loaded folder reloads the folder.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-invalid-db-folder-load";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var folder;
 var setA;
 
--- a/mail/test/mozmill/folder-display/test-mail-views.js
+++ b/mail/test/mozmill/folder-display/test-mail-views.js
@@ -1,36 +1,38 @@
 /* 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-mail-views";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
+
+var elib = ChromeUtils.import(
+  "chrome://mozmill/content/modules/elementslib.jsm"
+);
+
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
+var { MailViewConstants } = ChromeUtils.import(
+  "resource:///modules/MailViewManager.jsm"
+);
 
 var baseFolder, savedFolder;
 var setUntagged, setTagged;
 
-var { MailViewConstants } = ChromeUtils.import(
-  "resource:///modules/MailViewManager.jsm"
-);
-var elib = ChromeUtils.import(
-  "chrome://mozmill/content/modules/elementslib.jsm"
-);
-
 var setupModule = function(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   // Create a folder with some messages that have no tags and some that are
   //  tagged Important ($label1).
   baseFolder = create_folder("MailViewA");
   [setUntagged, setTagged] = make_new_sets_in_folder(baseFolder, [{}, {}]);
   setTagged.addTag("$label1"); // Important, by default
 };
 
--- a/mail/test/mozmill/folder-display/test-message-commands-on-msgstore.js
+++ b/mail/test/mozmill/folder-display/test-message-commands-on-msgstore.js
@@ -8,25 +8,24 @@
  * markings on the messages are stored in the msgStore, not only in the database.
  * For now, it checks for bug 840418.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-message-commands-on-msgstore";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "compose-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
+
+var { plan_for_window_close, wait_for_window_close } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var { IOUtils } = ChromeUtils.import("resource:///modules/IOUtils.js");
 
 var statusHeader = "X-Mozilla-Status: ";
--- a/mail/test/mozmill/folder-display/test-message-commands.js
+++ b/mail/test/mozmill/folder-display/test-message-commands.js
@@ -7,43 +7,40 @@
  * that can't be tested with xpcshell tests because they're handling in the
  * front end - which is why Archive is the only command currently tested.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-content-tab-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-message-commands";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "content-tab-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "content-tab-helpers"];
+
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
 var unreadFolder, shiftDeleteFolder, threadDeleteFolder;
 var archiveSrcFolder = null;
 var archiveURI;
 
 var acctMgr;
 var tagArray;
 
 var setupModule = function(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
   let cth = collector.getModule("content-tab-helpers");
   cth.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   unreadFolder = create_folder("UnreadFolder");
   shiftDeleteFolder = create_folder("ShiftDeleteFolder");
   threadDeleteFolder = create_folder("ThreadDeleteFolder");
   archiveSrcFolder = create_folder("ArchiveSrc");
 
   make_new_sets_in_folder(unreadFolder, [{ count: 2 }]);
   make_new_sets_in_folder(shiftDeleteFolder, [{ count: 3 }]);
--- a/mail/test/mozmill/folder-display/test-message-pane-visibility.js
+++ b/mail/test/mozmill/folder-display/test-message-pane-visibility.js
@@ -5,29 +5,26 @@
 /*
  * Test that the message pane collapses properly, stays collapsed amongst tab
  *  changes, and that persistence works (to a first approximation).
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-message-pane-visibility";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var folder;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   folder = create_folder("MessagePaneVisibility");
   make_new_sets_in_folder(folder, [{ count: 3 }]);
 }
 
 /**
  * By default, the message pane should be visible.  Make sure that this state of
  *  affairs is correct in terms of menu options, splitters, etc.
--- a/mail/test/mozmill/folder-display/test-message-window.js
+++ b/mail/test/mozmill/folder-display/test-message-window.js
@@ -5,30 +5,34 @@
 /*
  * Test that we can open and close a standalone message display window from the
  *  folder pane.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-message-window";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
+
+var {
+  plan_for_modal_dialog,
+  plan_for_window_close,
+  wait_for_modal_dialog,
+  wait_for_window_close,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
 
 var folderA, folderB;
 var curMessage;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   folderA = create_folder("MessageWindowA");
   folderB = create_folder("MessageWindowB");
   // create three messages in the folder to display
   let msg1 = create_thread(1);
   let msg2 = create_thread(1);
   let thread1 = create_thread(2);
   let thread2 = create_thread(2);
--- a/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js
+++ b/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js
@@ -6,38 +6,39 @@
  * Test that messages without a backing view are opened correctly. Examples of
  * messages without a backing view are those opened from the command line or
  * desktop search integration results.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-opening-messages-without-a-backing-view";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
+
+var { plan_for_new_window, wait_for_new_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
 // One folder's enough
 var folder = null;
 
 // A list of the message headers in this folder
 var msgHdrsInFolder = null;
 
 // Number of messages to open for multi-message tests
 var NUM_MESSAGES_TO_OPEN = 5;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   folder = create_folder("OpeningMessagesNoBackingViewA");
   make_new_sets_in_folder(folder, [{ count: 10 }]);
   // We don't obey mail view persistence unless the view picker is there
   add_to_toolbar(mc.e("mail-bar3"), "mailviews-container");
 }
 
 /**
--- a/mail/test/mozmill/folder-display/test-opening-messages.js
+++ b/mail/test/mozmill/folder-display/test-opening-messages.js
@@ -14,33 +14,34 @@
  *   that multiple messages opened in windows are just the same function called
  *   repeatedly.)
  * - reusing an existing window to show another message
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-opening-messages";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
+
+var { plan_for_new_window, wait_for_new_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 // One folder's enough
 var folder = null;
 
 // Number of messages to open for multi-message tests
 var NUM_MESSAGES_TO_OPEN = 5;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   folder = create_folder("OpeningMessagesA");
   make_new_sets_in_folder(folder, [{ count: 10 }]);
 }
 
 /**
  * Test opening a single message in a new tab.
  */
--- a/mail/test/mozmill/folder-display/test-recent-menu.js
+++ b/mail/test/mozmill/folder-display/test-recent-menu.js
@@ -6,21 +6,20 @@
  * This tests the move/copy to recent folder menus to make sure
  * that they get updated when messages are moved to folders, and
  * don't get updated when we archive.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-recent-menu";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var { fixIterator } = ChromeUtils.import(
   "resource:///modules/iteratorUtils.jsm"
 );
--- a/mail/test/mozmill/folder-display/test-right-click-middle-click-folders.js
+++ b/mail/test/mozmill/folder-display/test-right-click-middle-click-folders.js
@@ -5,29 +5,26 @@
 /*
  * Test the many horrors involving right-clicks, middle clicks, and
  * selections... on folders!
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-right-click-middle-click-folders";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var folderA, folderB, folderC;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   folderA = create_folder("RightClickMiddleClickFoldersA");
   folderB = create_folder("RightClickMiddleClickFoldersB");
   folderC = create_folder("RightClickMiddleClickFoldersC");
 
   // We aren't really interested in the messages the folders contain, but just
   // for appearance's sake, add a message to each folder
 
--- a/mail/test/mozmill/folder-display/test-right-click-middle-click-messages.js
+++ b/mail/test/mozmill/folder-display/test-right-click-middle-click-messages.js
@@ -4,38 +4,35 @@
 
 /*
  * Test the many horrors involving right-clicks, middle clicks, and selections.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-right-click-middle-click-messages";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 
 var folder, threadedFolder;
 
 /**
  * The number of messages in the thread we use to test.
  */
 var NUM_MESSAGES_IN_THREAD = 6;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   folder = create_folder("RightClickMiddleClickA");
   threadedFolder = create_folder("RightClickMiddleClickB");
   // we want exactly as many messages as we plan to delete, so that we can test
   //  that the message window and tabs close when they run out of things to
   //  to display.
   make_new_sets_in_folder(folder, [{ count: 20 }]);
   // Create a few messages and one thread (the order is important here, as it
--- a/mail/test/mozmill/folder-display/test-savedsearch-reload-after-compact.js
+++ b/mail/test/mozmill/folder-display/test-savedsearch-reload-after-compact.js
@@ -5,27 +5,24 @@
 /**
  * Test reload of saved searches over local folders after compaction
  * of local folders.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-savedsearch-reload-after-compact";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 }
 
 /**
  * Add some messages to a folder, delete the first one, and create a saved
  * search over the inbox and the folder. Then, compact folders.
  */
 function test_setup_virtual_folder_and_compact() {
   let otherFolder = create_folder("otherFolder");
--- a/mail/test/mozmill/folder-display/test-tabs-simple.js
+++ b/mail/test/mozmill/folder-display/test-tabs-simple.js
@@ -9,29 +9,26 @@
  * cause more realistic focus changes so those changes now look sillier
  * because in many cases we are explicitly setting focus back after the thread
  * tree gains focus.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-tabs-simple";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var folderA, folderB, setA, setB;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   folderA = create_folder("TabsSimpleA");
   folderB = create_folder("TabsSimpleB");
 
   // We will verify we are seeing the right folder by checking that it has the
   //  right messages in it.
   [setA] = make_new_sets_in_folder(folderA, [{}]);
   [setB] = make_new_sets_in_folder(folderB, [{}]);
--- a/mail/test/mozmill/folder-pane/test-folder-pane-consumers.js
+++ b/mail/test/mozmill/folder-pane/test-folder-pane-consumers.js
@@ -5,25 +5,24 @@
 /*
  * Tests for other dialogs using the tree view implementation in folderPane.js.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
 /* import-globals-from ../shared-modules/test-nntp-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-folder-pane";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "nntp-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "nntp-helpers"];
+
+var { plan_for_modal_dialog, wait_for_modal_dialog } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 var nntpAccount;
 
 function setupModule(module) {
--- a/mail/test/mozmill/folder-tree-modes/test-custom-folder-tree-mode.js
+++ b/mail/test/mozmill/folder-tree-modes/test-custom-folder-tree-mode.js
@@ -6,21 +6,26 @@
 /*
  * Tests for custom folder tree modes. The test mode is provided by the test
  * extension in the test-extension subdirectory.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-custom-folder-tree-mode";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
+
+var {
+  close_window,
+  plan_for_new_window,
+  wait_for_new_window,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
 
 var gInbox;
 
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
   }
 
--- a/mail/test/mozmill/folder-tree-modes/test-custom-smart-folder.js
+++ b/mail/test/mozmill/folder-tree-modes/test-custom-smart-folder.js
@@ -6,21 +6,20 @@
 /*
  * Tests for custom folder tree modes. The test mode is provided by the test
  * extension in the test-extension subdirectory.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-custom-smart-folder";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 // spaces in the name are intentional
 var smartParentNameA = "My Smart Folder A";
 var smartParentNameB = "My Smart Folder B";
 
 var rootFolder;
 var inboxSubfolder, subfolderA, subfolderB;
 var smartFolderInbox;
--- a/mail/test/mozmill/folder-tree-modes/test-mode-switching.js
+++ b/mail/test/mozmill/folder-tree-modes/test-mode-switching.js
@@ -6,21 +6,20 @@
  * Bug 978592.
  * Test that switching folder modes via menu works and also compact versions
  * can be toggled properly.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-mode-switching";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var rootFolder;
 var inboxFolder;
 var unreadFolder;
 var favoriteFolder;
 var toggle_menu;
 var toggle_appmenu;
 var tree;
--- a/mail/test/mozmill/folder-widget/test-message-filters.js
+++ b/mail/test/mozmill/folder-widget/test-message-filters.js
@@ -6,31 +6,41 @@
  * Test various properties of the message filters.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-address-book-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
 /* import-globals-from ../shared-modules/test-nntp-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-message-filters";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = [
   "folder-display-helpers",
-  "window-helpers",
   "nntp-helpers",
   "address-book-helpers",
 ];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 
+var {
+  close_window,
+  plan_for_modal_dialog,
+  plan_for_new_window,
+  plan_for_window_close,
+  wait_for_existing_window,
+  wait_for_modal_dialog,
+  wait_for_new_window,
+  wait_for_window_focused,
+  wait_for_window_close,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
+
 var { gMockPromptService } = ChromeUtils.import(
   "resource://testing-common/mozmill/PromptHelpers.jsm"
 );
 
 var folderA;
 
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
--- a/mail/test/mozmill/instrumentation/test-instrument-setup.js
+++ b/mail/test/mozmill/instrumentation/test-instrument-setup.js
@@ -1,28 +1,32 @@
 /* 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-instrument-setup";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 
 var { input_value } = ChromeUtils.import(
   "resource://testing-common/mozmill/KeyboardHelpers.jsm"
 );
+var {
+  plan_for_window_close,
+  wait_for_existing_window,
+  wait_for_window_close,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var user = {
   name: "Roger Sterling",
   email: "roger.sterling@example.com",
   incomingHost: "testin.example.com",
   outgoingHost: "testout.example.com",
--- a/mail/test/mozmill/message-header/test-message-header.js
+++ b/mail/test/mozmill/message-header/test-message-header.js
@@ -7,30 +7,33 @@
  * the more button ...
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-address-book-helpers.js */
 /* import-globals-from ../shared-modules/test-dom-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-message-header";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = [
   "folder-display-helpers",
-  "window-helpers",
   "address-book-helpers",
   "dom-helpers",
 ];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
+
+var { resize_to } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 var folder, folderMore;
 var gInterestingMessage;
 
--- a/mail/test/mozmill/message-header/test-phishing-bar.js
+++ b/mail/test/mozmill/message-header/test-phishing-bar.js
@@ -4,32 +4,37 @@
 
 /**
  * Test that phishing notifications behave properly.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-phishing-bar";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 
 var {
   assert_notification_displayed,
   get_notification_button,
   wait_for_notification_to_show,
   wait_for_notification_to_stop,
 } = ChromeUtils.import(
   "resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
 );
+var {
+  close_window,
+  plan_for_modal_dialog,
+  plan_for_new_window,
+  wait_for_new_window,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
 
 var folder;
 
 var kBoxId = "mail-notification-top";
 var kNotificationValue = "maybeScam";
 
 function setupModule(module) {
   for (let dep of MODULE_REQUIRES) {
--- a/mail/test/mozmill/message-header/test-reply-identity.js
+++ b/mail/test/mozmill/message-header/test-reply-identity.js
@@ -5,25 +5,20 @@
 /**
  * Tests that actions such as replying choses the most suitable identity.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-reply-identity";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "compose-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var testFolder = null;
 
 var identity1Email = "carl@example.com";
 var identity2Email = "lenny@springfield.invalid";
 
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
--- a/mail/test/mozmill/message-header/test-reply-to-list-from-address-selection.js
+++ b/mail/test/mozmill/message-header/test-reply-to-list-from-address-selection.js
@@ -5,25 +5,20 @@
 /*
  *  Test for the most suitable identity in From address for reply-to-list
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-compose-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-reply-to-list-from-address-selection";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "compose-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers"];
 
 var testFolder = null;
 var msgHdr = null;
 var replyToListWindow = null;
 
 var identityString1 = "tinderbox_correct_identity@foo.invalid";
 
 function setupModule(module) {
--- a/mail/test/mozmill/message-header/test-return-receipt.js
+++ b/mail/test/mozmill/message-header/test-return-receipt.js
@@ -4,34 +4,32 @@
 
 /*
  * Test return receipt (MDN) stuff.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-return-receipt";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var { assert_notification_displayed } = ChromeUtils.import(
   "resource://testing-common/mozmill/NotificationBoxHelpers.jsm"
 );
 
 var folder;
 
 var kBoxId = "mail-notification-top";
 var kNotificationValue = "mdnRequested";
 
 function setupModule(module) {
   collector.getModule("folder-display-helpers").installInto(module);
-  collector.getModule("window-helpers").installInto(module);
 
   folder = create_folder("ReturnReceiptTest");
 
   // Create a message that requests a return receipt.
   let msg0 = create_message({
     from: ["Ake", "ake@example.com"],
     clobberHeaders: { "Disposition-Notification-To": "ake@example.com" },
   });
--- a/mail/test/mozmill/message-reader/test-bug594646.js
+++ b/mail/test/mozmill/message-reader/test-bug594646.js
@@ -7,29 +7,31 @@
 /**
  * Tests that opening an .eml file the body of the message is correct,
  * that it hasn't been UTF-8 mojibake'd.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-bug594646";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 
+var { close_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var gReferenceTextContent;
 
 function setupModule(module) {
   collector.getModule("folder-display-helpers").installInto(module);
-  collector.getModule("window-helpers").installInto(module);
   gReferenceTextContent = extract_eml_body_textcontent(
     "./bug594646_reference.eml"
   );
 }
 
 function extract_eml_body_textcontent(eml) {
   let file = os.getFileForPath(os.abspath(eml, os.getFileForPath(__file__)));
   let msgc = open_message_from_file(file);
--- a/mail/test/mozmill/message-window/test-commands.js
+++ b/mail/test/mozmill/message-window/test-commands.js
@@ -1,36 +1,37 @@
 /* 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-commands";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 
+var { close_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var folder1, folder2;
 
 var setupModule = function(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 
   folder1 = create_folder("CopyFromFolder");
   folder2 = create_folder("CopyToFolder");
   make_new_sets_in_folder(folder1, [{ count: 1 }]);
 };
 
 function test_copy_eml_message() {
   // First, copy an email to a folder and delete it immediately just so it shows
--- a/mail/test/mozmill/message-window/test-eml-subject.js
+++ b/mail/test/mozmill/message-window/test-eml-subject.js
@@ -4,35 +4,37 @@
 
 /**
  * Tests that opening an .eml file with empty subject works.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-eml-subject";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
+
+var { close_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var { StringBundle } = ChromeUtils.import(
   "resource:///modules/StringBundle.js"
 );
 var { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
 
 var setupModule = function(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
 };
 
 function check_eml_window_title(subject, eml) {
   let file = os.getFileForPath(os.abspath(eml, os.getFileForPath(__file__)));
   let msgc = open_message_from_file(file);
 
   let brandBundle = new StringBundle(
     "chrome://branding/locale/brand.properties"
--- a/mail/test/mozmill/message-window/test-message-sidebar.js
+++ b/mail/test/mozmill/message-window/test-message-sidebar.js
@@ -1,25 +1,20 @@
 /* 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/. */
 
 "use strict";
 
-/* import-globals-from ../shared-modules/test-window-helpers.js */
+/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
 
 var MODULE_NAME = "test-message-sidebar";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["window-helpers"];
-
-var windowHelper;
-var mc;
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
-function setupModule(module) {
-  windowHelper = collector.getModule("window-helpers");
-  mc = windowHelper.wait_for_existing_window("mail:3pane");
-  windowHelper.installInto(module);
-  windowHelper.augment_controller(mc);
-}
+var setupModule = function(module) {
+  let fdh = collector.getModule("folder-display-helpers");
+  fdh.installInto(module);
+};
 
 function test_messagepane_extension_points_exist() {
   mc.assertNode(mc.eid("messagepanewrapper"));
 }
--- a/mail/test/mozmill/message-window/test-vcard-actions.js
+++ b/mail/test/mozmill/message-window/test-vcard-actions.js
@@ -5,28 +5,29 @@
 /**
  * Tests for attached vcards.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-address-book-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-vcard-actions";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "address-book-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "address-book-helpers"];
 
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 
+var {
+  close_window,
+  plan_for_modal_dialog,
+  wait_for_modal_dialog,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
+
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
   }
 }
 
 /**
  * Bug 1374779
--- a/mail/test/mozmill/message-window/test-view-plaintext.js
+++ b/mail/test/mozmill/message-window/test-view-plaintext.js
@@ -4,24 +4,28 @@
 
 /**
  * Tests that the plain text part of multipart/alternative messages can be correctly viewed.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-view-plaintext";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
+
+var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
+
+var { close_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
-var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 
 function setupModule(module) {
   for (let lib of MODULE_REQUIRES) {
     collector.getModule(lib).installInto(module);
   }
 }
 
 /**
--- a/mail/test/mozmill/newmailaccount/test-newmailaccount.js
+++ b/mail/test/mozmill/newmailaccount/test-newmailaccount.js
@@ -5,34 +5,43 @@
 /**
  * Tests the get an account (account provisioning) workflow.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
 /* import-globals-from ../shared-modules/test-content-tab-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 /* import-globals-from ../shared-modules/test-newmailaccount-helpers.js */
 /* import-globals-from ../shared-modules/test-dom-helpers.js */
 
 var MODULE_NAME = "test-newmailaccount";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = [
   "folder-display-helpers",
   "content-tab-helpers",
-  "window-helpers",
   "newmailaccount-helpers",
   "dom-helpers",
 ];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 
+var {
+  close_window,
+  plan_for_modal_dialog,
+  plan_for_new_window,
+  plan_for_window_close,
+  wait_for_browser_load,
+  wait_for_modal_dialog,
+  wait_for_new_window,
+  wait_for_window_close,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
+
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var { HttpServer } = ChromeUtils.import(
   "chrome://mozmill/content/stdlib/httpd.jsm"
 );
 
--- a/mail/test/mozmill/notification/test-notification.js
+++ b/mail/test/mozmill/notification/test-notification.js
@@ -1,20 +1,26 @@
 /* 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/. */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-notifications";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
+
+var {
+  plan_for_new_window,
+  plan_for_window_close,
+  wait_for_new_window,
+  wait_for_window_close,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
 
 var { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
@@ -102,19 +108,16 @@ var gMockAlertsServiceFactory = {
     return gMockAlertsService;
   },
 };
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
 
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
-
   // Register the mock alerts service
   Components.manager
     .QueryInterface(Ci.nsIComponentRegistrar)
     .registerFactory(
       Components.ID("{1bda6c33-b089-43df-a8fd-111907d6385a}"),
       "Mock Alerts Service",
       "@mozilla.org/system-alerts-service;1",
       gMockAlertsServiceFactory
--- a/mail/test/mozmill/override-main-menu-collapse/test-override-mainmenu-collapse.js
+++ b/mail/test/mozmill/override-main-menu-collapse/test-override-mainmenu-collapse.js
@@ -6,27 +6,29 @@
  * Tests that the main menu will NOT be collapsed by default if Thunderbird
  * starts with no accounts created, and mail.main_menu.collapse_by_default set
  * to false.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-override-mainmenu-collapse";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
+
+var { close_window, wait_for_existing_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 function setupModule(module) {
   collector.getModule("folder-display-helpers").installInto(module);
-  collector.getModule("window-helpers").installInto(module);
 }
 
 function test_main_menu_not_collapsed() {
   // Due to random oranges on slower machines, we need to ensure that startup
   // is complete before running this test.
   let done = false;
   let observer = {
     observe(aSubject, aTopic, aData) {
--- a/mail/test/mozmill/pref-window/test-font-chooser.js
+++ b/mail/test/mozmill/pref-window/test-font-chooser.js
@@ -10,27 +10,29 @@
  * font.name-list.<style>.<language>.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-content-tab-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
 /* import-globals-from ../shared-modules/test-pref-window-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-font-chooser";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = [
   "folder-display-helpers",
-  "window-helpers",
   "pref-window-helpers",
   "content-tab-helpers",
 ];
 
+var { wait_for_frame_load } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
 var { Preferences } = ChromeUtils.import(
   "resource://gre/modules/Preferences.jsm"
 );
 
--- a/mail/test/mozmill/quick-filter-bar/test-display-issues.js
+++ b/mail/test/mozmill/quick-filter-bar/test-display-issues.js
@@ -9,27 +9,29 @@
  * the unit test machines (see also testing/machine-configuration.json).
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-dom-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
 /* import-globals-from ../shared-modules/test-quick-filter-bar-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-display-issues";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = [
   "folder-display-helpers",
-  "window-helpers",
   "quick-filter-bar-helpers",
   "dom-helpers",
 ];
 
+var { close_window, resize_to } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var folder;
 var setUnstarred, setStarred;
 var gOriginalPaneWidth;
 
 var gEnlargedWindowWidth = 1260;
 var gShrunkenWindowWidth = 600;
 
 var gTodayPane;
--- a/mail/test/mozmill/quick-filter-bar/test-filter-logic.js
+++ b/mail/test/mozmill/quick-filter-bar/test-filter-logic.js
@@ -6,29 +6,23 @@
  * Verify that we are constructing the filters that we expect and that they
  * are hooked up to the right buttons.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
 /* import-globals-from ../shared-modules/test-quick-filter-bar-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-filter-logic";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "quick-filter-bar-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "quick-filter-bar-helpers"];
 
 function setupModule(module) {
   collector.getModule("folder-display-helpers").installInto(module);
-  collector.getModule("window-helpers").installInto(module);
   collector.getModule("quick-filter-bar-helpers").installInto(module);
 }
 
 function test_filter_unread() {
   let folder = create_folder("QuickFilterBarFilterUnread");
   let [unread, read] = make_new_sets_in_folder(folder, [
     { count: 1 },
     { count: 1 },
--- a/mail/test/mozmill/quick-filter-bar/test-keyboard-interface.js
+++ b/mail/test/mozmill/quick-filter-bar/test-keyboard-interface.js
@@ -8,33 +8,26 @@
  * test-toggle-bar.js, but we test that repeatedly hitting control-shift-k
  * selects the text entered in the quick filter bar.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
 /* import-globals-from ../shared-modules/test-quick-filter-bar-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-keyboard-interface";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "quick-filter-bar-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "quick-filter-bar-helpers"];
 
 var folder;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
   let qfb = collector.getModule("quick-filter-bar-helpers");
   qfb.installInto(module);
 
   folder = create_folder("QuickFilterBarKeyboardInterface");
   // we need a message so we can select it so we can find in message
   make_new_sets_in_folder(folder, [{ count: 1 }]);
   be_in_folder(folder);
 }
--- a/mail/test/mozmill/quick-filter-bar/test-sticky-filter-logic.js
+++ b/mail/test/mozmill/quick-filter-bar/test-sticky-filter-logic.js
@@ -6,31 +6,24 @@
  * Sticky logic only needs to test the general sticky logic plus any filters
  *  with custom propagateState implementations (currently: tags, text filter.)
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
 /* import-globals-from ../shared-modules/test-quick-filter-bar-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-sticky-filter-logic";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "quick-filter-bar-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "quick-filter-bar-helpers"];
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
   let qfb = collector.getModule("quick-filter-bar-helpers");
   qfb.installInto(module);
 }
 
 /**
  * Persist the current settings through folder change and inherit into a new tab.
  */
 function test_sticky_basics() {
--- a/mail/test/mozmill/quick-filter-bar/test-toggle-bar.js
+++ b/mail/test/mozmill/quick-filter-bar/test-toggle-bar.js
@@ -6,34 +6,27 @@
  * Test that the message filter bar toggles into and out of existence and
  * states are updated as appropriate.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
 /* import-globals-from ../shared-modules/test-quick-filter-bar-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-toggle-bar";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "quick-filter-bar-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "quick-filter-bar-helpers"];
 
 var folder;
 var setUnstarred, setStarred;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
   let qfb = collector.getModule("quick-filter-bar-helpers");
   qfb.installInto(module);
 
   folder = create_folder("QuickFilterBarToggleBar");
   [setUnstarred, setStarred] = make_new_sets_in_folder(folder, [
     { count: 1 },
     { count: 1 },
   ]);
--- a/mail/test/mozmill/search-window/test-search-window.js
+++ b/mail/test/mozmill/search-window/test-search-window.js
@@ -6,35 +6,37 @@
  * Tests:
  * - https://bugzilla.mozilla.org/show_bug.cgi?id=474701#c96 first para
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
 /* import-globals-from ../shared-modules/test-search-window-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-search-window";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "search-window-helpers",
-  "window-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "search-window-helpers"];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 
+var {
+  plan_for_modal_dialog,
+  plan_for_new_window,
+  plan_for_window_close,
+  wait_for_modal_dialog,
+  wait_for_new_window,
+  wait_for_window_close,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
+
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
   let sh = collector.getModule("search-window-helpers");
   sh.installInto(module);
 }
 
 var folder, setFoo, setBar, setFooBar;
 
 // Number of messages to open for multi-message tests
 var NUM_MESSAGES_TO_OPEN = 5;
--- a/mail/test/mozmill/session-store/test-session-store.js
+++ b/mail/test/mozmill/session-store/test-session-store.js
@@ -5,26 +5,33 @@
 /*
  * Session Storage Tests. Session Restoration Tests are currently implemented in
  * folder-display/test-message-pane-visibility.js.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-session-store";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var controller = ChromeUtils.import(
   "chrome://mozmill/content/modules/controller.jsm"
 );
 
+var {
+  close_window,
+  plan_for_new_window,
+  plan_for_window_close,
+  wait_for_new_window,
+  wait_for_window_close,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
+
 var { IOUtils } = ChromeUtils.import("resource:///modules/IOUtils.js");
 var { FileUtils } = ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
 var { SessionStoreManager } = ChromeUtils.import(
   "resource:///modules/SessionStoreManager.jsm"
 );
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var folderA, folderB;
rename from mail/test/mozmill/shared-modules/test-window-helpers.js
rename to mail/test/mozmill/shared-modules/WindowHelpers.jsm
--- a/mail/test/mozmill/shared-modules/test-window-helpers.js
+++ b/mail/test/mozmill/shared-modules/WindowHelpers.jsm
@@ -1,15 +1,37 @@
 /* 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/. */
 
 "use strict";
 
-var MODULE_NAME = "window-helpers";
+this.EXPORTED_SYMBOLS = [
+  // These are used by test-folder-display-helpers.js and shouldn't really be
+  // exported, but it's convenient right now.
+  "captureWindowStatesForErrorReporting",
+  "getWindowTypeForXulWindow",
+  "hereIsMarkAction",
+
+  "plan_for_new_window",
+  "wait_for_new_window",
+  "plan_for_modal_dialog",
+  "wait_for_modal_dialog",
+  "plan_for_window_close",
+  "wait_for_window_close",
+  "close_window",
+  "wait_for_existing_window",
+  "wait_for_window_focused",
+  "wait_for_browser_load",
+  "wait_for_frame_load",
+  "plan_for_observable_event",
+  "wait_for_observable_event",
+  "resize_to",
+  "augment_controller",
+];
 
 var { fixIterator } = ChromeUtils.import(
   "resource:///modules/iteratorUtils.jsm"
 );
 var { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var controller = ChromeUtils.import(
@@ -51,18 +73,16 @@ var WINDOW_CLOSE_TIMEOUT_MS = 10000;
  */
 var WINDOW_CLOSE_CHECK_INTERVAL_MS = 100;
 
 /**
  * Timeout for focusing a window.  Only really an issue on linux.
  */
 var WINDOW_FOCUS_TIMEOUT_MS = 10000;
 
-var hiddenWindow = Services.appShell.hiddenDOMWindow;
-
 // Have a dummy mark_action function in case test-folder-display-helpers does
 // not provide us with one.
 var mark_action = function dummy_mark_action() {};
 var mark_failure = function dummy_mark_failure() {};
 var normalize_for_json = function dummy_normalize_for_json() {};
 /**
  * This is used by test-folder-display-helpers to provide us with a reference
  * to logHelper's mark_action because of ugliness in the module system.
@@ -72,38 +92,16 @@ function hereIsMarkAction(
   mark_failure_impl,
   normalize_for_json_impl
 ) {
   mark_action = mark_action_impl;
   mark_failure = mark_failure_impl;
   normalize_for_json = normalize_for_json_impl;
 }
 
-function installInto(module) {
-  module.plan_for_new_window = plan_for_new_window;
-  module.wait_for_new_window = wait_for_new_window;
-  module.plan_for_modal_dialog = plan_for_modal_dialog;
-  module.wait_for_modal_dialog = wait_for_modal_dialog;
-  module.plan_for_window_close = plan_for_window_close;
-  module.wait_for_window_close = wait_for_window_close;
-  module.close_window = close_window;
-  module.wait_for_existing_window = wait_for_existing_window;
-  module.wait_for_window_focused = wait_for_window_focused;
-
-  module.wait_for_browser_load = wait_for_browser_load;
-  module.wait_for_frame_load = wait_for_frame_load;
-
-  module.plan_for_observable_event = plan_for_observable_event;
-  module.wait_for_observable_event = wait_for_observable_event;
-
-  module.resize_to = resize_to;
-
-  module.augment_controller = augment_controller;
-}
-
 function getWindowTypeOrId(aWindowElem) {
   let windowType = aWindowElem.getAttribute("windowtype");
   // Ignore types that start with "prompt:". This prefix gets added in
   // toolkit/components/prompts/src/CommonDialog.jsm since bug 1388238.
   if (windowType && !windowType.startsWith("prompt:")) {
     return windowType;
   }
 
@@ -348,17 +346,17 @@ var WindowWatcher = {
       augment_controller(troller, this.waitingForOpen);
 
       this._timer.cancel();
 
       let self = this;
       function startTest() {
         self.planForWindowClose(troller.window);
         try {
-          let runner = new frame.Runner(collector);
+          let runner = new frame.Runner();
           runner.wrapper(self.subTestFunc, troller);
         } finally {
           self.subTestFunc = null;
         }
 
         // if the test failed, make sure we force the window closed...
         // except I'm not sure how to easily figure that out...
         // so just close it no matter what.
@@ -1706,18 +1704,16 @@ function _augment_helper(aController, aA
     }
   }
 
   if (aAugmentDef.onAugment) {
     aAugmentDef.onAugment(aController);
   }
 }
 
-var INPUT_PEEK_EVENTS = ["click", "keypress"];
-
 var UNIQUE_WINDOW_ID_ATTR = "__winHelper_uniqueId";
 
 /**
  * Given something you would find on event.target (should be a DOM node /
  *  DOM window), attempt to describe the hierarchy of that thing all the way
  *  to the outermost enclosing window.  This is intended to solve the problem
  *  where our event target can be the "Window" of an iframe, which is not
  *  very enlightening.  We really want to know the frameElement and what
@@ -2138,24 +2134,16 @@ function screenshotToDataURL(aWindow) {
   subrenderCandidates(doc.documentElement.getElementsByTagName("iframe"));
   subrenderCandidates(doc.documentElement.getElementsByTagName("browser"));
   */
 
   return canvas.toDataURL("image/png", "");
 }
 
 /**
- * Render the contents of a window to a base64-encoded string.
- */
-function screenshotToBase64(aWindow) {
-  let dataUrl = screenshotToDataURL(aWindow);
-  return dataUrl.substring(dataUrl.indexOf("base64,") + 7);
-}
-
-/**
  * Capture general information on the state of all open windows and provide
  *  them in a JSON-serializable object blob.
  *
  * Specific details for each window:
  * - Screen coordinates and dimensions of the window.
  * - Is the window active/focused?
  * - The focused element in the window; we leave this up to logHelper to
  *    describe.
--- a/mail/test/mozmill/shared-modules/moz.build
+++ b/mail/test/mozmill/shared-modules/moz.build
@@ -12,9 +12,10 @@ TEST_HARNESS_FILES.mozmill.stage['shared
 
 TESTING_JS_MODULES.mozmill += [
     'AttachmentHelpers.jsm',
     'KeyboardHelpers.jsm',
     'MessageHelpers.jsm',
     'MockObjectHelpers.jsm',
     'NotificationBoxHelpers.jsm',
     'PromptHelpers.jsm',
+    'WindowHelpers.jsm',
 ]
--- a/mail/test/mozmill/shared-modules/test-account-manager-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-account-manager-helpers.js
@@ -1,29 +1,32 @@
 /* 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/. */
 
 "use strict";
 
 var MODULE_NAME = "account-manager-helpers";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var utils = ChromeUtils.import("chrome://mozmill/content/modules/utils.jsm");
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 
-var wh, fdh, mc;
+var wh = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
+var fdh, mc;
 
 function setupModule() {
   fdh = collector.getModule("folder-display-helpers");
   mc = fdh.mc;
-  wh = collector.getModule("window-helpers");
 }
 
 function installInto(module) {
   setupModule();
 
   // Now copy helper functions
   module.open_advanced_settings = open_advanced_settings;
   module.open_advanced_settings_from_account_wizard = open_advanced_settings_from_account_wizard;
--- a/mail/test/mozmill/shared-modules/test-address-book-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-address-book-helpers.js
@@ -1,38 +1,40 @@
 /* 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/. */
 
 "use strict";
 
 var MODULE_NAME = "address-book-helpers";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
+
+var windowHelper = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 var ABJS_PREFIX = "jsaddrbook://";
 var ABLDAP_PREFIX = "moz-abldapdirectory://";
 
 var collectedAddresses;
 
 var abController;
 
 var folderDisplayHelper;
 var mc;
-var windowHelper;
 
 function setupModule() {
   folderDisplayHelper = collector.getModule("folder-display-helpers");
   mc = folderDisplayHelper.mc;
-  windowHelper = collector.getModule("window-helpers");
   // Ensure all the directories are initialised.
   MailServices.ab.directories;
   collectedAddresses = MailServices.ab.getDirectory(
     "jsaddrbook://history.sqlite"
   );
 }
 
 function installInto(module) {
--- a/mail/test/mozmill/shared-modules/test-cloudfile-backend-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-cloudfile-backend-helpers.js
@@ -1,48 +1,44 @@
 /* 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/. */
 
 "use strict";
 
 var MODULE_NAME = "cloudfile-backend-helpers";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["window-helpers"];
+
+var wh = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { cloudFileAccounts } = ChromeUtils.import(
   "resource:///modules/cloudFileAccounts.jsm"
 );
 
 var kUserAuthRequested = "cloudfile:auth";
 var kUserDataRequested = "cloudfile:user";
 var kUploadFile = "cloudfile:uploadFile";
 var kGetFileURL = "cloudfile:getFileURL";
 var kDeleteFile = "cloudfile:deleteFile";
 var kLogout = "cloudfile:logout";
 
-var wh;
-
 function installInto(module) {
-  setupModule(module);
   module.kUserAuthRequested = kUserAuthRequested;
   module.kUserDataRequested = kUserDataRequested;
   module.kUploadFile = kUploadFile;
   module.kGetFileURL = kGetFileURL;
   module.kDeleteFile = kDeleteFile;
   module.kLogout = kLogout;
   module.SimpleRequestObserverManager = SimpleRequestObserverManager;
   module.SimpleRequestObserver = SimpleRequestObserver;
   module.assert_can_cancel_uploads = assert_can_cancel_uploads;
 }
 
-function setupModule(module) {
-  wh = collector.getModule("window-helpers");
-}
-
 function SimpleRequestObserverManager() {
   this._observers = [];
 }
 
 SimpleRequestObserverManager.prototype = {
   create(aName) {
     let obs = new SimpleRequestObserver(aName);
     this._observers.push(obs);
--- a/mail/test/mozmill/shared-modules/test-compose-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-compose-helpers.js
@@ -1,37 +1,36 @@
 /* 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/. */
 
 "use strict";
 
 var MODULE_NAME = "compose-helpers";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "dom-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "dom-helpers"];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 var utils = ChromeUtils.import("chrome://mozmill/content/modules/utils.jsm");
 
+var windowHelper = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var kTextNodeType = 3;
 
 var folderDisplayHelper;
 var mc;
-var windowHelper, domHelper;
+var domHelper;
 
 function setupModule() {
   folderDisplayHelper = collector.getModule("folder-display-helpers");
   mc = folderDisplayHelper.mc;
-  windowHelper = collector.getModule("window-helpers");
   domHelper = collector.getModule("dom-helpers");
 }
 
 function installInto(module) {
   setupModule();
 
   // Now copy helper functions
   module.open_compose_new_mail = open_compose_new_mail;
--- a/mail/test/mozmill/shared-modules/test-content-tab-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-content-tab-helpers.js
@@ -1,50 +1,51 @@
 /* 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/. */
 
 "use strict";
 
 var MODULE_NAME = "content-tab-helpers";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 var utils = ChromeUtils.import("chrome://mozmill/content/modules/utils.jsm");
 
 var { MockObjectReplacer } = ChromeUtils.import(
   "resource://testing-common/mozmill/MockObjectHelpers.jsm"
 );
+var wh = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var NORMAL_TIMEOUT = 6000;
 var FAST_TIMEOUT = 1000;
 var FAST_INTERVAL = 100;
 var EXT_PROTOCOL_SVC_CID = "@mozilla.org/uriloader/external-protocol-service;1";
 
 var folderDisplayHelper;
 var mc;
-var wh;
 
 var _originalBlocklistURL = null;
 
 // logHelper (and therefore folderDisplayHelper) exports
 var mark_failure;
 var gMockExtProtSvcReg;
 
 function setupModule() {
   folderDisplayHelper = collector.getModule("folder-display-helpers");
   mc = folderDisplayHelper.mc;
   mark_failure = folderDisplayHelper.mark_failure;
 
-  wh = collector.getModule("window-helpers");
   gMockExtProtSvcReg = new MockObjectReplacer(
     EXT_PROTOCOL_SVC_CID,
     MockExtProtConstructor
   );
 }
 
 function installInto(module) {
   setupModule();
--- a/mail/test/mozmill/shared-modules/test-customization-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-customization-helpers.js
@@ -1,30 +1,33 @@
 /* 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/. */
 
 "use strict";
 
 var MODULE_NAME = "customization-helpers";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var elib = ChromeUtils.import(
   "chrome://mozmill/content/modules/elementslib.jsm"
 );
 
+var wh = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var USE_SHEET_PREF = "toolbar.customization.usesheet";
 
-var wh, fdh;
+var fdh;
 
 function setupModule() {
   fdh = collector.getModule("folder-display-helpers");
-  wh = collector.getModule("window-helpers");
 }
 
 function installInto(module) {
   setupModule();
 
   // Now copy helper functions
   module.CustomizeDialogHelper = CustomizeDialogHelper;
 }
--- a/mail/test/mozmill/shared-modules/test-folder-display-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-folder-display-helpers.js
@@ -1,28 +1,32 @@
 /* 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/. */
 
 "use strict";
 
 var MODULE_NAME = "folder-display-helpers";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["window-helpers"];
 
 var EventUtils = ChromeUtils.import(
   "chrome://mozmill/content/stdlib/EventUtils.jsm"
 );
 var controller = ChromeUtils.import(
   "chrome://mozmill/content/modules/controller.jsm"
 );
 var frame = ChromeUtils.import("chrome://mozmill/content/modules/frame.jsm");
 var os = ChromeUtils.import("chrome://mozmill/content/stdlib/os.jsm");
 var utils = ChromeUtils.import("chrome://mozmill/content/modules/utils.jsm");
 
+// the windowHelper module
+var windowHelper = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
 var { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/log4moz.js");
 
 var nsMsgViewIndex_None = 0xffffffff;
 var { MailConsts } = ChromeUtils.import("resource:///modules/MailConsts.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.jsm");
@@ -92,19 +96,16 @@ var testHelperModule;
 var msgGen;
 
 var inboxFolder = null;
 
 // logHelper exports
 var mark_action;
 var mark_failure;
 
-// the windowHelper module
-var windowHelper;
-
 // Default size of the main Thunderbird window in which the tests will run.
 var gDefaultWindowWidth = 1024;
 var gDefaultWindowHeight = 768;
 
 var initialized = false;
 function setupModule() {
   if (initialized) {
     return;
@@ -242,17 +243,16 @@ function setupModule() {
   SyntheticPartLeaf = testHelperModule.SyntheticPartLeaf;
   SyntheticPartMultiMixed = testHelperModule.SyntheticPartMultiMixed;
   SyntheticPartMultiRelated = testHelperModule.SyntheticPartMultiRelated;
 
   delete_message_set = testHelperModule.async_delete_messages;
 
   // use window-helper's augment_controller method to get our extra good stuff
   //  we need.
-  windowHelper = collector.getModule("window-helpers");
   mc = windowHelper.wait_for_existing_window("mail:3pane");
   windowHelper.augment_controller(mc);
 
   // Tell window-helper about the true mark_action function in order to try
   // and further complicate this horrid seven-dimensional rats' nest.
   windowHelper.hereIsMarkAction(
     mark_action,
     mark_failure,
@@ -2634,17 +2634,17 @@ function _verify_summarized_message_set(
  *
  * @param aController The controller who has the summarized display going on.
  * @param [aMessages] Optional set of messages to verify.  If not provided, this
  *     is extracted via the folderDisplay.  If a SyntheticMessageSet is provided
  *     we will automatically retrieve what we need from it.
  */
 function assert_messages_summarized(aController, aSelectedMessages) {
   // - Compensate for selection stabilization code.
-  // Although test-window-helpers sets the stabilization interval to 0, we
+  // Although WindowHelpers sets the stabilization interval to 0, we
   //  still need to make sure we have drained the event queue so that it has
   //  actually gotten a chance to run.
   controller.sleep(0);
 
   // - Verify summary object knows about right messages
   if (aSelectedMessages == null) {
     aSelectedMessages = aController.folderDisplay.selectedMessages;
   }
--- a/mail/test/mozmill/shared-modules/test-nntp-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-nntp-helpers.js
@@ -1,17 +1,17 @@
 /* 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/. */
 
 "use strict";
 
 var MODULE_NAME = "nntp-helpers";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULES_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULES_REQUIRES = ["folder-display-helpers"];
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 
 var kSimpleNewsArticle =
   "From: John Doe <john.doe@example.com>\n" +
@@ -29,24 +29,22 @@ var groups = [
   ["test.empty", false],
   ["test.subscribe.empty", true],
   ["test.subscribe.simple", true],
   ["test.filter", true],
 ];
 
 var folderDisplayHelper;
 var mc;
-var windowHelper;
 
 var testHelperModule;
 
 function setupModule() {
   folderDisplayHelper = collector.getModule("folder-display-helpers");
   mc = folderDisplayHelper.mc;
-  windowHelper = collector.getModule("window-helpers");
   testHelperModule = {
     Cc,
     Ci,
     Cu,
     // fake some xpcshell stuff
     _TEST_FILE: ["mozmill"],
     do_throw(aMsg) {
       throw new Error(aMsg);
--- a/mail/test/mozmill/shared-modules/test-search-window-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-search-window-helpers.js
@@ -1,26 +1,28 @@
 /* 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/. */
 
 "use strict";
 
 var MODULE_NAME = "search-window-helpers";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
+
+var windowHelper = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var folderDisplayHelper;
 var mc;
-var windowHelper;
 
 function setupModule() {
   folderDisplayHelper = collector.getModule("folder-display-helpers");
   mc = folderDisplayHelper.mc;
-  windowHelper = collector.getModule("window-helpers");
 }
 
 function installInto(module) {
   setupModule();
 
   // Now copy helper functions
   module.open_search_window = open_search_window;
   module.open_search_window_from_context_menu = open_search_window_from_context_menu;
--- a/mail/test/mozmill/shared-modules/test-subscribe-window-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-subscribe-window-helpers.js
@@ -1,30 +1,31 @@
 /* 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/. */
 
 "use strict";
 
 var MODULE_NAME = "subscribe-window-helpers";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["window-helpers", "folder-display-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var { input_value, delete_all_existing } = ChromeUtils.import(
   "resource://testing-common/mozmill/KeyboardHelpers.jsm"
 );
+var windowHelper = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 var folderDisplayHelper;
 var mc;
-var windowHelper;
 
 function setupModule() {
   folderDisplayHelper = collector.getModule("folder-display-helpers");
   mc = folderDisplayHelper.mc;
-  windowHelper = collector.getModule("window-helpers");
 }
 
 function installInto(module) {
   setupModule();
 
   // Now copy helper functions
   module.open_subscribe_window_from_context_menu = open_subscribe_window_from_context_menu;
   module.enter_text_in_search_box = enter_text_in_search_box;
--- a/mail/test/mozmill/startup-firstrun/test-menubar-collapsed.js
+++ b/mail/test/mozmill/startup-firstrun/test-menubar-collapsed.js
@@ -5,25 +5,27 @@
 /**
  * Tests that the main menu will be collapsed by default if Thunderbird starts
  * with no accounts created.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-main-menu-collapsed";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
+
+var { close_window, wait_for_existing_window } = ChromeUtils.import(
+  "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
 
 function setupModule(module) {
   collector.getModule("folder-display-helpers").installInto(module);
-  collector.getModule("window-helpers").installInto(module);
 }
 
 function test_main_menu_collapsed() {
   // Due to random oranges on slower machines, we need to ensure that startup
   // is complete before running this test.
   let done = false;
   let observer = {
     observe(aSubject, aTopic, aData) {
--- a/mail/test/mozmill/tabmail/test-tabmail-closing.js
+++ b/mail/test/mozmill/tabmail/test-tabmail-closing.js
@@ -4,29 +4,27 @@
 
 /*
  * Test tabmail behaviour when tabs close.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-tabmail-closing";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+var MODULE_REQUIRES = ["folder-display-helpers"];
 
 var gFolder;
 
 var MSGS_PER_THREAD = 3;
 
 function setupModule(module) {
   collector.getModule("folder-display-helpers").installInto(module);
-  collector.getModule("window-helpers").installInto(module);
 
   gFolder = create_folder("test-tabmail-closing folder");
   make_new_sets_in_folder(gFolder, [{ msgsPerThread: MSGS_PER_THREAD }]);
 }
 
 /**
  * Test that if we open up a message in a tab from the inbox tab, that
  * if we immediately close that tab, we switch back to the inbox tab.
--- a/mail/test/mozmill/tabmail/test-tabmail-customize.js
+++ b/mail/test/mozmill/tabmail/test-tabmail-customize.js
@@ -6,36 +6,32 @@
  * Tests customization features of the tabs toolbar.
  */
 
 "use strict";
 
 /* import-globals-from ../shared-modules/test-customization-helpers.js */
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
 /* import-globals-from ../shared-modules/test-mouse-event-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-tabmail-customize";
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = [
   "folder-display-helpers",
   "mouse-event-helpers",
-  "window-helpers",
   "customization-helpers",
 ];
 
 var gCDHelper;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
   let meh = collector.getModule("mouse-event-helpers");
   meh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
   let cu = collector.getModule("customization-helpers");
   cu.installInto(module);
   gCDHelper = new CustomizeDialogHelper(
     "mail-toolbar-menubar2",
     "CustomizeMailToolbar",
     "mailnews:customizeToolbar"
   );
 }
--- a/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js
+++ b/mail/test/mozmill/tabmail/test-tabmail-dragndrop.js
@@ -1,46 +1,46 @@
 /* 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/. */
 
 "use strict";
 
-var elib = ChromeUtils.import(
-  "chrome://mozmill/content/modules/elementslib.jsm"
-);
-var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
-
 /*
  * Test rearanging tabs via drag'n'drop.
  */
 
 /* import-globals-from ../shared-modules/test-folder-display-helpers.js */
 /* import-globals-from ../shared-modules/test-mouse-event-helpers.js */
-/* import-globals-from ../shared-modules/test-window-helpers.js */
 
 var MODULE_NAME = "test-tabmail-dragndrop";
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = [
-  "folder-display-helpers",
-  "window-helpers",
-  "mouse-event-helpers",
-];
+var MODULE_REQUIRES = ["folder-display-helpers", "mouse-event-helpers"];
+
+var elib = ChromeUtils.import(
+  "chrome://mozmill/content/modules/elementslib.jsm"
+);
+
+var {
+  close_window,
+  plan_for_new_window,
+  wait_for_new_window,
+} = ChromeUtils.import("resource://testing-common/mozmill/WindowHelpers.jsm");
+
+var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var folder;
 var msgHdrsInFolder = [];
 
 // The number of messages in folder.
 var NUM_MESSAGES_IN_FOLDER = 15;
 
 function setupModule(module) {
   let fdh = collector.getModule("folder-display-helpers");
   fdh.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
   let meh = collector.getModule("mouse-event-helpers");
   meh.installInto(module);
 
   folder = create_folder("MessageFolder");
   make_new_sets_in_folder(folder, [{ count: NUM_MESSAGES_IN_FOLDER }]);
 }
 
 /**