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 chrome.scripting extension APIs #39395

Merged
merged 1 commit into from Aug 28, 2023
Merged

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented Aug 7, 2023

Description of Change

Closes #37876.

This PR adds support for chrome.scripting.

From reference docs:

chrome.scripting allows API to inject JavaScript and CSS into websites. This is similar to what you can do with content scripts. But by using the chrome.scripting namespace, extensions can make decisions at runtime.

This represents an important step towards proper support of Manifest V3. Specifically - chrome.scripting supersedes chrome.tabs.executeScript, which is gone in Manifest V3. It's commonly used in several DevTools extensions, including React DevTools.

The source code added here is essentially unchanged from upstream - we need to add it to our api definitions because it lives upstream in chrome/browser/extensions/api, which we do not depend on (and shouldn't, since many of the api implementations therein involve concepts not transferable to Electron without significant modification).

Checklist

Release Notes

Notes: Added support for chrome.scripting extension APIs.

@codebytere codebytere added the semver/minor backwards-compatible functionality label Aug 7, 2023
@electron-cation electron-cation bot added api-review/requested 🗳 new-pr 🌱 PR opened in the last 24 hours labels Aug 7, 2023
@codebytere codebytere force-pushed the chrome-scripting branch 2 times, most recently from ad0243c to 762d1ce Compare August 7, 2023 19:35
@codebytere codebytere force-pushed the chrome-scripting branch 3 times, most recently from 385065d to f3577e1 Compare August 7, 2023 21:02
@codebytere codebytere marked this pull request as ready for review August 7, 2023 21:02
@codebytere codebytere added target/25-x-y PR should also be added to the "25-x-y" branch. target/26-x-y PR should also be added to the "26-x-y" branch. labels Aug 8, 2023
@codebytere codebytere requested a review from a team as a code owner August 8, 2023 18:52
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Aug 14, 2023
@github-actions github-actions bot added the target/27-x-y PR should also be added to the "27-x-y" branch. label Aug 16, 2023
@codebytere codebytere requested a review from a team August 23, 2023 20:16
Copy link
Member

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

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

@jkleinsc jkleinsc merged commit f0ad357 into main Aug 28, 2023
19 checks passed
@jkleinsc jkleinsc deleted the chrome-scripting branch August 28, 2023 14:39
@release-clerk
Copy link

release-clerk bot commented Aug 28, 2023

Release Notes Persisted

Added support for chrome.scripting extension APIs.

@trop
Copy link
Contributor

trop bot commented Aug 28, 2023

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

@trop trop bot added in-flight/27-x-y and removed target/27-x-y PR should also be added to the "27-x-y" branch. labels Aug 28, 2023
@trop
Copy link
Contributor

trop bot commented Aug 28, 2023

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

@trop
Copy link
Contributor

trop bot commented Aug 28, 2023

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

@trop trop bot added in-flight/26-x-y in-flight/25-x-y and removed target/26-x-y PR should also be added to the "26-x-y" branch. target/25-x-y PR should also be added to the "25-x-y" branch. labels Aug 28, 2023
@trop trop bot added merged/27-x-y PR was merged to the "27-x-y" branch. and removed in-flight/27-x-y labels Aug 31, 2023
@trop trop bot added merged/26-x-y PR was merged to the "26-x-y" branch. merged/25-x-y PR was merged to the "25-x-y" branch. and removed in-flight/26-x-y in-flight/25-x-y labels Sep 28, 2023
@jasonfill
Copy link

@codebytere Is there a list of what V3 APIs are currently supported? I have looked around but have yet to be able to locate it.

@codebytere
Copy link
Member Author

@jasonfill i've tried to tune up this doc to reflect current support - what would help that doc be more effective for you?

MrHuangJser pushed a commit to MrHuangJser/electron that referenced this pull request Dec 11, 2023
feat: support chrome.scripting extension  APIs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review/approved ✅ merged/25-x-y PR was merged to the "25-x-y" branch. merged/26-x-y PR was merged to the "26-x-y" branch. merged/27-x-y PR was merged to the "27-x-y" branch. semver/minor backwards-compatible functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: chrome.scripting API not implemented for extensions using Manifest V3
4 participants