Skip to content

feat: make Chrome extensions work on custom protocols#49951

Merged
jkleinsc merged 1 commit into
mainfrom
nikwen/extensions-custom-protocols
Mar 27, 2026
Merged

feat: make Chrome extensions work on custom protocols#49951
jkleinsc merged 1 commit into
mainfrom
nikwen/extensions-custom-protocols

Conversation

@nikwen
Copy link
Copy Markdown
Member

@nikwen nikwen commented Feb 25, 2026

Description of Change

Fixes #26812

Adds an allowExtensions privilege to protocol.registerSchemesAsPrivileged() to enable Chrome extensions on custom protocols.

Implementation details:

  • electron_api_web_request.cc also uses URLPattern. I have spent a lot of time on verifying that those usages still work as expected. I've also added tests to ensure they will continue to work going forward.
  • The part of the patches that can be upstreamed has been upstreamed in https://crrev.com/c/7639311. The rest cannot be upstreamed, unfortunately. For the details, see the description of the Chromium patch file.

Checklist

Release Notes

Notes: Added allowExtensions privilege to protocol.registerSchemesAsPrivileged() to enable Chrome extensions on custom protocols.

@nikwen nikwen added semver/minor backwards-compatible functionality wip ⚒ labels Feb 25, 2026
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Feb 25, 2026
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Mar 4, 2026
@nikwen nikwen force-pushed the nikwen/extensions-custom-protocols branch from 346d31f to cbd6983 Compare March 5, 2026 20:57
- if (scheme == kValidSchemes[i] && (valid_schemes_ & kValidSchemeMasks[i])) {
- return true;
+ if (scheme == kValidSchemes[i]) {
+ return valid_schemes_ & kValidSchemeMasks[i];
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

These lines have been upstreamed in https://crrev.com/c/7639311.

@nikwen nikwen added target/40-x-y PR should also be added to the "40-x-y" branch. target/41-x-y PR should also be added to the "41-x-y" branch. and removed wip ⚒ labels Mar 5, 2026
@nikwen nikwen marked this pull request as ready for review March 5, 2026 21:20
@nikwen nikwen requested a review from a team as a code owner March 5, 2026 21:20
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Mar 5, 2026
@nikwen nikwen force-pushed the nikwen/extensions-custom-protocols branch from cbd6983 to 3741b3b Compare March 11, 2026 12:41
Comment thread docs/api/app.md Outdated
Copy link
Copy Markdown
Member

@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.

The documentation needs to be updated to reflect this item:
"Once enabled, the feature cannot be disabled again until the app is restarted (due to how Chromium's code is written)."

I'm surprised there isn't a way to make this dynamic, though I suppose most people would either want it on or off.

@nikwen
Copy link
Copy Markdown
Member Author

nikwen commented Mar 11, 2026

@jkleinsc Thanks for the review! Documentation line added.

@nikwen nikwen requested a review from jkleinsc March 11, 2026 21:13
Comment thread shell/renderer/renderer_client_base.cc Outdated
@nikwen nikwen requested a review from jkleinsc March 12, 2026 14:45
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Mar 12, 2026
@github-actions github-actions Bot added the target/42-x-y PR should also be added to the "42-x-y" branch. label Mar 13, 2026
Comment thread spec/fixtures/extensions/custom-protocol-panel/main.js Outdated
Comment thread docs/api/app.md Outdated
Comment thread patches/chromium/feat_allow_enabling_extensions_on_all_protocols.patch Outdated
Comment thread patches/chromium/feat_allow_enabling_extensions_on_all_protocols.patch Outdated
@nikwen nikwen force-pushed the nikwen/extensions-custom-protocols branch from 8ce4a25 to 1c2c562 Compare March 21, 2026 18:52
@nikwen nikwen requested a review from reitowo March 21, 2026 19:13
@jkleinsc jkleinsc merged commit 4eff8f2 into main Mar 27, 2026
116 of 117 checks passed
@jkleinsc jkleinsc deleted the nikwen/extensions-custom-protocols branch March 27, 2026 00:00
@release-clerk
Copy link
Copy Markdown

release-clerk Bot commented Mar 27, 2026

Release Notes Persisted

Added allowExtensions privilege to protocol.registerSchemesAsPrivileged() to enable Chrome extensions on custom protocols.

@trop
Copy link
Copy Markdown
Contributor

trop Bot commented Mar 27, 2026

I was unable to backport this PR to "40-x-y" cleanly;
you will need to perform this backport manually.

@trop trop Bot added needs-manual-bp/40-x-y and removed target/40-x-y PR should also be added to the "40-x-y" branch. labels Mar 27, 2026
@trop
Copy link
Copy Markdown
Contributor

trop Bot commented Mar 27, 2026

I have automatically backported this PR to "41-x-y", please check out #50529

@trop trop Bot added in-flight/41-x-y and removed target/41-x-y PR should also be added to the "41-x-y" branch. labels Mar 27, 2026
@trop
Copy link
Copy Markdown
Contributor

trop Bot commented Mar 27, 2026

I have automatically backported this PR to "42-x-y", please check out #50530

@trop trop Bot added in-flight/42-x-y and removed target/42-x-y PR should also be added to the "42-x-y" branch. labels Mar 27, 2026
@tmm1
Copy link
Copy Markdown
Contributor

tmm1 commented Mar 27, 2026

🎉

@Nantris
Copy link
Copy Markdown
Contributor

Nantris commented Mar 27, 2026

Sorry to be comment spam but a simple thumbs up does not adequately convey my appreciation for this PR. Thank you to all involved!

@nikwen
Copy link
Copy Markdown
Member Author

nikwen commented Mar 27, 2026

my appreciation for this PR. Thank you to all involved!

Thanks! Appreciate the kind words. :)

@trop
Copy link
Copy Markdown
Contributor

trop Bot commented Mar 30, 2026

@nikwen has manually backported this PR to "40-x-y", please check out #50588

@trop trop Bot added in-flight/40-x-y merged/41-x-y PR was merged to the "41-x-y" branch. merged/42-x-y PR was merged to the "42-x-y" branch. merged/40-x-y PR was merged to the "40-x-y" branch. and removed needs-manual-bp/40-x-y in-flight/41-x-y in-flight/42-x-y in-flight/40-x-y labels Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-review/approved ✅ merged/40-x-y PR was merged to the "40-x-y" branch. merged/41-x-y PR was merged to the "41-x-y" branch. merged/42-x-y PR was merged to the "42-x-y" branch. semver/minor backwards-compatible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Extensions in custom protocols

8 participants