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

feat: support registering MV3 extension service workers #27562

Merged
merged 6 commits into from
Feb 11, 2021

Conversation

samuelmaddock
Copy link
Member

@samuelmaddock samuelmaddock commented Jan 31, 2021

Description of Change

Manifest V3 (MV3) has become generally available in M88 Beta.

This adds the bare minimum in order to run MV3's new service workers meant to replace MV2's background processes.

A new registration-completed event is added to Session.serviceWorkers for testing whether extension service workers register properly.

cc @electron/wg-api

Checklist

Release Notes

Notes:

  • Added support for registering Manifest V3 extension service workers.
  • Added 'registration-completed' event to ServiceWorkers.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jan 31, 2021
schemes->secure_schemes.push_back(extensions::kExtensionScheme);
schemes->service_worker_schemes.push_back(extensions::kExtensionScheme);
schemes->cors_enabled_schemes.push_back(extensions::kExtensionScheme);
schemes->csp_bypassing_schemes.push_back(extensions::kExtensionScheme);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these schemes are added in ChromeContentClient::AddAdditionalSchemes

@@ -118,9 +118,6 @@ RendererClientBase::RendererClientBase() {
ParseSchemesCLISwitch(command_line, switches::kSecureSchemes);
for (const std::string& scheme : secure_schemes_list)
url::AddSecureScheme(scheme.data());
// In Chrome we should set extension's origins to match the pages they can
// work on, but in Electron currently we just let extensions do anything.
url::AddSecureScheme(extensions::kExtensionScheme);
// We rely on the unique process host id which is notified to the
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was able to be removed as it's now included in the --secure-schemes=scheme1,scheme2 switch.

docs/api/service-workers.md Outdated Show resolved Hide resolved
shell/browser/api/electron_api_service_worker_context.cc Outdated Show resolved Hide resolved
spec-main/extensions-spec.ts Outdated Show resolved Hide resolved
@zcbenz zcbenz added the semver/minor backwards-compatible functionality label Feb 3, 2021
@jkleinsc jkleinsc added semver/minor backwards-compatible functionality and removed semver/minor backwards-compatible functionality new-pr 🌱 PR opened in the last 24 hours labels Feb 4, 2021
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Feb 4, 2021
Copy link
Contributor

@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM.

@electron-cation electron-cation bot added api-review/requested 🗳 and removed new-pr 🌱 PR opened in the last 24 hours labels Feb 8, 2021
Copy link
Member

@nornagon nornagon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM

@jkleinsc
Copy link
Contributor

Merging as CI failure is known flake

@jkleinsc jkleinsc merged commit 3250ef5 into electron:master Feb 11, 2021
@release-clerk
Copy link

release-clerk bot commented Feb 11, 2021

Release Notes Persisted

  • Added support for registering Manifest V3 extension service workers.
  • Added 'registration-completed' event to ServiceWorkers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review/requested 🗳 semver/minor backwards-compatible functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants