зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1529516) per dev's request for causing issues with wdspec a=backout
Backed out changeset 0c48c658c7cf (bug 1529516) Backed out changeset 4e00119c579c (bug 1529516)
This commit is contained in:
Родитель
d7a2f49ed8
Коммит
7bb80a2258
|
@ -213,8 +213,6 @@ 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 = () => {
|
||||
|
@ -222,12 +220,11 @@ function TimedPromise(fn,
|
|||
let err = new throws();
|
||||
reject(err);
|
||||
} else {
|
||||
log.warn(`TimedPromise timed out after ${timeout} ms`, trace);
|
||||
log.warn(`TimedPromise timed out after ${timeout} ms`, stack());
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
|
||||
trace = stack();
|
||||
timer.initWithCallback({notify: bail}, timeout, TYPE_ONE_SHOT);
|
||||
|
||||
try {
|
||||
|
@ -262,14 +259,7 @@ function Sleep(timeout) {
|
|||
if (typeof timeout != "number") {
|
||||
throw new TypeError();
|
||||
}
|
||||
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);
|
||||
});
|
||||
return new TimedPromise(() => {}, {timeout, throws: null});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче