From 2faa58eb4cb6cf870fd75f0d28b92353e6aaf51a Mon Sep 17 00:00:00 2001 From: "alanknight@google.com" Date: Fri, 15 May 2015 01:10:19 +0000 Subject: [PATCH] Testing for appendHtml and insertAdjacentHtml should be consistently sanitized BUG= Review URL: https://codereview.chromium.org//1147473002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45807 260f80e4-7a28-3924-810f-c04153c831b5 --- CHANGELOG.md | 8 + sdk/lib/html/dart2js/html_dart2js.dart | 22 ++- sdk/lib/html/dartium/html_dartium.dart | 12 +- sdk/lib/svg/dart2js/svg_dart2js.dart | 5 +- sdk/lib/svg/dartium/svg_dartium.dart | 5 +- tests/co19/co19-dart2js.status | 179 ++++++++++++++++-- tests/co19/co19-dartium.status | 130 ++++++++++++- ...u_suppress_make_the_bug_critical_test.dart | 18 ++ .../impl/impl_DocumentFragment.darttemplate | 6 +- .../html/impl/impl_Element.darttemplate | 16 +- .../html/impl/impl_SVGElement.darttemplate | 5 +- 11 files changed, 360 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d236bf7d4eb..03791298e55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ ### Core library changes +* In dart:html, appendHtml and insertAdjacentHtml now take validator + and treeSanitizer parameters, and the inputs are consistently sanitized. +* List iterators may not throw ConcurrentModificationError as eagerly in + release mode. In checked mode, the modification check is still as eager + as possible. + [r45198](https://code.google.com/p/dart/source/detail?r=45198), +* Update experimental Isolate API: + - Make priority parameters of `Isolate.ping` and `Isolate.kill` methods * `dart:core` * Add `unmodifiable` constructor to `List` - [r45334](https://code.google.com/p/dart/source/detail?r=45334) diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart index 7e8622fdc3d..5e476b35104 100644 --- a/sdk/lib/html/dart2js/html_dart2js.dart +++ b/sdk/lib/html/dart2js/html_dart2js.dart @@ -9941,8 +9941,10 @@ class DocumentFragment extends Node implements ParentNode { * Parses the specified text as HTML and adds the resulting node after the * last child of this document fragment. */ - void appendHtml(String text) { - this.append(new DocumentFragment.html(text)); + void appendHtml(String text, {NodeValidator validator, + NodeTreeSanitizer, treeSanitizer}) { + this.append(new DocumentFragment.html(text, validator: validator, + treeSanitizer: treeSanitizer)); } /** @@ -12619,8 +12621,10 @@ abstract class Element extends Node implements GlobalEventHandlers, ParentNode, * Parses the specified text as HTML and adds the resulting node after the * last child of this element. */ - void appendHtml(String text) { - this.insertAdjacentHtml('beforeend', text); + void appendHtml(String text, {NodeValidator validator, + NodeTreeSanitizer treeSanitizer}) { + this.insertAdjacentHtml('beforeend', text, validator: validator, + treeSanitizer: treeSanitizer); } /** @@ -12888,12 +12892,10 @@ abstract class Element extends Node implements GlobalEventHandlers, ParentNode, * * [insertAdjacentText] * * [insertAdjacentElement] */ - void insertAdjacentHtml(String where, String html) { - if (JS('bool', '!!#.insertAdjacentHTML', this)) { - _insertAdjacentHtml(where, html); - } else { - _insertAdjacentNode(where, new DocumentFragment.html(html)); - } + void insertAdjacentHtml(String where, String html, {NodeValidator validator, + NodeTreeSanitizer treeSanitizer}) { + _insertAdjacentNode(where, new DocumentFragment.html(html, + validator: validator, treeSanitizer: treeSanitizer)); } @JSName('insertAdjacentHTML') diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart index 62bf3eeb517..8f2d3abe587 100644 --- a/sdk/lib/html/dartium/html_dartium.dart +++ b/sdk/lib/html/dartium/html_dartium.dart @@ -9412,8 +9412,10 @@ class DocumentFragment extends Node implements ParentNode { * Parses the specified text as HTML and adds the resulting node after the * last child of this document fragment. */ - void appendHtml(String text) { - this.append(new DocumentFragment.html(text)); + void appendHtml(String text, {NodeValidator validator, + NodeTreeSanitizer, treeSanitizer}) { + this.append(new DocumentFragment.html(text, validator: validator, + treeSanitizer: treeSanitizer)); } /** @@ -12255,8 +12257,10 @@ abstract class Element extends Node implements GlobalEventHandlers, ParentNode, * Parses the specified text as HTML and adds the resulting node after the * last child of this element. */ - void appendHtml(String text) { - this.insertAdjacentHtml('beforeend', text); + void appendHtml(String text, {NodeValidator validator, + NodeTreeSanitizer treeSanitizer}) { + this.insertAdjacentHtml('beforeend', text, validator: validator, + treeSanitizer: treeSanitizer); } /** diff --git a/sdk/lib/svg/dart2js/svg_dart2js.dart b/sdk/lib/svg/dart2js/svg_dart2js.dart index ba0ac0183ec..b8035b32c40 100644 --- a/sdk/lib/svg/dart2js/svg_dart2js.dart +++ b/sdk/lib/svg/dart2js/svg_dart2js.dart @@ -4858,11 +4858,12 @@ class SvgElement extends Element implements GlobalEventHandlers { } @DomName('Element.insertAdjacentHTML') - void insertAdjacentHtml(String where, String text) { + void insertAdjacentHtml(String where, String text, {NodeValidator validator, + NodeTreeSanitizer treeSanitizer}) { throw new UnsupportedError("Cannot invoke insertAdjacentHtml on SVG."); } - @DomName('Element.insertAdjacentHTML') + @DomName('Element.insertAdjacentElement') Element insertAdjacentElement(String where, Element element) { throw new UnsupportedError("Cannot invoke insertAdjacentElement on SVG."); } diff --git a/sdk/lib/svg/dartium/svg_dartium.dart b/sdk/lib/svg/dartium/svg_dartium.dart index d480db39b40..63a74c64146 100644 --- a/sdk/lib/svg/dartium/svg_dartium.dart +++ b/sdk/lib/svg/dartium/svg_dartium.dart @@ -5498,11 +5498,12 @@ class SvgElement extends Element implements GlobalEventHandlers { } @DomName('Element.insertAdjacentHTML') - void insertAdjacentHtml(String where, String text) { + void insertAdjacentHtml(String where, String text, {NodeValidator validator, + NodeTreeSanitizer treeSanitizer}) { throw new UnsupportedError("Cannot invoke insertAdjacentHtml on SVG."); } - @DomName('Element.insertAdjacentHTML') + @DomName('Element.insertAdjacentElement') Element insertAdjacentElement(String where, Element element) { throw new UnsupportedError("Cannot invoke insertAdjacentElement on SVG."); } diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status index c2ec3507a39..81dfa569716 100644 --- a/tests/co19/co19-dart2js.status +++ b/tests/co19/co19-dart2js.status @@ -384,6 +384,169 @@ LayoutTests/fast/forms/submit-form-with-dirname-attribute-with-nonhtml-ancestor_ LayoutTests/fast/forms/submit-nil-value-field-assert_t01: Skip # Test reloads itself. Issue 18558. LayoutTests/fast/forms/textarea-submit-crash_t01: Skip # Test reloads itself. Issue 18558. LayoutTests/fast/innerHTML/innerHTML-svg-write_t01: Fail # Test uses foreignObject tag, which sanitizer removes. co19 issue #746 +LibTest/html/IFrameElement/appendHtml_A01_t01: Pass, RuntimeError # Issue 23462 +LibTest/html/IFrameElement/appendHtml_A01_t02: Pass, RuntimeError # Issue 23462 +# +# Everything below this point is associated with co19 Issue 747 +# +LayoutTests/fast/dynamic/insertAdjacentHTML_t01: Pass, RuntimeError +LayoutTests/fast/layers/zindex-hit-test_t01: RuntimeError +LayoutTests/fast/layers/normal-flow-hit-test_t01: RuntimeError +LayoutTests/fast/multicol/balance-unbreakable_t01: Pass, RuntimeError +LayoutTests/fast/multicol/fixed-column-percent-logical-height-orthogonal-writing-mode_t01: RuntimeError +LayoutTests/fast/multicol/image-inside-nested-blocks-with-border_t01: RuntimeError +LayoutTests/fast/multicol/inherit-column-values_t01: RuntimeError +LayoutTests/fast/multicol/inline-getclientrects_t01: RuntimeError +LayoutTests/fast/multicol/newmulticol/balance_t01: Pass, RuntimeError +LayoutTests/fast/multicol/newmulticol/balance-maxheight_t02: RuntimeError +LayoutTests/fast/multicol/newmulticol/balance_t02: Pass, RuntimeError +LayoutTests/fast/multicol/newmulticol/balance_t04: Pass, RuntimeError +LayoutTests/fast/multicol/newmulticol/balance_t05: Pass, RuntimeError +LayoutTests/fast/multicol/newmulticol/balance_t06: Pass, RuntimeError +LayoutTests/fast/multicol/newmulticol/balance_t07: Pass, RuntimeError +LayoutTests/fast/multicol/newmulticol/balance_t08: Pass, RuntimeError +LayoutTests/fast/multicol/newmulticol/balance_t09: Pass, RuntimeError +LayoutTests/fast/multicol/newmulticol/balance_t10: Pass, RuntimeError # I don't understand how, but sometimes passes. +LayoutTests/fast/multicol/widows_t01: Pass, RuntimeError +LayoutTests/fast/multicol/vertical-lr/break-properties_t01: RuntimeError +LayoutTests/fast/multicol/orphans-relayout_t01: RuntimeError +LayoutTests/fast/multicol/zeroColumnCount_t01: RuntimeError +LayoutTests/fast/media/media-query-serialization_t01: RuntimeError +LayoutTests/fast/media/color-does-not-include-alpha_t01: RuntimeError +LayoutTests/fast/media/mq-append-delete_t01: RuntimeError +LayoutTests/fast/media/mq-color-index_t02: RuntimeError +LayoutTests/fast/media/mq-js-media-except_t02: RuntimeError +LayoutTests/fast/media/mq-js-media-except_t01: RuntimeError +LayoutTests/fast/media/mq-js-media-except_t03: RuntimeError +LayoutTests/fast/media/mq-js-update-media_t01: RuntimeError +LayoutTests/fast/media/mq-parsing_t01: Pass, RuntimeError # False passes on Firefox, but trying to keep these grouped with the issue. +LayoutTests/fast/mediastream/RTCPeerConnection-AddRemoveStream_t01: RuntimeError +LayoutTests/fast/loader/local-css-allowed-in-strict-mode_t01: RuntimeError +LayoutTests/fast/overflow/replaced-child-100percent-height-inside-fixed-container-with-overflow-auto_t01: Pass, RuntimeError # False pass on Safari +LayoutTests/fast/lists/marker-preferred-margins_t01: RuntimeError +LayoutTests/fast/lists/item-not-in-list-line-wrapping_t01: RuntimeError +LayoutTests/fast/innerHTML/innerHTML-special-elements_t01: RuntimeError +LayoutTests/fast/inline/fixed-pos-moves-with-abspos-inline-parent_t01: RuntimeError +LayoutTests/fast/inline/fixed-pos-moves-with-abspos-parent-relative-ancestor_t01: RuntimeError +LayoutTests/fast/inline/inline-relative-offset-boundingbox_t01: RuntimeError +LayoutTests/fast/inline/fixed-pos-moves-with-abspos-parent_t01: RuntimeError +LayoutTests/fast/inline/fixed-pos-with-transform-container-moves-with-abspos-parent_t01: RuntimeError +LayoutTests/fast/inline/empty-inline-before-collapsed-space_t01: RuntimeError +LayoutTests/fast/inline/reattach-inlines-in-anonymous-blocks-with-out-of-flow-siblings_t01: RuntimeError +LayoutTests/fast/overflow/overflow-rtl-vertical-origin_t01: Pass, RuntimeError # False passes on Firefox, but trying to keep these grouped with the issue. +LayoutTests/fast/replaced/computed-image-width-with-percent-height-and-fixed-ancestor_t01: Pass # False pass +LayoutTests/fast/table/col-width-span-expand_t01: RuntimeError +LayoutTests/fast/text/container-align-with-inlines_t01: RuntimeError +LayoutTests/fast/text/font-fallback-synthetic-italics_t01: Pass, RuntimeError +LayoutTests/fast/text/international/listbox-width-rtl_t01: RuntimeError +LayoutTests/fast/text/glyph-reordering_t01: Pass, RuntimeError # This is a false pass. The font gets sanitized, so whether it works or not probably depends on default sizes. +LayoutTests/fast/text/international/rtl-text-wrapping_t01: Pass # This is a false pass. All the content gets sanitized, so there's nothing to assert fail on. If the code did anything it would fail. +LayoutTests/fast/text/line-break-after-empty-inline-hebrew_t01: Pass, RuntimeError +LayoutTests/fast/text/line-break-after-inline-latin1_t01: RuntimeError +LayoutTests/fast/text/line-breaks-after-closing-punctuations_t01: RuntimeError +LayoutTests/fast/text/line-breaks-after-hyphen-before-number_t01: RuntimeError +LayoutTests/fast/text/line-breaks-after-ideographic-comma-or-full-stop_t01: RuntimeError +LayoutTests/fast/text/regional-indicator-symobls_t01: Pass, Fail +LayoutTests/fast/text-autosizing/inline-width_t01: RuntimeError +LayoutTests/fast/text-autosizing/text-removal_t01: RuntimeError +LayoutTests/fast/text-autosizing/table-inline-width_t01: RuntimeError +LayoutTests/fast/text/container-align-with-inlines_t01: RuntimeError +LayoutTests/fast/text/font-fallback-synthetic-italics_t01: RuntimeError +LayoutTests/fast/text/ipa-tone-letters_t01: Pass, RuntimeError +LayoutTests/fast/text/pre-wrap-trailing-tab_t01: RuntimeError +LayoutTests/fast/text-autosizing/display-type-change-lineHeight_t01: RuntimeError +LayoutTests/fast/url/trivial_t01: RuntimeError +LayoutTests/fast/url/trivial-segments_t01: RuntimeError +LayoutTests/fast/url/scheme_t01: RuntimeError +LayoutTests/fast/url/host-lowercase-per-scheme_t01: RuntimeError +LayoutTests/fast/url/safari-extension_t01: RuntimeError +LayoutTests/fast/url/safari-extension_t01: RuntimeError +LayoutTests/fast/url/port_t01: RuntimeError +LayoutTests/fast/url/mailto_t01: RuntimeError +LayoutTests/fast/url/path-url_t01: RuntimeError +LayoutTests/fast/url/anchor_t01: RuntimeError +LayoutTests/fast/writing-mode/auto-margins-across-boundaries_t01: RuntimeError +LayoutTests/fast/writing-mode/display-mutation_t01: RuntimeError +LayoutTests/fast/writing-mode/percentage-padding_t01: RuntimeError +LayoutTests/fast/writing-mode/relative-positioning-percentages_t01: RuntimeError +LayoutTests/fast/writing-mode/block-formatting-context_t01: RuntimeError +LayoutTests/fast/writing-mode/percentage-margins-absolute-replaced_t01: Pass, RuntimeError +LayoutTests/fast/html/adjacent-html-context-element_t01:RuntimeError +LayoutTests/fast/dom/HTMLElement/insertAdjacentHTML-errors_t01: RuntimeError +LayoutTests/fast/transforms/transform-inside-overflow-scroll_t01: RuntimeError +LayoutTests/fast/transforms/transform-hit-test-flipped_t01: Pass, RuntimeError # Passes on Firefox, but is clearly not testing what it's trying to test. +LayoutTests/fast/transforms/scrollIntoView-transformed_t01: Pass, RuntimeError # False passes on Firefox. +LayoutTests/fast/transforms/bounding-rect-zoom_t01: RuntimeError, Pass # Erratic, but only passes because divs have been entirely removed. +LayoutTests/fast/transforms/topmost-becomes-bottomost-for-scrolling_t01: RuntimeError +LayoutTests/fast/table/hittest-tablecell-bottom-edge_t01: RuntimeError +LayoutTests/fast/table/table-width-exceeding-max-width_t01: RuntimeError +LayoutTests/fast/table/table-size-integer-overflow_t01: RuntimeError +LayoutTests/fast/table/table-sections-border-spacing_t01: RuntimeError +LayoutTests/fast/table/switch-table-layout_t01: RuntimeError +LayoutTests/fast/table/switch-table-layout-multiple-section_t01: RuntimeError +LayoutTests/fast/table/switch-table-layout-dynamic-cells_t01: RuntimeError +LayoutTests/fast/table/resize-table-row_t01: RuntimeError +LayoutTests/fast/table/resize-table-cell_t01: RuntimeError +LayoutTests/fast/table/resize-table-binding-cell_t01: RuntimeError +LayoutTests/fast/table/min-max-width-preferred-size_t01: RuntimeError +LayoutTests/fast/table/margins-flipped-text-direction_t01: RuntimeError +LayoutTests/fast/table/html-table-width-max-width-constrained_t01: RuntimeError +LayoutTests/fast/table/fixed-table-layout-width-change_t01: Pass, RuntimeError # False passes on Firefox +LayoutTests/fast/table/fixed-table-with-percent-width-inside-extra-large-div_t01: RuntimeError +LayoutTests/fast/table/absolute-table-percent-lengths_t01: RuntimeError +LayoutTests/fast/svg/whitespace-length_t01: RuntimeError +LayoutTests/fast/svg/whitespace-number_t01: RuntimeError +LayoutTests/fast/svg/whitespace-length-invalid_t01: RuntimeError +LayoutTests/fast/svg/whitespace-angle_t01: RuntimeError +LayoutTests/fast/svg/tabindex-focus_t01: RuntimeError +LayoutTests/fast/svg/whitespace-integer_t01: RuntimeError +LayoutTests/fast/sub-pixel/shadows-computed-style_t01: RuntimeError +LayoutTests/fast/sub-pixel/tiled-canvas-elements_t01: RuntimeError +LayoutTests/fast/sub-pixel/float-list-inside_t01: RuntimeError +LayoutTests/fast/sub-pixel/float-with-margin-in-container_t01: RuntimeError +LayoutTests/fast/sub-pixel/float-percentage-widths_t01: RuntimeError +LayoutTests/fast/sub-pixel/computedstylemargin_t01: RuntimeError +LayoutTests/fast/sub-pixel/block-preferred-widths-with-sub-pixel-floats_t01: RuntimeError +LayoutTests/fast/sub-pixel/auto-table-layout-should-avoid-text-wrapping_t01: RuntimeError +LayoutTests/fast/sub-pixel/float-containing-block-with-margin_t01: RuntimeError +LayoutTests/fast/sub-pixel/replaced-element-baseline_t01: Pass, RuntimeError # Fails on Safari, false pass on others +LayoutTests/fast/selectors/style-sharing-last-child_t01: RuntimeError +LayoutTests/fast/selectors/specificity-overflow_t01: RuntimeError +LayoutTests/fast/scrolling/scroll-element-into-view_t01: RuntimeError +LayoutTests/fast/ruby/parse-rp_t01: RuntimeError +LayoutTests/fast/replaced/table-replaced-element_t01: RuntimeError +LayoutTests/fast/replaced/table-percent-height-text-controls_t01: RuntimeError +LayoutTests/fast/replaced/iframe-with-percentage-height-within-table-with-table-cell-ignore-height_t01: RuntimeError, Pass # Spurious intermittent pass +LayoutTests/fast/replaced/iframe-with-percentage-height-within-table-with-anonymous-table-cell_t01: RuntimeError, Pass # Spurious intermittent pass. +LayoutTests/fast/replaced/computed-image-width-with-percent-height-inside-table-cell-and-fixed-ancestor_t01: RuntimeError, Pass # Spurious intermittent pass +LayoutTests/fast/replaced/computed-image-width-with-percent-height-inside-table-cell-and-fixed-ancestor-vertical-lr_t01: RuntimeError, Pass # Spurious intermittent pass +LayoutTests/fast/replaced/computed-image-width-with-percent-height-and-fixed-ancestor_t01: RuntimeError +LayoutTests/fast/parser/stray-param_t01: RuntimeError +LayoutTests/fast/replaced/available-height-for-content_t01: RuntimeError +LayoutTests/fast/parser/parse-wbr_t01: RuntimeError +LayoutTests/fast/overflow/height-during-simplified-layout_t01: RuntimeError +LayoutTests/fast/overflow/child-100percent-height-inside-fixed-container-with-overflow-auto_t01: RuntimeError +WebPlatformTest/html-imports/link-import-null_t01: RuntimeError +WebPlatformTest/html/syntax/parsing/Document.getElementsByTagName-foreign_t01: RuntimeError +WebPlatformTest/html/syntax/parsing/math-parse_t03: RuntimeError +WebPlatformTest/html/syntax/parsing/math-parse_t01: RuntimeError +WebPlatformTest/html/semantics/document-metadata/styling/LinkStyle_t01: RuntimeError +WebPlatformTest/html/semantics/text-level-semantics/the-a-element/a.text-getter_t01: RuntimeError +WebPlatformTest/html/semantics/selectors/pseudo-classes/disabled_t01: Pass, RuntimeError # Spurious pass +WebPlatformTest/html/semantics/selectors/pseudo-classes/link_t01: RuntimeError +WebPlatformTest/html/semantics/selectors/pseudo-classes/valid-invalid_t01: RuntimeError +WebPlatformTest/html/semantics/selectors/pseudo-classes/focus_t01: RuntimeError +WebPlatformTest/html/semantics/forms/the-input-element/pattern_attribute_t01: RuntimeError +WebPlatformTest/html/semantics/forms/the-form-element/form-nameditem_t01: RuntimeError +WebPlatformTest/html/semantics/disabled-elements/disabledElement_t01: RuntimeError +WebPlatformTest/html/dom/documents/dom-tree-accessors/nameditem_t03: RuntimeError +WebPlatformTest/html/dom/documents/dom-tree-accessors/nameditem_t05: RuntimeError +WebPlatformTest/html/dom/documents/dom-tree-accessors/document.getElementsByName-param_t01: RuntimeError +WebPlatformTest/html/dom/documents/dom-tree-accessors/document.getElementsByName-newelements_t01: RuntimeError +WebPlatformTest/html/dom/documents/dom-tree-accessors/document.getElementsByName-case_t01: RuntimeError +# +# End of Issue 747 +# [ $compiler == dart2js && $runtime == chromeOnAndroid ] Language/12_Expressions/00_Object_Identity/1_Object_Identity_A05_t02: RuntimeError # Please triage this failure. @@ -1018,8 +1181,6 @@ LibTest/html/HttpRequestUpload/onLoadEnd_A01_t01: Skip # Times out. Please triag LibTest/html/HttpRequestUpload/onLoadStart_A01_t01: Skip # Times out. Please triage this failure LibTest/html/HttpRequestUpload/onLoad_A01_t01: Skip # Times out. Please triage this failure LibTest/html/IFrameElement/IFrameElement.created_A01_t01: RuntimeError # Please triage this failure -LibTest/html/IFrameElement/appendHtml_A01_t01: RuntimeError # Please triage this failure -LibTest/html/IFrameElement/appendHtml_A01_t02: RuntimeError # Please triage this failure LibTest/html/IFrameElement/attributeChanged_A01_t01: RuntimeError # Please triage this failure LibTest/html/IFrameElement/attributes_setter_A01_t01: RuntimeError # Please triage this failure LibTest/html/IFrameElement/blur_A01_t01: Skip # Times out. Please triage this failure @@ -2624,8 +2785,6 @@ LibTest/html/HttpRequestUpload/onLoadEnd_A01_t01: Skip # Times out. Please triag LibTest/html/HttpRequestUpload/onLoadStart_A01_t01: Skip # Times out. Please triage this failure LibTest/html/HttpRequestUpload/onLoad_A01_t01: Skip # Times out. Please triage this failure LibTest/html/IFrameElement/IFrameElement.created_A01_t01: RuntimeError # Please triage this failure -LibTest/html/IFrameElement/appendHtml_A01_t01: RuntimeError # Please triage this failure -LibTest/html/IFrameElement/appendHtml_A01_t02: RuntimeError # Please triage this failure LibTest/html/IFrameElement/attributeChanged_A01_t01: RuntimeError # Please triage this failure LibTest/html/IFrameElement/attributes_setter_A01_t01: RuntimeError # Please triage this failure LibTest/html/IFrameElement/blur_A01_t01: Skip # Times out. Please triage this failure @@ -3774,8 +3933,8 @@ LayoutTests/fast/text/find-russian_t01: RuntimeError # Please triage this failur LayoutTests/fast/text/find-soft-hyphen_t01: RuntimeError # Please triage this failure LayoutTests/fast/text/find-spaces_t01: RuntimeError # Please triage this failure LayoutTests/fast/text/font-ligature-letter-spacing_t01: Pass, RuntimeError # Fails on 6.2. Please triage this failure -LayoutTests/fast/text/font-ligatures-linebreak-word_t01: RuntimeError # Please triage this failure -LayoutTests/fast/text/font-ligatures-linebreak_t01: RuntimeError # Please triage this failure +LayoutTests/fast/text/font-ligatures-linebreak-word_t01: Pass, RuntimeError # Please triage this failure +LayoutTests/fast/text/font-ligatures-linebreak_t01: Pass, RuntimeError # Please triage this failure LayoutTests/fast/text/glyph-reordering_t01: Pass, RuntimeError # Fails on 7.1. Please triage this failure LayoutTests/fast/text/international/cjk-segmentation_t01: RuntimeError # Please triage this failure LayoutTests/fast/text/international/iso-8859-8_t01: RuntimeError # Please triage this failure @@ -3904,8 +4063,6 @@ LibTest/html/HttpRequestUpload/onLoadEnd_A01_t01: Skip # Times out. Please triag LibTest/html/HttpRequestUpload/onLoadStart_A01_t01: Skip # Times out. Please triage this failure LibTest/html/HttpRequestUpload/onLoad_A01_t01: Skip # Times out. Please triage this failure LibTest/html/IFrameElement/IFrameElement.created_A01_t01: RuntimeError # Please triage this failure -LibTest/html/IFrameElement/appendHtml_A01_t01: RuntimeError # Please triage this failure -LibTest/html/IFrameElement/appendHtml_A01_t02: RuntimeError # Please triage this failure LibTest/html/IFrameElement/attributeChanged_A01_t01: RuntimeError # Please triage this failure LibTest/html/IFrameElement/attributes_setter_A01_t01: RuntimeError # Please triage this failure LibTest/html/IFrameElement/blur_A01_t01: Skip # Times out. Please triage this failure @@ -5209,8 +5366,6 @@ LibTest/html/HttpRequestUpload/onLoadEnd_A01_t01: Skip # Times out. Please triag LibTest/html/HttpRequestUpload/onLoadStart_A01_t01: Skip # Times out. Please triage this failure LibTest/html/HttpRequestUpload/onLoad_A01_t01: Skip # Times out. Please triage this failure LibTest/html/IFrameElement/IFrameElement.created_A01_t01: RuntimeError # Please triage this failure -LibTest/html/IFrameElement/appendHtml_A01_t01: RuntimeError # Please triage this failure -LibTest/html/IFrameElement/appendHtml_A01_t02: RuntimeError # Please triage this failure LibTest/html/IFrameElement/attributeChanged_A01_t01: RuntimeError # Please triage this failure LibTest/html/IFrameElement/attributes_setter_A01_t01: RuntimeError # Please triage this failure LibTest/html/IFrameElement/blur_A01_t01: Skip # Times out. Please triage this failure @@ -7062,8 +7217,6 @@ LibTest/html/HttpRequestUpload/onLoadStart_A01_t01: Skip # Times out. Please tri LibTest/html/HttpRequestUpload/onLoad_A01_t01: Skip # Times out. Please triage this failure LibTest/html/IFrameElement/IFrameElement.created_A01_t01: RuntimeError # Please triage this failure LibTest/html/IFrameElement/addEventListener_A01_t04: Pass, RuntimeError # Please triage this failure -LibTest/html/IFrameElement/appendHtml_A01_t01: RuntimeError # Please triage this failure -LibTest/html/IFrameElement/appendHtml_A01_t02: RuntimeError # Please triage this failure LibTest/html/IFrameElement/attributeChanged_A01_t01: RuntimeError # Please triage this failure LibTest/html/IFrameElement/attributes_setter_A01_t01: RuntimeError # Please triage this failure LibTest/html/IFrameElement/blur_A01_t01: Skip # Times out. Please triage this failure @@ -9063,8 +9216,6 @@ LibTest/html/HttpRequestUpload/onLoadStart_A01_t01: Skip # Times out. Please tri LibTest/html/HttpRequestUpload/onLoad_A01_t01: Skip # Times out. Please triage this failure LibTest/html/IFrameElement/IFrameElement.created_A01_t01: RuntimeError # Please triage this failure LibTest/html/IFrameElement/addEventListener_A01_t04: Pass, RuntimeError # Please triage this failure -LibTest/html/IFrameElement/appendHtml_A01_t01: RuntimeError # Please triage this failure -LibTest/html/IFrameElement/appendHtml_A01_t02: RuntimeError # Please triage this failure LibTest/html/IFrameElement/attributeChanged_A01_t01: RuntimeError # Please triage this failure LibTest/html/IFrameElement/attributes_setter_A01_t01: RuntimeError # Please triage this failure LibTest/html/IFrameElement/blur_A01_t01: Skip # Times out. Please triage this failure diff --git a/tests/co19/co19-dartium.status b/tests/co19/co19-dartium.status index 80c156ea4e3..7a135945152 100644 --- a/tests/co19/co19-dartium.status +++ b/tests/co19/co19-dartium.status @@ -198,8 +198,8 @@ LibTest/html/HttpRequest/responseType_A01_t01: RuntimeError # co19-roll r706. P LibTest/html/HttpRequest/responseType_A01_t03: RuntimeError # co19-roll r706. Please triage this failure. LibTest/html/HttpRequest/statusText_A01_t01: RuntimeError # co19-roll r706. Please triage this failure. LibTest/html/IFrameElement/IFrameElement.created_A01_t01: RuntimeError # co19-roll r706. Please triage this failure. -LibTest/html/IFrameElement/appendHtml_A01_t01: RuntimeError # co19-roll r706. Please triage this failure. -LibTest/html/IFrameElement/appendHtml_A01_t02: RuntimeError # co19-roll r706. Please triage this failure. +LibTest/html/IFrameElement/appendHtml_A01_t01: RuntimeError # Issue 23462 +LibTest/html/IFrameElement/appendHtml_A01_t02: RuntimeError # Issue 23462 LibTest/html/IFrameElement/attributeChanged_A01_t01: RuntimeError # co19-roll r706. Please triage this failure. LibTest/html/IFrameElement/attributes_setter_A01_t01: RuntimeError # co19-roll r706. Please triage this failure. LibTest/html/IFrameElement/borderEdge_A01_t01: RuntimeError # co19-roll r706. Issue 16574 @@ -915,6 +915,132 @@ LayoutTests/fast/shapes/shape-outside-floats/shape-outside-rounded-boxes_t02: Ru LayoutTests/fast/table/nested-tables-with-div-offset_t01: Pass, RuntimeError # co19-roll r801: Please triage this failure. LayoutTests/fast/dom/getElementsByClassName/011_t01: RuntimeError # Chrome 39 roll. Please triage this failure +# +# Everything below this point is associated with co19 Issue 747 +# +LayoutTests/fast/multicol/balance-unbreakable_t01: RuntimeError +LayoutTests/fast/multicol/fixed-column-percent-logical-height-orthogonal-writing-mode_t01: RuntimeError +LayoutTests/fast/multicol/image-inside-nested-blocks-with-border_t01: RuntimeError +LayoutTests/fast/multicol/inherit-column-values_t01: RuntimeError +LayoutTests/fast/multicol/inline-getclientrects_t01: RuntimeError +LayoutTests/fast/multicol/newmulticol/balance_t01: RuntimeError +LayoutTests/fast/multicol/newmulticol/balance-maxheight_t02: RuntimeError +LayoutTests/fast/multicol/newmulticol/balance_t02: RuntimeError +LayoutTests/fast/multicol/newmulticol/balance_t05: RuntimeError +LayoutTests/fast/multicol/newmulticol/balance_t06: RuntimeError +LayoutTests/fast/multicol/newmulticol/balance_t10: RuntimeError, Pass # I don't understand how, but sometimes passes. +LayoutTests/fast/multicol/vertical-lr/break-properties_t01: RuntimeError +LayoutTests/fast/multicol/orphans-relayout_t01: RuntimeError +LayoutTests/fast/multicol/zeroColumnCount_t01: RuntimeError +LayoutTests/fast/media/media-query-serialization_t01: RuntimeError +LayoutTests/fast/media/color-does-not-include-alpha_t01: RuntimeError +LayoutTests/fast/media/mq-append-delete_t01: RuntimeError +LayoutTests/fast/media/mq-color-index_t02: RuntimeError +LayoutTests/fast/media/mq-js-media-except_t02: RuntimeError +LayoutTests/fast/media/mq-js-media-except_t01: RuntimeError +LayoutTests/fast/media/mq-js-media-except_t03: RuntimeError +LayoutTests/fast/media/mq-js-update-media_t01: RuntimeError +LayoutTests/fast/media/mq-parsing_t01: RuntimeError +LayoutTests/fast/mediastream/RTCPeerConnection-AddRemoveStream_t01: RuntimeError +LayoutTests/fast/loader/local-css-allowed-in-strict-mode_t01: RuntimeError +LayoutTests/fast/lists/marker-preferred-margins_t01: RuntimeError +LayoutTests/fast/lists/item-not-in-list-line-wrapping_t01: RuntimeError +LayoutTests/fast/innerHTML/innerHTML-special-elements_t01: RuntimeError +LayoutTests/fast/inline/fixed-pos-moves-with-abspos-inline-parent_t01: RuntimeError +LayoutTests/fast/inline/fixed-pos-moves-with-abspos-parent-relative-ancestor_t01: RuntimeError +LayoutTests/fast/inline/inline-relative-offset-boundingbox_t01: RuntimeError +LayoutTests/fast/inline/fixed-pos-moves-with-abspos-parent_t01: RuntimeError +LayoutTests/fast/inline/fixed-pos-with-transform-container-moves-with-abspos-parent_t01: RuntimeError +LayoutTests/fast/inline/empty-inline-before-collapsed-space_t01: RuntimeError +LayoutTests/fast/inline/reattach-inlines-in-anonymous-blocks-with-out-of-flow-siblings_t01: RuntimeError +LayoutTests/fast/text/container-align-with-inlines_t01: RuntimeError +LayoutTests/fast/text/font-fallback-synthetic-italics_t01: RuntimeError +LayoutTests/fast/text/international/listbox-width-rtl_t01: RuntimeError +LayoutTests/fast/text/glyph-reordering_t01: Pass # This is a false pass. All the content gets sanitized, so there's nothing to assert fail on. If the code did anything it would fail. +LayoutTests/fast/text/international/rtl-text-wrapping_t01: Pass # This is a false pass. All the content gets sanitized, so there's nothing to assert fail on. If the code did anything it would fail. +LayoutTests/fast/text/line-break-after-empty-inline-hebrew_t01: RuntimeError +LayoutTests/fast/text/line-break-after-inline-latin1_t01: RuntimeError +LayoutTests/fast/text/line-breaks-after-closing-punctuations_t01: RuntimeError +LayoutTests/fast/text/line-breaks-after-hyphen-before-number_t01: RuntimeError +LayoutTests/fast/text/line-breaks-after-ideographic-comma-or-full-stop_t01: RuntimeError +LayoutTests/fast/text-autosizing/inline-width_t01: RuntimeError +LayoutTests/fast/text-autosizing/text-removal_t01: RuntimeError +LayoutTests/fast/text-autosizing/table-inline-width_t01: RuntimeError +LayoutTests/fast/text/container-align-with-inlines_t01: RuntimeError +LayoutTests/fast/text/font-fallback-synthetic-italics_t01: RuntimeError +LayoutTests/fast/text/pre-wrap-trailing-tab_t01: RuntimeError +LayoutTests/fast/text-autosizing/display-type-change-lineHeight_t01: RuntimeError +LayoutTests/fast/url/trivial_t01: RuntimeError +LayoutTests/fast/url/trivial-segments_t01: RuntimeError +LayoutTests/fast/url/scheme_t01: RuntimeError +LayoutTests/fast/url/host-lowercase-per-scheme_t01: RuntimeError +LayoutTests/fast/url/safari-extension_t01: RuntimeError +LayoutTests/fast/url/safari-extension_t01: RuntimeError +LayoutTests/fast/url/port_t01: RuntimeError +LayoutTests/fast/url/mailto_t01: RuntimeError +LayoutTests/fast/url/path-url_t01: RuntimeError +LayoutTests/fast/url/anchor_t01: RuntimeError +LayoutTests/fast/writing-mode/auto-margins-across-boundaries_t01: RuntimeError +LayoutTests/fast/writing-mode/display-mutation_t01: RuntimeError +LayoutTests/fast/writing-mode/percentage-padding_t01: RuntimeError +LayoutTests/fast/writing-mode/relative-positioning-percentages_t01: RuntimeError +LayoutTests/fast/writing-mode/block-formatting-context_t01: RuntimeError +LayoutTests/fast/html/adjacent-html-context-element_t01:RuntimeError +LayoutTests/fast/canvas/canvas-transforms-fillRect-shadow_t01: RuntimeError +LayoutTests/fast/dom/HTMLElement/insertAdjacentHTML-errors_t01: RuntimeError +LayoutTests/fast/transforms/transform-inside-overflow-scroll_t01: RuntimeError +LayoutTests/fast/transforms/transform-hit-test-flipped_t01: RuntimeError +LayoutTests/fast/transforms/scrollIntoView-transformed_t01: RuntimeError +LayoutTests/fast/transforms/bounding-rect-zoom_t01: RuntimeError, Pass # Erratic, but only passes because divs have been entirely removed. +LayoutTests/fast/transforms/topmost-becomes-bottomost-for-scrolling_t01: RuntimeError +LayoutTests/fast/table/table-width-exceeding-max-width_t01: RuntimeError +LayoutTests/fast/table/table-size-integer-overflow_t01: RuntimeError +LayoutTests/fast/table/table-sections-border-spacing_t01: RuntimeError +LayoutTests/fast/table/switch-table-layout_t01: RuntimeError +LayoutTests/fast/table/switch-table-layout-multiple-section_t01: RuntimeError +LayoutTests/fast/table/switch-table-layout-dynamic-cells_t01: RuntimeError +LayoutTests/fast/table/resize-table-row_t01: RuntimeError +LayoutTests/fast/table/resize-table-cell_t01: RuntimeError +LayoutTests/fast/table/resize-table-binding-cell_t01: RuntimeError +LayoutTests/fast/table/min-max-width-preferred-size_t01: RuntimeError +LayoutTests/fast/table/margins-flipped-text-direction_t01: RuntimeError +LayoutTests/fast/table/html-table-width-max-width-constrained_t01: RuntimeError +LayoutTests/fast/table/fixed-table-layout-width-change_t01: RuntimeError +LayoutTests/fast/table/fixed-table-with-percent-width-inside-extra-large-div_t01: RuntimeError +LayoutTests/fast/table/absolute-table-percent-lengths_t01: RuntimeError +LayoutTests/fast/svg/whitespace-length_t01: RuntimeError +LayoutTests/fast/svg/whitespace-number_t01: RuntimeError +LayoutTests/fast/svg/whitespace-length-invalid_t01: RuntimeError +LayoutTests/fast/svg/whitespace-angle_t01: RuntimeError +LayoutTests/fast/svg/tabindex-focus_t01: RuntimeError +LayoutTests/fast/svg/whitespace-integer_t01: RuntimeError +LayoutTests/fast/sub-pixel/shadows-computed-style_t01: RuntimeError +LayoutTests/fast/sub-pixel/tiled-canvas-elements_t01: RuntimeError +LayoutTests/fast/sub-pixel/float-list-inside_t01: RuntimeError +LayoutTests/fast/sub-pixel/float-with-margin-in-container_t01: RuntimeError +LayoutTests/fast/sub-pixel/float-percentage-widths_t01: RuntimeError +LayoutTests/fast/sub-pixel/computedstylemargin_t01: RuntimeError +LayoutTests/fast/sub-pixel/block-preferred-widths-with-sub-pixel-floats_t01: RuntimeError +LayoutTests/fast/sub-pixel/auto-table-layout-should-avoid-text-wrapping_t01: RuntimeError +LayoutTests/fast/selectors/style-sharing-last-child_t01: RuntimeError +LayoutTests/fast/selectors/specificity-overflow_t01: RuntimeError +LayoutTests/fast/scrolling/scroll-element-into-view_t01: RuntimeError +LayoutTests/fast/ruby/parse-rp_t01: RuntimeError +LayoutTests/fast/replaced/table-replaced-element_t01: RuntimeError +LayoutTests/fast/replaced/table-percent-height-text-controls_t01: RuntimeError +LayoutTests/fast/replaced/iframe-with-percentage-height-within-table-with-table-cell-ignore-height_t01: RuntimeError, Pass # Spurious intermittent pass +LayoutTests/fast/replaced/iframe-with-percentage-height-within-table-with-anonymous-table-cell_t01: RuntimeError, Pass # Spurious intermittent pass. +LayoutTests/fast/replaced/computed-image-width-with-percent-height-inside-table-cell-and-fixed-ancestor_t01: RuntimeError, Pass # Spurious intermittent pass +LayoutTests/fast/replaced/computed-image-width-with-percent-height-inside-table-cell-and-fixed-ancestor-vertical-lr_t01: RuntimeError, Pass # Spurious intermittent pass +LayoutTests/fast/replaced/computed-image-width-with-percent-height-and-fixed-ancestor_t01: RuntimeError +LayoutTests/fast/parser/stray-param_t01: RuntimeError +LayoutTests/fast/replaced/available-height-for-content_t01: RuntimeError +LayoutTests/fast/parser/parse-wbr_t01: RuntimeError +LayoutTests/fast/overflow/height-during-simplified-layout_t01: RuntimeError +LayoutTests/fast/overflow/child-100percent-height-inside-fixed-container-with-overflow-auto_t01: RuntimeError +# +# End of Issue 747 +# [ $compiler == none && ($runtime == dartium || $runtime == ContentShellOnAndroid ) && $checked ] LayoutTests/fast/html/article-element_t01: RuntimeError # co19-roll r706. Please triage this failure. diff --git a/tests/html/node_validator_important_if_you_suppress_make_the_bug_critical_test.dart b/tests/html/node_validator_important_if_you_suppress_make_the_bug_critical_test.dart index cb0196d7393..4a5fe71550f 100644 --- a/tests/html/node_validator_important_if_you_suppress_make_the_bug_critical_test.dart +++ b/tests/html/node_validator_important_if_you_suppress_make_the_bug_critical_test.dart @@ -137,6 +137,24 @@ main() { validateNodeTree(template.content, expectedContent); }); + + test("appendHtml is sanitized", () { + var html = '
'; + document.body.appendHtml('
'); + var stuff = document.querySelector("#stuff"); + stuff.appendHtml(html); + expect(stuff.childNodes.length, 1); + stuff.remove(); + }); + + test("documentFragment.appendHtml is sanitized", () { + var html = '
'); + expect(fragment.childNodes.length, 1); + expect(fragment.childNodes[0].id, "bad"); + expect(fragment.childNodes[0].childNodes.length, 0); + }); }); group('URI_sanitization', () { diff --git a/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate b/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate index e401956c9ee..d533e49c52d 100644 --- a/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate +++ b/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate @@ -93,8 +93,10 @@ $endif * Parses the specified text as HTML and adds the resulting node after the * last child of this document fragment. */ - void appendHtml(String text) { - this.append(new DocumentFragment.html(text)); + void appendHtml(String text, {NodeValidator validator, + NodeTreeSanitizer, treeSanitizer}) { + this.append(new DocumentFragment.html(text, validator: validator, + treeSanitizer: treeSanitizer)); } /** diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate index d18eb4b94f7..6e3bac117b4 100644 --- a/tools/dom/templates/html/impl/impl_Element.darttemplate +++ b/tools/dom/templates/html/impl/impl_Element.darttemplate @@ -727,8 +727,10 @@ $(ANNOTATIONS)$(NATIVESPEC)abstract class $CLASSNAME$EXTENDS$IMPLEMENTS { * Parses the specified text as HTML and adds the resulting node after the * last child of this element. */ - void appendHtml(String text) { - this.insertAdjacentHtml('beforeend', text); + void appendHtml(String text, {NodeValidator validator, + NodeTreeSanitizer treeSanitizer}) { + this.insertAdjacentHtml('beforeend', text, validator: validator, + treeSanitizer: treeSanitizer); } /** @@ -1007,12 +1009,10 @@ $if DART2JS * * [insertAdjacentText] * * [insertAdjacentElement] */ - void insertAdjacentHtml(String where, String html) { - if (JS('bool', '!!#.insertAdjacentHTML', this)) { - _insertAdjacentHtml(where, html); - } else { - _insertAdjacentNode(where, new DocumentFragment.html(html)); - } + void insertAdjacentHtml(String where, String html, {NodeValidator validator, + NodeTreeSanitizer treeSanitizer}) { + _insertAdjacentNode(where, new DocumentFragment.html(html, + validator: validator, treeSanitizer: treeSanitizer)); } @JSName('insertAdjacentHTML') diff --git a/tools/dom/templates/html/impl/impl_SVGElement.darttemplate b/tools/dom/templates/html/impl/impl_SVGElement.darttemplate index dd235bc685f..378dec8a2a3 100644 --- a/tools/dom/templates/html/impl/impl_SVGElement.darttemplate +++ b/tools/dom/templates/html/impl/impl_SVGElement.darttemplate @@ -115,11 +115,12 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS } @DomName('Element.insertAdjacentHTML') - void insertAdjacentHtml(String where, String text) { + void insertAdjacentHtml(String where, String text, {NodeValidator validator, + NodeTreeSanitizer treeSanitizer}) { throw new UnsupportedError("Cannot invoke insertAdjacentHtml on SVG."); } - @DomName('Element.insertAdjacentHTML') + @DomName('Element.insertAdjacentElement') Element insertAdjacentElement(String where, Element element) { throw new UnsupportedError("Cannot invoke insertAdjacentElement on SVG."); }