Bug 824150 - Code cleanup in /mail/ and /mailnews/: Use new String methods like startsWith, endsWith, contains, remaining Services.jsm switches and querySelector use instead of NodeList calls: addons. r=mbanner
authorSebastian Hengst <archaeopteryx@coole-files.de>
Thu, 07 Feb 2013 17:19:39 +0100
changeset 14827 cd2d38507626fa851125c5005857bb258c510f25
parent 14826 fa45b123a36a70427b23578d7ef0a1000ba000aa
child 14828 c39b215c927ab1363dac7d8d5fe9ee21a309f223
push id867
push userbugzilla@standard8.plus.com
push dateMon, 01 Apr 2013 20:44:27 +0000
treeherdercomm-beta@797726b8d244 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbanner
bugs824150
Bug 824150 - Code cleanup in /mail/ and /mailnews/: Use new String methods like startsWith, endsWith, contains, remaining Services.jsm switches and querySelector use instead of NodeList calls: addons. r=mbanner
mail/test/mozmill/content-tabs/test-install-xpi.js
mail/test/mozmill/content-tabs/test-lwthemes.js
mail/test/mozmill/content-tabs/test-plugin-crashing.js
mail/test/mozmill/content-tabs/test-plugin-outdated.js
--- a/mail/test/mozmill/content-tabs/test-install-xpi.js
+++ b/mail/test/mozmill/content-tabs/test-install-xpi.js
@@ -62,17 +62,17 @@ function close_xpinstall_dialog(xpidlg) 
 function accept_xpinstall_dialog(xpidlg) {
   // The install dialog has a count down that we must wait for before
   // proceeding.
   mc.sleep(5500);
   xpidlg.window.document.documentElement.getButton('accept').doCommand();
 }
 
 function click_notification_box_action_in_current_tab() {
-  let actionButton = gNotificationBox.currentNotification.getElementsByTagName("button")[0];
+  let actionButton = gNotificationBox.currentNotification.querySelector("button");
   mc.click(new elib.Elem(actionButton));
 }
 
 function close_notification_box() {
   gNotificationBox.currentNotification.close();
 }
 
 function click_install_link_and_wait_for_alert(link) {
@@ -88,17 +88,17 @@ function click_install_link_and_wait_for
 
 function test_setup() {
   gNewTab =
     open_content_tab_with_url(url + "installxpi.html",
                               "specialTabs.siteClickHandler(event, siteRegExp);");
 
   // make the animation only take one frame
   gNotificationBox =
-    mc.tabmail.selectedTab.panel.getElementsByTagName("notificationbox")[0];
+    mc.tabmail.selectedTab.panel.querySelector("notificationbox");
   gNotificationBox.slideSteps = 1;
 }
 
 function test_install_corrupt_xpi() {
   // This install with give us a corrupt xpi warning.
   click_install_link_and_wait_for_alert("corruptlink");
 
   // Clicking the install button will close the current notification and open
--- a/mail/test/mozmill/content-tabs/test-lwthemes.js
+++ b/mail/test/mozmill/content-tabs/test-lwthemes.js
@@ -30,40 +30,40 @@ var setupModule = function (module) {
   cth.installInto(module);
 };
 
 const ALERT_TIMEOUT = 10000;
 
 function check_and_click_notification_box_action_in_current_tab(totalButtons,
                                                                 selectButton) {
   let notificationBox =
-    mc.tabmail.selectedTab.panel.getElementsByTagName("notificationbox")[0];
+    mc.tabmail.selectedTab.panel.querySelector("notificationbox");
 
   // This is a crude check to see that we've got the number of buttons we expect
   // and hence this is the right notification that is being shown.
   let buttons = notificationBox.currentNotification.getElementsByTagName("button");
   if (buttons.length != totalButtons)
     throw new Error("Expected " + totalButtons + " alert had " + buttons.length + " buttons");
 
   mc.click(new elib.Elem(buttons[selectButton]));
 }
 
 function close_notification_box_in_current_tab() {
   mc.tabmail.selectedTab.panel
-    .getElementsByTagName("notificationbox")[0]
+    .querySelector("notificationbox")
     .currentNotification.close();
 }
 
 function currentLwTheme() {
   return mc.window.LightWeightThemeWebInstaller._manager.currentThemeForDisplay;
 }
 
 function install_theme(themeNo, previousThemeNo) {
   let notificationBox =
-    mc.tabmail.selectedTab.panel.getElementsByTagName("notificationbox")[0];
+    mc.tabmail.selectedTab.panel.querySelector("notificationbox");
 
   // Clicking the button will bring up a notification box requesting to allow
   // installation of the theme
   NotificationWatcher.planForNotification(mc);
   mc.click(new elib.Elem(mc.window.content.document
                            .getElementById("install" + themeNo)));
   NotificationWatcher.waitForNotification(mc);
 
--- a/mail/test/mozmill/content-tabs/test-plugin-crashing.js
+++ b/mail/test/mozmill/content-tabs/test-plugin-crashing.js
@@ -50,17 +50,17 @@ function setupModule(module) {
   let crashReporter = Cc["@mozilla.org/toolkit/crash-reporter;1"]
                         .getService(Ci.nsICrashReporter);
 
   /* Bug 689580 - these crash tests fail randomly on 64-bit OSX.  We'll
    * disable them for now, until we can figure out what's going on.
    */
   Components.utils.import("resource://gre/modules/Services.jsm");
   let is64BitOSX = (mc.mozmillModule.isMac &&
-                    Services.appinfo.XPCOMABI.match(/x86_64-/));
+                    Services.appinfo.XPCOMABI.contains("x86_64-"));
 
   // These tests are no good if the crash reporter is disabled, or if
   // we don't have out-of-process plugins enabled.
   if (is64BitOSX ||  // XXX Remove once Bug 689580 is resolved
       !plugins_run_in_separate_processes(mc) ||
       !crashReporter.enabled) {
     let funcsToSkip = [test_can_crash_plugin,
                        test_crashed_plugin_notification_bar,
--- a/mail/test/mozmill/content-tabs/test-plugin-outdated.js
+++ b/mail/test/mozmill/content-tabs/test-plugin-outdated.js
@@ -98,19 +98,19 @@ function test_outdated_plugin_notificati
                                               kPluginUrl);
   NotificationWatcher.waitForNotification(mc);
 
   let notificationBar = get_notification_bar_for_tab(mc.tabmail.selectedTab);
   assert_not_equals(null, notificationBar, "Could not get notification bar");
   let notifValue = notificationBar.getNotificationWithValue("outdated-plugins");
   assert_not_equals(null, notifValue, "Notification value was not correct");
 
-  // buttons[0] should be the "update my plugins" button.
-  let buttons = notificationBar.getElementsByTagName("button");
+  // aButton should be the "update my plugins" button.
+  let aButton = notificationBar.querySelector("button");
 
   // Let's make sure that the "update my plugins" button opens up
   // a tab and takes us to the right place.
-  let updateTab = open_content_tab_with_click(buttons[0], kPluginUpdateUrl);
+  let updateTab = open_content_tab_with_click(aButton, kPluginUpdateUrl);
   assert_tab_has_title(updateTab, "Plugin Update Page");
   mc.tabmail.closeTab(updateTab);
 
   mc.tabmail.closeTab(pluginTab);
 }