mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Bug 1529516 - [marionette] Use Promise instead of TimedPromise for Sleep(). r=ato
"Sleep()" currently uses the TimedPromise class and as such logs a warning message each time. To not massively clutter the log files with those entries Sleep should just use a plain Promise. Depends on D20637 Differential Revision: https://phabricator.services.mozilla.com/D20638 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
8116bbe8f7
commit
65837e9068
@ -262,7 +262,14 @@ function Sleep(timeout) {
|
||||
if (typeof timeout != "number") {
|
||||
throw new TypeError();
|
||||
}
|
||||
return new TimedPromise(() => {}, {timeout, throws: null});
|
||||
if (!Number.isInteger(timeout) || timeout < 0) {
|
||||
throw new RangeError();
|
||||
}
|
||||
|
||||
return new Promise(resolve => {
|
||||
const timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
timer.initWithCallback({notify: resolve}, timeout, TYPE_ONE_SHOT);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user