Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 // JSON string it fails. Worse still it actually performs the callback twice | 74 // JSON string it fails. Worse still it actually performs the callback twice |
75 // too, firstly with an empty string and then with an Error: | 75 // too, firstly with an empty string and then with an Error: |
76 // "Extension compilation failed: Failed to parse the JSON String." | 76 // "Extension compilation failed: Failed to parse the JSON String." |
77 // To mitigate this we convert the rules to JSON here and also ignore | 77 // To mitigate this we convert the rules to JSON here and also ignore |
78 // callback values of "". (Usually the callback is performed with either | 78 // callback values of "". (Usually the callback is performed with either |
79 // null for success or an Error on failure.) | 79 // null for success or an Error on failure.) |
80 // Bug #26322821 filed on bugreport.apple.com | 80 // Bug #26322821 filed on bugreport.apple.com |
81 JSON.stringify(contentBlockerList.generateRules()), | 81 JSON.stringify(contentBlockerList.generateRules()), |
82 function(error) | 82 function(error) |
83 { | 83 { |
84 if (error === "") | 84 if (error == "") |
Sebastian Noack
2016/05/18 08:13:37
We always use == unless it makes a difference, as
kzar
2016/05/18 09:28:47
I wrongly thought that `(new Error("")).toString()
Sebastian Noack
2016/05/18 10:07:24
Even if error.toString() returns "", error == "" w
Sebastian Noack
2016/05/18 10:11:45
Never mind, you are actually right that == calls t
| |
85 return; | 85 return; |
86 | 86 |
87 lastSetContentBlockerError = error; | 87 lastSetContentBlockerError = error; |
88 callback(error); | 88 callback(error); |
89 } | 89 } |
90 ); | 90 ); |
91 } | 91 } |
92 | 92 |
93 function updateContentBlocker(isStartup, legacyAPISupported) | 93 function updateContentBlocker(isStartup, legacyAPISupported) |
94 { | 94 { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 }); | 153 }); |
154 }); | 154 }); |
155 } | 155 } |
156 | 156 |
157 port.on("safari.contentBlockingActive", (msg, sender) => | 157 port.on("safari.contentBlockingActive", (msg, sender) => |
158 { | 158 { |
159 if (!contentBlockingActive && afterContentBlockingFinished) | 159 if (!contentBlockingActive && afterContentBlockingFinished) |
160 return afterContentBlockingFinished; | 160 return afterContentBlockingFinished; |
161 return contentBlockingActive; | 161 return contentBlockingActive; |
162 }); | 162 }); |
LEFT | RIGHT |