mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-05 18:32:30 +01:00
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',
|
||||
} ],
|
||||
|
41
src/web_accessible_resources/noeval-if.js
Normal file
41
src/web_accessible_resources/noeval-if.js
Normal file
@ -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() {
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
30
src/web_accessible_resources/noeval.js
Normal file
30
src/web_accessible_resources/noeval.js
Normal file
@ -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
Block a user