mirror of https://github.com/gorhill/uBlock.git
this fixes #682
This commit is contained in:
parent
c7edec0d68
commit
77133b58c6
|
@ -151,6 +151,10 @@
|
|||
"message":"3rd-party frames are <b>blocked<\/b> everywhere by default",
|
||||
"description":""
|
||||
},
|
||||
"popupAnyRulePrompt":{
|
||||
"message":"all",
|
||||
"description":""
|
||||
},
|
||||
"popupImageRulePrompt":{
|
||||
"message":"images",
|
||||
"description":""
|
||||
|
|
|
@ -39,7 +39,6 @@ var Matrix = function() {
|
|||
/******************************************************************************/
|
||||
|
||||
var supportedDynamicTypes = {
|
||||
'*': true,
|
||||
'inline-script': true,
|
||||
'1p-script': true,
|
||||
'3p-script': true,
|
||||
|
@ -243,21 +242,15 @@ Matrix.prototype.evaluateCellZ = function(srcHostname, desHostname, type) {
|
|||
|
||||
Matrix.prototype.evaluateCellZY = function(srcHostname, desHostname, type) {
|
||||
this.r = 0;
|
||||
this.type = '*';
|
||||
|
||||
// Specific-destination + any type
|
||||
this.y = desHostname;
|
||||
this.r = this.evaluateCellZ(srcHostname, desHostname, '*');
|
||||
if ( this.r !== 0 ) { return this; }
|
||||
this.type = '*';
|
||||
var d = desHostname;
|
||||
for (;;) {
|
||||
d = toBroaderHostname(d);
|
||||
if ( d === '*' ) {
|
||||
break;
|
||||
}
|
||||
while ( d !== '*' ) {
|
||||
this.y = d;
|
||||
this.r = this.evaluateCellZ(srcHostname, d, '*');
|
||||
if ( this.r !== 0 ) { return this; }
|
||||
d = toBroaderHostname(d);
|
||||
}
|
||||
|
||||
// Any destination + specific-type
|
||||
|
|
|
@ -145,6 +145,7 @@ var getHostnameDict = function(hostnameToCountMap) {
|
|||
var getDynamicFilterRules = function(srcHostname, desHostnames) {
|
||||
var r = {};
|
||||
var dFiltering = µb.dynamicNetFilteringEngine;
|
||||
r['/ * *'] = dFiltering.evaluateCellZY('*', '*', '*').toFilterString();
|
||||
r['/ * image'] = dFiltering.evaluateCellZY('*', '*', 'image').toFilterString();
|
||||
r['/ * inline-script'] = dFiltering.evaluateCellZY('*', '*', 'inline-script').toFilterString();
|
||||
r['/ * 1p-script'] = dFiltering.evaluateCellZY('*', '*', '1p-script').toFilterString();
|
||||
|
@ -154,6 +155,7 @@ var getDynamicFilterRules = function(srcHostname, desHostnames) {
|
|||
return r;
|
||||
}
|
||||
|
||||
r['. * *'] = dFiltering.evaluateCellZY(srcHostname, '*', '*').toFilterString();
|
||||
r['. * image'] = dFiltering.evaluateCellZY(srcHostname, '*', 'image').toFilterString();
|
||||
r['. * inline-script'] = dFiltering.evaluateCellZY(srcHostname, '*', 'inline-script').toFilterString();
|
||||
r['. * 1p-script'] = dFiltering.evaluateCellZY(srcHostname, '*', '1p-script').toFilterString();
|
||||
|
|
|
@ -33,7 +33,7 @@ var popupData;
|
|||
var dfPaneBuilt = false;
|
||||
var popupHeight;
|
||||
var reIP = /^\d+(?:\.\d+){1,3}$/;
|
||||
var reSrcHostnameFromRule = /^d[abn]:([^ ]+) ([^ ]+)/;
|
||||
var reSrcHostnameFromRule = /^d[abn]:([^ ]+) ([^ ]+) ([^ ]+)/;
|
||||
var scopeToSrcHostnameMap = {
|
||||
'/': '*',
|
||||
'.': ''
|
||||
|
@ -201,11 +201,12 @@ var updateDynamicFilterCell = function(scope, des, type, rule) {
|
|||
var matches = reSrcHostnameFromRule.exec(rule);
|
||||
if ( matches !== null ) {
|
||||
ownRule = matches[2] === des &&
|
||||
matches[3] === type &&
|
||||
matches[1] === scopeToSrcHostnameMap[scope];
|
||||
}
|
||||
cell.toggleClass('ownRule', ownRule);
|
||||
|
||||
if ( scope !== '.' || type !== '*' ) {
|
||||
if ( scope !== '.' || des === '*' ) {
|
||||
return;
|
||||
}
|
||||
if ( popupData.hostnameDict.hasOwnProperty(des) === false ) {
|
||||
|
@ -269,12 +270,9 @@ var buildAllDynamicFilters = function() {
|
|||
var key, des;
|
||||
for ( var i = 0; i < keys.length; i++ ) {
|
||||
key = keys[i];
|
||||
// Specific-type rules -- these are built-in
|
||||
if ( key.slice(-1) !== '*' ) {
|
||||
continue;
|
||||
}
|
||||
des = key.slice(2, key.indexOf(' ', 2));
|
||||
if ( desHostnameDone.hasOwnProperty(des) ) {
|
||||
// Specific-type rules -- these are built-in
|
||||
if ( des === '*' || desHostnameDone.hasOwnProperty(des) ) {
|
||||
continue;
|
||||
}
|
||||
addDynamicFilterRow(des);
|
||||
|
|
|
@ -26,12 +26,13 @@
|
|||
<div id="refresh" class="fa"></div>
|
||||
</div><!-- DO NOT REMOVE --><div>
|
||||
<div id="dynamicFilteringContainer">
|
||||
<div><span data-i18n="popupAnyRulePrompt"></span><span data-src="/" data-des="*" data-type="*"> </span><span data-src="." data-des="*" data-type="*"></span></div>
|
||||
<div><span data-i18n="popupImageRulePrompt"></span><span data-src="/" data-des="*" data-type="image"> </span><span data-src="." data-des="*" data-type="image"></span></div>
|
||||
<div><span data-i18n="popupInlineScriptRulePrompt"></span><span data-src="/" data-des="*" data-type="inline-script"> </span><span data-src="." data-des="*" data-type="inline-script"> </span></div>
|
||||
<div><span data-i18n="popup1pScriptRulePrompt"></span><span data-src="/" data-des="*" data-type="1p-script"> </span><span data-src="." data-des="*" data-type="1p-script"> </span></div>
|
||||
<div><span data-i18n="popup3pScriptRulePrompt"></span><span data-src="/" data-des="*" data-type="3p-script"> </span><span data-src="." data-des="*" data-type="3p-script"> </span></div>
|
||||
<div><span data-i18n="popup3pFrameRulePrompt"></span><span data-src="/" data-des="*" data-type="3p-frame"> </span><span data-src="." data-des="*" data-type="3p-frame"> </span></div>
|
||||
<div id="privacyInfo"></div>
|
||||
<div id="privacyInfo" style="display: none;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue