set a limit on longth of suggested network filters (see https://github.com/gorhill/uBlock/issues/1725#issuecomment-226479197)

This commit is contained in:
gorhill 2016-06-16 09:15:49 -04:00
parent 5f1f697af1
commit c0515c20a4
1 changed files with 5 additions and 2 deletions

View File

@ -336,18 +336,21 @@ var backgroundImageURLFromElement = function(elem) {
/******************************************************************************/
// https://github.com/gorhill/uBlock/issues/1725#issuecomment-226479197
// Limit returned string to 2048 characters.
var resourceURLFromElement = function(elem) {
var tagName = elem.localName, s;
if ( (s = netFilter1stSources[tagName]) ) {
s = elem[s];
if ( typeof s === 'string' && s !== '' ) {
return s;
return s.slice(0, 2048);
}
}
if ( (s = netFilter2ndSources[tagName]) ) {
s = elem[s];
if ( typeof s === 'string' && s !== '' ) {
return s;
return s.slice(0, 2048);
}
}
return backgroundImageURLFromElement(elem);