Closed Bug 1330657 Opened 7 years ago Closed 7 years ago

Enable <script type="module"> for content behind a pref


(Core :: DOM: Core & HTML, defect)

Not set



Tracking Status
firefox54 --- fixed


(Reporter: evilpie, Assigned: jonco)


(Blocks 1 open bug)


(Keywords: dev-doc-complete, DevAdvocacy)


(1 file)

We should let people experiment with modules. Hopefully we can actually ship milestone 0 soon. If CORS is the last thing blocking that I would suggest shipping with CORS first. Oh and look at what Safari and possibly Chrome are implementing.
Worth sending an "intent to experiment" or something, possibly.

I'm not seeing an obvious bug on the CORS thing in the dep tree of bug 568953.  Is that filed?
Keywords: DevAdvocacy
Component: JavaScript Engine → DOM: Core & HTML
The current plan is to enable this behind a pref.  This will allow easier testing with web platform tests too.
Assignee: nobody → jcoppeard
Summary: Enable <script type="module"> for content on Nightly → Enable <script type="module"> for content behind a pref
Blocks: 1330682
Blocks: 1337780
I sent an "Intent to implement" to dev.platform a few weeks ago:!topic/
Patch to enable modules with dom.moduleScripts.enabled pref.
Attachment #8834912 - Flags: review?(bkelly)
Comment on attachment 8834912 [details] [diff] [review]

Review of attachment 8834912 [details] [diff] [review]:

::: dom/base/nsScriptLoader.cpp
@@ +658,5 @@
>  bool
> +nsScriptLoader::ModuleScriptsEnabled()
> +{
> +  return nsContentUtils::IsChromeDoc(mDocument) ||
> +         mozilla::Preferences::GetBool("dom.moduleScripts.enabled", false);

Do you want to use Preferences::AddBoolVarCache() instead since it looks like this gets consulted on every script load?  I'm not sure how slow GetBool() itself is.
Attachment #8834912 - Flags: review?(bkelly) → review+
GetBool is mostly a hashtable lookup and a bunch of method calls.  But yes, using a bool var cache here would be much better.
Also, no need for that "mozilla::" noise in this file.
Great, I'll use that then.
Pushed by
Enable <script type="module"> behind a pref r=bkelly
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
I've added a note about this to our Experimental features page:

I've removed the mention that had been added to the Fx54 release notes, as it is not usually our policy to mention features there until they are enabled by default, afaiu.

Let me know if that looks OK.
You need to log in before you can comment on or make changes to this bug.