RESOLVED FIXED 166987
Add the support for nomodule attribute on script element
https://bugs.webkit.org/show_bug.cgi?id=166987
Summary Add the support for nomodule attribute on script element
Ryosuke Niwa
Reported 2017-01-12 14:11:57 PST
See https://github.com/whatwg/html/pull/2261 We should add the support for nomodule attribute which prevents scripts from running now that we have the support for type=module.
Attachments
Patch (21.29 KB, patch)
2017-01-13 06:15 PST, Yusuke Suzuki
no flags
Patch (20.39 KB, patch)
2017-01-13 07:08 PST, Yusuke Suzuki
sam: review+
Patch for landing (24.44 KB, patch)
2017-01-15 00:54 PST, Yusuke Suzuki
no flags
Radar WebKit Bug Importer
Comment 1 2017-01-12 14:13:25 PST
Yusuke Suzuki
Comment 2 2017-01-13 06:15:35 PST
Sam Weinig
Comment 3 2017-01-13 06:53:37 PST
Comment on attachment 298755 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=298755&action=review > Source/WebCore/html/HTMLScriptElement.idl:32 > + attribute boolean noModule; Can this be a [Reflect] attribute, and avoid the need for the explicit implementation?
Yusuke Suzuki
Comment 4 2017-01-13 07:01:36 PST
Comment on attachment 298755 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=298755&action=review >> Source/WebCore/html/HTMLScriptElement.idl:32 >> + attribute boolean noModule; > > Can this be a [Reflect] attribute, and avoid the need for the explicit implementation? Ah, I thought we need the implementation because of the name `noModule` JS property v.s. `nomodule` attribute name. But it seems that we can use `Reflect` and `ImplementedAs`. Fixed.
Yusuke Suzuki
Comment 5 2017-01-13 07:05:26 PST
Comment on attachment 298755 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=298755&action=review >>> Source/WebCore/html/HTMLScriptElement.idl:32 >>> + attribute boolean noModule; >> >> Can this be a [Reflect] attribute, and avoid the need for the explicit implementation? > > Ah, I thought we need the implementation because of the name `noModule` JS property v.s. `nomodule` attribute name. > But it seems that we can use `Reflect` and `ImplementedAs`. Fixed. Oops, no, we can just use [Reflect] according to the CodeGenerator.pm.
Yusuke Suzuki
Comment 6 2017-01-13 07:08:16 PST
Ryosuke Niwa
Comment 7 2017-01-13 13:55:36 PST
Comment on attachment 298757 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=298757&action=review > Source/WebCore/dom/ScriptElement.h:112 > + virtual bool noModuleAttributeValue() const = 0; I think it’s better to call this hasNoModuleAttribute instead of noModuleAttributeValue.
Yusuke Suzuki
Comment 8 2017-01-14 09:17:12 PST
Comment on attachment 298757 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=298757&action=review >> Source/WebCore/dom/ScriptElement.h:112 >> + virtual bool noModuleAttributeValue() const = 0; > > I think it’s better to call this hasNoModuleAttribute instead of noModuleAttributeValue. If we change this to `hasNoModuleAttribute`, I think we should change deferAttributeValue, asyncAttributeValue. Changed.
Yusuke Suzuki
Comment 9 2017-01-15 00:54:44 PST
Created attachment 298893 [details] Patch for landing
Ryosuke Niwa
Comment 10 2017-01-23 21:46:07 PST
Did you ever land this patch? I can't find it on trac.
Yusuke Suzuki
Comment 11 2017-01-23 22:50:52 PST
(In reply to comment #10) > Did you ever land this patch? I can't find it on trac. yeah, I need to land it.
Yusuke Suzuki
Comment 12 2017-01-23 22:54:10 PST
Serg Hospodarets
Comment 13 2017-03-23 02:18:17 PDT
Just want to make sure, will the first stable version of Safari with ES modules support also contain the "nomodule" addition? Otherwise, the whole point may be missed: https://blog.hospodarets.com/native-ecmascript-modules-nomodule#comment-3218775686
Note You need to log in before you can comment on or make changes to this bug.