Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manifest V3 migration #1522

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Manifest V3 migration #1522

wants to merge 14 commits into from

Conversation

extesy
Copy link
Owner

@extesy extesy commented Jan 19, 2025

@extesy extesy self-assigned this Jan 19, 2025
@extesy extesy marked this pull request as ready for review March 9, 2025 01:05
@extesy
Copy link
Owner Author

extesy commented Mar 9, 2025

@LiliaDoe @GrosPoulet This branch is at the state that it currently loads as a valid Manifest V3 extension and actually works for a couple sites that I tried. Feel free to experiment with it, I need all the feedback I can get before I merge it into main branch.

@LiliaDoe
Copy link
Contributor

LiliaDoe commented Mar 9, 2025

Will do! Would you prefer it tested on chrome? Else, I'll test it mainly on firefox

@extesy
Copy link
Owner Author

extesy commented Mar 9, 2025

Testing in Firefox would be perfect. I mostly use Chrome so it's good to have some coverage between different browsers.

@LiliaDoe
Copy link
Contributor

LiliaDoe commented Mar 9, 2025

My testing thus far has found a couple things.

  • The first is an issue with the manifest for Firefox. I made a PR with a fix that should allow Chrome and Firefox to work.
  • The second is a reoccuring error: Error: Could not establish connection. Receiving end does not exist. It's most consistent on https://www.furaffinity.net/, but I found it occurs on https://www.ebay.com/ upon initial load where it then goes away after the page finishes loading. It doesn't seem like "preloadAvailable" has a "message.action" case in function "onMessage" within "js/background.js". That may be what's causing the error

Everything else works great so far on Firefox!

Firefox 136 still needs background.scripts in the manifest to work. This
adds it
@extesy
Copy link
Owner Author

extesy commented Mar 9, 2025

Thank you for testing! I also noticed this "Receiving end does not exist" error when saving options but I haven't yet been able to figure out what is causing it.

@extesy
Copy link
Owner Author

extesy commented Mar 9, 2025

Migration docs say that unlike background pages, service workers could shut down at any time and lose all their registered listeners. So maybe that is what's causing the problem.

@LiliaDoe
Copy link
Contributor

LiliaDoe commented Mar 9, 2025

I was seeing the error on the master branch too in reddit, while debugging that Reddit video issue.

Edit: I double checked today, and I don't see the error showing on master branch now. Maybe it was on my end

@extesy
Copy link
Owner Author

extesy commented Mar 12, 2025

@LiliaDoe I've made some fixes recently - the options can be saved now without errors but they don't seem to be updating other pages immediately, so a reload is required. Other than that, everything seems to work. Can you please re-check? I think I can live with options requiring a reload if it lets us restore the extension in Chrome web store.

@LiliaDoe
Copy link
Contributor

LiliaDoe commented Mar 12, 2025

@extesy https://www.furaffinity.net/ still does not work, showing the same error. Direct image links on the site still work as expected. This makes me think the error message is being sent when part of the prepareFromDocument function is triggered:

chrome.runtime.sendMessage({action:'ajaxRequest', url: url, method: 'GET'}, function(data) {

The error occurs on many other sites, but without affecting functionality. Options can be saved for me as well, despite the connection error showing.

I'm not sure how to fix it. The background worker is online when it happens. It's like the listener just doesn't exist. It may be related to the listener not registering in time: https://developer.chrome.com/docs/extensions/develop/migrate/to-service-workers#register-listeners

@extesy
Copy link
Owner Author

extesy commented Mar 12, 2025

@LiliaDoe How about now? I checked https://www.furaffinity.net and I don't see connection errors in console.

@LiliaDoe
Copy link
Contributor

LiliaDoe commented Mar 12, 2025

@extesy I see it working on Chrome too, but the error still persists on Firefox. I'll see if the Mozilla docs have anything about this (https://extensionworkshop.com/documentation/develop/manifest-v3-migration-guide/)

Edit: I found an error in the background page. importScripts is throwing an error, but only in Firefox:

14:00:49.891 Uncaught ReferenceError: importScripts is not defined
    <anonymous> moz-extension://9739b5ce-f8b8-4f65-ba52-f60f83c9d221/js/background.js:1
background.js:1:1

Fixing it didn't seem to fix it not working, though. Also, onMessage in background.js doesn't seem to be called at all in Firefox

@LiliaDoe
Copy link
Contributor

I found a separate issue within firefox. In the permissions, every url that has a plugin for it is listed
image

@extesy
Copy link
Owner Author

extesy commented Mar 13, 2025

@LiliaDoe I fixed importScripts error in Firefox, please check it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants