mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-24 16:15:45 +01:00
Fixes issue #640. Hopefully. Given that I've never seen it on any of the dozens of setups I've tested on.
This commit is contained in:
@@ -1,5 +1,13 @@
|
|||||||
# TODO: normalize this debacle of Vim legacy messages
|
# TODO: normalize this debacle of Vim legacy messages
|
||||||
|
|
||||||
|
error.damnYouJägermonkey = + \
|
||||||
|
Hallo. It looks like you've run into a problem resulting from \
|
||||||
|
overzealous optimizations by the JavaScript engine. We've disabled \
|
||||||
|
future use of these optimizations, but you'll need to restart your \
|
||||||
|
browser in order to correct the problems they've caused. You can \
|
||||||
|
re-enable them by resetting the javascript.options.methodjit.chrome \
|
||||||
|
preference.
|
||||||
|
|
||||||
abbreviation.noSuch = No such abbreviation
|
abbreviation.noSuch = No such abbreviation
|
||||||
abbreviation.none = No abbreviations found
|
abbreviation.none = No abbreviations found
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,10 @@ var Messages = Module("messages", {
|
|||||||
get: function get(value, default_) {
|
get: function get(value, default_) {
|
||||||
for (let bundle in values(this.bundles))
|
for (let bundle in values(this.bundles))
|
||||||
try {
|
try {
|
||||||
return bundle.GetStringFromName(value);
|
let res = bundle.GetStringFromName(value);
|
||||||
|
if (res.slice(0, 2) == "+ ")
|
||||||
|
return res.slice(2).replace(/\s+/g, " ");
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
|
|
||||||
@@ -73,7 +76,10 @@ var Messages = Module("messages", {
|
|||||||
format: function format(value, args, default_) {
|
format: function format(value, args, default_) {
|
||||||
for (let bundle in values(this.bundles))
|
for (let bundle in values(this.bundles))
|
||||||
try {
|
try {
|
||||||
return bundle.formatStringFromName(value, args, args.length);
|
let res = bundle.formatStringFromName(value, args, args.length);
|
||||||
|
if (res.slice(0, 2) == "+ ")
|
||||||
|
return res.slice(2).replace(/\s+/g, " ");
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
|
|
||||||
|
|||||||
@@ -428,56 +428,68 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
* @returns [string] The resulting strings.
|
* @returns [string] The resulting strings.
|
||||||
*/
|
*/
|
||||||
debrace: function debrace(pattern) {
|
debrace: function debrace(pattern) {
|
||||||
var res = [];
|
try {
|
||||||
|
if (isArray(pattern)) {
|
||||||
|
// Jägermonkey hates us.
|
||||||
|
let obj = ({
|
||||||
|
res: [],
|
||||||
|
rec: function rec(acc) {
|
||||||
|
let vals;
|
||||||
|
|
||||||
|
while (isString(vals = pattern[acc.length]))
|
||||||
|
acc.push(vals);
|
||||||
|
|
||||||
|
if (acc.length == pattern.length)
|
||||||
|
this.res.push(acc.join(""))
|
||||||
|
else
|
||||||
|
for (let val in values(vals))
|
||||||
|
this.rec(acc.concat(val));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
obj.rec([]);
|
||||||
|
return obj.res;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pattern.indexOf("{") == -1)
|
||||||
|
return [pattern];
|
||||||
|
|
||||||
|
let res = [];
|
||||||
|
|
||||||
|
let split = function split(pattern, re, fn, dequote) {
|
||||||
|
let end = 0, match, res = [];
|
||||||
|
while (match = re.exec(pattern)) {
|
||||||
|
end = match.index + match[0].length;
|
||||||
|
res.push(match[1]);
|
||||||
|
if (fn)
|
||||||
|
fn(match);
|
||||||
|
}
|
||||||
|
res.push(pattern.substr(end));
|
||||||
|
return res.map(function (s) util.dequote(s, dequote));
|
||||||
|
}
|
||||||
|
|
||||||
|
let patterns = [];
|
||||||
|
let substrings = split(pattern, /((?:[^\\{]|\\.)*)\{((?:[^\\}]|\\.)*)\}/gy,
|
||||||
|
function (match) {
|
||||||
|
patterns.push(split(match[2], /((?:[^\\,]|\\.)*),/gy,
|
||||||
|
null, ",{}"));
|
||||||
|
}, "{}");
|
||||||
|
|
||||||
if (isArray(pattern)) {
|
|
||||||
let rec = function rec(acc) {
|
let rec = function rec(acc) {
|
||||||
let vals;
|
if (acc.length == patterns.length)
|
||||||
|
res.push(array(substrings).zip(acc).flatten().join(""));
|
||||||
while (isString(vals = pattern[acc.length]))
|
|
||||||
acc.push(vals);
|
|
||||||
|
|
||||||
if (acc.length == pattern.length)
|
|
||||||
res.push(acc.join(""))
|
|
||||||
else
|
else
|
||||||
for (let val in values(vals))
|
for (let [, pattern] in Iterator(patterns[acc.length]))
|
||||||
rec(acc.concat(val));
|
rec(acc.concat(pattern));
|
||||||
}
|
}
|
||||||
rec([]);
|
rec([]);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
catch (e if e.message && ~e.message.indexOf("res is undefined")) {
|
||||||
if (pattern.indexOf("{") == -1)
|
// prefs.safeSet() would be reset on :rehash
|
||||||
return [pattern];
|
prefs.set("javascript.options.methodjit.chrome", false);
|
||||||
|
util.dactyl.warn(_(UTF8("error.damnYouJägermonkey")));
|
||||||
function split(pattern, re, fn, dequote) {
|
return [];
|
||||||
let end = 0, match, res = [];
|
|
||||||
while (match = re.exec(pattern)) {
|
|
||||||
end = match.index + match[0].length;
|
|
||||||
res.push(match[1]);
|
|
||||||
if (fn)
|
|
||||||
fn(match);
|
|
||||||
}
|
|
||||||
res.push(pattern.substr(end));
|
|
||||||
return res.map(function (s) util.dequote(s, dequote));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let patterns = [];
|
|
||||||
let substrings = split(pattern, /((?:[^\\{]|\\.)*)\{((?:[^\\}]|\\.)*)\}/gy,
|
|
||||||
function (match) {
|
|
||||||
patterns.push(split(match[2], /((?:[^\\,]|\\.)*),/gy,
|
|
||||||
null, ",{}"));
|
|
||||||
}, "{}");
|
|
||||||
|
|
||||||
function rec(acc) {
|
|
||||||
if (acc.length == patterns.length)
|
|
||||||
res.push(array(substrings).zip(acc).flatten().join(""));
|
|
||||||
else
|
|
||||||
for (let [, pattern] in Iterator(patterns[acc.length]))
|
|
||||||
rec(acc.concat(pattern));
|
|
||||||
}
|
|
||||||
rec([]);
|
|
||||||
return res;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user