aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorgorhill <rhill@raymondhill.net>2014-12-19 14:00:46 -0500
committergorhill <rhill@raymondhill.net>2014-12-19 14:00:46 -0500
commit6fc7f96a4866458953f2fbae5239916aada78ce0 (patch)
treeb0e2090a358b65ec0defeaba3d15bf56776049c3 /src
parent35db700f58095f6aade12445c3a805dcab57e300 (diff)
downloaduBlock-6fc7f96a4866458953f2fbae5239916aada78ce0.zip
uBlock-6fc7f96a4866458953f2fbae5239916aada78ce0.tar.gz
uBlock-6fc7f96a4866458953f2fbae5239916aada78ce0.tar.bz2
this fixes #423
Diffstat (limited to 'src')
-rw-r--r--src/js/contentscript-end.js5
-rw-r--r--src/js/contentscript-start.js8
-rw-r--r--src/js/cosmetic-filtering.js6
3 files changed, 14 insertions, 5 deletions
diff --git a/src/js/contentscript-end.js b/src/js/contentscript-end.js
index 25c6200..1d8cf7f 100644
--- a/src/js/contentscript-end.js
+++ b/src/js/contentscript-end.js
@@ -42,6 +42,11 @@ var messager = vAPI.messaging.channel('contentscript-end.js');
// ABP cosmetic filters
(function() {
+ if ( vAPI.skipCosmeticFiltering ) {
+ // console.debug('Abort cosmetic filtering');
+ return;
+ }
+
var queriedSelectors = {};
var injectedSelectors = vAPI.hideCosmeticFilters || {};
var classSelectors = null;
diff --git a/src/js/contentscript-start.js b/src/js/contentscript-start.js
index aed3f4f..a856348 100644
--- a/src/js/contentscript-start.js
+++ b/src/js/contentscript-start.js
@@ -34,11 +34,16 @@
/******************************************************************************/
-// because Safari
+// Because Safari
if ( vAPI.canExecuteContentScript() !== true ) {
return;
}
+// Because in case
+if ( !vAPI ) {
+ return;
+}
+
/******************************************************************************/
var localMessager = vAPI.messaging.channel('contentscript-start.js');
@@ -116,6 +121,7 @@ var netFilters = function(details) {
};
var filteringHandler = function(details) {
+ vAPI.skipCosmeticFiltering = !details || details.skipCosmeticFiltering;
if ( details ) {
if ( details.cosmeticHide.length !== 0 || details.cosmeticDonthide.length !== 0 ) {
cosmeticFilters(details);
diff --git a/src/js/cosmetic-filtering.js b/src/js/cosmetic-filtering.js
index 1aac13e..5435dd5 100644
--- a/src/js/cosmetic-filtering.js
+++ b/src/js/cosmetic-filtering.js
@@ -969,7 +969,7 @@ FilterContainer.prototype.pruneSelectorCache = function() {
/******************************************************************************/
FilterContainer.prototype.retrieveGenericSelectors = function(request) {
- if ( µb.userSettings.parseAllABPHideFilters !== true ) {
+ if ( this.acceptedCount !== 0 ) {
return;
}
if ( !request.selectors ) {
@@ -1031,9 +1031,6 @@ FilterContainer.prototype.retrieveGenericSelectors = function(request) {
/******************************************************************************/
FilterContainer.prototype.retrieveDomainSelectors = function(request) {
- if ( µb.userSettings.parseAllABPHideFilters !== true ) {
- return;
- }
if ( !request.locationURL ) {
return;
}
@@ -1047,6 +1044,7 @@ FilterContainer.prototype.retrieveDomainSelectors = function(request) {
var r = {
domain: domain,
entity: pos === -1 ? domain : domain.slice(0, pos - domain.length),
+ skipCosmeticFiltering: this.acceptedCount === 0,
cosmeticHide: [],
cosmeticDonthide: [],
netHide: [],