From 3e1afcad4b63d40c3af6bc16e4ec540d374767d1 Mon Sep 17 00:00:00 2001 From: John Foerch Date: Wed, 4 May 2011 15:08:18 -0400 Subject: [PATCH] predicate_alist_match: typecheck for RegExp keys In XULRunner 5 and up, RegExps can no longer be called as functions. Fuzzing up the definition of 'predicate' to explicitly allow RegExp objects in predicate_alist_match seemed a reasonable fix. Resolves issue350. http://whereswalden.com/2011/03/06/javascript-change-in-firefox-5-not-4-and-in-other-browsers-regular-expressions-cant-be-called-like-functions/ https://bugzilla.mozilla.org/show_bug.cgi?id=313637 https://bugzilla.mozilla.org/show_bug.cgi?id=61911 --- modules/utils.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/utils.js b/modules/utils.js index 8a46ce7..ef3b028 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -435,7 +435,10 @@ function read_from_x_primary_selection () { function predicate_alist_match (alist, key) { for each (let i in alist) { - if (i[0](key)) + if (i[0] instanceof RegExp) { + if (i[0].exec(key)) + return i[1]; + } else if (i[0](key)) return i[1]; } return undefined; -- 2.11.4.GIT