1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 23:18:01 +01:00

Make :yank :extensions work as expected.

This commit is contained in:
Kris Maglione
2011-01-22 04:59:46 -05:00
parent f536b56ff3
commit 3f0901ee2a
4 changed files with 12 additions and 2 deletions

View File

@@ -1215,7 +1215,9 @@ var CommandLine = Module("commandline", {
function observe(str, highlight, dom) { function observe(str, highlight, dom) {
buffer.push(dom && !isString(str) ? util.domToString(dom) : str); buffer.push(dom && !isString(str) ? util.domToString(dom) : str);
} }
this.savingOutput = true;
dactyl.trapErrors.apply(dactyl, [fn, self].concat(Array.slice(arguments, 2))); dactyl.trapErrors.apply(dactyl, [fn, self].concat(Array.slice(arguments, 2)));
this.savingOutput = false;
return buffer.join("\n"); return buffer.join("\n");
} }
}, { }, {

View File

@@ -1804,6 +1804,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
&#xa0;on restart)</>; &#xa0;on restart)</>;
return <></>; return <></>;
} }
let waiting = true;
AddonManager.getAddonsByTypes(["extension"], function (extensions) { AddonManager.getAddonsByTypes(["extension"], function (extensions) {
if (args[0]) if (args[0])
extensions = extensions.filter(function (extension) extension.name.indexOf(args[0]) >= 0); extensions = extensions.filter(function (extension) extension.name.indexOf(args[0]) >= 0);
@@ -1823,7 +1824,10 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
dactyl.echoerr("Exxx: No extension matching " + filter.quote()); dactyl.echoerr("Exxx: No extension matching " + filter.quote());
else else
dactyl.echoerr("No extensions installed"); dactyl.echoerr("No extensions installed");
waiting = false;
}); });
if (commandline.savingOutput)
util.waitFor(function () !waiting);
}, },
{ argCount: "?" }); { argCount: "?" });

View File

@@ -803,8 +803,8 @@ var CompletionContext = Class("CompletionContext", {
*/ */
wait: function wait(interruptable, timeout) { wait: function wait(interruptable, timeout) {
let end = Date.now() + timeout; let end = Date.now() + timeout;
while (this.incomplete && (!timeout || Date.now() > end)) util.waitFor(function () !this.incomplete || (this.timeout && Date.now() > end),
util.threadYield(false, interruptable); this);
return this.incomplete; return this.incomplete;
} }
}, { }, {

View File

@@ -1507,6 +1507,10 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
this.yielders--; this.yielders--;
} }
}, },
waitFor: function waitFor(test, self, interruptable) {
while (!test.call(self))
this.threadYield(false, interruptable);
},
yieldable: function yieldable(func) yieldable: function yieldable(func)
function magic() { function magic() {