Bug 1220327 - Intermittent TalosError: Timeout in tp5n. r=jmaher

--HG--
extra : commitid : 4YHpifx0aM9
extra : rebase_source : 5917f295fafd9b603b8b592c260b5ee4026a7818
This commit is contained in:
Julien Pagès 2015-11-27 00:04:54 +01:00
Родитель ba5bea27af
Коммит b653095287
1 изменённых файлов: 45 добавлений и 13 удалений

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

@ -35,7 +35,6 @@ var report;
var noisy = false;
var timeout = -1;
var delay = 250;
var timeoutEvent = -1;
var running = false;
var forceCC = true;
var reportRSS = true;
@ -68,6 +67,47 @@ var pageUrls;
// the io service
var gIOS = null;
/**
* SingleTimeout class. Allow to register one and only one callback using
* setTimeout at a time.
*/
var SingleTimeout = function() {
this.timeoutEvent = undefined;
};
/**
* Register a callback with the given timeout.
*
* If timeout is < 0, this is a no-op.
*
* If a callback was previously registered and has not been called yet, it is
* first cleared with clear().
*/
SingleTimeout.prototype.register = function(callback, timeout) {
if (timeout >= 0) {
if (this.timeoutEvent !== undefined) {
this.clear();
}
var that = this;
this.timeoutEvent = setTimeout(function() {
that.timeoutEvent = undefined;
callback();
}, timeout);
}
};
/**
* Clear a registered callback.
*/
SingleTimeout.prototype.clear = function() {
if (this.timeoutEvent !== undefined) {
clearTimeout(this.timeoutEvent);
this.timeoutEvent = undefined;
}
};
var failTimeout = new SingleTimeout();
function plInit() {
if (running) {
return;
@ -346,9 +386,7 @@ function plLoadPage() {
};
}
if (timeout > 0) {
timeoutEvent = setTimeout(function () {loadFail(); }, timeout);
}
failTimeout.register(loadFail, timeout);
// record which page we are about to open
Profiler.mark("Opening " + pages[pageIndex].url.path);
@ -566,9 +604,7 @@ function plPaintedCapturing() {
}
function _loadHandlerCapturing() {
if (timeout > 0) {
clearTimeout(timeoutEvent);
}
failTimeout.clear();
if (!(plPageFlags() & TEST_DOES_OWN_TIMING)) {
dumpLine("tp: Capturing onload handler used with page that doesn't do its own timing?");
@ -625,9 +661,7 @@ function plPainted() {
}
function _loadHandler() {
if (timeout > 0) {
clearTimeout(timeoutEvent);
}
failTimeout.clear();
var end_time = Date.now();
var time = (end_time - start_time);
@ -651,9 +685,7 @@ function _loadHandler() {
// the core handler for remote (e10s) browser
function plLoadHandlerMessage() {
if (timeout > 0) {
clearTimeout(timeoutEvent);
}
failTimeout.clear();
if ((plPageFlags() & EXECUTE_SCROLL_TEST)) {
// Let the page settle down after its load event, then execute the scroll test.