mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 10:57:58 +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) {
|
||||
let top = util.topWindow(win);
|
||||
|
||||
if (top == window)
|
||||
this._triggerLoadAutocmd("PageLoadPre", win.document, win.location.href != "null" ? window.location.href : uri);
|
||||
if (uri == "null")
|
||||
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) {
|
||||
this.keyEvents.push(event);
|
||||
if (this.type == "keydown")
|
||||
this.keyEvents.push(event);
|
||||
else
|
||||
this.keyEvents = [];
|
||||
|
||||
let isMacro = event.isMacro || this.feedingEvent && this.feedingEvent.isMacro;
|
||||
if (this.lastKeyFake && !isMacro)
|
||||
|
||||
@@ -663,7 +663,9 @@ var Mappings = Module("mappings", {
|
||||
function uniqueModes(modes) {
|
||||
let chars = [k for ([k, v] in Iterator(modules.modes.modeChars))
|
||||
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"],
|
||||
|
||||
@@ -68,11 +68,9 @@ if (!Object.defineProperties)
|
||||
}
|
||||
if (!Object.freeze)
|
||||
Object.freeze = function freeze(obj) {};
|
||||
if (!Object.getOwnPropertyDescriptor)
|
||||
Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(obj, prop) {
|
||||
if (!Object.getPropertyDescriptor)
|
||||
Object.getPropertyDescriptor = function getOwnPropertyDescriptor(obj, prop) {
|
||||
try {
|
||||
if (!hasOwnProperty.call(obj, prop))
|
||||
return undefined;
|
||||
let desc = {
|
||||
configurable: true,
|
||||
enumerable: propertyIsEnumerable.call(obj, prop)
|
||||
@@ -93,6 +91,11 @@ if (!Object.getOwnPropertyDescriptor)
|
||||
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)
|
||||
Object.getOwnPropertyNames = function getOwnPropertyNames(obj, _debugger) {
|
||||
try {
|
||||
|
||||
@@ -374,12 +374,19 @@ var Contexts = Module("contexts", {
|
||||
bindMacro: function (args, default_, params) {
|
||||
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;
|
||||
|
||||
if (callable(params))
|
||||
var makeParams = function makeParams(self, args)
|
||||
iter.toObject([k, process(v)]
|
||||
for ([k, v] in iter(params.apply(self, args))));
|
||||
let (obj = params.apply(self, args))
|
||||
iter.toObject([k, Proxy(obj, k)] for (k in properties(obj)));
|
||||
else if (params)
|
||||
makeParams = function makeParams(self, args)
|
||||
iter.toObject([name, process(args[i])]
|
||||
|
||||
@@ -54,7 +54,7 @@ var JavaScript = Module("javascript", {
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -1326,9 +1326,15 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
if (desc.value instanceof Class.Property)
|
||||
desc = desc.value.init(k) || desc.value;
|
||||
|
||||
for (let obj = object; obj && !orig; obj = Object.getPrototypeOf(obj))
|
||||
if (orig = Object.getOwnPropertyDescriptor(obj, k))
|
||||
Object.defineProperty(original, k, orig);
|
||||
if (k in object) {
|
||||
for (let obj = object; obj && !orig; obj = Object.getPrototypeOf(obj))
|
||||
if (orig = Object.getOwnPropertyDescriptor(obj, k))
|
||||
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
|
||||
// patching.
|
||||
@@ -1668,7 +1674,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
catch (e) {}
|
||||
|
||||
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);
|
||||
},
|
||||
|
||||
@@ -1928,7 +1934,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
let res = [], seen = {};
|
||||
(function rec(frame) {
|
||||
try {
|
||||
res = res.concat(util.subdomains(frame.location.host));
|
||||
res = res.concat(util.subdomains(frame.location.hostname));
|
||||
}
|
||||
catch (e) {}
|
||||
Array.forEach(frame.frames, rec);
|
||||
|
||||
Reference in New Issue
Block a user