Skip to content

Loading…

More image types for transposeType #495

Closed
lewisje opened this Issue · 2 comments

2 participants

@lewisje

I was browsing the source code and found this line in the function transposeType: https://github.com/gorhill/uBlock/blob/master/src/js/ublock.js#L294

if ( '.ico.png.gif.jpg.jpeg.'.indexOf(ext) !== -1 ) {

This line is meant to suss out whether a request treated by the webRequest API as other is actually an image, but why aren't bmp and webp in that string? I realize the former is old and should never be used in Web design, but browsers do understand it, and although the latter does not have wide support, I know that some sites actually send WebP images to browsers that support the format.

Also, a few lines up, why can't the function also transpose request types that are detected as object (like those requests that nsIContentPolicy on Firefox would detect as objectsubrequest) and yet are actually images or fonts (which the function already changes to stylesheet if they were originally other)?

@gorhill

why

Because there are no known issues?

@gorhill

Not an issue. The code for image/css/other was put there to deal with a Chromium bug. The guessing of image/css types can now be removed as the bug was solved for these types.

@gorhill gorhill closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.