From 0dbfd855884637c4dd713df1c5733c108e35e2f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Fri, 6 Apr 2012 22:02:15 +0200 Subject: [PATCH] Bug 723953 - Fennec chrome scripts and tests leak global variables. r=mbrubeck --- mobile/xul/chrome/content/browser-scripts.js | 18 +++++++----- mobile/xul/chrome/content/browser-ui.js | 4 --- mobile/xul/chrome/content/browser.xul | 2 +- mobile/xul/chrome/content/downloads.js | 11 +++---- mobile/xul/chrome/content/extensions.js | 29 ++++++------------- mobile/xul/chrome/tests/browser_addons.js | 5 ---- .../chrome/tests/browser_addons_locales.js | 6 ++-- mobile/xul/chrome/tests/browser_contacts.js | 4 ++- .../chrome/tests/browser_localerepository.js | 5 ++-- .../tests/browser_localerepository_buildid.js | 5 ++-- .../tests/browser_localerepository_pref.js | 5 ++-- mobile/xul/chrome/tests/browser_vkb.js | 2 +- testing/mochitest/browser-test.js | 28 ------------------ 13 files changed, 42 insertions(+), 82 deletions(-) diff --git a/mobile/xul/chrome/content/browser-scripts.js b/mobile/xul/chrome/content/browser-scripts.js index aa4ed082d362..561948f459f4 100644 --- a/mobile/xul/chrome/content/browser-scripts.js +++ b/mobile/xul/chrome/content/browser-scripts.js @@ -42,15 +42,17 @@ Cu.import("resource://gre/modules/Services.jsm"); /** * Delay load some JS modules */ -XPCOMUtils.defineLazyGetter(this, "PluralForm", function() { - Cu.import("resource://gre/modules/PluralForm.jsm"); - return PluralForm; -}); +XPCOMUtils.defineLazyModuleGetter(this, "PluralForm", + "resource://gre/modules/PluralForm.jsm"); -XPCOMUtils.defineLazyGetter(this, "PlacesUtils", function() { - Cu.import("resource://gre/modules/PlacesUtils.jsm"); - return PlacesUtils; -}); +XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", + "resource://gre/modules/PlacesUtils.jsm"); + +XPCOMUtils.defineLazyModuleGetter(this, "AddonManager", + "resource://gre/modules/AddonManager.jsm"); + +XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", + "resource://gre/modules/NetUtil.jsm"); /* window.Rect is used by http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-Rect * so it is not possible to set a lazy getter for Geometry.jsm diff --git a/mobile/xul/chrome/content/browser-ui.js b/mobile/xul/chrome/content/browser-ui.js index f8c833845990..b4923126bea2 100644 --- a/mobile/xul/chrome/content/browser-ui.js +++ b/mobile/xul/chrome/content/browser-ui.js @@ -37,10 +37,6 @@ * * ***** END LICENSE BLOCK ***** */ -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/AddonManager.jsm"); - [ ["AllPagesList", "popup_autocomplete", "cmd_openLocation"], ["HistoryList", "history-items", "cmd_history"], diff --git a/mobile/xul/chrome/content/browser.xul b/mobile/xul/chrome/content/browser.xul index ad35df46ccbb..9bae8cfe9fdd 100644 --- a/mobile/xul/chrome/content/browser.xul +++ b/mobile/xul/chrome/content/browser.xul @@ -81,8 +81,8 @@ xmlns:html="http://www.w3.org/1999/xhtml">