mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 09:07:54 +01:00
Safari: block programmatic image requests, more thorough XHR
Currently, this is done the same way we block XMLHttpRequests: mess with the constructor. This was done in the most efficient way I could think of (overhead is relatively minimal). This also injects uBlock's blocking interceptor earlier, thusly covering more requests that may have slipped through before.
This commit is contained in:
parent
29fa6cb2e8
commit
58ae9f266b
1 changed files with 7 additions and 7 deletions
|
@ -237,15 +237,15 @@ wo = open,\
|
|||
xo = XMLHttpRequest.prototype.open,\
|
||||
img = Image;\
|
||||
_noOP = function(){};\
|
||||
window.Image = function() {\
|
||||
Image = function() {\
|
||||
var x = new img();\
|
||||
Object.defineProperty(x, 'src', {\
|
||||
get: function() {\
|
||||
return x.getAttribute('src');\
|
||||
},\
|
||||
set: function(val) {\
|
||||
x.setAttribute('src', block(val, 'image') ? 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=' : val);\
|
||||
}\
|
||||
get: function() {\
|
||||
return x.getAttribute('src');\
|
||||
},\
|
||||
set: function(val) {\
|
||||
x.setAttribute('src', block(val, 'image') ? 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=' : val);\
|
||||
}\
|
||||
});\
|
||||
return x;\
|
||||
};\
|
||||
|
|
Loading…
Reference in a new issue