No Completions
@@ -1985,7 +1958,7 @@ var ItemList = Class("ItemList", {
*
* @param {number} offset Start at this index and show options["maxitems"].
*/
- _fill: function (offset) {
+ _fill: function _fill(offset) {
XML.ignoreWhiteSpace = false;
let diff = offset - this._startIndex;
if (this._items == null || offset == null || diff == 0 || offset < 0)
@@ -2068,7 +2041,7 @@ var ItemList = Class("ItemList", {
show: function show() { this._container.collapsed = false; },
visible: function visible() !this._container.collapsed,
- reset: function (brief) {
+ reset: function reset(brief) {
this._startIndex = this._endIndex = this._selIndex = -1;
this._div = null;
if (!brief)
@@ -2138,7 +2111,7 @@ var ItemList = Class("ItemList", {
// util.dump({ time: Date.now() - this.start });
},
- onEvent: function onEvent(event) false
+ onKeyPress: function onKeyPress(event) false
}, {
WAITING_MESSAGE: "Generating results..."
});
diff --git a/common/content/events.js b/common/content/events.js
index 163aab60..22c41d55 100644
--- a/common/content/events.js
+++ b/common/content/events.js
@@ -24,9 +24,9 @@ var ProcessorStack = Class("ProcessorStack", {
input.preExecute = params.preExecute;
if (params.postExecute)
input.postExecute = params.postExecute;
- if (params.onEvent && input.hive === mappings.builtin)
+ if (params.onKeyPress && input.hive === mappings.builtin)
input.fallthrough = function (event) {
- return params.onEvent(event) === false ? Events.KILL : Events.PASS;
+ return params.onKeyPress(event) === false ? Events.KILL : Events.PASS;
};
}
},
diff --git a/common/content/hints.js b/common/content/hints.js
index b2571170..9381de8d 100644
--- a/common/content/hints.js
+++ b/common/content/hints.js
@@ -327,7 +327,7 @@ var HintSession = Class("HintSession", {
*
* @param {Event} event The event to handle.
*/
- onEvent: function onEvent(event) {
+ onKeyPress: function onKeyPress(event) {
const KILL = false, PASS = true;
let key = events.toString(event);
diff --git a/common/content/modes.js b/common/content/modes.js
index 422bbee1..8904aeec 100644
--- a/common/content/modes.js
+++ b/common/content/modes.js
@@ -148,10 +148,10 @@ var Modes = Module("modes", {
// Fix me.
preExecute: function (map) { if (modes.main == modes.QUOTE && map.name !== "
") modes.pop() },
postExecute: function (map) { if (modes.main == modes.QUOTE && map.name === "") modes.pop() },
- onEvent: function () { if (modes.main == modes.QUOTE) modes.pop() }
+ onKeyPress: function () { if (modes.main == modes.QUOTE) modes.pop() }
});
this.addMode("IGNORE", { hidden: true }, {
- onEvent: function (event) Events.KILL,
+ onKeyPress: function (event) Events.KILL,
bases: []
});
diff --git a/common/content/statusline.js b/common/content/statusline.js
index 090366ed..ccc3b454 100644
--- a/common/content/statusline.js
+++ b/common/content/statusline.js
@@ -46,20 +46,13 @@ var StatusLine = Module("statusline", {
-
+
-
-
-
-
-
diff --git a/common/modules/addons.jsm b/common/modules/addons.jsm
index f3778cff..00ae81de 100644
--- a/common/modules/addons.jsm
+++ b/common/modules/addons.jsm
@@ -233,23 +233,15 @@ var Addon = Class("Addon", {
}
});
-["cancelUninstall", "findUpdates", "getResourceURI", "hasResource",
- "isCompatibleWith", "uninstall"].forEach(function (prop) {
- Addon.prototype[prop] = function proxy() this.addon[prop].apply(this.addon, arguments);
-});
-
-["aboutURL", "appDisabled", "applyBackgroundUpdates", "blocklistState",
- "contributors", "creator", "description", "developers", "homepageURL",
- "iconURL", "id", "install", "installDate", "isActive", "isCompatible",
- "isPlatformCompatible", "name", "operationsRequiringRestart",
- "optionsURL", "pendingOperations", "pendingUpgrade", "permissions",
- "providesUpdatesSecurely", "releaseNotesURI", "scope", "screenshots",
- "size", "sourceURI", "translators", "type", "updateDate",
- "userDisabled", "version"].forEach(function (prop) {
- Object.defineProperty(Addon.prototype, prop, {
- get: function get_proxy() this.addon[prop],
- set: function set_proxy(val) this.addon[prop] = val
- });
+iter.forEach(properties(config.addon), function (prop) {
+ let desc = Object.getOwnPropertyDescriptor(config.addon, prop);
+ if (callable(desc.value))
+ Addon.prototype[prop] = function proxy() this.addon[prop].apply(this.addon, arguments);
+ else
+ Object.defineProperty(Addon.prototype, prop, {
+ get: function get_proxy() this.addon[prop],
+ set: function set_proxy(val) this.addon[prop] = val
+ });
});
var AddonList = Class("AddonList", {
diff --git a/common/modules/highlight.jsm b/common/modules/highlight.jsm
index b032d66c..ac9496f0 100644
--- a/common/modules/highlight.jsm
+++ b/common/modules/highlight.jsm
@@ -188,10 +188,17 @@ var Highlights = Module("Highlight", {
* @param {Node} node
* @param {string} group
*/
- highlightNode: function (node, group) {
+ highlightNode: function (node, group, applyBindings) {
node.setAttributeNS(NS.uri, "highlight", group);
- for each (let h in group.split(" "))
- this.loaded[h] = true;
+
+ let groups = group.split(" ");
+ for each (let group in groups)
+ this.loaded[group] = true;
+
+ if (applyBindings)
+ for each (let group in groups)
+ if (group in template.bindings)
+ template.bindings[group](node, applyBindings);
},
/**
diff --git a/common/modules/overlay.jsm b/common/modules/overlay.jsm
index 72eb99a9..dc1e7431 100644
--- a/common/modules/overlay.jsm
+++ b/common/modules/overlay.jsm
@@ -270,9 +270,11 @@ var Overlay = Module("Overlay", {
modules.events.addSessionListener(window, "unload", function onUnload() {
window.removeEventListener("unload", onUnload.wrapped, false);
- for (let [, mod] in iter(modules))
- if (mod instanceof ModuleBase && "destroy" in mod)
- util.trapErrors(mod.destroy, mod);
+ for (let prop in properties(modules)) {
+ let desc = Object.getOwnPropertyDescriptor(modules, prop);
+ if (desc.value instanceof ModuleBase && "destroy" in desc.value)
+ util.trapErrors(desc.value.destroy, desc.value);
+ }
}, false);
}
}));
diff --git a/common/modules/template.jsm b/common/modules/template.jsm
index d9db8cb6..8948ec89 100644
--- a/common/modules/template.jsm
+++ b/common/modules/template.jsm
@@ -131,6 +131,16 @@ var Template = Module("Template", {
update: function update() {
this.collapsed = !this.commandAllowed;
}
+ }),
+
+ Events: Class("Events", Binding, {
+ init: function init(node, params) {
+ init.supercall(this, node);
+
+ let obj = params.eventTarget;
+ for (let [event, handler] in Iterator(obj[this.getAttribute("events") || "events"]))
+ node.addEventListener(event, obj.closure(handler), false);
+ }
})
},
diff --git a/common/modules/util.jsm b/common/modules/util.jsm
index 7ee979c8..023264d6 100644
--- a/common/modules/util.jsm
+++ b/common/modules/util.jsm
@@ -1602,19 +1602,17 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
case "element":
let domnode = doc.createElementNS(node.namespace(), node.localName());
+ for each (let attr in node.@*::*)
+ if (attr.name() != "highlight")
+ domnode.setAttributeNS(attr.namespace(), attr.localName(), String(attr));
+
for each (let child in node.*::*)
domnode.appendChild(xmlToDom(child, doc, nodes));
if (nodes && node.@key)
nodes[node.@key] = domnode;
- for each (let attr in node.@*::*)
- if (attr.name() != "highlight")
- domnode.setAttributeNS(attr.namespace(), attr.localName(), String(attr));
- else {
- highlight.highlightNode(domnode, String(attr));
- if (attr in template.bindings)
- template.bindings[attr](domnode, nodes);
- }
+ if (node.@highlight)
+ highlight.highlightNode(domnode, String(node.@highlight), nodes || true);
return domnode;
default:
return null;