Bug 161651 - [WebCore] Clean up script loading code in XML
Summary: [WebCore] Clean up script loading code in XML
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: XML (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords:
Depends on:
Blocks: 147340
  Show dependency treegraph
 
Reported: 2016-09-06 15:41 PDT by Yusuke Suzuki
Modified: 2016-11-16 22:47 PST (History)
9 users (show)

See Also:


Attachments
Patch (6.97 KB, patch)
2016-11-16 20:12 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (25.54 KB, patch)
2016-11-16 22:06 PST, Yusuke Suzuki
rniwa: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2016-09-06 15:41:23 PDT
...
Comment 1 Yusuke Suzuki 2016-11-16 20:12:09 PST
Created attachment 295022 [details]
Patch

WIP
Comment 2 Yusuke Suzuki 2016-11-16 22:06:35 PST
Created attachment 295028 [details]
Patch
Comment 3 Ryosuke Niwa 2016-11-16 22:21:50 PST
Comment on attachment 295028 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=295028&action=review

> Source/WebCore/dom/ScriptElement.cpp:167
> +    // XHTML document does not support "defer" attribute semantics.
> +    // And module tag also uses defer attribute semantics. We disable script type="module" for non HTML document.

Is this behavior spec compliant!?
Comment 4 Yusuke Suzuki 2016-11-16 22:32:36 PST
Comment on attachment 295028 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=295028&action=review

>> Source/WebCore/dom/ScriptElement.cpp:167
>> +    // And module tag also uses defer attribute semantics. We disable script type="module" for non HTML document.
> 
> Is this behavior spec compliant!?

XHTML defines "defer" attribute. But WebKit does not implement it for a long time.
Once "defer" is implemented, we can reconsider enabling modules in XHTML. But I'm not sure that's worth doing (implementing defer semantics and enabling modules in XHTML).

Since "defer" semantics is not implemented, before this patch, we just ignore the modules in XHTML document. But it causes some strange behavior.
For example, if you write <script type="module"> in document, it is ignored. But if you create script tag with `type="module"` dynamically, it works.
To make it consistent, I think disabling modules until "defer" is implemented in XHTML is better.

I'll note the above description in this comment.
Comment 5 Yusuke Suzuki 2016-11-16 22:38:30 PST
Comment on attachment 295028 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=295028&action=review

>>> Source/WebCore/dom/ScriptElement.cpp:167
>>> +    // And module tag also uses defer attribute semantics. We disable script type="module" for non HTML document.
>> 
>> Is this behavior spec compliant!?
> 
> XHTML defines "defer" attribute. But WebKit does not implement it for a long time.
> Once "defer" is implemented, we can reconsider enabling modules in XHTML. But I'm not sure that's worth doing (implementing defer semantics and enabling modules in XHTML).
> 
> Since "defer" semantics is not implemented, before this patch, we just ignore the modules in XHTML document. But it causes some strange behavior.
> For example, if you write <script type="module"> in document, it is ignored. But if you create script tag with `type="module"` dynamically, it works.
> To make it consistent, I think disabling modules until "defer" is implemented in XHTML is better.
> 
> I'll note the above description in this comment.

We have a bug for that https://bugs.webkit.org/show_bug.cgi?id=123387. I'll paste this URL.
According to that bug, blink intentionally does not support it https://bugs.chromium.org/p/chromium/issues/detail?id=611136.
Comment 6 Yusuke Suzuki 2016-11-16 22:47:38 PST
Committed r208840: <http://trac.webkit.org/changeset/208840>