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

RESOLVED FIXED in Firefox 54

Status

()

Core
DOM: Core & HTML
RESOLVED FIXED
3 months ago
22 days ago

People

(Reporter: evilpie, Assigned: jonco)

Tracking

(Blocks: 2 bugs, {dev-doc-complete, DevAdvocacy})

unspecified
mozilla54
dev-doc-complete, DevAdvocacy
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox54 fixed)

Details

Attachments

(1 attachment)

(Reporter)

Description

3 months ago
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.
Keywords: dev-doc-needed
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?

Updated

3 months ago
Keywords: DevAdvocacy
(Assignee)

Updated

3 months ago
Component: JavaScript Engine → DOM: Core & HTML
(Assignee)

Comment 2

3 months ago
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
(Assignee)

Updated

3 months ago
Blocks: 1330682
(Assignee)

Updated

3 months ago
Blocks: 1337780
(Assignee)

Comment 3

3 months ago
I sent an "Intent to implement" to dev.platform a few weeks ago:

https://groups.google.com/forum/#!topic/mozilla.dev.platform/dr67sITwva8
(Assignee)

Comment 4

3 months ago
Created attachment 8834912 [details] [diff] [review]
bug1330657-enable-with-pref

Patch to enable modules with dom.moduleScripts.enabled pref.
Attachment #8834912 - Flags: review?(bkelly)
Comment on attachment 8834912 [details] [diff] [review]
bug1330657-enable-with-pref

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.
(Assignee)

Comment 8

3 months ago
Great, I'll use that then.

Comment 9

3 months ago
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/effda19da482
Enable <script type="module"> behind a pref r=bkelly

Comment 10

3 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/effda19da482
Status: NEW → RESOLVED
Last Resolved: 3 months ago
status-firefox54: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
I've added a note about this to our Experimental features page:

https://developer.mozilla.org/en-US/Firefox/Experimental_features

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.
Keywords: dev-doc-needed → dev-doc-complete
You need to log in before you can comment on or make changes to this bug.