Bug 724286 - Fix TelemetryTimestamps, AddonManagerPrivate global scope pollution and whitelist __SSi. r=dietrich

This commit is contained in:
Dão Gottwald 2012-02-05 21:22:57 +01:00
Родитель dfae6bcec1
Коммит e8ed468174
5 изменённых файлов: 19 добавлений и 7 удалений

Просмотреть файл

@ -137,8 +137,9 @@ __defineGetter__("gPrefService", function() {
}); });
__defineGetter__("AddonManager", function() { __defineGetter__("AddonManager", function() {
Cu.import("resource://gre/modules/AddonManager.jsm"); let tmp = {};
return this.AddonManager; Cu.import("resource://gre/modules/AddonManager.jsm", tmp);
return this.AddonManager = tmp.AddonManager;
}); });
__defineSetter__("AddonManager", function (val) { __defineSetter__("AddonManager", function (val) {
delete this.AddonManager; delete this.AddonManager;
@ -1503,7 +1504,9 @@ function prepareForStartup() {
} }
function delayedStartup(isLoadingBlank, mustLoadSidebar) { 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"); TelemetryTimestamps.add("delayedStartupStarted");
gDelayedStartupTimeoutId = null; gDelayedStartupTimeoutId = null;
@ -1779,7 +1782,7 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
return; return;
let duration = new Date() - appMenuOpening; let duration = new Date() - appMenuOpening;
appMenuOpening = null; appMenuOpening = null;
Services.telemetry.getHistogramById("FX_APP_MENU_OPEN_MS").add(duration); Services.telemetry.getHistogramById("FX_APP_MENU_OPEN_MS").add(duration);
}, false); }, false);
} }

Просмотреть файл

@ -11,7 +11,9 @@ function getSimpleMeasurementsFromTelemetryPing() {
function test() { function test() {
// Test the module logic // 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(); let now = Date.now();
TelemetryTimestamps.add("foo"); TelemetryTimestamps.add("foo");
ok(TelemetryTimestamps.get().foo, "foo was added"); ok(TelemetryTimestamps.get().foo, "foo was added");

Просмотреть файл

@ -95,7 +95,7 @@ Tester.prototype = {
this._cs.registerListener(this); this._cs.registerListener(this);
this._globalProperties = Object.keys(window); this._globalProperties = Object.keys(window);
this._globalPropertyWhitelist = ["navigator", "constructor", "Application", this._globalPropertyWhitelist = ["navigator", "constructor", "Application",
"__SS_tabsToRestore", "webConsoleCommandController", "__SS_tabsToRestore", "__SSi", "webConsoleCommandController",
// Temporarily added to whitelist for Fennec tests: // Temporarily added to whitelist for Fennec tests:
"AddonUpdateChecker", "AddonUpdateChecker",

Просмотреть файл

@ -4,6 +4,11 @@
Components.utils.import("resource://gre/modules/NetUtil.jsm"); 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("/"); var pathParts = gTestPath.split("/");
// Drop the test filename // Drop the test filename
pathParts.splice(pathParts.length - 1, pathParts.length); pathParts.splice(pathParts.length - 1, pathParts.length);

Просмотреть файл

@ -1,6 +1,8 @@
const TEST_ROOT = "http://example.com/browser/toolkit/mozapps/plugins/tests/"; 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; var gPFS;