From 3f6d9fab7910c54584c67c71ce9d5bbe52cd4d82 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Thu, 3 Dec 2020 23:03:20 +0000 Subject: [PATCH] Bug 1679091 [wpt PR 26631] - Remove setInnerHTML completely, a=testonly Automatic update from web-platform-tests Remove setInnerHTML completely The conversation [1] about the recent changes to setInnerHTML have led to the conclusion [2] that perhaps we shouldn't add a new XSS sink method at all. That would "fix" the declarative Shadow DOM problem, but would create a new sink that all security libraries would need to know about and handle. Seems like not a good trade. In the meantime, a polyfill can stand in for setInnerHTML: Element.prototype.setInnerHTML = function(content) { const fragment = (new DOMParser()).parseFromString(`
${content}
`, 'text/html', {includeShadowRoots: true}); this.replaceChildren(...fragment.body.firstChild.childNodes); }; [1] https://github.com/whatwg/dom/issues/912 [2] https://github.com/whatwg/dom/issues/912#issuecomment-732476002 Bug: 1042130 Change-Id: Ibaf15a3edf86be9a720225dea2ba2741f2882b8c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2555589 Auto-Submit: Mason Freed Commit-Queue: Kouhei Ueno Reviewed-by: Kouhei Ueno Cr-Commit-Position: refs/heads/master{#830501} -- wpt-commits: 60d87a5d19f5cf033f96b26f9597b32ad2732792 wpt-pr: 26631 UltraBlame original commit: 1046b32a6c9d31383f782745ed88a9d1fd4bc71e --- ...ative-shadow-dom-attachment.tentative.html | 3 +- ...eclarative-shadow-dom-basic.tentative.html | 35 +++++------- ...clarative-shadow-dom-opt-in.tentative.html | 57 +++++++------------ .../declarative/setinnerhtml.tentative.html | 48 ---------------- .../shadow-dom/declarative/support/helpers.js | 4 ++ 5 files changed, 39 insertions(+), 108 deletions(-) delete mode 100644 testing/web-platform/tests/shadow-dom/declarative/setinnerhtml.tentative.html create mode 100644 testing/web-platform/tests/shadow-dom/declarative/support/helpers.js diff --git a/testing/web-platform/tests/shadow-dom/declarative/declarative-shadow-dom-attachment.tentative.html b/testing/web-platform/tests/shadow-dom/declarative/declarative-shadow-dom-attachment.tentative.html index c4a35d341c1f6..b9033f5992422 100644 --- a/testing/web-platform/tests/shadow-dom/declarative/declarative-shadow-dom-attachment.tentative.html +++ b/testing/web-platform/tests/shadow-dom/declarative/declarative-shadow-dom-attachment.tentative.html @@ -5,6 +5,7 @@ + +