mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 09:08:37 +01:00
Factor out unnecessary and potentially problematic use of threadYield in editFieldExternally.
This commit is contained in:
@@ -1230,6 +1230,16 @@ const Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
|
||||
while (flush === true && mainThread.hasPendingEvents());
|
||||
},
|
||||
|
||||
yieldable: function yieldable(func)
|
||||
function magic() {
|
||||
let gen = func.apply(this, arguments);
|
||||
(function next() {
|
||||
try {
|
||||
util.timeout(next, gen.next());
|
||||
} catch(e if e instanceof StopIteration) {};
|
||||
})();
|
||||
},
|
||||
|
||||
/**
|
||||
* Traps errors in the called function, possibly reporting them.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user