Open Bug 1359525 Opened 8 years ago Updated 3 years ago

support content scripts for web-loaded sidebar

Categories

(WebExtensions :: Frontend, enhancement, P5)

54 Branch
enhancement

Tracking

(Not tracked)

REOPENED

People

(Reporter: john.turtle, Unassigned)

References

Details

(Whiteboard: [sidebar][triaged])

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:54.0) Gecko/20100101 Firefox/54.0 Build ID: 20170420011827 Steps to reproduce: 1. Create a WebExtension that sets the sidebar panel from a web URL. 2. Use a content script to call runtime.connect(), in order to send messages to/from the background script. Actual results: Messages from background-to-sidebar script are *not* received, and no error is detected. (Side note: messages from the sidebar-to-background script do work.) Expected results: In the attached example, the sidebar textbox labeled "Received from background" should have been updated each time the background script calls postMessage(). The attached tar file has an example WebExtension that shows the problem, and includes a README file and a couple screen shots.
Component: Untriaged → WebExtensions: Untriaged
Product: Firefox → Toolkit
This is intentional and expected.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
Kris thought you were trying to use APIs in the web content. reopening. Given that the schema defines strictRelativeUrl for the panel in the manifest, I'm inclined to feel that should also be reflected in the param for setPanel, and that allowing a remote url there was an oversight.
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: INVALID → ---
Priority: -- → P3
Whiteboard: [sidebar][triaged]
Currently content scripts are not supported outside of tabs and that is a chunk of work (basically dont do this). We'll might lock down the sidebar schema a bit more to make it hard to load web urls though there would still be ways to work around that.
Sorry to heat that, since it significantly reduces the likelihood that I will port my extension from XUL. I would recommend updating the online docs for content scripts and sidebars to explicitly state that content scripts are not supported in sidebar pages. * https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts * https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Sidebars Thanks for looking into this.
I need content scripts in sidebars as well. Usecase is that any iframes loaded in the sidebar need their links retargeted to _content otherwise they open up in the sidebar. This prevents porting one of my extensions as well.
(In reply to Mike Kaply [:mkaply] from comment #6) > I need content scripts in sidebars as well. Usecase is that any iframes > loaded in the sidebar need their links retargeted to _content otherwise they > open up in the sidebar. That should already work since the (extension) sidebar is marked as an apptab. Also, the intention is to remove the web-only sidebar panel. bug 1452645
Severity: normal → enhancement
Component: WebExtensions: Untriaged → WebExtensions: Frontend
Priority: P3 → P5
Summary: WebExtensions messaging error with web-loaded sidebar → support content scripts for web-loaded sidebar
Product: Toolkit → WebExtensions
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: