1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-14 20:35:47 +01:00

Fix addons.jsm on FF36.

This commit is contained in:
Kris Maglione
2011-01-27 01:44:18 -05:00
parent 197850aeca
commit 9403511795
6 changed files with 73 additions and 67 deletions

View File

@@ -232,17 +232,6 @@ var Addon = Class("Addon", {
}
});
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", {
init: function init(modules, types, filter) {
this.modules = modules;
@@ -533,6 +522,17 @@ var addonErrors = array.toObject([
endModule();
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
});
});
} catch(e){ if (isString(e)) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
// vim: set fdm=marker sw=4 ts=4 et ft=javascript:

View File

@@ -83,7 +83,7 @@ var CompletionContext = Class("CompletionContext", {
self.waitingForTab = false;
delete self._generate;
delete self._ignoreCase;
delete self.ignoreCase;
if (self != this)
return self;
["_caret", "contextList", "maxItems", "onUpdate", "selectionTypes", "tabPressed", "updateAsync", "value"].forEach(function (key) {
@@ -305,7 +305,7 @@ var CompletionContext = Class("CompletionContext", {
get filter() this._filter != null ? this._filter : this.value.substr(this.offset, this.caret),
set filter(val) {
delete this._ignoreCase;
delete this.ignoreCase;
return this._filter = val;
},
@@ -401,18 +401,15 @@ var CompletionContext = Class("CompletionContext", {
this.noUpdate = false;
},
get ignoreCase() {
if (this._ignoreCase == null) {
let mode = this.wildcase;
if (mode == "match")
this._ignoreCase = false;
if (mode == "ignore")
this._ignoreCase = true;
this._ignoreCase = !/[A-Z]/.test(this.filter);
}
return this._ignoreCase;
},
set ignoreCase(val) this._ignoreCase = val,
ignoreCase: Class.memoize(function () {
let mode = this.wildcase;
if (mode == "match")
return false;
else if (mode == "ignore")
return true;
else
return !/[A-Z]/.test(this.filter);
}),
/**
* Returns a list of all completion items which match the current
@@ -483,8 +480,13 @@ var CompletionContext = Class("CompletionContext", {
filtered = filtered.slice(0, this.maxItems);
// Sorting
if (this.sortResults && this.compare)
if (this.sortResults && this.compare) {
filtered.sort(this.compare);
if (!this.anchored) {
let filter = this.filter;
filtered.sort(function (a, b) (b.text.indexOf(filter) == 0) - (a.text.indexOf(filter) == 0));
}
}
return this.cache.filtered = filtered;
}
@@ -573,7 +575,7 @@ var CompletionContext = Class("CompletionContext", {
* @param {number} count The number of characters to advance the context.
*/
advance: function advance(count) {
delete this._ignoreCase;
delete this.ignoreCase;
let advance = count;
if (this.quote && count) {
advance = this.quote[1](this.filter.substr(0, count)).length;