New issue
Advanced search Search tips

Issue 808311 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocked on:
issue 736967

Blocking:
issue 648828



Sign in to add a comment

HTML parser doesn't support customized <script> and <html>

Project Member Reported by tkent@chromium.org, Feb 2 2018

Issue description

Chrome Version: ToT
OS: All but iOS

What steps will reproduce the problem?
(1) Open the following document

<!DOCTYPE html>
<html>
<body>
<script>
class MyElement extends HTMLScriptElement {
  constructor() { super(); }
  connectedCallback() {
    this.style.display = 'block';
    this.style.whiteSpace = 'pre-wrap';
    this.style.border = 'solid 1px blue';
  }
}
customElements.define('my-script', MyElement, { extends: 'script' });
</script>
<script is="my-script">console.log('foo');</script>
</body>
</html>


What is the expected result?
"console.log('foo');" within a blue box is shown.

What happens instead?
Nothing is shown.

Please use labels and text to provide additional information.
Firefox works correctly.

We have a special handling for <script> creation. See HTMLConstructionSite::InsertScriptElement().

 

Comment 1 by tkent@chromium.org, Feb 2 2018

Summary: HTML parser doesn't support customized <script> and <html> (was: Customized <script> element doesn't work with HTML parser)
See HTMLConstructionSite::InsertHTMLHtmlStartTagBeforeHTML() too.

Project Member

Comment 2 by bugdroid1@chromium.org, Feb 2 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/da0d0c5000a2bb40462601ef8cde0c40f7932fe5

commit da0d0c5000a2bb40462601ef8cde0c40f7932fe5
Author: Kent Tamura <tkent@chromium.org>
Date: Fri Feb 02 13:14:39 2018

custom-elements: Handle V0 type extension as close to element creation as possible.

Move V0 type extension handling in Element::
AttributeChangedFromParserOrByCloning() to its callsites close to
element creation.

* HTMLConstructionSite:
  Move 'is' attribute lookup from LookUpCustomElementDefinition() to
  CreateElement() in order to avoid looking up 'is' again.

* XMLDocumentParser:
  Convert libxml attributes to blink::Attribute before element creation
  to find 'is' attribute easily.

This CL has no behavior changes, and is a preparation to consolidate
V0 type extension handling and element creation.

Bug:  808302 ,  808311 ,  807871 
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Ibb4254720f1bed8b92e878fa7b29c986bfa1f87d
Reviewed-on: https://chromium-review.googlesource.com/898685
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534035}
[modify] https://crrev.com/da0d0c5000a2bb40462601ef8cde0c40f7932fe5/third_party/WebKit/Source/core/dom/Document.cpp
[modify] https://crrev.com/da0d0c5000a2bb40462601ef8cde0c40f7932fe5/third_party/WebKit/Source/core/dom/Element.cpp
[modify] https://crrev.com/da0d0c5000a2bb40462601ef8cde0c40f7932fe5/third_party/WebKit/Source/core/html/HTMLScriptElement.cpp
[modify] https://crrev.com/da0d0c5000a2bb40462601ef8cde0c40f7932fe5/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp
[modify] https://crrev.com/da0d0c5000a2bb40462601ef8cde0c40f7932fe5/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.h
[modify] https://crrev.com/da0d0c5000a2bb40462601ef8cde0c40f7932fe5/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp
[modify] https://crrev.com/da0d0c5000a2bb40462601ef8cde0c40f7932fe5/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp

Comment 3 by phistuck@gmail.com, Feb 4 2018

What does "V0" mean in this context?
Shadow DOM v0?

Comment 4 by tkent@chromium.org, Feb 5 2018

> What does "V0" mean in this context?

It means Custom Element V0.

Comment 5 Deleted

Comment 6 by tkent@chromium.org, Feb 5 2018

Owner: tkent@chromium.org
Status: Started (was: tars)
Project Member

Comment 7 by bugdroid1@chromium.org, Feb 5 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c692ea5f2087b64de33e59224cf89dacb814590a

