 Issue 29556737:
  Issue 5141 - Convert filter match to C++  (Closed) 
  Base URL: https://hg.adblockplus.org/adblockpluscore/
    
  
    Issue 29556737:
  Issue 5141 - Convert filter match to C++  (Closed) 
  Base URL: https://hg.adblockplus.org/adblockpluscore/| Index: compiled/library.js | 
| =================================================================== | 
| --- a/compiled/library.js | 
| +++ b/compiled/library.js | 
| @@ -56,22 +56,25 @@ | 
| FilterNotifier.triggerListeners(notifierTopics.get(topic), | 
| exports.Subscription.fromPointer(subscription)); | 
| }, | 
| $_regexp_data: Object.create(null), | 
| $_regexp_counter: 0, | 
| GenerateRegExp__deps: ["$_regexp_data", "$_regexp_counter"], | 
| - GenerateRegExp: function(source, matchCase) | 
| + GenerateRegExp: function(source, matchCase, global) | 
| { | 
| var id = ++_regexp_counter; | 
| try | 
| { | 
| - _regexp_data[id] = new RegExp(readString(source), matchCase ? "" : "i"); | 
| + var flag = matchCase ? "" : "i"; | 
| + if (global) | 
| + flag += "g"; | 
| + _regexp_data[id] = new RegExp(readString(source), flag); | 
| return id; | 
| } | 
| catch (e) | 
| { | 
| return -1; | 
| } | 
| }, | 
| @@ -80,10 +83,32 @@ | 
| { | 
| delete _regexp_data[id]; | 
| }, | 
| TestRegExp__deps: ["$_regexp_data"], | 
| TestRegExp: function(id, str) | 
| { | 
| return _regexp_data[id].test(readString(str)); | 
| + }, | 
| + | 
| + ExecRegExp__deps: ["$_regexp_data"], | 
| + ExecRegExp: function(id, str) | 
| + { | 
| + var match = _regexp_data[id].exec(readString(str)); | 
| + if (match) | 
| + return match.index; | 
| + return -1; | 
| + }, | 
| + | 
| + MatchRegExp__deps: ["$_regexp_data"], | 
| + MatchRegExp: function(id, str, reMatchResults) | 
| + { | 
| + var string = readString(str); | 
| + var result = new exports.ReMatchResults(reMatchResults); | 
| + var matches = string.match(_regexp_data[id]); | 
| + if (!matches) | 
| + return false; | 
| + for (var i = 0; i < matches.length; i++) | 
| + result.push(createString(matches[i])); | 
| 
sergei
2017/10/04 08:54:32
matches[i] is JS String, but result.push expects o
 
hub
2017/10/06 13:49:17
No. push() argument is plain JS string. The bindin
 
sergei
2017/10/09 15:27:50
Acknowledged.
 | 
| + return true; | 
| } | 
| }); |