mirror of https://github.com/gorhill/uBlock.git
parent
0ba9a35818
commit
8e245c8919
|
@ -138,6 +138,11 @@ const immutableResources = new Map([
|
|||
alias: 'nano-stb.js',
|
||||
redirect: false
|
||||
} ],
|
||||
[ 'noeval.js', {
|
||||
} ],
|
||||
[ 'noeval-if.js', {
|
||||
redirect: false
|
||||
} ],
|
||||
[ 'noeval-silent.js', {
|
||||
alias: 'silent-noeval.js',
|
||||
} ],
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/*******************************************************************************
|
||||
|
||||
uBlock Origin - a browser extension to block requests.
|
||||
Copyright (C) 2019-present Raymond Hill
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||
|
||||
Home: https://github.com/gorhill/uBlock
|
||||
*/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
let needle = '{{1}}';
|
||||
if ( needle === '' || needle === '{{1}}' ) {
|
||||
needle = '.?';
|
||||
} else if ( needle.slice(0,1) === '/' && needle.slice(-1) === '/' ) {
|
||||
needle = needle.slice(1,-1);
|
||||
} else {
|
||||
needle = needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
}
|
||||
needle = new RegExp(needle);
|
||||
window.eval = new Proxy(window.eval, { // jshint ignore: line
|
||||
apply: function(target, thisArg, args) {
|
||||
const a = args[0];
|
||||
if ( needle.test(a.toString()) === false ) {
|
||||
return target.apply(thisArg, args);
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
(function() {
|
||||
'use strict';
|
||||
window.eval = function() {
|
||||
}.bind(window);
|
||||
window.eval = new Proxy(window.eval, { // jshint ignore: line
|
||||
apply: function() {
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
|
||||
uBlock Origin - a browser extension to block requests.
|
||||
Copyright (C) 2019-present Raymond Hill
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||
|
||||
Home: https://github.com/gorhill/uBlock
|
||||
*/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
const log = console.log.bind(console);
|
||||
window.eval = new Proxy(window.eval, { // jshint ignore: line
|
||||
apply: function(target, thisArg, args) {
|
||||
log(`Document tried to eval... ${args[0]}\n`);
|
||||
}
|
||||
});
|
||||
})();
|
|
@ -76,7 +76,7 @@
|
|||
}
|
||||
const prop = chain.slice(0, pos);
|
||||
let v = owner[prop];
|
||||
chain = chain.slice(pos + 1);
|
||||
chain = chain.slice(pos + 1);
|
||||
if ( v !== undefined ) {
|
||||
makeProxy(v, chain);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue