Bug 1529516 - [marionette] Make stacktrace of logged TimedPromise contain the upper stack. r=ato

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Henrik Skupin 2019-02-21 13:04:54 +00:00
parent 5014792038
commit 8116bbe8f7

View File

@ -213,6 +213,8 @@ function TimedPromise(fn,
}
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 = () => {
@ -220,11 +222,12 @@ function TimedPromise(fn,
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 {