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

Undetectable widgets, to avoid conflicts (modals, tooltips, notifications, …) #656

Closed
fregante opened this issue Jul 10, 2024 · 3 comments
Labels
status: duplicate Duplicate issue

Comments

@fregante
Copy link

Some extensions inject widgets and other hidden DOM content that is at risk of being inadvertently removed by the host website. Some examples:

  • overlays (modals, tooltips, notifications, anything that doesn't change the layout)
  • iframes (used for sandboxing or by APIs clients (e.h. gapi))
  • <style> created by the content script

I think we'd benefit from a way to inject content without risking (style) conflicts, removal by the host, race conditions, etc.

Proposal

Offer a shadow/child/detached/isolated document context that extensions can interact with without being detected. This document would be visually overlaid on the page, if any elements are visible, without causing any layout shifts.

const modal = document.createElement('dialog');
modal.append(document.createElement('iframe'))
browser.dom.attach(modal, {style: 'isolated'});
modal.showModal();

const style = document.createElement('style');
ReactDom.render(<CssVariablesUpdatedViaIframeWidgetOrSomething/>, style);
browser.dom.attach(style);

I haven't put much thought into the actual API that would enable this, as it would probably have to follow the browser limits/implementation.

Prior art

  • content script styles appear as "injected stylesheet" in Chrome but are not actually attached to the document. They might now be surfaced in this document.
  • content scripts have a dedicated execution world, which the host cannot access

Other more specific requests

@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 Jul 10, 2024
@xeenon
Copy link
Collaborator

xeenon commented Jul 17, 2024

Similar to #235.

@Rob--W
Copy link
Member

Rob--W commented Jul 18, 2024

Closing as duplicate of #235. The generic feature request has come up many times before, but there won't be any progress until there is a specific API proposal that can feasibly be implemented by browsers. See the meeting notes of today's meeting (pending review in #660) for more words on this.

@Rob--W Rob--W closed this as completed Jul 18, 2024
@Rob--W Rob--W added status: duplicate Duplicate issue and removed needs-triage: chrome Chrome needs to assess this issue for the first time needs-triage: safari Safari needs to assess this issue for the first time needs-triage: firefox Firefox needs to assess this issue for the first time labels Jul 18, 2024
@fregante
Copy link
Author

Thank you

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

No branches or pull requests

3 participants