commit c692ea5f2087b64de33e59224cf89dacb814590a
Author: Kent Tamura <tkent@chromium.org>
Date: Mon Feb 05 04:05:26 2018

Move V0CustomElementRegistrationContext::SetTypeExtension calls in Document::createElement to Document::CreateElement.

Also, fix a bug that V1 createElementNS() produced a type extension
defined by V0 registerElement(). This bug was introduced by
crrev.com/533660.

This CL is a preparation to consolidate V0 type extension handling
and element creation.

Bug:  808302 ,  808311 ,  807871 
Change-Id: I81251e1c72db4f8f8333f407944a91f2d823bb77
Reviewed-on: https://chromium-review.googlesource.com/900607
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534324}
[modify] https://crrev.com/c692ea5f2087b64de33e59224cf89dacb814590a/third_party/WebKit/LayoutTests/custom-elements/v0-v1-interop.html
[modify] https://crrev.com/c692ea5f2087b64de33e59224cf89dacb814590a/third_party/WebKit/Source/core/dom/Document.cpp

Comment 8 by phistuck@gmail.com, Feb 5 2018

Huh, why bother improving Custom Elements v0?

Comment 9 by tkent@chromium.org, Feb 5 2018

> Huh, why bother improving Custom Elements v0?

We don't intent to improve Custom Elements v0 by these CLs. They are necessary to fix this V1 bug without breaking v0 features.


Blockedon: 736967
Project Member

Comment 11 by bugdroid1@chromium.org, Feb 6 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/699f193db749a2c8c5fa01c8a986682afaf37bc8

commit 699f193db749a2c8c5fa01c8a986682afaf37bc8
Author: Kent Tamura <tkent@chromium.org>
Date: Tue Feb 06 07:51:20 2018

custom-elements: HTML parser should support customized <html>.

HTMLConstructionSite::InsertHTMLHtmlStartTagBeforeHTML() should use
"create an element" algorithm.

Test: Update builtin-coverage.html so that it tests elements parsed by
the document parser if they are unable to be tested with innerHTML
setter. Now it can test <html is=> and <body is=>.

Bug:  808311 
Change-Id: I511edfa28750210d39b9e9a0fb711e245dc5737d
Reviewed-on: https://chromium-review.googlesource.com/903345
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534655}
[modify] https://crrev.com/699f193db749a2c8c5fa01c8a986682afaf37bc8/third_party/WebKit/LayoutTests/external/wpt/custom-elements/builtin-coverage-expected.txt
[modify] https://crrev.com/699f193db749a2c8c5fa01c8a986682afaf37bc8/third_party/WebKit/LayoutTests/external/wpt/custom-elements/builtin-coverage.html
[modify] https://crrev.com/699f193db749a2c8c5fa01c8a986682afaf37bc8/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp

Project Member

Comment 12 by bugdroid1@chromium.org, Feb 7 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/202db73b8d3bd2cefbb570785c576c7fd10d5164

commit 202db73b8d3bd2cefbb570785c576c7fd10d5164
Author: Kent Tamura <tkent@chromium.org>
Date: Wed Feb 07 01:46:08 2018

Change the type of the second optional argument of element factories.

The second argument was a bool representing craete_by_parser.
This CL changes it to CreateElementFlags, which contains the
same flag.

This is a preparation to support <script is=>.
This CL has no behavior changes.

