aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/dynamic-net-filtering.js
diff options
context:
space:
mode:
authorgorhill <rhill@raymondhill.net>2015-07-24 19:27:23 -0400
committergorhill <rhill@raymondhill.net>2015-07-24 19:27:23 -0400
commit35106dcd9048db9e60656f77b70c2aeae8217610 (patch)
treead1cb3c9986979a45a755ec073095822ea44a41b /src/js/dynamic-net-filtering.js
parentc1e54d33b2fb093ff5c344423a97e47910f24eda (diff)
downloaduBlock-35106dcd9048db9e60656f77b70c2aeae8217610.zip
uBlock-35106dcd9048db9e60656f77b70c2aeae8217610.tar.gz
uBlock-35106dcd9048db9e60656f77b70c2aeae8217610.tar.bz2
new dynamic rule type: "3p-passive", for css/images
Diffstat (limited to 'src/js/dynamic-net-filtering.js')
-rw-r--r--src/js/dynamic-net-filtering.js55
1 files changed, 7 insertions, 48 deletions
diff --git a/src/js/dynamic-net-filtering.js b/src/js/dynamic-net-filtering.js
index 2f91616..7748437 100644
--- a/src/js/dynamic-net-filtering.js
+++ b/src/js/dynamic-net-filtering.js
@@ -46,7 +46,8 @@ var supportedDynamicTypes = {
'inline-script': true,
'1p-script': true,
'3p-script': true,
- '3p-frame': true
+ '3p-frame': true,
+ '3p-passive': true
};
var typeBitOffsets = {
@@ -56,7 +57,8 @@ var typeBitOffsets = {
'3p-script': 6,
'3p-frame': 8,
'image': 10,
- '3p': 12
+ '3p': 12,
+ '3p-passive': 14
};
var actionToNameMap = {
@@ -386,7 +388,9 @@ Matrix.prototype.evaluateCellZY = function(srcHostname, desHostname, type) {
// Specific party
if ( thirdParty ) {
// 3rd-party, specific type
- if ( type === 'script' ) {
+ if ( type === 'image' || type === 'stylesheet' ) {
+ if ( this.evaluateCellZ(srcHostname, '*', '3p-passive') !== 0 ) { return this; }
+ } else if ( type === 'script' ) {
if ( this.evaluateCellZ(srcHostname, '*', '3p-script') !== 0 ) { return this; }
} else if ( type === 'sub_frame' ) {
if ( this.evaluateCellZ(srcHostname, '*', '3p-frame') !== 0 ) { return this; }
@@ -588,51 +592,6 @@ Matrix.prototype.fromString = function(text, append) {
/******************************************************************************/
-Matrix.prototype.fromObsoleteSelfie = function(selfie) {
- if ( selfie === '' ) {
- return '';
- }
- var bin = {};
- try {
- bin = JSON.parse(selfie);
- } catch(e) {
- }
- var filters = bin.filters;
- var bits, val;
- for ( var hostname in filters ) {
- if ( filters.hasOwnProperty(hostname) === false ) {
- continue;
- }
- bits = filters[hostname];
- val = bits & 3;
- if ( val === 1 ) {
- this.setCell(hostname, '*', 'inline-script', 1);
- } else if ( val === 2 ) {
- this.setCell(hostname, '*', 'inline-script', 3);
- }
- val = (bits >> 2) & 3;
- if ( val === 1 ) {
- this.setCell(hostname, '*', '1p-script', 1);
- } else if ( val === 2 ) {
- this.setCell(hostname, '*', '1p-script', 3);
- }
- val = (bits >> 4) & 3;
- if ( val === 1 ) {
- this.setCell(hostname, '*', '3p-script', 1);
- } else if ( val === 2 ) {
- this.setCell(hostname, '*', '3p-script', 3);
- }
- val = (bits >> 8) & 3;
- if ( val === 1 ) {
- this.setCell(hostname, '*', '3p-frame', 1);
- } else if ( val === 2 ) {
- this.setCell(hostname, '*', '3p-frame', 3);
- }
- }
-};
-
-/******************************************************************************/
-
Matrix.prototype.toSelfie = function() {
return {
magicId: magicId,