| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | |
| 3 * Copyright (C) 2006-2017 eyeo GmbH | |
| 4 * | |
| 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 | |
| 7 * published by the Free Software Foundation. | |
| 8 * | |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 * GNU General Public License for more details. | |
| 13 * | |
| 14 * You should have received a copy of the GNU General Public License | |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
| 16 */ | |
| 17 | |
| 18 "use strict"; | |
| 19 | |
| 20 mergeInto(LibraryManager.library, { | |
| 21 LogString: function(str) | |
| 22 { | |
| 23 console.log(readString(str)); | |
| 24 }, | |
| 25 | |
| 26 LogInteger: function(i) | |
| 27 { | |
| 28 console.log(i); | |
| 29 }, | |
| 30 | |
| 31 LogPointer: function(ptr) | |
| 32 { | |
| 33 console.log(ptr); | |
| 34 }, | |
| 35 | |
| 36 LogError: function(str) | |
| 37 { | |
| 38 console.error(new Error(readString(str)).stack); | |
| 39 }, | |
| 40 | |
| 41 CharToLower: function(charCode) | |
| 42 { | |
| 43 return String.fromCharCode(charCode).toLowerCase().charCodeAt(0); | |
|
sergei
2017/05/02 09:48:06
Coming back to https://codereview.adblockplus.org/
Wladimir Palant
2017/05/03 11:57:17
I cannot reproduce that - neither in Firefox nor i
sergei
2017/05/03 13:24:04
Only in Chrome but I'm on Windows, additional info
Wladimir Palant
2017/05/04 09:14:27
We are only using this functionality on domain nam
Wladimir Palant
2017/05/04 09:35:19
Going through the locale-insensitive mappings in f
| |
| 44 }, | |
| 45 | |
| 46 JSNotifyFilterChange: function(topic, filter) | |
| 47 { | |
| 48 FilterNotifier.triggerListeners(notifierTopics.get(topic), | |
| 49 exports.Filter.fromPointer(filter)); | |
| 50 }, | |
| 51 | |
| 52 JSNotifySubscriptionChange: function(topic, subscription) | |
| 53 { | |
| 54 FilterNotifier.triggerListeners(notifierTopics.get(topic), | |
| 55 exports.Subscription.fromPointer(subscription)); | |
| 56 }, | |
| 57 | |
| 58 $_regexp_data: Object.create(null), | |
| 59 $_regexp_counter: 0, | |
| 60 | |
| 61 GenerateRegExp__deps: ["$_regexp_data", "$_regexp_counter"], | |
| 62 GenerateRegExp: function(source, matchCase) | |
| 63 { | |
| 64 var id = ++_regexp_counter; | |
| 65 try | |
| 66 { | |
| 67 _regexp_data[id] = new RegExp(readString(source), matchCase ? "" : "i"); | |
| 68 return id; | |
| 69 } | |
| 70 catch (e) | |
| 71 { | |
| 72 return -1; | |
| 73 } | |
| 74 }, | |
| 75 | |
| 76 DeleteRegExp__deps: ["$_regexp_data"], | |
| 77 DeleteRegExp: function(id) | |
| 78 { | |
| 79 delete _regexp_data[id]; | |
| 80 }, | |
| 81 | |
| 82 TestRegExp__deps: ["$_regexp_data"], | |
| 83 TestRegExp: function(id, str) | |
| 84 { | |
| 85 return _regexp_data[id].test(readString(str)); | |
| 86 } | |
| 87 }); | |
| OLD | NEW |