Bug 724286 - Fix TelemetryTimestamps, AddonManagerPrivate global scope pollution and whitelist __SSi. r=dietrich
authorDão Gottwald <dao@mozilla.com>
Sun, 05 Feb 2012 21:22:57 +0100
changeset 86220 75a63510cbcf3fa625581aa95f367b9b367cc93b
parent 86219 7c4257358d6ae97f644d8784b9ac3a0fd572efde
child 86221 7122bcc5c21d6a0af45e1b458e49949cdadace69
push id22004
push usermak77@bonardo.net
push dateMon, 06 Feb 2012 08:37:47 +0000
treeherdermozilla-central@6292e55419d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdietrich
bugs724286
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 724286 - Fix TelemetryTimestamps, AddonManagerPrivate global scope pollution and whitelist __SSi. r=dietrich
browser/base/content/browser.js
browser/modules/test/browser_TelemetryTimestamps.js
testing/mochitest/browser-test.js
toolkit/mozapps/extensions/test/browser/head.js
toolkit/mozapps/plugins/tests/browser_bug435788.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -132,18 +132,19 @@ XPCOMUtils.defineLazyGetter(window, "gFi
 });
 
 __defineGetter__("gPrefService", function() {
   delete this.gPrefService;
   return this.gPrefService = Services.prefs;
 });
 
 __defineGetter__("AddonManager", function() {
-  Cu.import("resource://gre/modules/AddonManager.jsm");
-  return this.AddonManager;
+  let tmp = {};
+  Cu.import("resource://gre/modules/AddonManager.jsm", tmp);
+  return this.AddonManager = tmp.AddonManager;
 });
 __defineSetter__("AddonManager", function (val) {
   delete this.AddonManager;
   return this.AddonManager = val;
 });
 
 __defineGetter__("PluralForm", function() {
   Cu.import("resource://gre/modules/PluralForm.jsm");
@@ -1498,17 +1499,19 @@ function prepareForStartup() {
   gBrowser.addEventListener("MozApplicationManifest",
                             OfflineApps, false);
 
   // setup simple gestures support
   gGestureSupport.init(true);
 }
 
 function delayedStartup(isLoadingBlank, mustLoadSidebar) {
-  Cu.import("resource:///modules/TelemetryTimestamps.jsm");
+  let tmp = {};
+  Cu.import("resource:///modules/TelemetryTimestamps.jsm", tmp);
+  let TelemetryTimestamps = tmp.TelemetryTimestamps;
   TelemetryTimestamps.add("delayedStartupStarted");
   gDelayedStartupTimeoutId = null;
 
   Services.obs.addObserver(gSessionHistoryObserver, "browser:purge-session-history", false);
   Services.obs.addObserver(gXPInstallObserver, "addon-install-disabled", false);
   Services.obs.addObserver(gXPInstallObserver, "addon-install-started", false);
   Services.obs.addObserver(gXPInstallObserver, "addon-install-blocked", false);
   Services.obs.addObserver(gXPInstallObserver, "addon-install-failed", false);
@@ -1774,17 +1777,17 @@ function delayedStartup(isLoadingBlank, 
       if (event.button == 0)
         appMenuOpening = new Date();
     }, false);
     appMenuPopup.addEventListener("popupshown", function(event) {
       if (event.target != appMenuPopup || !appMenuOpening)
         return;
       let duration = new Date() - appMenuOpening;
       appMenuOpening = null;
-      Services.telemetry.getHistogramById("FX_APP_MENU_OPEN_MS").add(duration);
+      Services.telemetry.getHistogramById("FX_APP_MENU_OPEN_MS").add(duration);
     }, false);
   }
 
   window.addEventListener("mousemove", MousePosTracker, false);
   window.addEventListener("dragover", MousePosTracker, false);
 
   Services.obs.notifyObservers(window, "browser-delayed-startup-finished", "");
   TelemetryTimestamps.add("delayedStartupFinished");
--- a/browser/modules/test/browser_TelemetryTimestamps.js
+++ b/browser/modules/test/browser_TelemetryTimestamps.js
@@ -6,17 +6,19 @@ function getSimpleMeasurementsFromTeleme
   let str = Cc['@mozilla.org/supports-string;1'].createInstance(Ci.nsISupportsString);
   TelemetryPing.observe(str, "get-payload", "");
 
   return JSON.parse(str.data).simpleMeasurements;
 }
 
 function test() {
   // Test the module logic
-  Cu.import("resource:///modules/TelemetryTimestamps.jsm");
+  let tmp = {};
+  Cu.import("resource:///modules/TelemetryTimestamps.jsm", tmp);
+  let TelemetryTimestamps = tmp.TelemetryTimestamps;
   let now = Date.now();
   TelemetryTimestamps.add("foo");
   ok(TelemetryTimestamps.get().foo, "foo was added");
   ok(TelemetryTimestamps.get().foo >= now, "foo has a reasonable value");
 
   // Add timestamp with value
   // Use a value far in the future since TelemetryPing substracts the time of
   // process initialization.
--- a/testing/mochitest/browser-test.js
+++ b/testing/mochitest/browser-test.js
@@ -90,17 +90,17 @@ Tester.prototype = {
     //if testOnLoad was not called, then gConfig is not defined
     if (!gConfig)
       gConfig = readConfig();
     this.repeat = gConfig.repeat;
     this.dumper.dump("*** Start BrowserChrome Test Results ***\n");
     this._cs.registerListener(this);
     this._globalProperties = Object.keys(window);
     this._globalPropertyWhitelist = ["navigator", "constructor", "Application",
-      "__SS_tabsToRestore", "webConsoleCommandController",
+      "__SS_tabsToRestore", "__SSi", "webConsoleCommandController",
 
       // Temporarily added to whitelist for Fennec tests:
       "AddonUpdateChecker",
       "PlacesAggregatedTransaction",
       "PlacesCreateFolderTransaction",
       "PlacesCreateBookmarkTransaction",
       "PlacesCreateSeparatorTransaction",
       "PlacesCreateLivemarkTransaction",
--- a/toolkit/mozapps/extensions/test/browser/head.js
+++ b/toolkit/mozapps/extensions/test/browser/head.js
@@ -1,14 +1,19 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 Components.utils.import("resource://gre/modules/NetUtil.jsm");
 
+let tmp = {};
+Components.utils.import("resource://gre/modules/AddonManager.jsm", tmp);
+let AddonManager = tmp.AddonManager;
+let AddonManagerPrivate = tmp.AddonManagerPrivate;
+
 var pathParts = gTestPath.split("/");
 // Drop the test filename
 pathParts.splice(pathParts.length - 1, pathParts.length);
 
 var gTestInWindow = /-window$/.test(pathParts[pathParts.length - 1]);
 
 // Drop the UI type
 pathParts.splice(pathParts.length - 1, pathParts.length);
--- a/toolkit/mozapps/plugins/tests/browser_bug435788.js
+++ b/toolkit/mozapps/plugins/tests/browser_bug435788.js
@@ -1,11 +1,13 @@
 const TEST_ROOT = "http://example.com/browser/toolkit/mozapps/plugins/tests/";
 
-Components.utils.import("resource://gre/modules/AddonManager.jsm");
+let tmp = {};
+Components.utils.import("resource://gre/modules/AddonManager.jsm", tmp);
+let AddonManager = tmp.AddonManager;
 
 var gPFS;
 
 function test() {
   waitForExplicitFinish();
 
   prepare_test_1();
 }