mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 01:57:58 +01:00
Minor cleanup.
This commit is contained in:
@@ -260,9 +260,10 @@ var CommandWidgets = Class("CommandWidgets", {
|
||||
configurable: true, enumerable: true,
|
||||
get: function get_whenReady() {
|
||||
let elem = document.getElementById(id);
|
||||
while (elem.contentDocument.documentURI != elem.getAttribute("src") ||
|
||||
["viewable", "complete"].indexOf(elem.contentDocument.readyState) < 0)
|
||||
util.threadYield();
|
||||
|
||||
util.waitFor(function () elem.contentDocument.documentURI === elem.getAttribute("src") &&
|
||||
["viewable", "complete"].indexOf(elem.contentDocument.readyState) >= 0);
|
||||
|
||||
res = res || (processor || util.identity).call(self, elem);
|
||||
return res;
|
||||
}
|
||||
@@ -1189,9 +1190,8 @@ var CommandLine = Module("commandline", {
|
||||
this.waiting = true;
|
||||
for (let [, context] in Iterator(list)) {
|
||||
let done = function done() !(idx >= n + context.items.length || idx == -2 && !context.items.length);
|
||||
while (context.incomplete && !done())
|
||||
util.threadYield(false, true);
|
||||
|
||||
util.waitFor(function () !context.incomplete || done())
|
||||
if (done())
|
||||
break;
|
||||
|
||||
@@ -1420,7 +1420,7 @@ var CommandLine = Module("commandline", {
|
||||
let command = commandline.command;
|
||||
|
||||
self.accepted = true;
|
||||
return function () modes.pop();
|
||||
return function () { modes.pop(); };
|
||||
});
|
||||
|
||||
[
|
||||
|
||||
@@ -1191,8 +1191,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
|
||||
case dactyl.NEW_WINDOW:
|
||||
let win = window.openDialog(document.documentURI, "_blank", "chrome,all,dialog=no");
|
||||
while (win.document.readyState != "complete")
|
||||
util.threadYield();
|
||||
util.waitFor(function () win.document.readyState === "complete");
|
||||
browser = win.getBrowser();
|
||||
// FALLTHROUGH
|
||||
case dactyl.CURRENT_TAB:
|
||||
|
||||
@@ -526,7 +526,7 @@ var Events = Module("events", {
|
||||
if (quiet)
|
||||
commandline.quiet = quiet;
|
||||
|
||||
util.threadYield(1, true);
|
||||
util.threadYield(1, true); // Why? --Kris
|
||||
|
||||
for (let [, evt_obj] in Iterator(events.fromString(keys))) {
|
||||
let now = Date.now();
|
||||
@@ -922,8 +922,6 @@ var Events = Module("events", {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
waitForPageLoad: function (time) {
|
||||
util.threadYield(true); // clear queue
|
||||
|
||||
if (buffer.loaded)
|
||||
return true;
|
||||
|
||||
@@ -1267,7 +1265,7 @@ var Events = Module("events", {
|
||||
|
||||
let urlbar = document.getElementById("urlbar");
|
||||
if (elem == null && urlbar && urlbar.inputField == this._lastFocus)
|
||||
util.threadYield(true);
|
||||
util.threadYield(true); // Why? --Kris
|
||||
|
||||
while (modes.main.ownsFocus)
|
||||
modes.pop(null, { fromFocus: true });
|
||||
|
||||
@@ -203,12 +203,14 @@ var Tabs = Module("tabs", {
|
||||
getGroups: function () {
|
||||
if ("_groups" in this)
|
||||
return this._groups;
|
||||
|
||||
if (window.TabView && TabView._initFrame)
|
||||
TabView._initFrame();
|
||||
|
||||
let iframe = document.getElementById("tab-view");
|
||||
this._groups = this._groups = iframe ? iframe.contentWindow : null;
|
||||
while (this._groups && !this._groups.TabItems)
|
||||
util.threadYield(false, true);
|
||||
this._groups = iframe ? iframe.contentWindow : null;
|
||||
if (this._groups)
|
||||
util.waitFor(function () this._groups.TabItems, this);
|
||||
return this._groups;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user