1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-08 05:04:12 +01:00

Fix util.regexp#exec for null matches.

This commit is contained in:
Kris Maglione
2011-01-13 13:08:59 -05:00
parent 77e8bc5f65
commit 4246d6f327

View File

@@ -1234,6 +1234,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
return m1 + "(" + (m3 || "");
});
var struct = Struct.apply(null, groups);
var source = expr;
}
let res = update(RegExp(expr, flags), {
@@ -1241,7 +1242,10 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
dactylPropertyNames: ["exec", "match", "test", "toSource", "toString", "global", "ignoreCase", "lastIndex", "multiLine", "source", "sticky"]
});
if (struct)
update(res, { exec: function exec() struct.fromArray(exec.superapply(this, arguments)) });
update(res, {
exec: function exec() let (match = exec.superapply(this, arguments)) match && struct.fromArray(match),
source: source, struct: struct
});
return res;
}, {
/**