gorhill 2016-01-18 00:26:29 -05:00
parent 41499dbab2
commit a7a840500b
1 changed files with 4 additions and 9 deletions

View File

@ -474,16 +474,11 @@ var foilLargeMediaElement = function(details) {
if ( µb.hnSwitches.evaluateZ('no-large-media', pageStore.tabHostname) !== true ) { if ( µb.hnSwitches.evaluateZ('no-large-media', pageStore.tabHostname) !== true ) {
return; return;
} }
// Not all servers provide the Content-Length header: when this happens, var i = headerIndexFromName('content-length', details.responseHeaders);
// assume the worse. if ( i === -1 ) {
var contentLength = 1000000, return;
i = headerIndexFromName('content-length', details.responseHeaders);
if ( i !== -1 ) {
contentLength = parseInt(details.responseHeaders[i].value, 10);
if ( isNaN(contentLength) ) {
contentLength = 1000000;
}
} }
var contentLength = parseInt(details.responseHeaders[i].value, 10) || 0;
if ( (contentLength >>> 10) < µb.userSettings.largeMediaSize ) { if ( (contentLength >>> 10) < µb.userSettings.largeMediaSize ) {
return; return;
} }