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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 { | 278 { |
279 if (this.abpEngine.isElemhideEnabled() && this.filteringEnabled) | 279 if (this.abpEngine.isElemhideEnabled() && this.filteringEnabled) |
280 { | 280 { |
281 if (referrer != null) | 281 if (referrer != null) |
282 { | 282 { |
283 this.referrerMapping.add(url, referrer); | 283 this.referrerMapping.add(url, referrer); |
284 } | 284 } |
285 final List<String> referrerChain = this.referrerMapping.buildReferrerChain
(referrer); | 285 final List<String> referrerChain = this.referrerMapping.buildReferrerChain
(referrer); |
286 final String[] referrerChainArray = referrerChain.toArray(new String[refer
rerChain.size()]); | 286 final String[] referrerChainArray = referrerChain.toArray(new String[refer
rerChain.size()]); |
287 final List<String> selectors = this.abpEngine.getElementHidingSelectors(ur
l, referrerChainArray); | 287 final List<String> selectors = this.abpEngine.getElementHidingSelectors(ur
l, referrerChainArray); |
288 return selectors.toArray(new String[selectors.size()]); | 288 // We're returning 'null' when no selectors are available to be consistent |
| 289 // with the previous implementation |
| 290 return selectors.isEmpty() ? null : selectors.toArray(new String[selectors
.size()]); |
289 } | 291 } |
290 else | 292 else |
291 { | 293 { |
| 294 /* |
| 295 * This case is still the default for Adblock Plus for Android, as we did
not yet |
| 296 * re-enable element hiding but only enhanced/fixed the current implementa
tion. |
| 297 * See: https://issues.adblockplus.org/ticket/3364 |
| 298 */ |
292 /* We need to ignore element hiding rules here to work around two bugs: | 299 /* We need to ignore element hiding rules here to work around two bugs: |
293 * 1. CSS is being injected even when there's an exception rule with $elem
hide | 300 * 1. CSS is being injected even when there's an exception rule with $elem
hide |
294 * 2. The injected CSS causes blank pages in Chrome for Android | 301 * 2. The injected CSS causes blank pages in Chrome for Android |
295 * | 302 * |
296 * Starting with 1.1.2, we ignored element hiding rules after download any
way, to keep the | 303 * Starting with 1.1.2, we ignored element hiding rules after download any
way, to keep the |
297 * memory usage down. Doing this with libadblockplus is trickier, but woul
d be the clean | 304 * memory usage down. Doing this with libadblockplus is trickier, but woul
d be the clean |
298 * solution. */ | 305 * solution. */ |
299 return null; | 306 return null; |
300 } | 307 } |
301 } | 308 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 } | 449 } |
443 catch (final IOException e) | 450 catch (final IOException e) |
444 { | 451 { |
445 Log.e(TAG, e.getMessage(), e); | 452 Log.e(TAG, e.getMessage(), e); |
446 } | 453 } |
447 | 454 |
448 // Set crash handler | 455 // Set crash handler |
449 Thread.setDefaultUncaughtExceptionHandler(new CrashHandler(this)); | 456 Thread.setDefaultUncaughtExceptionHandler(new CrashHandler(this)); |
450 } | 457 } |
451 } | 458 } |
LEFT | RIGHT |