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

[electron-chrome-extensions] event for chrome.tabs.update #79

Open
Kilian opened this issue Jan 20, 2023 · 2 comments
Open

[electron-chrome-extensions] event for chrome.tabs.update #79

Kilian opened this issue Jan 20, 2023 · 2 comments

Comments

@Kilian
Copy link
Contributor

Kilian commented Jan 20, 2023

One of my extensions calles chrome.tabs.update with a new URL like so:

const openInSuperposition = url => chrome.tabs.update({ url: `superposition://${url}` });

I'd like to be able to hook into that call and decide how to update or handle that URL change. Is that possible?

@Kilian
Copy link
Contributor Author

Kilian commented Mar 24, 2023

Looking into this, it seems that because I dont provide a tabId, the current implementation picks the webcontents of the sender as the active tab but if that's not added to the extension manager (in my case, the main UI) then getting the tabid returns undefined and the chrome.tabs.update function is aborted:

https://github.com/samuelmaddock/electron-browser-shell/blob/master/packages/electron-chrome-extensions/src/browser/api/tabs.ts#L257

Is there a way to fall back to whatever webContents was last selected with selectExtensionTab?

samuelmaddock added a commit that referenced this issue Jun 3, 2023
@samuelmaddock
Copy link
Owner

I had a bug in the code which was trying to get the active tab from the window of the MV2 background page. I updated the code to get the active tab from the last focused window instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants