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

Expose chrome.runtime.inIncognitoContext #611

Open
tophf opened this issue May 11, 2024 · 1 comment
Open

Expose chrome.runtime.inIncognitoContext #611

tophf opened this issue May 11, 2024 · 1 comment
Labels
supportive: chrome Supportive from Chrome supportive: firefox Supportive from Firefox supportive: safari Supportive from Safari

Comments

@tophf
Copy link

tophf commented May 11, 2024

Supersedes #605 with a different solution and an explanation why workarounds are problematic.

Goal: expose chrome.runtime.inIncognitoContext in all contexts.

Optional goal: deprecate chrome.extension.inIncognitoContext

  • We'll fix the false implication that the [entire] extension is in the incognito context - compare it to the other methods in the extension namespace that apply to the entire extension conceptually e.g. isAllowedIncognitoAccess, isAllowedFileSchemeAccess, getBackgroundPage, getViews.
  • We'll continue the established trend: lastError, getURL, sendRequest/sendMessage, onRequest/onMessage

Immediately beneficial use case: userscripts of extensions in the default spanning incognito mode.

The problem doesn't concern the split mode extensions which can embed the value in the code of the userscripts registered just for the incognito mode.

The workaround for a userscript is problematic as it requires an additional "isolated world":

  • it consumes a lot of memory (more than 40kB) and time to initialize the entire JS world compared to this simple boolean value, which translates into multiple megabytes and seconds for users who have a lot of tabs and consequently frames;
  • it's not necessary for other functions of the userscript extensions e.g. Violentmonkey only uses messaging to handle everything in the background script including storage access and its propagation to other tabs, because the built-in chrome.storage is too slow in Chrome and inflexible everywhere as there's no way to register the onChanged listener for specified keys, but even if there was an extension may prefer IndexedDB for its richer API;
  • it cannot be created synchronously on demand, so extensions can't use a lazy getter;
  • it cannot be destroyed to reclaim the memory.
@github-actions github-actions bot added needs-triage: chrome Chrome needs to assess this issue for the first time needs-triage: firefox Firefox needs to assess this issue for the first time needs-triage: safari Safari needs to assess this issue for the first time labels May 11, 2024
@xeenon xeenon added supportive: safari Supportive from Safari and removed needs-triage: safari Safari needs to assess this issue for the first time labels May 23, 2024
@Rob--W Rob--W added supportive: firefox Supportive from Firefox follow-up: chrome Needs a response from a Chrome representative and removed needs-triage: firefox Firefox needs to assess this issue for the first time labels May 23, 2024
@oliverdunk
Copy link
Member

I spoke to @rdcronin about this. We are supportive of adding this property to chrome.runtime and exposing it to user scripts. As mentioned in the original post, the property on chrome.extension would be deprecated but remain around for backwards compatibility.

We both agreed this probably doesn't need to be configurable using userScripts.configureWorld. Let us know if you feel otherwise though, @tophf.

@oliverdunk oliverdunk added supportive: chrome Supportive from Chrome and removed follow-up: chrome Needs a response from a Chrome representative needs-triage: chrome Chrome needs to assess this issue for the first time labels Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
supportive: chrome Supportive from Chrome supportive: firefox Supportive from Firefox supportive: safari Supportive from Safari
Projects
None yet
Development

No branches or pull requests

4 participants