| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * This file is part of Adblock Plus <https://adblockplus.org/>, | 2  * This file is part of Adblock Plus <https://adblockplus.org/>, | 
| 3  * Copyright (C) 2006-present eyeo GmbH | 3  * Copyright (C) 2006-present eyeo GmbH | 
| 4  * | 4  * | 
| 5  * Adblock Plus is free software: you can redistribute it and/or modify | 5  * Adblock Plus is free software: you can redistribute it and/or modify | 
| 6  * it under the terms of the GNU General Public License version 3 as | 6  * it under the terms of the GNU General Public License version 3 as | 
| 7  * published by the Free Software Foundation. | 7  * published by the Free Software Foundation. | 
| 8  * | 8  * | 
| 9  * Adblock Plus is distributed in the hope that it will be useful, | 9  * Adblock Plus is distributed in the hope that it will be useful, | 
| 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 54   JSNotifySubscriptionChange: function(topic, subscription) | 54   JSNotifySubscriptionChange: function(topic, subscription) | 
| 55   { | 55   { | 
| 56     FilterNotifier.triggerListeners(notifierTopics.get(topic), | 56     FilterNotifier.triggerListeners(notifierTopics.get(topic), | 
| 57         exports.Subscription.fromPointer(subscription)); | 57         exports.Subscription.fromPointer(subscription)); | 
| 58   }, | 58   }, | 
| 59 | 59 | 
| 60   $_regexp_data: Object.create(null), | 60   $_regexp_data: Object.create(null), | 
| 61   $_regexp_counter: 0, | 61   $_regexp_counter: 0, | 
| 62 | 62 | 
| 63   GenerateRegExp__deps: ["$_regexp_data", "$_regexp_counter"], | 63   GenerateRegExp__deps: ["$_regexp_data", "$_regexp_counter"], | 
| 64   GenerateRegExp: function(source, matchCase) | 64   GenerateRegExp: function(source, matchCase, global) | 
| 65   { | 65   { | 
| 66     var id = ++_regexp_counter; | 66     var id = ++_regexp_counter; | 
| 67     try | 67     try | 
| 68     { | 68     { | 
| 69       _regexp_data[id] = new RegExp(readString(source), matchCase ? "" : "i"); | 69       var flag = matchCase ? "" : "i"; | 
|  | 70       if (global) | 
|  | 71         flag += "g"; | 
|  | 72       _regexp_data[id] = new RegExp(readString(source), flag); | 
| 70       return id; | 73       return id; | 
| 71     } | 74     } | 
| 72     catch (e) | 75     catch (e) | 
| 73     { | 76     { | 
| 74       return -1; | 77       return -1; | 
| 75     } | 78     } | 
| 76   }, | 79   }, | 
| 77 | 80 | 
| 78   DeleteRegExp__deps: ["$_regexp_data"], | 81   DeleteRegExp__deps: ["$_regexp_data"], | 
| 79   DeleteRegExp: function(id) | 82   DeleteRegExp: function(id) | 
| 80   { | 83   { | 
| 81     delete _regexp_data[id]; | 84     delete _regexp_data[id]; | 
| 82   }, | 85   }, | 
| 83 | 86 | 
| 84   TestRegExp__deps: ["$_regexp_data"], | 87   TestRegExp__deps: ["$_regexp_data"], | 
| 85   TestRegExp: function(id, str) | 88   TestRegExp: function(id, str) | 
| 86   { | 89   { | 
| 87     return _regexp_data[id].test(readString(str)); | 90     return _regexp_data[id].test(readString(str)); | 
|  | 91   }, | 
|  | 92 | 
|  | 93   ExecRegExp__deps: ["$_regexp_data"], | 
|  | 94   ExecRegExp: function(id, str) | 
|  | 95   { | 
|  | 96     var match = _regexp_data[id].exec(readString(str)); | 
|  | 97     if (match) | 
|  | 98       return match.index; | 
|  | 99     return -1; | 
|  | 100   }, | 
|  | 101 | 
|  | 102   MatchRegExp__deps: ["$_regexp_data"], | 
|  | 103   MatchRegExp: function(id, str, reMatchResults) | 
|  | 104   { | 
|  | 105     var string = readString(str); | 
|  | 106     var matches = string.match(_regexp_data[id]); | 
|  | 107     if (!matches) | 
|  | 108       return false; | 
|  | 109     for (var i = 0; i < matches.length; i++) | 
|  | 110       reMatchResults.push(createString(matches[i])); | 
|  | 111     return true; | 
| 88   } | 112   } | 
| 89 }); | 113 }); | 
| OLD | NEW | 
|---|