bug 1492499: marionette: increase TimedPromise timeout on debug; r=whimboo

The things that rely on TimedPromise, such as awaiting a sizemodechange
event on exiting fullscreen, takes a lot longer to perform in Asan
and debug builds than in optimised builds.

This patch increases the TimedPromise timeout duration by three
times in debug builds, which is the same amount WPT uses.

Depends on D10569

Differential Revision: https://phabricator.services.mozilla.com/D11189

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Tolfsen 2018-11-08 13:11:40 +00:00
Родитель fdddd29e71
Коммит 4d97ed0425
1 изменённых файлов: 8 добавлений и 2 удалений

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

@ -4,6 +4,7 @@
"use strict";
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
@ -27,6 +28,8 @@ this.EXPORTED_SYMBOLS = [
const {TYPE_ONE_SHOT, TYPE_REPEATING_SLACK} = Ci.nsITimer;
const PROMISE_TIMEOUT = AppConstants.DEBUG ? 4500 : 1500;
/**
* @callback Condition
*
@ -150,9 +153,11 @@ function PollPromise(func, {timeout = 2000, interval = 10} = {}) {
* callback invoked after the ``timeout`` duration is reached.
* It is given two callbacks: ``resolve(value)`` and
* ``reject(error)``.
* @param {timeout=} [timeout=1500] timeout
* @param {timeout=} timeout
* ``condition``'s ``reject`` callback will be called
* after this timeout, given in milliseconds.
* By default 1500 ms in an optimised build and 4500 ms in
* debug builds.
* @param {Error=} [throws=TimeoutError] throws
* When the ``timeout`` is hit, this error class will be
* thrown. If it is null, no error is thrown and the promise is
@ -166,7 +171,8 @@ function PollPromise(func, {timeout = 2000, interval = 10} = {}) {
* @throws {RangeError}
* If `timeout` is not an unsigned integer.
*/
function TimedPromise(fn, {timeout = 1500, throws = TimeoutError} = {}) {
function TimedPromise(fn,
{timeout = PROMISE_TIMEOUT, throws = TimeoutError} = {}) {
const timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
if (typeof fn != "function") {