mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 807478 - fix timeout argument to waitFor(), r=cjones
This commit is contained in:
parent
60abcfab6e
commit
f83afe286c
@ -689,7 +689,9 @@ MarionetteDriverActor.prototype = {
|
||||
}
|
||||
|
||||
let curWindow = this.getCurrentWindow();
|
||||
let marionette = new Marionette(this, curWindow, "chrome", this.marionetteLog, this.marionettePerf);
|
||||
let marionette = new Marionette(this, curWindow, "chrome",
|
||||
this.marionetteLog, this.marionettePerf,
|
||||
this.scriptTimeout);
|
||||
let _chromeSandbox = this.createExecuteSandbox(curWindow, marionette, aRequest.args, aRequest.specialPowers);
|
||||
if (!_chromeSandbox)
|
||||
return;
|
||||
@ -799,7 +801,8 @@ MarionetteDriverActor.prototype = {
|
||||
let original_onerror = curWindow.onerror;
|
||||
let that = this;
|
||||
let marionette = new Marionette(this, curWindow, "chrome",
|
||||
this.marionetteLog, this.marionettePerf);
|
||||
this.marionetteLog, this.marionettePerf,
|
||||
this.scriptTimeout);
|
||||
marionette.command_id = this.command_id;
|
||||
|
||||
function chromeAsyncReturnFunc(value, status) {
|
||||
|
@ -264,7 +264,9 @@ function createExecuteContentSandbox(aWindow) {
|
||||
sandbox.__proto__ = sandbox.window;
|
||||
sandbox.testUtils = utils;
|
||||
|
||||
let marionette = new Marionette(this, aWindow, "content", marionetteLogObj, marionettePerf);
|
||||
let marionette = new Marionette(this, aWindow, "content",
|
||||
marionetteLogObj, marionettePerf,
|
||||
marionetteTimeout);
|
||||
sandbox.marionette = marionette;
|
||||
marionette.exports.forEach(function(fn) {
|
||||
try {
|
||||
@ -445,7 +447,6 @@ function executeWithCallback(msg, timeout) {
|
||||
asyncTestTimeoutId = curWindow.setTimeout(function() {
|
||||
sandbox.asyncComplete('timed out', 28);
|
||||
}, marionetteTimeout);
|
||||
sandbox.marionette.timeout = marionetteTimeout;
|
||||
|
||||
curWindow.addEventListener('error', function win__onerror(evt) {
|
||||
curWindow.removeEventListener('error', win__onerror, true);
|
||||
|
@ -5,14 +5,14 @@
|
||||
* The Marionette object, passed to the script context.
|
||||
*/
|
||||
|
||||
function Marionette(scope, window, context, logObj, perfData) {
|
||||
function Marionette(scope, window, context, logObj, perfData, timeout) {
|
||||
this.scope = scope;
|
||||
this.window = window;
|
||||
this.tests = [];
|
||||
this.logObj = logObj;
|
||||
this.perfData = perfData;
|
||||
this.context = context;
|
||||
this.timeout = 0;
|
||||
this.timeout = timeout;
|
||||
this.TEST_UNEXPECTED_FAIL = "TEST-UNEXPECTED-FAIL";
|
||||
this.TEST_PASS = "TEST-PASS";
|
||||
this.TEST_KNOWN_FAIL = "TEST-KNOWN-FAIL";
|
||||
@ -144,14 +144,15 @@ Marionette.prototype = {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
timeout = timeout || Date.now();
|
||||
if (Date.now() - timeout > this.timeout) {
|
||||
var now = Date.now();
|
||||
var deadline = now + (typeof(timeout) == "undefined" ? this.timeout : timeout);
|
||||
if (deadline <= now) {
|
||||
dump("waitFor timeout: " + test.toString() + "\n");
|
||||
// the script will timeout here, so no need to raise a separate
|
||||
// timeout exception
|
||||
return;
|
||||
}
|
||||
this.window.setTimeout(this.waitFor.bind(this), 100, callback, test, timeout);
|
||||
this.window.setTimeout(this.waitFor.bind(this), 100, callback, test, deadline - now);
|
||||
},
|
||||
|
||||
runEmulatorCmd: function runEmulatorCmd(cmd, callback) {
|
||||
|
Loading…
Reference in New Issue
Block a user