This commit is contained in:
gorhill 2016-08-15 07:52:50 -04:00
parent dcc9138f31
commit d82a7e1ece
1 changed files with 8 additions and 4 deletions

View File

@ -327,11 +327,15 @@ var unpreview = function() {
/******************************************************************************/
// https://github.com/gorhill/uBlock/issues/1897
// Ignore `data:` URI, they can't be handled by an HTTP observer.
var backgroundImageURLFromElement = function(elem) {
var style = window.getComputedStyle(elem);
var bgImg = style.backgroundImage || '';
var matches = /^url\((["']?)([^"']+)\1\)$/.exec(bgImg);
return matches !== null && matches.length === 3 ? matches[2] : '';
var style = window.getComputedStyle(elem),
bgImg = style.backgroundImage || '',
matches = /^url\((["']?)([^"']+)\1\)$/.exec(bgImg),
url = matches !== null && matches.length === 3 ? matches[2] : '';
return url.lastIndexOf('data:', 0) === -1 ? url.slice(0, 1024) : '';
};
/******************************************************************************/