1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-03 01:29:39 +02:00

redirect engine: code review + added more neutered resources

This commit is contained in:
gorhill 2015-11-26 11:13:33 -05:00
parent 2e8adfe944
commit 791a025ad5
3 changed files with 78 additions and 32 deletions

View File

@ -1,5 +1,5 @@
a65d3b35ba116f897c7ef5db2046da73 assets/ublock/unbreak.txt
7d7d8d4d795ad6821e2a728790b8d0f1 assets/ublock/redirect-resources.txt
487882164fd6aa571fbc10d5f01eb7e1 assets/ublock/redirect-resources.txt
7a04294b44b88baa34cf3e4bfe0e59db assets/ublock/privacy.txt
b2dbf435507aa0262b289c67cbef2142 assets/ublock/filters.txt
146704ad1c0393e342afdb416762c183 assets/ublock/badware.txt

View File

@ -12,7 +12,9 @@
hd-main.js application/javascript
var L = (function(){
var l = {};
var noopfn = function() {};
var noopfn = function() {
;
};
var props = ["pf", "ed", "Qe", "fd", "xh", "Uc", "ef", "zd", "Ad", "Qc", "Ri", "Wc", "Vc", "Xc", "Wg", "rd", "qd", "sd", "Pe", "Id", "Hd", "Jd", "fg", "Fd", "Ed", "Gd", "ek", "Cd", "Bd", "Dd", "Nj", "Sc", "Rc", "Tc", "wg", "xd", "wd", "yd", "fh", "ld", "md", "nd", "Re", "cd", "Pc", "ke", "Yc", "Xg", "jd", "kd", "oh", "ad", "bd", "mi", "gd", "hd", "ae", "dd", "fk", "ij", "ud", "td", "vd", "ig", "od", "pd", "Yd", "$j", "Oc", "bf"];
for (var i = 0; i < props.length; i++) {
l[props[i]] = noopfn;
@ -26,37 +28,81 @@ handtinytrans.gif image/gif;base64
R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
fuckadblock.js-3.2.0 application/javascript
(function() {
var noopfn = function() {
;
};
//
var Fab = function() {};
Fab.prototype._bait = null;
Fab.prototype._checkBait = noopfn;
Fab.prototype._creatBait = noopfn;
Fab.prototype._destroyBait = noopfn;
Fab.prototype._log = noopfn;
Fab.prototype._options = null;
Fab.prototype._stopLoop = noopfn;
Fab.prototype._var = null;
Fab.prototype.check = noopfn;
Fab.prototype.clearEvent = noopfn;
Fab.prototype.emitEvent = noopfn;
Fab.prototype.on = function(a, b) {
if ( !a ) { b(); }
};
Fab.prototype.onDetected = noopfn;
Fab.prototype.onNotDetected = function(a) {
a();
};
Fab.prototype.setOption = noopfn;
window.FuckAdBlock = Fab;
//
window.fuckAdBlock = new Fab();
})();
noopframe text/html
<!DOCTYPE html>
<html>
<head><title></title></head>
<body></body>
</html>
# To neutralize GA scripts. The goal is to provide the minimal API
# expected by clients of these scripts so that the end users are able
# to wholly block GA while minimizing risks of page breakage.
# Test cases (need way more):
# - https://github.com/chrisaljoudi/uBlock/issues/119
#www.google-analytics.com/ga.js application/javascript
#(function() {
# var noopfn = function() {};
# //
# var gaq = function() {};
# gaq.push = function(a) {
# if ( typeof a === 'function' ) {
# a();
# }
# };
# //
# var tracker = function() {};
# tracker._getLinkerUrl = function(a) { return a; };
# //
# var gat = function() {};
# gat._getTrackerByName = function() { return tracker; };
# window._gat = gat;
# //
# (function() {
# var aa = window._gaq || [];
# if ( Array.isArray(aa) ) {
# while ( aa[0] ) {
# gaq.push(aa.shift());
# }
# }
# })();
# window._gaq = gaq;
#})();
www.google-analytics.com/ga.js application/javascript
(function() {
var noopfn = function() {
;
};
//
var gaq = function() {
;
};
gaq.push = function(a) {
if ( typeof a === 'function' ) {
a();
}
};
//
var tracker = function() {};
tracker._getLinkerUrl = function(a) { return a; };
//
var gat = function() {};
gat._getTrackerByName = function() { return tracker; };
window._gat = gat;
//
(function() {
var aa = window._gaq || [];
if ( Array.isArray(aa) ) {
while ( aa[0] ) {
gaq.push(aa.shift());
}
}
})();
window._gaq = gaq;
})();

View File

@ -156,7 +156,7 @@ RedirectEngine.prototype.compileRuleFromStaticFilter = function(line) {
if ( type !== undefined ) {
return;
}
type = option;
type = this.supportedTypes[option];
continue;
}
}
@ -201,7 +201,7 @@ RedirectEngine.prototype.compileRuleFromStaticFilter = function(line) {
/******************************************************************************/
RedirectEngine.prototype.reFilterParser = /^\|\|([^\/\?#]+)([^$]+)\$([^$]+)$/;
RedirectEngine.prototype.reFilterParser = /^\|\|([^\/?#^*]+)([^$]+)\$([^$]+)$/;
RedirectEngine.prototype.supportedTypes = (function() {
var types = Object.create(null);