extesy / hoverzoom

Google Chrome extension for zooming images on mouse hover
https://chrome.google.com/webstore/detail/hover-zoom%20/pccckmaobkjjboncdfnnofkonhgpceea
MIT License
1.14k stars 178 forks source link

Hover Zoom+ for Firefox - "Save image" Action Key does not work (Version 1.0.218) #1387

Closed isick1e closed 1 week ago

isick1e commented 3 months ago

Describe the bug On Version 1.0.218 extension for Firefox, the "Save image" Action Key does not work to save an image that is currently hovered. This functionality works fine on the Chrome extension, however.

All of the other Action Keys seem to work, aside from "Save image". I have just moved over to Firefox from Chrome, so I don't know how long this function hasn't worked.

I tried to reinstall the extension fresh with all settings reset using the "Reset" and "Save" buttons to no avail. As seen in the screenshots below, under the extension permissions, only "Access your data for all websites" is enabled by default.

I went ahead and enabled the three other Optional permissions "Download files and read and modify the browser’s download history", "Access browsing history", and "Access browser tabs". The "Save image" Action Key still doesn't download images. I have also enabled the "Enable Action Keys focus overlay message" setting to ensure the image is focused before trying to save it.

To Reproduce

  1. Go to Google.com
  2. Search "cats"
  3. Click on Images
  4. Hover over various image results and allow them to enlarge.
  5. Press the "Save image" Action Key (default S)
  6. Nothing happens, the image does not download.

In the Screenshots section below, I will show the Console outputs when using the "Save image" Action Key.

Expected behavior Pressing the desired Action Key on a hovered image should download the image to the set download location.

Screenshots Screenshots of the default Hoverzoom+ Extension settings on Firefox: firefox_7r0Nfryllx

firefox_ZjzspzdlWh

Screenshots of my modified Hoverzoom+ Extension settings on Firefox to enable optional features:

firefox_Fuv10tL4rG

Screenshot of the Firefox Console (F12) and the Hover Zoom+ Extension debug console outputs when hovering over the first 3 Google image results and pressing the "Save image" Action Key.

firefox_nBHuxJhcBC

When I press the "Save image" Action Key, the Firefox Console outputs "Download: (file URL)" and the extension debug console outputs "downloadFile: [object object]" then "downloadFile granted: undefined", without downloading anything at all.

However, when I try the "Save image" Action Key on the Chrome extension, the file does download as expected, and the following Console output is generated:

chrome_SUMzQbAdax

Desktop (please complete the following information):

Himbosuarus commented 2 months ago

Having the same issue I believe

LiliaDoe commented 2 weeks ago

The issue is in the onMessage function in background.js, line 98. For some reason chrome.permissions.request is not returning a promise in Firefox 131.0.3

chrome.permissions.request({permissions: ['downloads']}, function (granted) {
                cLog('downloadFile granted: ' + granted);
                if (granted) { //granted always returns undefined in firefox
                    downloadFile(message.url, message.filename, message.conflictAction, callback);
                }
extesy commented 1 week ago

@LiliaDoe Yep, I tracked it down to the same place, but I have no idea why Firefox would behave that way. Seems like a bug in Firefox?

LiliaDoe commented 1 week ago

@extesy I'd say it is as well. There is a workaround I discovered, to first check for the permission with permissions.contains, but it's not ideal

extesy commented 1 week ago

Fixed in 02bb4426d6ed607852111cd7cb691e5ec06489bc. Will be available in the next release.