summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorKris Maglione <maglione.k@gmail.com>2011-03-09 03:49:38 -0500
committerKris Maglione <maglione.k@gmail.com>2011-03-09 03:49:38 -0500
commitcc73345c715e97887eae99178a622721aa84466b (patch)
treee7c6b0c11bf56bdbd1046fa793ad0a1d81a41ada /common
parentdfd7398a4fab250d529738abad3271ae2033df2d (diff)
downloadpentadactyl-cc73345c715e97887eae99178a622721aa84466b.tar.gz
Fix some initialization order issues.
Diffstat (limited to 'common')
-rw-r--r--common/content/commandline.js2
-rw-r--r--common/content/hints.js3
-rw-r--r--common/content/modes.js4
-rw-r--r--common/modules/io.jsm3
-rw-r--r--common/modules/javascript.jsm1
-rw-r--r--common/modules/util.jsm5
6 files changed, 14 insertions, 4 deletions
diff --git a/common/content/commandline.js b/common/content/commandline.js
index 46944739..69e6a3cc 100644
--- a/common/content/commandline.js
+++ b/common/content/commandline.js
@@ -1390,7 +1390,7 @@ var CommandLine = Module("commandline", {
subCommand: 0
});
},
- modes: function () {
+ modes: function initModes() {
modes.addMode("COMMAND_LINE", {
char: "c",
description: "Active when the command line is focused",
diff --git a/common/content/hints.js b/common/content/hints.js
index bc932d00..bcf431ce 100644
--- a/common/content/hints.js
+++ b/common/content/hints.js
@@ -1115,7 +1115,8 @@ var Hints = Module("hints", {
Mode: Struct("HintMode", "name", "prompt", "action", "tags", "filter")
.localize("prompt")
}, {
- modes: function () {
+ modes: function initModes() {
+ initModes.require("commandline");
modes.addMode("HINTS", {
extended: true,
description: "Active when selecting elements in QuickHint or ExtendedHint mode",
diff --git a/common/content/modes.js b/common/content/modes.js
index a46b33ed..55fa19fe 100644
--- a/common/content/modes.js
+++ b/common/content/modes.js
@@ -426,6 +426,10 @@ var Modes = Module("modes", {
}, {
Mode: Class("Mode", {
init: function init(name, options, params) {
+ if (options.bases)
+ util.assert(options.bases.every(function (m) m instanceof this, this.constructor),
+ "Invalid bases", true);
+
update(this, {
id: 1 << Modes.Mode._id++,
name: name,
diff --git a/common/modules/io.jsm b/common/modules/io.jsm
index 93f9752e..a6487a99 100644
--- a/common/modules/io.jsm
+++ b/common/modules/io.jsm
@@ -996,7 +996,8 @@ unlet s:cpo_save
}]);
},
- modes: function (dactyl, modules, window) {
+ modes: function initModes(dactyl, modules, window) {
+ initModes.require("commandline");
const { modes } = modules;
modes.addMode("FILE_INPUT", {
diff --git a/common/modules/javascript.jsm b/common/modules/javascript.jsm
index 7d9eeff5..0f78615c 100644
--- a/common/modules/javascript.jsm
+++ b/common/modules/javascript.jsm
@@ -700,6 +700,7 @@ var JavaScript = Module("javascript", {
});
},
modes: function initModes(dactyl, modules, window) {
+ initModes.require("commandline");
const { modes } = modules;
modes.addMode("REPL", {
diff --git a/common/modules/util.jsm b/common/modules/util.jsm
index d087d6c0..673366a0 100644
--- a/common/modules/util.jsm
+++ b/common/modules/util.jsm
@@ -931,7 +931,10 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
let docShells = window.docShell.getDocShellEnumerator(Ci.nsIDocShellTreeItem[type],
Ci.nsIDocShell.ENUMERATE_FORWARDS);
while (docShells.hasMoreElements())
- yield docShells.getNext().QueryInterface(Ci.nsIDocShell).contentViewer.DOMDocument;
+ let (viewer = docShells.getNext().QueryInterface(Ci.nsIDocShell).contentViewer) {
+ if (viewer)
+ yield viewer.DOMDocument;
+ }
}
}
},