1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 19:07:58 +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

@@ -110,7 +110,7 @@ var Modes = Module("modes", {
this.addMode("INPUT", {
char: "I",
description: "The base mode for input modes, including Insert and Command Line",
bases: [this.BASE],
bases: [this.MAIN],
input: true
});
this.addMode("INSERT", {
@@ -154,11 +154,6 @@ var Modes = Module("modes", {
input: true
});
this.addMode("INPUT_MULTILINE", {
extended: true,
hidden: true,
input: true
});
this.addMode("LINE", {
extended: true, hidden: true
});
@@ -269,11 +264,11 @@ var Modes = Module("modes", {
delayed: [],
delay: function (callback, self) { this.delayed.push([callback, self]); },
save: function save(id, obj, prop) {
save: function save(id, obj, prop, test) {
if (!(id in this.boundProperties))
for (let elem in array.iterValues(this._modeStack))
elem.saved[id] = { obj: obj, prop: prop, value: obj[prop] };
this.boundProperties[id] = { obj: Cu.getWeakReference(obj), prop: prop };
elem.saved[id] = { obj: obj, prop: prop, value: obj[prop], test: test };
this.boundProperties[id] = { obj: Cu.getWeakReference(obj), prop: prop, test: test };
},
// helper function to set both modes in one go
@@ -299,15 +294,17 @@ var Modes = Module("modes", {
let push = mainMode != null && !(stack && stack.pop) &&
Modes.StackElement(this._main, this._extended, params, {});
if (push && this.topOfStack) {
if (this.topOfStack.params.leave)
dactyl.trapErrors("leave", this.topOfStack.params,
{ push: push }, push);
for (let [id, { obj, prop }] in Iterator(this.boundProperties)) {
for (let [id, { obj, prop, test }] in Iterator(this.boundProperties)) {
if (!obj.get())
delete this.boundProperties[id];
else
this.topOfStack.saved[id] = { obj: obj.get(), prop: prop, value: obj.get()[prop] };
this.topOfStack.saved[id] = { obj: obj.get(), prop: prop, value: obj.get()[prop], test: test };
}
}
@@ -319,8 +316,9 @@ var Modes = Module("modes", {
this._modeStack.push(push);
if (stack && stack.pop)
for (let { obj, prop, value } in values(this.topOfStack.saved))
obj[prop] = value;
for (let { obj, prop, value, test } in values(this.topOfStack.saved))
if (!test || !test(stack, prev))
obj[prop] = value;
this.show();
@@ -460,7 +458,7 @@ var Modes = Module("modes", {
return val === undefined ? value : val;
},
set: function (val) {
modes.save(id, this, prop);
modes.save(id, this, prop, desc.test);
if (desc.set)
value = desc.set.call(this, val);
value = !desc.set || value === undefined ? val : value;