From 9e3c046bbe2ef6d3f248b464c7fa19674d3710b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Sat, 11 Jun 2011 16:54:23 +0200 Subject: [PATCH] more random browser chrome test cleanup (no bug) --- browser/base/content/test/browser_bug321000.js | 6 +----- .../base/content/test/browser_scratchpad_files.js | 4 ---- .../places/tests/perf/browser_ui_000_data.js | 14 ++------------ .../tests/perf/browser_ui_bookmarks_sidebar.js | 10 ---------- .../places/tests/perf/browser_ui_history_menu.js | 10 ---------- .../tests/perf/browser_ui_history_sidebar.js | 9 --------- .../tests/perf/browser_ui_history_sidebar_2.js | 9 --------- .../tests/perf/browser_ui_history_sidebar_3.js | 9 --------- .../places/tests/perf/browser_ui_locationbar.js | 14 +------------- docshell/test/navigation/browser_bug343515.js | 7 ++----- .../test/browser/browser_nsIDownloadManagerUI.js | 3 --- toolkit/mozapps/extensions/test/browser/head.js | 1 - toolkit/mozapps/extensions/test/xpinstall/head.js | 13 +++---------- 13 files changed, 9 insertions(+), 100 deletions(-) diff --git a/browser/base/content/test/browser_bug321000.js b/browser/base/content/test/browser_bug321000.js index d73a926a127..9cfdfc701c5 100644 --- a/browser/base/content/test/browser_bug321000.js +++ b/browser/base/content/test/browser_bug321000.js @@ -38,9 +38,6 @@ * * ***** END LICENSE BLOCK ***** */ -const Ci = Components.interfaces; -const Cc = Components.classes; - const kTestString = " hello hello \n world\nworld "; var gTests = [ @@ -87,8 +84,7 @@ function test_paste(aCurrentTest) { var inputListener = { test: aCurrentTest, handleEvent: function(event) { - var element = event.target; - element.removeEventListener("input", this, false); + element.removeEventListener(event.type, this, false); is(element.value, this.test.expected, this.test.desc); diff --git a/browser/base/content/test/browser_scratchpad_files.js b/browser/base/content/test/browser_scratchpad_files.js index 1b3ce4c2ad5..5af7b6a482c 100644 --- a/browser/base/content/test/browser_scratchpad_files.js +++ b/browser/base/content/test/browser_scratchpad_files.js @@ -2,10 +2,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cu = Components.utils; - Cu.import("resource://gre/modules/NetUtil.jsm"); Cu.import("resource://gre/modules/FileUtils.jsm"); diff --git a/browser/components/places/tests/perf/browser_ui_000_data.js b/browser/components/places/tests/perf/browser_ui_000_data.js index 524eb24f2b2..105c0cc329c 100644 --- a/browser/components/places/tests/perf/browser_ui_000_data.js +++ b/browser/components/places/tests/perf/browser_ui_000_data.js @@ -52,16 +52,6 @@ waitForExplicitFinish(); const TEST_IDENTIFIER = "ui-perf-test"; const TEST_SUITE = "places"; -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cr = Components.results; - -var wm = Cc["@mozilla.org/appshell/window-mediator;1"]. - getService(Ci.nsIWindowMediator); -var win = wm.getMostRecentWindow("navigator:browser"); - -var ios = Cc["@mozilla.org/network/io-service;1"]. - getService(Ci.nsIIOService); var hs = Cc["@mozilla.org/browser/nav-history-service;1"]. getService(Ci.nsINavHistoryService); var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"]. @@ -112,7 +102,7 @@ ptests.push({ visit_date_microsec -= 86400 * 1000 * 1000; // remove a day var spec = "http://example.com/" + visit_date_microsec; for (var j = 0; j < visits_per_day; j++) { - var uri = ios.newURI(spec + j, null, null); + var uri = Services.io.newURI(spec + j, null, null); add_visit(uri, visit_date_microsec); } } @@ -132,7 +122,7 @@ ptests.push({ visit_date_microsec -= 86400 * 1000 * 1000; // remove a day var spec = "http://example.com/" + visit_date_microsec; for (var j = 0; j < visits_per_day; j++) { - var uri = ios.newURI(spec + j, null, null); + var uri = Services.io.newURI(spec + j, null, null); if (bookmark_counter < bookmarks_per_day) { add_bookmark(uri); bookmark_counter++; diff --git a/browser/components/places/tests/perf/browser_ui_bookmarks_sidebar.js b/browser/components/places/tests/perf/browser_ui_bookmarks_sidebar.js index f3a64685ad1..420bc405230 100644 --- a/browser/components/places/tests/perf/browser_ui_bookmarks_sidebar.js +++ b/browser/components/places/tests/perf/browser_ui_bookmarks_sidebar.js @@ -47,16 +47,6 @@ waitForExplicitFinish(); const TEST_IDENTIFIER = "ui-perf-test"; const TEST_SUITE = "places"; -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cr = Components.results; - -var wm = Cc["@mozilla.org/appshell/window-mediator;1"]. - getService(Ci.nsIWindowMediator); -var win = wm.getMostRecentWindow("navigator:browser"); - -var ios = Cc["@mozilla.org/network/io-service;1"]. - getService(Ci.nsIIOService); var hs = Cc["@mozilla.org/browser/nav-history-service;1"]. getService(Ci.nsINavHistoryService); var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"]. diff --git a/browser/components/places/tests/perf/browser_ui_history_menu.js b/browser/components/places/tests/perf/browser_ui_history_menu.js index 77203f119df..0a08059a2e3 100644 --- a/browser/components/places/tests/perf/browser_ui_history_menu.js +++ b/browser/components/places/tests/perf/browser_ui_history_menu.js @@ -44,16 +44,6 @@ Tests the performance of opening the history menu. const TEST_IDENTIFIER = "ui-perf-test"; const TEST_SUITE = "places"; -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cr = Components.results; - -var wm = Cc["@mozilla.org/appshell/window-mediator;1"]. - getService(Ci.nsIWindowMediator); -var win = wm.getMostRecentWindow("navigator:browser"); - -var ios = Cc["@mozilla.org/network/io-service;1"]. - getService(Ci.nsIIOService); var hs = Cc["@mozilla.org/browser/nav-history-service;1"]. getService(Ci.nsINavHistoryService); var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"]. diff --git a/browser/components/places/tests/perf/browser_ui_history_sidebar.js b/browser/components/places/tests/perf/browser_ui_history_sidebar.js index 1365ade44e8..ba58978a862 100644 --- a/browser/components/places/tests/perf/browser_ui_history_sidebar.js +++ b/browser/components/places/tests/perf/browser_ui_history_sidebar.js @@ -47,15 +47,6 @@ waitForExplicitFinish(); const TEST_IDENTIFIER = "ui-perf-test"; const TEST_SUITE = "places"; -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cr = Components.results; - -var wm = Cc["@mozilla.org/appshell/window-mediator;1"]. - getService(Ci.nsIWindowMediator); -var win = wm.getMostRecentWindow("navigator:browser"); -var ios = Cc["@mozilla.org/network/io-service;1"]. - getService(Ci.nsIIOService); var hs = Cc["@mozilla.org/browser/nav-history-service;1"]. getService(Ci.nsINavHistoryService); var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"]. diff --git a/browser/components/places/tests/perf/browser_ui_history_sidebar_2.js b/browser/components/places/tests/perf/browser_ui_history_sidebar_2.js index f83e50a8078..0fe83369852 100644 --- a/browser/components/places/tests/perf/browser_ui_history_sidebar_2.js +++ b/browser/components/places/tests/perf/browser_ui_history_sidebar_2.js @@ -47,15 +47,6 @@ waitForExplicitFinish(); const TEST_IDENTIFIER = "ui-perf-test"; const TEST_SUITE = "places"; -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cr = Components.results; - -var wm = Cc["@mozilla.org/appshell/window-mediator;1"]. - getService(Ci.nsIWindowMediator); -var win = wm.getMostRecentWindow("navigator:browser"); -var ios = Cc["@mozilla.org/network/io-service;1"]. - getService(Ci.nsIIOService); var hs = Cc["@mozilla.org/browser/nav-history-service;1"]. getService(Ci.nsINavHistoryService); var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"]. diff --git a/browser/components/places/tests/perf/browser_ui_history_sidebar_3.js b/browser/components/places/tests/perf/browser_ui_history_sidebar_3.js index c298c1c4135..b11acbe9e97 100644 --- a/browser/components/places/tests/perf/browser_ui_history_sidebar_3.js +++ b/browser/components/places/tests/perf/browser_ui_history_sidebar_3.js @@ -47,15 +47,6 @@ waitForExplicitFinish(); const TEST_IDENTIFIER = "ui-perf-test"; const TEST_SUITE = "places"; -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cr = Components.results; - -var wm = Cc["@mozilla.org/appshell/window-mediator;1"]. - getService(Ci.nsIWindowMediator); -var win = wm.getMostRecentWindow("navigator:browser"); -var ios = Cc["@mozilla.org/network/io-service;1"]. - getService(Ci.nsIIOService); var hs = Cc["@mozilla.org/browser/nav-history-service;1"]. getService(Ci.nsINavHistoryService); var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"]. diff --git a/browser/components/places/tests/perf/browser_ui_locationbar.js b/browser/components/places/tests/perf/browser_ui_locationbar.js index bc9c994c328..421e0b929f8 100644 --- a/browser/components/places/tests/perf/browser_ui_locationbar.js +++ b/browser/components/places/tests/perf/browser_ui_locationbar.js @@ -46,24 +46,12 @@ waitForExplicitFinish(); const TEST_IDENTIFIER = "ui-perf-test"; const TEST_SUITE = "places"; -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cr = Components.results; - -var wm = Cc["@mozilla.org/appshell/window-mediator;1"]. - getService(Ci.nsIWindowMediator); -var win = wm.getMostRecentWindow("navigator:browser"); - -var ios = Cc["@mozilla.org/network/io-service;1"]. - getService(Ci.nsIIOService); var hs = Cc["@mozilla.org/browser/nav-history-service;1"]. getService(Ci.nsINavHistoryService); var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"]. getService(Ci.nsINavBookmarksService); -var prefs = Cc["@mozilla.org/preferences-service;1"]. - getService(Ci.nsIPrefBranch); -var maxResults = prefs.getIntPref("browser.urlbar.maxRichResults"); +var maxResults = Services.prefs.getIntPref("browser.urlbar.maxRichResults"); var onSearchComplete = gURLBar.onSearchComplete; function add_visit(aURI, aDate) { diff --git a/docshell/test/navigation/browser_bug343515.js b/docshell/test/navigation/browser_bug343515.js index 67e93efdbe2..dd888965019 100644 --- a/docshell/test/navigation/browser_bug343515.js +++ b/docshell/test/navigation/browser_bug343515.js @@ -2,8 +2,6 @@ // Globals var testPath = "http://mochi.test:8888/browser/docshell/test/navigation/"; -var Ci = Components.interfaces; -var Cc = Components.classes; var ctx = {}; // Helper function to check if a window is active @@ -214,9 +212,8 @@ function step7() { function allDone() { // Close the tabs we made - gBrowser.removeCurrentTab(); - gBrowser.tabContainer.advanceSelectedTab(1, true); - gBrowser.removeCurrentTab(); + gBrowser.removeTab(ctx.tab1); + gBrowser.removeTab(ctx.tab2); // Tell the framework we're done finish(); diff --git a/toolkit/components/downloads/test/browser/browser_nsIDownloadManagerUI.js b/toolkit/components/downloads/test/browser/browser_nsIDownloadManagerUI.js index bdc557e9d12..9f4eccc4423 100644 --- a/toolkit/components/downloads/test/browser/browser_nsIDownloadManagerUI.js +++ b/toolkit/components/downloads/test/browser/browser_nsIDownloadManagerUI.js @@ -34,9 +34,6 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ - -let Cc = Components.classes; -let Ci = Components.interfaces; let Cr = Components.results; function test_visibility_open() diff --git a/toolkit/mozapps/extensions/test/browser/head.js b/toolkit/mozapps/extensions/test/browser/head.js index 7d5e2f6d2a2..ceb3249d0b8 100644 --- a/toolkit/mozapps/extensions/test/browser/head.js +++ b/toolkit/mozapps/extensions/test/browser/head.js @@ -2,7 +2,6 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -Components.utils.import("resource://gre/modules/AddonManager.jsm"); Components.utils.import("resource://gre/modules/NetUtil.jsm"); var pathParts = gTestPath.split("/"); diff --git a/toolkit/mozapps/extensions/test/xpinstall/head.js b/toolkit/mozapps/extensions/test/xpinstall/head.js index dc8955d317a..3cb7302eb33 100644 --- a/toolkit/mozapps/extensions/test/xpinstall/head.js +++ b/toolkit/mozapps/extensions/test/xpinstall/head.js @@ -26,8 +26,6 @@ function extractChromeRoot(path) { return chromeRootPath; } -Components.utils.import("resource://gre/modules/AddonManager.jsm"); - /** * This is a test harness designed to handle responding to UI during the process * of installing an XPI. A test can set callbacks to hear about specific parts @@ -362,12 +360,7 @@ var Harness = { } }, - QueryInterface: function(iid) { - if (iid.equals(Components.interfaces.nsIObserver) || - iid.equals(Components.interfaces.nsIWindowMediatorListener) || - iid.equals(Components.interfaces.nsISupports)) - return this; - - throw Components.results.NS_ERROR_NO_INTERFACE; - } + QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, + Ci.nsIWindowMediatorListener, + Ci.nsISupports]) }