Closed Bug 1405723 Opened 7 years ago Closed 6 years ago

Cannot access elements within iframe via context menu

Categories

(WebExtensions :: General, enhancement, P5)

enhancement

Tracking

(firefox57 wontfix)

RESOLVED INVALID
Tracking Status
firefox57 --- wontfix

People

(Reporter: kohei, Unassigned)

Details

While working on porting Nightly Tester Tools to a WebExtension [1], I've noticed that it's ability to paste a UA info or extension list into a textbox doesn't work with a `<textarea>`, `<input>` or any other `contenteditable` elements within an `<iframe>`.

The content script is [2] and some discussion can be found at [3]. In this case, `document` will always be the topmost document, and `document.activeElement` will be an `<iframe>` on the page rather than a textbox inside it. Test cases can be found at [4][5][6].

[1] https://addons.mozilla.org/en-US/firefox/addon/nightly-tester-tools/versions/beta
[2] https://github.com/mozilla/nightlytt/blob/master/extension/content.js
[3] https://github.com/mozilla/nightlytt/pull/253
[4] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Live_example
[5] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#Example
[6] https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Editable_content
Severity: normal → enhancement
Priority: -- → P5
Whiteboard: [design-decision-needed]
Hi Kohei, this has been added to the agenda for the WebExtensions APIs triage meeting on March 6, 2018. Would you be able to join us? 

Here’s a quick overview of what to expect at the triage: 

* We normally spend 5 minutes per bug
* The more information in the bug, the better
* The goal of the triage is to give a general thumbs up or thumbs down on a proposal; we won't be going deep into implementation details

Relevant Links: 

* Wiki for the meeting: https://wiki.mozilla.org/WebExtensions/Triage#Next_Meeting
* Meeting agenda: https://docs.google.com/document/d/1n-Cbk3d6j394mObWPMhQsfIyHIL08RhC_IEV2QBV1x8/edit#
* Vision doc for WebExtensions: https://wiki.mozilla.org/WebExtensions/Vision
You need to inject your content script into the correct frame, rather than the top-level frame. You can check the frameId property of the event data to determine which frame the context menu was opened in.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID
Whiteboard: [design-decision-needed]
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.