Bug 851516: browser-chrome should wait for delayedStartup. r=joe

--HG--
extra : rebase_source : 242defb996e64271c100b7de1140dde76d3e3c39
This commit is contained in:
Gavin Sharp 2013-03-19 09:50:31 +01:00
parent c42cc7a82d
commit 7281829ef2
2 changed files with 27 additions and 0 deletions

View File

@ -1640,6 +1640,7 @@ var gBrowserInit = {
}
Services.obs.notifyObservers(window, "browser-delayed-startup-finished", "");
setTimeout(function () { BrowserChromeTest.markAsReady(); }, 0);
TelemetryTimestamps.add("delayedStartupFinished");
},
@ -7537,3 +7538,20 @@ function focusNextFrame(event) {
focusAndSelectUrlBar();
}
let BrowserChromeTest = {
_cb: null,
_ready: false,
markAsReady: function () {
this._ready = true;
if (this._cb) {
this._cb();
this._cb = null;
}
},
runWhenReady: function (cb) {
if (this._ready)
cb();
else
this._cb = cb;
}
};

View File

@ -92,6 +92,15 @@ Tester.prototype = {
},
start: function Tester_start() {
// Check whether this window is ready to run tests.
if (window.BrowserChromeTest) {
BrowserChromeTest.runWhenReady(this.actuallyStart.bind(this));
return;
}
this.actuallyStart();
},
actuallyStart: function Tester_actuallyStart() {
//if testOnLoad was not called, then gConfig is not defined
if (!gConfig)
gConfig = readConfig();