1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 22:07:58 +01:00

Hackier but more reliable literal() stuff.

This commit is contained in:
Kris Maglione
2014-06-18 12:24:55 -07:00
parent fdf188166d
commit cde8cd6763
15 changed files with 66 additions and 63 deletions

View File

@@ -359,14 +359,14 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
let defaults = { lt: "<", gt: ">" };
let re = util.regexp(literal(/*
let re = util.regexp(literal(function () /*
([^]*?) // 1
(?:
(<\{) | // 2
(< ((?:[a-z]-)?[a-z-]+?) (?:\[([0-9]+)\])? >) | // 3 4 5
(\}>) // 6
)
*/), "gixy");
*/$), "gixy");
macro = String(macro);
let end = 0;
for (let match in re.iterate(macro)) {
@@ -749,7 +749,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
*
* @returns {XMLHttpRequest}
*/
httpGet: function httpGet(url, params={}, self) {
httpGet: function httpGet(url, params={}, self=null) {
if (callable(params))
// Deprecated.
params = { callback: params.bind(self) };
@@ -908,7 +908,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
},
// ripped from Firefox; modified
unsafeURI: Class.Memoize(() => util.regexp(String.replace(literal(/*
unsafeURI: Class.Memoize(() => util.regexp(String.replace(literal(function () /*
[
\s
// Invisible characters (bug 452979)
@@ -922,7 +922,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
// Bidi formatting characters. (RFC 3987 sections 3.2 and 4.1 paragraph 6)
U200E U200F U202A U202B U202C U202D U202E
]
*/), /U/g, "\\u"),
*/$), /U/g, "\\u"),
"gx")),
losslessDecodeURI: function losslessDecodeURI(url) {
return url.split("%25").map(function (url) {