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 compatibility #21

Closed
wants to merge 9 commits into from
Closed

Manifest v3 compatibility #21

wants to merge 9 commits into from

Conversation

jelmervdl
Copy link
Owner

Ultimately this should solve #10.

@jelmervdl jelmervdl linked an issue Jun 10, 2022 that may be closed by this pull request
jelmervdl added 5 commits July 4, 2022 13:21
Not working with the content policy right now
…in content

Trying to use Worker in contentScript did not give me the right origin, but loading an iframe does? Anyway, this way we forward all requests from all frames to the background script, and then background script will forward them to a single iframe that hosts a WASMTranslationHelper. And it works! There are some opportunities to use makeServer and makeClient in other places as well I think, because this is about the 5th time I've implemented that functionality…
@jelmervdl
Copy link
Owner Author

The general problem was that it was impossible to load the WASMTranslationWorker inside the background-script context. This is now solved by loading it in the tab, in an iframe in the top-most frame. Similar to how the original firefox-translations addon does it. Translation requests from all frames in a tab are then proxied through the background-script to that one iframe.

Downside is that we now have 1 translator loaded per tab instead of one shared among all tabs, and that it does not survive page navigation. Performance is therefore worse than the manifest-v2 branches of this add-on. But it is similar to the Mozilla version of this add-on. So probably it is good enough…

# Conflicts:
#	extension/controller/translation/WASMTranslationHelper.js
#	extension/controller/translation/WASMTranslationWorker.js
@jelmervdl
Copy link
Owner Author

https://bugzilla.mozilla.org/show_bug.cgi?id=1687778 would be helpful, although I can probably shim it reasonably easy since in Firefox effectively the worker stays in memory, so just a local variable can do this work as long as I'm not trying to sync it between the popup and the background-script. (content-script should have no access to begin with according to the spec?)

@jelmervdl
Copy link
Owner Author

@jelmervdl
Copy link
Owner Author

I don't know what Google is doing but V3 is still a hot mess. It feels a lot like how Twitter killed their ecosystem when they turned off their API.

@jelmervdl
Copy link
Owner Author

Superseded by #73

@jelmervdl jelmervdl closed this Jul 19, 2023
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.

Google Chrome
1 participant