-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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: session.setExtensionAPIHandlers for handling chrome.tabs.get and default tab requests #27917
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Re: I also converted the callbacks to be direct values, instead of |
Thanks! |
@sentialx @samuelmaddock how are we feeling about merging this? I know it's been a while! |
I think everything was done here, so I guess it's okay to merge. |
"description": "The tab's loading status." | ||
}, | ||
{ | ||
"id": "MutedInfoReason", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before we merge this, I'd like to sync parts of this file from upstream to ensure the schema is up to date.
API LGTM |
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
Marking as |
converted to draft to reflect WIP status. |
Description of Change
This PR adds an API
session.setExtensionAPIHandlers
so that users can specify the behavior of thechrome.tabs.get
API and the default tab behavior (for example when an extension callschrome.tabs.getZoom
withouttabId
it fallbacks to the active tab). The same handlers are being used forPort.sender.Tab
and also forElectronExtensionsBrowserClient::GetTabAndWindowIdForWebContents
which is responsible forchrome.webRequest
request detailstabId
property). Also adds support forchrome.tabs.insertCSS
andremoveCSS
This PR does not introduce any breaking changes to the API. If the handlers are not registered,
chrome.tabs.get
will fallback to the previous behavior and warn the user.For example:
cc @nornagon @samuelmaddock
Could this be backported to 11-x-y and 12-x-y?
Checklist
npm test
passesRelease Notes
Notes:
session.setExtensionAPIHandlers
so that users can specify the behavior forchrome.tabs.get
and the default tab.Port.sender.tab
.chrome.tabs.insertCSS
andchrome.tabs.removeCSS
.chrome.webRequest
would not specify thetabId
property in the request details.webContents.getExtensionTabDetails
to get the Chrome APITab
representation ofwebContents
.