Bug 160634 - Align Range.createContextualFragment() input validation with the specification
Summary: Align Range.createContextualFragment() input validation with the specification
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: https://w3c.github.io/DOM-Parsing/#do...
Keywords: WebExposed
Depends on:
Blocks:
 
Reported: 2016-08-06 14:14 PDT by Chris Dumez
Modified: 2016-08-06 19:45 PDT (History)
8 users (show)

See Also:


Attachments
Patch (3.71 KB, patch)
2016-08-06 14:16 PDT, Chris Dumez
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews117 for mac-yosemite (1.45 MB, application/zip)
2016-08-06 15:19 PDT, Build Bot
no flags Details
Patch (5.71 KB, patch)
2016-08-06 18:08 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (10.74 KB, patch)
2016-08-06 19:14 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2016-08-06 14:14:28 PDT
Align Range.createContextualFragment() input validation with the specification:
- https://w3c.github.io/DOM-Parsing/#dom-element-insertadjacenthtml (Step 2)

In particular, we were throwing a NOT_SUPPORTED_ERR when element had localname "html" but was not in the HTML namespace. We should not throw in this case.

Firefox complies with the specification here.
Comment 1 Chris Dumez 2016-08-06 14:16:06 PDT
Created attachment 285497 [details]
Patch
Comment 2 Build Bot 2016-08-06 15:19:27 PDT
Comment on attachment 285497 [details]
Patch

Attachment 285497 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/1825540

New failing tests:
imported/w3c/web-platform-tests/domparsing/createContextualFragment.html
Comment 3 Build Bot 2016-08-06 15:19:31 PDT
Created attachment 285500 [details]
Archive of layout-test-results from ews117 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews117  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 4 Chris Dumez 2016-08-06 18:08:59 PDT
Created attachment 285510 [details]
Patch
Comment 5 Darin Adler 2016-08-06 18:39:40 PDT
Comment on attachment 285510 [details]
Patch

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

> Source/WebCore/editing/markup.cpp:956
> +    if (is<HTMLElement>(element) && downcast<HTMLElement>(element).ieForbidsInsertHTML()) {

Could move the function ieForbidsInsertHTML to Element from HTMLElement to get rid of this casting.

Could also give it a different name since there is probably some nomenclature in the standard now rather than referring to IE.
Comment 6 Chris Dumez 2016-08-06 19:11:33 PDT
Comment on attachment 285510 [details]
Patch

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

>> Source/WebCore/editing/markup.cpp:956
>> +    if (is<HTMLElement>(element) && downcast<HTMLElement>(element).ieForbidsInsertHTML()) {
> 
> Could move the function ieForbidsInsertHTML to Element from HTMLElement to get rid of this casting.
> 
> Could also give it a different name since there is probably some nomenclature in the standard now rather than referring to IE.

Sounds good. I'll move it to Element. However, I have trouble finding the equivalent in the specification. I suspect it may not be standard behavior.

The spec is:
- https://w3c.github.io/DOM-Parsing/#idl-def-range-createcontextualfragment(domstring)
which points to:
- https://html.spec.whatwg.org/#html-fragment-parsing-algorithm
Comment 7 Chris Dumez 2016-08-06 19:14:56 PDT
Created attachment 285515 [details]
Patch
Comment 8 WebKit Commit Bot 2016-08-06 19:45:17 PDT
Comment on attachment 285515 [details]
Patch

Clearing flags on attachment: 285515

Committed r204235: <http://trac.webkit.org/changeset/204235>
Comment 9 WebKit Commit Bot 2016-08-06 19:45:24 PDT
All reviewed patches have been landed.  Closing bug.