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

Move initialization of offscreen proxy elements #668

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

toasted-nutbread
Copy link
Collaborator

@toasted-nutbread toasted-nutbread commented Feb 11, 2024

This change is intending to move all of the proxy stuff out of Backend directly and makes the main function in charge of initialization. There are a few reasons behind this:

  • I general, I think it's just better dependency management so Backend can remain agnostic to the details of whether or not something if a proxy.
  • Backend really doesn't need to have knowledge of the Offscreen class itself, since all it does is prepare it, and the prepare can be handled externally.
  • Additionally, the prepare function of Offscreen hooks chrome.runtime.onMessage, which should really be performed as soon as possible. This was referencing the wrong class.

Historically, there is some weirdness involving how the chrome events used to be hooked on the service worker after the transition from removing the background page in MV3. At least one of these events needs to be hooked without being deferred, otherwise the service worker can terminate immediately and never wake back up. I'm trying to think about how to better address this as well, since I have run into some issues that are not easy to solve due to the way the API hooking is deferred. Notably, the issue of the entire API not being able to be used until the service worker has been fully started, which can apparently take a non-trivial amount of time when large dictionaries have been installed.

Draft for now as I work some stuff out.

@toasted-nutbread toasted-nutbread requested a review from a team as a code owner February 11, 2024 02:50
@toasted-nutbread toasted-nutbread marked this pull request as draft February 11, 2024 03:00
Copy link

⚠️ Visual differences introduced by this PR; please validate if they are desirable.

View Playwright Report (note: open the "playwright-report" artifact)

@cashewnuttynuts cashewnuttynuts added the kind/meta The issue or PR is meta label Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/meta The issue or PR is meta
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants