bug 1492499: marionette: increase TimedPromise timeout on debug; r=whimboo
authorAndreas Tolfsen <ato@sny.no>
Thu, 08 Nov 2018 13:11:40 +0000
changeset 504352 2c1b00a6a97f90dea740c046759698bed3a4c6fe
parent 504351 a4fcddffde4140fc2c0597055ae216eed4c795fd
child 504353 c359697043078fa233fd45d044263fe6db5eeb3d
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhimboo
bugs1492499
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
testing/marionette/sync.js
--- a/testing/marionette/sync.js
+++ b/testing/marionette/sync.js
@@ -1,14 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
+ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 const {
   error,
   stack,
   TimeoutError,
 } = ChromeUtils.import("chrome://marionette/content/error.js", {});
@@ -22,16 +23,18 @@ this.EXPORTED_SYMBOLS = [
   "MessageManagerDestroyedPromise",
   "PollPromise",
   "Sleep",
   "TimedPromise",
 ];
 
 const {TYPE_ONE_SHOT, TYPE_REPEATING_SLACK} = Ci.nsITimer;
 
+const PROMISE_TIMEOUT = AppConstants.DEBUG ? 4500 : 1500;
+
 /**
  * @callback Condition
  *
  * @param {function(*)} resolve
  *     To be called when the condition has been met.  Will return the
  *     resolved value.
  * @param {function} reject
  *     To be called when the condition has not been met.  Will cause
@@ -145,33 +148,36 @@ function PollPromise(func, {timeout = 20
  *
  * In contrast to a regular Promise, it times out after ``timeout``.
  *
  * @param {Condition} func
  *     Function to run, which will have its ``reject``
  *     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
  *     instead resolved on timeout.
  *
  * @return {Promise.<*>}
  *     Timed promise.
  *
  * @throws {TypeError}
  *     If `timeout` is not a number.
  * @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") {
     throw new TypeError();
   }
   if (typeof timeout != "number") {
     throw new TypeError();
   }