Support loading background scripts as ES6 modules
Categories
(WebExtensions :: General, enhancement)
Tracking
(Not tracked)
People
(Reporter: crownofdesign, Unassigned)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [dev-ux])
Attachments
(1 file)
8.38 KB,
application/zip
|
Details |
Updated•7 years ago
|
Updated•7 years ago
|
Comment 3•7 years ago
|
||
Comment 4•7 years ago
|
||
Comment 5•7 years ago
|
||
Comment 6•7 years ago
|
||
Comment 7•7 years ago
|
||
Comment 8•7 years ago
|
||
Updated•7 years ago
|
Comment 10•7 years ago
|
||
Comment 11•7 years ago
|
||
Comment 12•7 years ago
|
||
Updated•7 years ago
|
Updated•7 years ago
|
Updated•6 years ago
|
Comment 13•6 years ago
|
||
Comment 14•6 years ago
|
||
Updated•6 years ago
|
Comment 15•5 years ago
|
||
I'm trying to use this:
<!DOCTYPE html>
<html><head><meta charset='UTF-8' /><script type='module' src='background.js'></script></head></html>
...
"background": { "page": "background.html" }
...
to share a function between a background
script and a page_action
. The extension debugger crashes when I open the page_action
.
Do we just have to replicate code for now, or is there a way this works that I don't know? Thanks.
Comment 16•5 years ago
|
||
So that's why MY debugger froze but it worked for others! Some other user complained about it here:
https://discourse.mozilla.org/t/how-is-everyone-debugging-webextension-popups-in-firefox-68/41095
You can still share modules between different contexts, just don't try to debug it (if you need to debug, open popup.html
in a tab).
Also someone should create an issues for that if it wasn't reported yet.
Comment 17•5 years ago
|
||
Thanks.
I'm on FF 67 on Linux. I have two small extensions that use page_action
and I've never had a problem debugging, inspector and everything. I just tried to move one function to a module, added one call in the page_action
script and one in background.js
. When I reload that version of the extension, the page_action
does not work. Obviously debugging fails. Inlining that function makes everything work again. Using the module in page_action
and inlining the function in background.js
also works; with full debugging. Seems like a case you should know about, given that the documentation recommends this.
Comment 18•5 years ago
|
||
If we decide to deprecate background pages in favor of service workers, implementing this doesn't make much sense, so marking as depending on bug 1578286.
Comment 19•5 years ago
|
||
The extensions should already be able to use JS modules in the background page without any additional changes by using the background.page
manifest properties instead of using the "background.scripts" one (on the contrary there is currently no way to use JS modules for the content scripts, which is tracked by Bug 1451545).
Given that the extension can already achieve this, and that the background page may be replaced by a service worker in the future, I'm closing this as wontfix for now.
Comment 20•5 years ago
|
||
So bug 1451545 is already on the roadmap? Status new doesn’t imply that there’s any decision yet.
Comment 21•2 years ago
|
||
For service worker-based extensions, module background scripts are tracked at bug 1775574.
Comment 22•11 months ago
|
||
type: "module"
enables support for ES6 modules in background.scripts -> bug 1811443.
Description
•