Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Change background.js to service-worker.js for MV3 #4785

Closed
4 tasks
jpmedley opened this issue Jan 5, 2023 · 2 comments
Closed
4 tasks

Change background.js to service-worker.js for MV3 #4785

jpmedley opened this issue Jan 5, 2023 · 2 comments
Labels
extensions Issues related to extensions documentation. P0 An urgent priority task. Drop everything and work on this!

Comments

@jpmedley
Copy link
Contributor

jpmedley commented Jan 5, 2023

In MV3, an 'extension service worker' replaces 'background scripts' from MV2. Both are currently referred to as 'background scripts. As a consequence, developers (specifically those on StackOverflow) can be discussing different things and not realize it because both are called 'background scripts'.

To provide clarity, the strings 'background.js' and 'background script' will be replaced with 'service-worker.js' and 'extension service worker' respectively.

This has these subtasks:

  • Replace 'background.js' with 'service-worker.js' in all MV3 documents.
  • Replace 'background script' with 'extension service worker' or 'service worker' as appropriate in all MV3 documents.
  • Do both of previous to generated portion of API documents. (@jpmedley )
  • Make similar changes in MV2 document wherever appropriate.

Old

  "name": "Awesome Test Extension",
  ...
  "background": {
    "service_worker": "background.js"
  },
  ...
}

New

  "name": "Awesome Test Extension",
  ...
  "background": {
    "service_worker": "service-worker.js"
  },
  ...
}
@jpmedley jpmedley added P0 An urgent priority task. Drop everything and work on this! extensions Issues related to extensions documentation. labels Jan 5, 2023
@jpmedley jpmedley assigned rachelandrew and unassigned rachelandrew Jan 5, 2023
@tophf
Copy link

tophf commented Jan 23, 2023

I'm not sure putting emphasis on the "service worker" is a good idea because the distinctive qualities of this technology are not used by 99.999% of extensions, i.e. caching the remote content and serving it via the onfetch event. ManifestV3 extensions use the service worker in the same way they've been always using the non-perisistent background script. ManifestV4 or 5 may switch to a better technology because SW is not really suitable for extensions due to a number of restrictions on various API that make sense for a web page back-end but not for an extension.

@dstmarthe
Copy link
Collaborator

Moving this to the new issue tracker. See it at: https://issuetracker.google.com/issues/324141337

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
extensions Issues related to extensions documentation. P0 An urgent priority task. Drop everything and work on this!
Projects
None yet
Development

No branches or pull requests

4 participants