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