mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 14:47:59 +01:00
Fix mode name generated for longer names in mapping serialization. Closes issue #565.
--HG-- extra : rebase_source : 115073fae6cf2a15692cac72df976e1eacf5298e
This commit is contained in:
@@ -28,8 +28,11 @@ var Browser = Module("browser", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
|||||||
"content-document-global-created": function (win, uri) {
|
"content-document-global-created": function (win, uri) {
|
||||||
let top = util.topWindow(win);
|
let top = util.topWindow(win);
|
||||||
|
|
||||||
if (top == window)
|
if (uri == "null")
|
||||||
this._triggerLoadAutocmd("PageLoadPre", win.document, win.location.href != "null" ? window.location.href : uri);
|
uri = null;
|
||||||
|
|
||||||
|
if (top == window && (win.location.href || uri))
|
||||||
|
this._triggerLoadAutocmd("PageLoadPre", win.document, win.location.href || uri);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1315,7 +1315,10 @@ var Events = Module("events", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
keyup: function onKeyUp(event) {
|
keyup: function onKeyUp(event) {
|
||||||
|
if (this.type == "keydown")
|
||||||
this.keyEvents.push(event);
|
this.keyEvents.push(event);
|
||||||
|
else
|
||||||
|
this.keyEvents = [];
|
||||||
|
|
||||||
let isMacro = event.isMacro || this.feedingEvent && this.feedingEvent.isMacro;
|
let isMacro = event.isMacro || this.feedingEvent && this.feedingEvent.isMacro;
|
||||||
if (this.lastKeyFake && !isMacro)
|
if (this.lastKeyFake && !isMacro)
|
||||||
|
|||||||
@@ -663,7 +663,9 @@ var Mappings = Module("mappings", {
|
|||||||
function uniqueModes(modes) {
|
function uniqueModes(modes) {
|
||||||
let chars = [k for ([k, v] in Iterator(modules.modes.modeChars))
|
let chars = [k for ([k, v] in Iterator(modules.modes.modeChars))
|
||||||
if (v.every(function (mode) modes.indexOf(mode) >= 0))];
|
if (v.every(function (mode) modes.indexOf(mode) >= 0))];
|
||||||
return array.uniq(modes.filter(function (m) chars.indexOf(m.char) < 0).concat(chars));
|
return array.uniq(modes.filter(function (m) chars.indexOf(m.char) < 0)
|
||||||
|
.map(function (m) m.name.toLowerCase())
|
||||||
|
.concat(chars));
|
||||||
}
|
}
|
||||||
|
|
||||||
commands.add(["feedkeys", "fk"],
|
commands.add(["feedkeys", "fk"],
|
||||||
|
|||||||
@@ -68,11 +68,9 @@ if (!Object.defineProperties)
|
|||||||
}
|
}
|
||||||
if (!Object.freeze)
|
if (!Object.freeze)
|
||||||
Object.freeze = function freeze(obj) {};
|
Object.freeze = function freeze(obj) {};
|
||||||
if (!Object.getOwnPropertyDescriptor)
|
if (!Object.getPropertyDescriptor)
|
||||||
Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(obj, prop) {
|
Object.getPropertyDescriptor = function getOwnPropertyDescriptor(obj, prop) {
|
||||||
try {
|
try {
|
||||||
if (!hasOwnProperty.call(obj, prop))
|
|
||||||
return undefined;
|
|
||||||
let desc = {
|
let desc = {
|
||||||
configurable: true,
|
configurable: true,
|
||||||
enumerable: propertyIsEnumerable.call(obj, prop)
|
enumerable: propertyIsEnumerable.call(obj, prop)
|
||||||
@@ -93,6 +91,11 @@ if (!Object.getOwnPropertyDescriptor)
|
|||||||
throw e.stack ? e : Error(e);
|
throw e.stack ? e : Error(e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if (!Object.getOwnPropertyDescriptor)
|
||||||
|
Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(obj, prop) {
|
||||||
|
if (hasOwnProperty.call(obj, prop))
|
||||||
|
return Object.getPropertyDescriptor(obj, prop);
|
||||||
|
};
|
||||||
if (!Object.getOwnPropertyNames)
|
if (!Object.getOwnPropertyNames)
|
||||||
Object.getOwnPropertyNames = function getOwnPropertyNames(obj, _debugger) {
|
Object.getOwnPropertyNames = function getOwnPropertyNames(obj, _debugger) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -374,12 +374,19 @@ var Contexts = Module("contexts", {
|
|||||||
bindMacro: function (args, default_, params) {
|
bindMacro: function (args, default_, params) {
|
||||||
const { dactyl, events, modules } = this.modules;
|
const { dactyl, events, modules } = this.modules;
|
||||||
|
|
||||||
|
function Proxy(obj, key) Class.Property({
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true,
|
||||||
|
get: function Proxy_get() process(obj[key]),
|
||||||
|
set: function Proxy_set(val) obj[key] = val
|
||||||
|
})
|
||||||
|
|
||||||
let process = util.identity;
|
let process = util.identity;
|
||||||
|
|
||||||
if (callable(params))
|
if (callable(params))
|
||||||
var makeParams = function makeParams(self, args)
|
var makeParams = function makeParams(self, args)
|
||||||
iter.toObject([k, process(v)]
|
let (obj = params.apply(self, args))
|
||||||
for ([k, v] in iter(params.apply(self, args))));
|
iter.toObject([k, Proxy(obj, k)] for (k in properties(obj)));
|
||||||
else if (params)
|
else if (params)
|
||||||
makeParams = function makeParams(self, args)
|
makeParams = function makeParams(self, args)
|
||||||
iter.toObject([name, process(args[i])]
|
iter.toObject([name, process(args[i])]
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ var JavaScript = Module("javascript", {
|
|||||||
|
|
||||||
lazyInit: true,
|
lazyInit: true,
|
||||||
|
|
||||||
newContext: function () this.modules.newContext(this.modules.userContext),
|
newContext: function () this.modules.newContext(this.modules.userContext, true),
|
||||||
|
|
||||||
get completers() JavaScript.completers, // For backward compatibility
|
get completers() JavaScript.completers, // For backward compatibility
|
||||||
|
|
||||||
|
|||||||
@@ -1326,10 +1326,16 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
if (desc.value instanceof Class.Property)
|
if (desc.value instanceof Class.Property)
|
||||||
desc = desc.value.init(k) || desc.value;
|
desc = desc.value.init(k) || desc.value;
|
||||||
|
|
||||||
|
if (k in object) {
|
||||||
for (let obj = object; obj && !orig; obj = Object.getPrototypeOf(obj))
|
for (let obj = object; obj && !orig; obj = Object.getPrototypeOf(obj))
|
||||||
if (orig = Object.getOwnPropertyDescriptor(obj, k))
|
if (orig = Object.getOwnPropertyDescriptor(obj, k))
|
||||||
Object.defineProperty(original, k, orig);
|
Object.defineProperty(original, k, orig);
|
||||||
|
|
||||||
|
if (!orig)
|
||||||
|
if (orig = Object.getPropertyDescriptor(object, k))
|
||||||
|
Object.defineProperty(original, k, orig);
|
||||||
|
}
|
||||||
|
|
||||||
// Guard against horrible add-ons that use eval-based monkey
|
// Guard against horrible add-ons that use eval-based monkey
|
||||||
// patching.
|
// patching.
|
||||||
if (callable(desc.value)) {
|
if (callable(desc.value)) {
|
||||||
@@ -1668,7 +1674,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
catch (e) {}
|
catch (e) {}
|
||||||
|
|
||||||
let ary = host.split(".");
|
let ary = host.split(".");
|
||||||
ary = [ary.slice(i).join(".") for (i in util.range(ary.length - 1, 0, -1))];
|
ary = [ary.slice(i).join(".") for (i in util.range(ary.length, 0, -1))];
|
||||||
return ary.filter(function (h) h.length >= base.length);
|
return ary.filter(function (h) h.length >= base.length);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1928,7 +1934,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
let res = [], seen = {};
|
let res = [], seen = {};
|
||||||
(function rec(frame) {
|
(function rec(frame) {
|
||||||
try {
|
try {
|
||||||
res = res.concat(util.subdomains(frame.location.host));
|
res = res.concat(util.subdomains(frame.location.hostname));
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
Array.forEach(frame.frames, rec);
|
Array.forEach(frame.frames, rec);
|
||||||
|
|||||||
Reference in New Issue
Block a user