qsniyg / maxurl

Finds larger/original versions of images and videos
https://qsniyg.github.io/maxurl/
Apache License 2.0
1.1k stars 69 forks source link

Images opened in their own tabs do not redirect anymore to the original size image in v0.12.0 and onwards on Firefox 56 #192

Closed Bwin4L closed 4 years ago

Bwin4L commented 4 years ago

Hello,

On Firefox 56 (yes, it's old and and I should probably move to other XUL-based browsers), since the changes to how requests are made in v0.12.0, image redirection seems to be broken. I believe it might be caused by a Firefox bug: I looked at the response and while resp.readyState does equal 2, the headers are null (resp.responseHeaders = null). Fortunately, the "fix" (workaround) is rather simple. Changing line 31337 on v0.12.2 from:

if (resp.readyState >= 2) {

to

if (resp.readyState >= 2 && resp.responseHeaders) {

i.e. checking whether the response headers are indeed there fixes the issue for me. The same "fix" must probably also be applied on line 33111, for GET requests: change it from

if (incomplete_request && resp.readyState >= 2) {

to

if (incomplete_request && resp.readyState >= 2 && resp.responseHeaders) {

I would absolutely understand you if you didn't want to implement this fix, after all I'm the one using an old browser. Despite this, would you still consider adding this to the script's code?

Thanks! Bwin.

qsniyg commented 4 years ago

Thank you very much for the detailed report and fix! For some reason while testing, that situation never occurred, but it makes complete sense that it could happen.

Bwin4L commented 4 years ago

Wow, that was blazingly fast! Thanks a lot! :)