Bug:  808311 
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I065b23a4797ba26b050e2113a4df7daf1cc385d6
Reviewed-on: https://chromium-review.googlesource.com/904225
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534870}
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/build/scripts/make_element_factory.py
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/build/scripts/make_element_lookup_trie.py
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/build/scripts/make_element_type_helpers.py
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/build/scripts/templates/element_factory.cc.tmpl
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/css/StyleEngineTest.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/dom/CreateElementFlags.h
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/dom/DocumentTest.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/exported/WebHelperPluginImpl.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicyTest.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/HTMLEmbedElement.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/HTMLEmbedElement.h
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/HTMLImageElement.h
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/HTMLImageElementTest.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/HTMLLinkElement.h
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/HTMLLinkElementSizesAttributeTest.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/HTMLMarqueeElement.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/HTMLObjectElement.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/HTMLObjectElement.h
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/HTMLPlugInElement.h
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/HTMLScriptElement.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/HTMLScriptElement.h
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/HTMLStyleElement.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/HTMLStyleElement.h
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/HTMLTagNames.json5
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/forms/FileInputType.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/forms/FileInputTypeTest.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/forms/HTMLInputElement.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/forms/HTMLInputElement.h
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/forms/HTMLInputElementTest.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/svg/SVGScriptElement.h
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/svg/SVGStyleElement.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/svg/SVGStyleElement.h
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/core/svg/SVGTagNames.json5
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/modules/media_controls/elements/MediaControlInputElement.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/modules/media_controls/elements/MediaControlLoadingPanelElement.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverlayPlayButtonElement.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/modules/media_controls/elements/MediaControlTextTrackListElement.cpp
[modify] https://crrev.com/202db73b8d3bd2cefbb570785c576c7fd10d5164/third_party/WebKit/Source/modules/media_controls/elements/MediaControlTimelineElement.cpp

Project Member

Comment 13 by bugdroid1@chromium.org, Feb 7 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4837a24f5ea9e4fd383cb49b5f950c86b61bce90

commit 4837a24f5ea9e4fd383cb49b5f950c86b61bce90
Author: Kent Tamura <tkent@chromium.org>
Date: Wed Feb 07 01:51:16 2018

Add already_started_ and created_during_document_write_ members to CreateElementFlags.

This CL has no behavior changes.

Bug:  808311 
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Ica27f0cdadfe3a8381eb2dd90bd1a781d5b04cd5
Reviewed-on: https://chromium-review.googlesource.com/905704
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534872}
[modify] https://crrev.com/4837a24f5ea9e4fd383cb49b5f950c86b61bce90/third_party/WebKit/Source/core/dom/CreateElementFlags.h
[modify] https://crrev.com/4837a24f5ea9e4fd383cb49b5f950c86b61bce90/third_party/WebKit/Source/core/html/HTMLScriptElement.cpp
[modify] https://crrev.com/4837a24f5ea9e4fd383cb49b5f950c86b61bce90/third_party/WebKit/Source/core/html/HTMLScriptElement.h
[modify] https://crrev.com/4837a24f5ea9e4fd383cb49b5f950c86b61bce90/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp
[modify] https://crrev.com/4837a24f5ea9e4fd383cb49b5f950c86b61bce90/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp
[modify] https://crrev.com/4837a24f5ea9e4fd383cb49b5f950c86b61bce90/third_party/WebKit/Source/core/svg/SVGScriptElement.h

Project Member

Comment 14 by bugdroid1@chromium.org, Feb 7 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e90821a3528e187a9c395750093947f9fb49dde8

commit e90821a3528e187a9c395750093947f9fb49dde8
Author: Kent Tamura <tkent@chromium.org>
Date: Wed Feb 07 05:14:15 2018

custom-elements: HTML parser should support customized <script>.

HTMLConstructionSite::InsertScriptElement() should use "create an
element" algorithm [1]. We call Document::CreateElement() only if
"is" attribute exists to avoid performance degradation.

[1] https://dom.spec.whatwg.org/#concept-create-element

Bug:  808311 
Change-Id: If22355c3e8856f627d6b21fe3a5644fadd31b918
Reviewed-on: https://chromium-review.googlesource.com/903664
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Commit-Queue: Kouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534921}
[delete] https://crrev.com/91179078c4b39dc548bae7ff055e7bf13faccda8/third_party/WebKit/LayoutTests/external/wpt/custom-elements/builtin-coverage-expected.txt
[modify] https://crrev.com/e90821a3528e187a9c395750093947f9fb49dde8/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp

Status: Fixed (was: Started)

Sign in to add a comment