mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-04 19:24:14 +01:00
Bang on tests some more. Ameliorate some async completion issues.
--HG-- extra : rebase_source : 0f550b1650963e4010e447db2df7d6815627bae2
This commit is contained in:
@@ -1536,10 +1536,19 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
this.yielders--;
|
||||
}
|
||||
},
|
||||
|
||||
waitFor: function waitFor(test, self, timeout, interruptable) {
|
||||
let end = timeout && Date.now() + timeout;
|
||||
while ((!end || Date.now() < end) && !test.call(self))
|
||||
this.threadYield(false, interruptable);
|
||||
let end = timeout && Date.now() + timeout, result;
|
||||
|
||||
let timer = services.Timer(function () {}, 10, services.Timer.TYPE_REPEATING_SLACK);
|
||||
try {
|
||||
while (!(result = test.call(self)) && (!end || Date.now() < end))
|
||||
this.threadYield(false, interruptable);
|
||||
}
|
||||
finally {
|
||||
timer.cancel();
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
yieldable: function yieldable(func)
|
||||
|
||||
Reference in New Issue
Block a user