Bug 162353 - Fix serialization of bgsound, keygen and track elements
Summary: Fix serialization of bgsound, keygen and track elements
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: WebExposed
Depends on:
Blocks:
 
Reported: 2016-09-21 11:55 PDT by Chris Dumez
Modified: 2016-09-21 21:38 PDT (History)
7 users (show)

See Also:


Attachments
Patch (32.98 KB, patch)
2016-09-21 13:47 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (34.07 KB, patch)
2016-09-21 20:19 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (1.08 MB, application/zip)
2016-09-21 21:18 PDT, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2016-09-21 11:55:24 PDT
Fix serialization of keygen and track elements to match the specification:
- https://html.spec.whatwg.org/#serialising-html-fragments

They are not supposed to have an end tag. Firefox and Chrome agree with the specification.
Comment 1 Chris Dumez 2016-09-21 13:47:18 PDT
Created attachment 289474 [details]
Patch
Comment 2 Darin Adler 2016-09-21 16:22:33 PDT
Comment on attachment 289474 [details]
Patch

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

Does this leave us with sufficient test coverage? I can’t easily see the difference between this list and the ieForbidsInsertHTML list.

> Source/WebCore/editing/MarkupAccumulator.cpp:615
> +    return element.hasTagName(areaTag)
> +        || element.hasTagName(baseTag)
> +        || element.hasTagName(basefontTag)
> +        || element.hasTagName(bgsoundTag)
> +        || element.hasTagName(brTag)
> +        || element.hasTagName(colTag)
> +        || element.hasTagName(embedTag)
> +        || element.hasTagName(frameTag)
> +        || element.hasTagName(hrTag)
> +        || element.hasTagName(imgTag)
> +        || element.hasTagName(inputTag)
> +        || element.hasTagName(keygenTag)
> +        || element.hasTagName(linkTag)
> +        || element.hasTagName(metaTag)
> +        || element.hasTagName(paramTag)
> +        || element.hasTagName(sourceTag)
> +        || element.hasTagName(trackTag)
> +        || element.hasTagName(wbrTag);

An unrolled set of checks like this might be less efficient than using an array of the tags with a loop when there are so many tags involved; it might even be worth considering a HashSet, but probably not.
Comment 3 Chris Dumez 2016-09-21 16:30:47 PDT
Comment on attachment 289474 [details]
Patch

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

>> Source/WebCore/editing/MarkupAccumulator.cpp:615
>> +        || element.hasTagName(wbrTag);
> 
> An unrolled set of checks like this might be less efficient than using an array of the tags with a loop when there are so many tags involved; it might even be worth considering a HashSet, but probably not.

Compared to ieForbidsInsertHTML(), this list adds bgsound, keygen, and track. It removes <image>.
-> We have newly passing tests for bgsound, keygen, and track.
-> For <image>, it is an SVGElement, not an HTMLElement. Therefore, it would have returned early at the beginning of this function.

I'll look into using an array / loop.
Comment 4 Darin Adler 2016-09-21 16:34:10 PDT
Comment on attachment 289474 [details]
Patch

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

>>> Source/WebCore/editing/MarkupAccumulator.cpp:615
>>> +        || element.hasTagName(wbrTag);
>> 
>> An unrolled set of checks like this might be less efficient than using an array of the tags with a loop when there are so many tags involved; it might even be worth considering a HashSet, but probably not.
> 
> Compared to ieForbidsInsertHTML(), this list adds bgsound, keygen, and track. It removes <image>.
> -> We have newly passing tests for bgsound, keygen, and track.
> -> For <image>, it is an SVGElement, not an HTMLElement. Therefore, it would have returned early at the beginning of this function.
> 
> I'll look into using an array / loop.

Sounds good.

I know it’s not normal, but are you sure you can’t create an element with the HTML namespace but with the tag "image"? I guess there is some trick that converts "image" into imgTag during normal parsing. And I suppose this is for HTML, not XML documents, but still wondering if there is some way to create such an element.
Comment 5 Chris Dumez 2016-09-21 16:37:30 PDT
(In reply to comment #4)
> Comment on attachment 289474 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=289474&action=review
> 
> >>> Source/WebCore/editing/MarkupAccumulator.cpp:615
> >>> +        || element.hasTagName(wbrTag);
> >> 
> >> An unrolled set of checks like this might be less efficient than using an array of the tags with a loop when there are so many tags involved; it might even be worth considering a HashSet, but probably not.
> > 
> > Compared to ieForbidsInsertHTML(), this list adds bgsound, keygen, and track. It removes <image>.
> > -> We have newly passing tests for bgsound, keygen, and track.
> > -> For <image>, it is an SVGElement, not an HTMLElement. Therefore, it would have returned early at the beginning of this function.
> > 
> > I'll look into using an array / loop.
> 
> Sounds good.
> 
> I know it’s not normal, but are you sure you can’t create an element with
> the HTML namespace but with the tag "image"? I guess there is some trick
> that converts "image" into imgTag during normal parsing. And I suppose this
> is for HTML, not XML documents, but still wondering if there is some way to
> create such an element.

Sure, it is possible to do document.createElement("image") and get an HTMLUnknownElement that the tag image. I have likely changed the behavior in such case (although the behavior change is a good thing here). I'll add test coverage and make sure other browsers pass this test).
Comment 6 Chris Dumez 2016-09-21 20:19:09 PDT
Created attachment 289510 [details]
Patch
Comment 7 WebKit Commit Bot 2016-09-21 21:03:28 PDT
The commit-queue encountered the following flaky tests while processing attachment 289510 [details]:

fast/images/move-image-to-new-document.html bug 162372 (authors: arv@chromium.org, darin@apple.com, and mark.lam@apple.com)
The commit-queue is continuing to process your patch.
Comment 8 Build Bot 2016-09-21 21:18:44 PDT
Comment on attachment 289510 [details]
Patch

Attachment 289510 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/2122770

New failing tests:
fast/images/move-image-to-new-document.html
Comment 9 Build Bot 2016-09-21 21:18:48 PDT
Created attachment 289516 [details]
Archive of layout-test-results from ews107 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 10 Chris Dumez 2016-09-21 21:38:39 PDT
Comment on attachment 289510 [details]
Patch

Clearing flags on attachment: 289510

Committed r206246: <http://trac.webkit.org/changeset/206246>
Comment 11 Chris Dumez 2016-09-21 21:38:45 PDT
All reviewed patches have been landed.  Closing bug.