Bug 1529516 - [marionette] Make stacktrace of logged TimedPromise contain the upper stack. r=ato
authorHenrik Skupin <mail@hskupin.info>
Thu, 21 Feb 2019 13:04:54 +0000
changeset 518136 4e00119c579cf49617d95f147cfbb9434b9a4039
parent 518135 8d55bb225424f4ee0fad6d6bbfc1b78991dc2d74
child 518137 0c48c658c7cfcc8b49e69b4805d8eb64b3f1cb48
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1529516
milestone67.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 1529516 - [marionette] Make stacktrace of logged TimedPromise contain the upper stack. r=ato Differential Revision: https://phabricator.services.mozilla.com/D20637
testing/marionette/sync.js
--- a/testing/marionette/sync.js
+++ b/testing/marionette/sync.js
@@ -208,28 +208,31 @@ function TimedPromise(fn,
   if (typeof timeout != "number") {
     throw new TypeError();
   }
   if (!Number.isInteger(timeout) || timeout < 0) {
     throw new RangeError();
   }
 
   return new Promise((resolve, reject) => {
+    let trace;
+
     // Reject only if |throws| is given.  Otherwise it is assumed that
     // the user is OK with the promise timing out.
     let bail = () => {
       if (throws !== null) {
         let err = new throws();
         reject(err);
       } else {
-        log.warn(`TimedPromise timed out after ${timeout} ms`, stack());
+        log.warn(`TimedPromise timed out after ${timeout} ms`, trace);
         resolve();
       }
     };
 
+    trace = stack();
     timer.initWithCallback({notify: bail}, timeout, TYPE_ONE_SHOT);
 
     try {
       fn(resolve, reject);
     } catch (e) {
       reject(e);
     }
   }).then(res => {