Closed
Bug 1351741
Opened 8 years ago
Closed 8 years ago
Add a simple API to open a file dialog without needing to go through content scripts.
Categories
(WebExtensions :: General, enhancement)
WebExtensions
General
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: wisniewskit, Unassigned)
References
Details
Attachments
(1 file)
5.09 KB,
patch
|
Details | Diff | Splinter Review |
Consider an extension which wishes to bring up a file picker dialog from the background script (for instance when the user presses a hotkey command).
Right now, the only way (in theory) would be to inject a <input type=file> into the active tab's DOM, trigger a click event on it, then transfer any resulting file objects back to the background script. Unfortunately that isn't always possible to do.
There is not always a content-script available to work with (about: pages, especially about:newtab). Addons would therefore need to open a new tab to be sure they can have a file input to work with. Unfortunately, popups are blocked in addon pages, and that includes the popup triggered when one calls .click on a file input.
Whether or not such popups could be allowed, this all strikes me as needlessly convoluted. The background script should be able to avoid the need for content scripts, opening tabs or messing with the DOM of existing ones, and having to sendMessage a file object (or multiple file objects).
I've attached a quick proof-of-concept patch which just adds a browser.windows.openDialog method. I'm using it for an internal project of mine, and don't mind helping it across the finish line if this proposal is deemed desirable.
Comment 1•8 years ago
|
||
You don't need to go through a content script, but you do need to have some UI page visible. It can be a tab page, for example. It can't currently be a popup due to bug 1292701.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
Reporter | ||
Comment 2•8 years ago
|
||
I'm not sure what you mean, could you elaborate? Say the user is looking at about:newtab or about:debugging, and trigger an onCommand via hotkey. How would I open a file dialog in that case?
Flags: needinfo?(kmaglione+bmo)
Updated•7 years ago
|
Product: Toolkit → WebExtensions
Updated•6 years ago
|
Flags: needinfo?(kmaglione+bmo)
You need to log in
before you can comment on or make changes to this bug.
Description
•