Simon-Tesla / RaccoonyWebEx

A WebExtension that adds shiny features to art sites
MIT License
44 stars 4 forks source link

Right click "Download with Raccoony" stopped working #146

Closed Athesis closed 2 years ago

Athesis commented 2 years ago

The right-clock context menu "Download with Raccoony" stopped working

On right click on any website image and select "Download with Raccoony", nothing happens. Tested it on two different systems and different firefox profiles.

Simon-Tesla commented 2 years ago

That is very strange; it works fine for me. When you say nothing happens, that means you don't see anything new in your downloads? And does it happen for any site you try it on? Would you be willing to share your settings file? (Addons and Themes > Raccoony WebExtension > Options > Export Settings)

Athesis commented 2 years ago

Yes, no new download, no file saved. And sure, here's the content of the file (exported from Version 1.2.5 on Linux, the path is writable):

{ "default_settings": { "autoFullscreen": true, "fullscreenScrollGestureEnabled": false, "downloadPath": "Y/NDL/{siteName}/{author}/{submissionId}_{filename}_by_{author}.{extension}", "hotkeysEnabled": true, "tabLoadDelay": 1, "tabLoadSortBy": "date", "tabLoadSortAsc": true, "tabLoadType": "Timer", "writeMetadata": true, "autoDownload": false, "contextDownloadPath": "Y/mcX/{siteName}/{filename}.{extension}" }, "e621_settings": { "autoFullscreen": false }, "furaffinity_settings": { "autoFullscreen": false }, "inkbunny_settings": { "autoFullscreen": false }, "patreon_settings": {}, "version": 4, "weasyl_settings": { "autoFullscreen": false } }

Can I open some kind of debug to collect further informations for you?

Athesis commented 2 years ago

I̶ ̶m̶i̶g̶h̶t̶ ̶j̶u̶s̶t̶ ̶f̶o̶u̶n̶d̶ ̶t̶h̶e̶ ̶r̶e̶a̶s̶o̶n̶,̶ ̶i̶t̶ ̶s̶e̶e̶m̶s̶ ̶l̶i̶k̶e̶ ̶R̶a̶c̶c̶o̶o̶n̶y̶/̶F̶i̶r̶e̶f̶o̶x̶ ̶d̶o̶s̶n̶'̶t̶ ̶l̶i̶k̶e̶ ̶t̶o̶ ̶s̶a̶v̶e̶ ̶f̶i̶l̶e̶s̶ ̶i̶n̶t̶o̶ ̶a̶ ̶f̶o̶l̶d̶e̶r̶ ̶w̶i̶t̶h̶ ̶o̶v̶e̶r̶ ̶1̶3̶2̶5̶0̶ ̶O̶b̶j̶e̶c̶t̶s̶?̶

Okey, if I change any setting it works for a couple of images and stops again.

Simon-Tesla commented 2 years ago

I'm not aware of any such limitation for downloads with Firefox. As far as collecting debug logs, if you type in about:debugging into the address bar, choose "This Firefox" and then click Inspect on the Raccoony WebExtension, that'll bring up the dev console for the extension. From there, if you can switch to "Console" and look for a log line that starts with [raccoony] [background] received request messageaction_download and copy the log with the objects expanded along with any error messages in the log, that would be helpful in figuring out what's going on.

image image

Simon-Tesla commented 2 years ago

Also, you may need to initiate a download with the console open to see messages about it. I don't think it saves them if the dev tools aren't open.

Athesis commented 2 years ago

The problem dosn't reappear as long the debug console is open. As soon I close the Console, it's back again.

What I did: Downloads not working. -> Open the Debug Console Downloads still not working, nothing happens in the Console. -> Open Raccoony settings and uncheck / check “Show Raccoony in right-click menu” Downloads now keep working until I close the Console again.

Besides the “Background event” warning, noting else seems to happen...

Simon-Tesla commented 2 years ago

Hm... weird. This is a long shot, but if you can open the F12 dev tools on the page and look for [raccoony] logs there, that might be helpful. If you're not seeing any logs while attempting to download from the background script, it might be that the background script isn't even receiving messages.

Simon-Tesla commented 2 years ago

I've noticed that this seems to repro relatively consistently on tumblr. It appears to have something to do with the sites Content Security Policy settings, so I'll have to see if there's a way around that.

Simon-Tesla commented 2 years ago

Hmm... this is very strange. I'm starting to see this behavior on other sites too. I suspect but can't confirm that it was introduced by a firefox update. I've noticed that sometimes closing and reopening the tab can fix it, but it doesn't seem universal either.

Simon-Tesla commented 2 years ago

The documentation for the tabs.executeScript() API doesn't mention anything about CSP (and really, there's no reason extension scripts shouldn't be able to run regardless of CSP). Maybe a bug in Firefox? Or maybe I need to specify a CSP on my extension itself. I'm betting that's likely what's happening here.

Simon-Tesla commented 2 years ago

Verified that Chrome seems to work (with version 1.2.5, but the context script mechanism didn't change in 1.2.6pre), so this is either a Firefox change or a Firefox bug.

Simon-Tesla commented 2 years ago

Hmm... there's also an issue where the background script doesn't seem to be loading at all in some cases, which is very weird.

Simon-Tesla commented 2 years ago

I'll need to do more testing but it looks like changing the manifest to use persistent:true for the background script may fix the issue, at least for now.

Simon-Tesla commented 2 years ago

Pretty sure this is the fix; previously (up to v. 105) Firefox ignored the persistent: false key in the manifest and persisted anyway. There appears to be some sort of bug either in Firefox or in the way I handle event pages that makes it so that non-persistent event pages don't work there, as I've always had persistent: false in the manifest and Chrome seemed to behave fine. Guess I'll have to pore over bugzilla, see if I can find anything. Or file one myself.

I'll give this fix another day or so of testing and then roll another prerelease xpi so that people using FF have an option for this. Might also roll a patch on 1.2.5 in the meantime.

Simon-Tesla commented 2 years ago

Fixed in the 1.2.6pre2 and 1.2.5.1 releases.