diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations index ea55ac1d642f4..6abff9fd0f83e 100644 --- a/LayoutTests/TestExpectations +++ b/LayoutTests/TestExpectations @@ -5483,13 +5483,14 @@ webkit.org/b/261849 imported/w3c/web-platform-tests/css/css-scroll-anchoring/zer webkit.org/b/261849 imported/w3c/web-platform-tests/css/css-scroll-anchoring/start-edge-in-block-layout-direction.html [ Skip ] # Trusted Types aren't fully implemented yet -webkit.org/b/266630 imported/w3c/web-platform-tests/trusted-types/trusted-types-event-handlers.html [ Skip ] webkit.org/b/266630 imported/w3c/web-platform-tests/trusted-types/WorkerGlobalScope-eval.html [ Skip ] webkit.org/b/266630 imported/w3c/web-platform-tests/trusted-types/trusted-types-reporting.html [ Skip ] webkit.org/b/266630 imported/w3c/web-platform-tests/trusted-types/trusted-types-svg-script.html [ Skip ] webkit.org/b/266630 imported/w3c/web-platform-tests/trusted-types/trusted-types-eval-reporting-no-unsafe-eval.html [ Skip ] webkit.org/b/266630 imported/w3c/web-platform-tests/trusted-types/trusted-types-eval-reporting-report-only.html [ Skip ] webkit.org/b/266630 imported/w3c/web-platform-tests/trusted-types/WorkerGlobalScope-importScripts.html [ Pass Failure ] +webkit.org/b/266630 imported/w3c/web-platform-tests/trusted-types/trusted-types-navigation.html [ Pass Failure ] +webkit.org/b/274088 imported/w3c/web-platform-tests/trusted-types/Element-setAttribute-respects-Elements-node-documents-globals-CSP.html [ Pass Failure ] # These tests are image failures imported/w3c/web-platform-tests/css/css-scroll-anchoring/vertical-rl-viewport-size-change-000.html [ Skip ] diff --git a/LayoutTests/imported/w3c/web-platform-tests/trusted-types/Element-setAttribute-respects-Elements-node-documents-globals-CSP-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/trusted-types/Element-setAttribute-respects-Elements-node-documents-globals-CSP-expected.txt index 378e92e1902d5..030c4a0a472e8 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/trusted-types/Element-setAttribute-respects-Elements-node-documents-globals-CSP-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/trusted-types/Element-setAttribute-respects-Elements-node-documents-globals-CSP-expected.txt @@ -1,20 +1,20 @@ +CONSOLE MESSAGE: This requires a TrustedScriptURL value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScriptURL value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScriptURL value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScriptURL value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedHTML value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedHTML value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScriptURL value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScriptURL value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" -FAIL setAttribute and setAttributeNode respect the element's node document's global's CSP; - Element=iframe; Parent=div; Attribute=srcdoc assert_throws_js: function "() => { - sourceElement.setAttributeNode(sourceAttr); - }" did not throw -FAIL setAttribute and setAttributeNode respect the element's node document's global's CSP; - Element=script; Parent=div; Attribute=src assert_throws_js: function "() => { - sourceElement.setAttributeNode(sourceAttr); - }" did not throw -FAIL setAttribute and setAttributeNode respect the element's node document's global's CSP; - Element=script; Parent=svg; Attribute=href assert_throws_js: function "() => { - sourceElement.setAttributeNode(sourceAttr); - }" did not throw -FAIL setAttribute and setAttributeNode respect the element's node document's global's CSP; - Element=script; Parent=svg; Attribute=xlink:href assert_throws_js: function "() => { - sourceElement.setAttributeNode(sourceAttr); - }" did not throw +PASS setAttribute and setAttributeNode respect the element's node document's global's CSP; + Element=iframe; Parent=div; Attribute=srcdoc +PASS setAttribute and setAttributeNode respect the element's node document's global's CSP; + Element=script; Parent=div; Attribute=src +PASS setAttribute and setAttributeNode respect the element's node document's global's CSP; + Element=script; Parent=svg; Attribute=href +PASS setAttribute and setAttributeNode respect the element's node document's global's CSP; + Element=script; Parent=svg; Attribute=xlink:href diff --git a/LayoutTests/imported/w3c/web-platform-tests/trusted-types/GlobalEventHandlers-onclick-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/trusted-types/GlobalEventHandlers-onclick-expected.txt index f0b6f972b0635..3b7760f528a13 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/trusted-types/GlobalEventHandlers-onclick-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/trusted-types/GlobalEventHandlers-onclick-expected.txt @@ -1,5 +1,7 @@ +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" PASS a.setAttribte('onclick') sets a trusted script. -FAIL a.setAttribute('onclick') sets an unsuitable trusted type. assert_unreached: Reached unreachable code -FAIL a.setAttribute('click') sets a test string. assert_unreached: Reached unreachable code +PASS a.setAttribute('onclick') sets an unsuitable trusted type. +PASS a.setAttribute('click') sets a test string. diff --git a/LayoutTests/imported/w3c/web-platform-tests/trusted-types/TrustedTypePolicyFactory-metadata.tentative-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/trusted-types/TrustedTypePolicyFactory-metadata.tentative-expected.txt index 2690bb581351d..421dca36deb82 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/trusted-types/TrustedTypePolicyFactory-metadata.tentative-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/trusted-types/TrustedTypePolicyFactory-metadata.tentative-expected.txt @@ -1,3 +1,15 @@ +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" PASS Test assignment of string on madeup.madeup PASS Test assignment of string on madeup.setAttribute(madeup,..) @@ -16,21 +28,21 @@ PASS Test assignment of TrustedScript on madeup.setAttribute(id,..) PASS Test assignment of TrustedScriptURL on madeup.id PASS Test assignment of TrustedScriptURL on madeup.setAttribute(id,..) PASS Test assignment of string on madeup.onerror -FAIL Test assignment of string on madeup.setAttribute(onerror,..) assert_throws_js: throws function "_ => { element.setAttribute(property, value); }" did not throw +PASS Test assignment of string on madeup.setAttribute(onerror,..) PASS Test assignment of TrustedHTML on madeup.onerror -FAIL Test assignment of TrustedHTML on madeup.setAttribute(onerror,..) assert_throws_js: throws function "_ => { element.setAttribute(property, value); }" did not throw +PASS Test assignment of TrustedHTML on madeup.setAttribute(onerror,..) PASS Test assignment of TrustedScript on madeup.onerror PASS Test assignment of TrustedScript on madeup.setAttribute(onerror,..) PASS Test assignment of TrustedScriptURL on madeup.onerror -FAIL Test assignment of TrustedScriptURL on madeup.setAttribute(onerror,..) assert_throws_js: throws function "_ => { element.setAttribute(property, value); }" did not throw +PASS Test assignment of TrustedScriptURL on madeup.setAttribute(onerror,..) PASS Test assignment of string on madeup.onclick -FAIL Test assignment of string on madeup.setAttribute(onclick,..) assert_throws_js: throws function "_ => { element.setAttribute(property, value); }" did not throw +PASS Test assignment of string on madeup.setAttribute(onclick,..) PASS Test assignment of TrustedHTML on madeup.onclick -FAIL Test assignment of TrustedHTML on madeup.setAttribute(onclick,..) assert_throws_js: throws function "_ => { element.setAttribute(property, value); }" did not throw +PASS Test assignment of TrustedHTML on madeup.setAttribute(onclick,..) PASS Test assignment of TrustedScript on madeup.onclick PASS Test assignment of TrustedScript on madeup.setAttribute(onclick,..) PASS Test assignment of TrustedScriptURL on madeup.onclick -FAIL Test assignment of TrustedScriptURL on madeup.setAttribute(onclick,..) assert_throws_js: throws function "_ => { element.setAttribute(property, value); }" did not throw +PASS Test assignment of TrustedScriptURL on madeup.setAttribute(onclick,..) PASS Test assignment of string on b.madeup PASS Test assignment of string on b.setAttribute(madeup,..) PASS Test assignment of TrustedHTML on b.madeup @@ -48,19 +60,19 @@ PASS Test assignment of TrustedScript on b.setAttribute(id,..) PASS Test assignment of TrustedScriptURL on b.id PASS Test assignment of TrustedScriptURL on b.setAttribute(id,..) PASS Test assignment of string on b.onerror -FAIL Test assignment of string on b.setAttribute(onerror,..) assert_throws_js: throws function "_ => { element.setAttribute(property, value); }" did not throw +PASS Test assignment of string on b.setAttribute(onerror,..) PASS Test assignment of TrustedHTML on b.onerror -FAIL Test assignment of TrustedHTML on b.setAttribute(onerror,..) assert_throws_js: throws function "_ => { element.setAttribute(property, value); }" did not throw +PASS Test assignment of TrustedHTML on b.setAttribute(onerror,..) PASS Test assignment of TrustedScript on b.onerror PASS Test assignment of TrustedScript on b.setAttribute(onerror,..) PASS Test assignment of TrustedScriptURL on b.onerror -FAIL Test assignment of TrustedScriptURL on b.setAttribute(onerror,..) assert_throws_js: throws function "_ => { element.setAttribute(property, value); }" did not throw +PASS Test assignment of TrustedScriptURL on b.setAttribute(onerror,..) PASS Test assignment of string on b.onclick -FAIL Test assignment of string on b.setAttribute(onclick,..) assert_throws_js: throws function "_ => { element.setAttribute(property, value); }" did not throw +PASS Test assignment of string on b.setAttribute(onclick,..) PASS Test assignment of TrustedHTML on b.onclick -FAIL Test assignment of TrustedHTML on b.setAttribute(onclick,..) assert_throws_js: throws function "_ => { element.setAttribute(property, value); }" did not throw +PASS Test assignment of TrustedHTML on b.setAttribute(onclick,..) PASS Test assignment of TrustedScript on b.onclick PASS Test assignment of TrustedScript on b.setAttribute(onclick,..) PASS Test assignment of TrustedScriptURL on b.onclick -FAIL Test assignment of TrustedScriptURL on b.setAttribute(onclick,..) assert_throws_js: throws function "_ => { element.setAttribute(property, value); }" did not throw +PASS Test assignment of TrustedScriptURL on b.setAttribute(onclick,..) diff --git a/LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Element-setAttribute-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Element-setAttribute-expected.txt index c0a84bce73abf..92bb7cb7aa16c 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Element-setAttribute-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Element-setAttribute-expected.txt @@ -1,23 +1,24 @@ +CONSOLE MESSAGE: This requires a TrustedScriptURL value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScriptURL value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScriptURL value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedHTML value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedHTML value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedHTML value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScriptURL value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" -FAIL script.src accepts only TrustedScriptURL assert_throws_js: function "_ => { - elem.setAttribute(attribute, value); - }" did not throw -FAIL iframe.srcdoc accepts only TrustedHTML assert_throws_js: function "_ => { - elem.setAttribute(attribute, value); - }" did not throw -FAIL div.onclick accepts only TrustedScript assert_throws_js: function "_ => { - elem.setAttribute(attribute, value); - }" did not throw -FAIL `Script.prototype.setAttribute.SrC = string` throws. assert_throws_js: function "_ => { - el.setAttribute('SrC', INPUTS.URL); - }" did not throw +PASS script.src accepts only TrustedScriptURL +PASS iframe.srcdoc accepts only TrustedHTML +PASS div.onclick accepts only TrustedScript +PASS `Script.prototype.setAttribute.SrC = string` throws. PASS script.src accepts string and null after default policy was created. -FAIL script.src's mutationobservers receive the default policy's value. assert_equals: expected "http://this.is.a.successful.test/" but got "http://this.is.a.scripturl.test/" -FAIL iframe.srcdoc's mutationobservers receive the default policy's value. assert_equals: expected "Quack, I want to be a duck!" but got "Hi, I want to be transformed!" -FAIL div.onclick's mutationobservers receive the default policy's value. assert_equals: expected "Meow, I want to be a cat!" but got "Hi, I want to be transformed!" +PASS script.src's mutationobservers receive the default policy's value. +PASS iframe.srcdoc's mutationobservers receive the default policy's value. +PASS div.onclick's mutationobservers receive the default policy's value. PASS iframe.srcdoc accepts string and null after default policy was created. -FAIL div.onclick accepts string and null after default policy was created. assert_equals: expected "Meow, I want to be a cat!" but got "Hi, I want to be transformed!" +PASS div.onclick accepts string and null after default policy was created. PASS a.rel accepts strings PASS a.rel accepts null -FAIL `script.src = setAttributeNode(embed.src)` with string works. assert_equals: expected "http://this.is.a.successful.test/" but got "http://this.is.a.scripturl.test/" +PASS `script.src = setAttributeNode(embed.src)` with string works. diff --git a/LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Element-setAttributeNS-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Element-setAttributeNS-expected.txt index 2e26a6785b989..0f96720e08709 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Element-setAttributeNS-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Element-setAttributeNS-expected.txt @@ -1,3 +1,7 @@ +CONSOLE MESSAGE: This requires a TrustedScriptURL value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScriptURL value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScriptURL value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScriptURL value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" PASS Element.setAttributeNS assigned via policy (successful HTML transformation) PASS Element.setAttributeNS assigned via policy (successful Script transformation) @@ -5,9 +9,7 @@ PASS Element.setAttributeNS assigned via policy (successful ScriptURL transforma PASS Element.setAttributeNS accepts untrusted string for non-specced accessor PASS Element.setAttributeNS accepts null for non-specced accessor PASS Assigning TrustedScriptURL to works -FAIL Blocking non-TrustedScriptURL assignment to works assert_throws_js: function "_ => { - elem.setAttributeNS(xlinkNamespace, "href", v); - }" did not throw +PASS Blocking non-TrustedScriptURL assignment to works PASS Check `setAttributeNS` allows setting non-trusted string for non-lowercase attribute "SRCDOC" (ns=null) for "iframe" element (ns=http://www.w3.org/1999/xhtml). PASS Check `setAttributeNS` allows setting non-trusted string for non-lowercase attribute "SRC" (ns=null) for "script" element (ns=http://www.w3.org/1999/xhtml). PASS Check `setAttributeNS` allows setting non-trusted string for non-lowercase attribute "HREF" (ns=null) for "script" element (ns=http://www.w3.org/2000/svg). diff --git a/LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-event-handlers-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-event-handlers-expected.txt index d740b3cb53834..5730a75631dd7 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-event-handlers-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-event-handlers-expected.txt @@ -1,11 +1,104 @@ -CONSOLE MESSAGE: Unrecognized Content-Security-Policy directive 'require-trusted-types-for'. +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScript value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" - -FAIL Event handler onclick should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler onchange should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler onfocus should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler oNclick should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler OnClIcK should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw +PASS Event handler onclick should be blocked. +PASS Event handler onchange should be blocked. +PASS Event handler onfocus should be blocked. +PASS Event handler oNclick should be blocked. +PASS Event handler OnClIcK should be blocked. PASS Non-event handler one should not be blocked. PASS Non-event handler oNe should not be blocked. PASS Non-event handler onIcon should not be blocked. @@ -13,315 +106,99 @@ PASS Non-event handler offIcon should not be blocked. PASS Non-event handler blubb should not be blocked. PASS Non-event handler div.align should not be blocked. PASS Non-event handler div.title should not be blocked. -PASS Non-event handler div.lang should not be blocked. -PASS Non-event handler div.translate should not be blocked. -PASS Non-event handler div.dir should not be blocked. -PASS Non-event handler div.cue should not be blocked. -PASS Non-event handler div.cuebackground should not be blocked. -PASS Non-event handler div.hidden should not be blocked. -PASS Non-event handler div.accessKey should not be blocked. -PASS Non-event handler div.accessKeyLabel should not be blocked. PASS Non-event handler div.draggable should not be blocked. -PASS Non-event handler div.spellcheck should not be blocked. -PASS Non-event handler div.innerText should not be blocked. PASS Non-event handler div.inert should not be blocked. -PASS Non-event handler div.popover should not be blocked. -PASS Non-event handler div.outerText should not be blocked. -PASS Non-event handler div.autocorrect should not be blocked. -PASS Non-event handler div.webkitdropzone should not be blocked. -PASS Non-event handler div.style should not be blocked. -PASS Non-event handler div.attributeStyleMap should not be blocked. -PASS Non-event handler div.contentEditable should not be blocked. -PASS Non-event handler div.enterKeyHint should not be blocked. -PASS Non-event handler div.isContentEditable should not be blocked. -PASS Non-event handler div.inputMode should not be blocked. -FAIL Event handler div.onabort should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onbeforetoggle should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onblur should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.oncancel should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.oncanplay should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.oncanplaythrough should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onchange should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onclick should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onclose should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.oncontentvisibilityautostatechange should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.oncontextmenu should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.oncopy should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw +PASS Event handler div.onabort should be blocked. +PASS Event handler div.onbeforetoggle should be blocked. +PASS Event handler div.onblur should be blocked. +PASS Event handler div.oncancel should be blocked. +PASS Event handler div.oncanplay should be blocked. +PASS Event handler div.oncanplaythrough should be blocked. +PASS Event handler div.onchange should be blocked. +PASS Event handler div.onclick should be blocked. +PASS Event handler div.onclose should be blocked. +PASS Event handler div.oncontentvisibilityautostatechange should be blocked. +PASS Event handler div.oncontextmenu should be blocked. +PASS Event handler div.oncopy should be blocked. FAIL Event handler div.oncuechange should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.oncut should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.ondblclick should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.ondrag should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.ondragend should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.ondragenter should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.ondragleave should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.ondragover should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.ondragstart should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.ondrop should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.ondurationchange should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onemptied should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onended should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onerror should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onfocus should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onformdata should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.oninput should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.oninvalid should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onkeydown should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onkeypress should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onkeyup should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onload should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onloadeddata should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onloadedmetadata should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onloadstart should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onmousedown should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onmouseenter should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onmouseleave should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onmousemove should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onmouseout should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onmouseover should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onmouseup should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onpaste should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onpause should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onplay should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onplaying should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onprogress should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onratechange should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onreset should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onresize should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onscroll should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onsecuritypolicyviolation should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onseeked should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onseeking should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onselect should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onslotchange should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onstalled should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onsubmit should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onsuspend should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.ontimeupdate should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.ontoggle should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onvolumechange should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onwaiting should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onwebkitanimationend should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onwebkitanimationiteration should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onwebkitanimationstart should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onwebkittransitionend should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onwheel should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onmousewheel should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onanimationstart should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onanimationiteration should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onanimationend should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onanimationcancel should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.ontransitionrun should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.ontransitionstart should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.ontransitionend should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.ontransitioncancel should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.ongotpointercapture should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onlostpointercapture should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onpointerdown should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onpointermove should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onpointerup should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onpointercancel should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onpointerover should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onpointerout should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onpointerenter should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onpointerleave should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onselectstart should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -FAIL Event handler div.onselectionchange should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -PASS Non-event handler div.offsetParent should not be blocked. -PASS Non-event handler div.offsetTop should not be blocked. -PASS Non-event handler div.offsetLeft should not be blocked. -PASS Non-event handler div.offsetWidth should not be blocked. -PASS Non-event handler div.offsetHeight should not be blocked. -PASS Non-event handler div.dataset should not be blocked. -PASS Non-event handler div.nonce should not be blocked. -PASS Non-event handler div.autofocus should not be blocked. -PASS Non-event handler div.tabIndex should not be blocked. -PASS Non-event handler div.click should not be blocked. -PASS Non-event handler div.attachInternals should not be blocked. -PASS Non-event handler div.showPopover should not be blocked. -PASS Non-event handler div.hidePopover should not be blocked. -PASS Non-event handler div.togglePopover should not be blocked. -PASS Non-event handler div.focus should not be blocked. -PASS Non-event handler div.blur should not be blocked. -PASS Non-event handler div.namespaceURI should not be blocked. -PASS Non-event handler div.prefix should not be blocked. -PASS Non-event handler div.localName should not be blocked. -PASS Non-event handler div.tagName should not be blocked. -PASS Non-event handler div.id should not be blocked. -PASS Non-event handler div.className should not be blocked. -PASS Non-event handler div.classList should not be blocked. -PASS Non-event handler div.slot should not be blocked. -PASS Non-event handler div.part should not be blocked. -PASS Non-event handler div.attributes should not be blocked. -PASS Non-event handler div.shadowRoot should not be blocked. -PASS Non-event handler div.role should not be blocked. -PASS Non-event handler div.ariaActiveDescendantElement should not be blocked. -PASS Non-event handler div.ariaAtomic should not be blocked. -PASS Non-event handler div.ariaAutoComplete should not be blocked. -PASS Non-event handler div.ariaBusy should not be blocked. -PASS Non-event handler div.ariaChecked should not be blocked. -PASS Non-event handler div.ariaColCount should not be blocked. -PASS Non-event handler div.ariaColIndex should not be blocked. -PASS Non-event handler div.ariaColSpan should not be blocked. -PASS Non-event handler div.ariaControlsElements should not be blocked. -PASS Non-event handler div.ariaCurrent should not be blocked. -PASS Non-event handler div.ariaDescribedByElements should not be blocked. -PASS Non-event handler div.ariaDescription should not be blocked. -PASS Non-event handler div.ariaDetailsElements should not be blocked. -PASS Non-event handler div.ariaDisabled should not be blocked. -PASS Non-event handler div.ariaErrorMessageElements should not be blocked. -PASS Non-event handler div.ariaExpanded should not be blocked. -PASS Non-event handler div.ariaFlowToElements should not be blocked. -PASS Non-event handler div.ariaHasPopup should not be blocked. -PASS Non-event handler div.ariaHidden should not be blocked. -PASS Non-event handler div.ariaInvalid should not be blocked. -PASS Non-event handler div.ariaKeyShortcuts should not be blocked. -PASS Non-event handler div.ariaLabel should not be blocked. -PASS Non-event handler div.ariaLabelledByElements should not be blocked. -PASS Non-event handler div.ariaLevel should not be blocked. -PASS Non-event handler div.ariaLive should not be blocked. -PASS Non-event handler div.ariaModal should not be blocked. -PASS Non-event handler div.ariaMultiLine should not be blocked. -PASS Non-event handler div.ariaMultiSelectable should not be blocked. -PASS Non-event handler div.ariaOrientation should not be blocked. -PASS Non-event handler div.ariaOwnsElements should not be blocked. -PASS Non-event handler div.ariaPlaceholder should not be blocked. -PASS Non-event handler div.ariaPosInSet should not be blocked. -PASS Non-event handler div.ariaPressed should not be blocked. -PASS Non-event handler div.ariaReadOnly should not be blocked. -PASS Non-event handler div.ariaRelevant should not be blocked. -PASS Non-event handler div.ariaRequired should not be blocked. -PASS Non-event handler div.ariaRoleDescription should not be blocked. -PASS Non-event handler div.ariaRowCount should not be blocked. -PASS Non-event handler div.ariaRowIndex should not be blocked. -PASS Non-event handler div.ariaRowSpan should not be blocked. -PASS Non-event handler div.ariaSelected should not be blocked. -PASS Non-event handler div.ariaSetSize should not be blocked. -PASS Non-event handler div.ariaSort should not be blocked. -PASS Non-event handler div.ariaValueMax should not be blocked. -PASS Non-event handler div.ariaValueMin should not be blocked. -PASS Non-event handler div.ariaValueNow should not be blocked. -PASS Non-event handler div.ariaValueText should not be blocked. -PASS Non-event handler div.scrollTop should not be blocked. -PASS Non-event handler div.scrollLeft should not be blocked. -PASS Non-event handler div.scrollWidth should not be blocked. -PASS Non-event handler div.scrollHeight should not be blocked. -PASS Non-event handler div.clientTop should not be blocked. -PASS Non-event handler div.clientLeft should not be blocked. -PASS Non-event handler div.clientWidth should not be blocked. -PASS Non-event handler div.clientHeight should not be blocked. -PASS Non-event handler div.outerHTML should not be blocked. +PASS Event handler div.oncut should be blocked. +PASS Event handler div.ondblclick should be blocked. +PASS Event handler div.ondrag should be blocked. +PASS Event handler div.ondragend should be blocked. +PASS Event handler div.ondragenter should be blocked. +PASS Event handler div.ondragleave should be blocked. +PASS Event handler div.ondragover should be blocked. +PASS Event handler div.ondragstart should be blocked. +PASS Event handler div.ondrop should be blocked. +PASS Event handler div.ondurationchange should be blocked. +PASS Event handler div.onemptied should be blocked. +PASS Event handler div.onended should be blocked. +PASS Event handler div.onerror should be blocked. +PASS Event handler div.onfocus should be blocked. +PASS Event handler div.onformdata should be blocked. +PASS Event handler div.oninput should be blocked. +PASS Event handler div.oninvalid should be blocked. +PASS Event handler div.onkeydown should be blocked. +PASS Event handler div.onkeypress should be blocked. +PASS Event handler div.onkeyup should be blocked. +PASS Event handler div.onload should be blocked. +PASS Event handler div.onloadeddata should be blocked. +PASS Event handler div.onloadedmetadata should be blocked. +PASS Event handler div.onloadstart should be blocked. +PASS Event handler div.onmousedown should be blocked. +PASS Event handler div.onmouseenter should be blocked. +PASS Event handler div.onmouseleave should be blocked. +PASS Event handler div.onmousemove should be blocked. +PASS Event handler div.onmouseout should be blocked. +PASS Event handler div.onmouseover should be blocked. +PASS Event handler div.onmouseup should be blocked. +PASS Event handler div.onpaste should be blocked. +PASS Event handler div.onpause should be blocked. +PASS Event handler div.onplay should be blocked. +PASS Event handler div.onplaying should be blocked. +PASS Event handler div.onprogress should be blocked. +PASS Event handler div.onratechange should be blocked. +PASS Event handler div.onreset should be blocked. +PASS Event handler div.onresize should be blocked. +PASS Event handler div.onscroll should be blocked. +PASS Event handler div.onsecuritypolicyviolation should be blocked. +PASS Event handler div.onseeked should be blocked. +PASS Event handler div.onseeking should be blocked. +PASS Event handler div.onselect should be blocked. +PASS Event handler div.onslotchange should be blocked. +PASS Event handler div.onstalled should be blocked. +PASS Event handler div.onsubmit should be blocked. +PASS Event handler div.onsuspend should be blocked. +PASS Event handler div.ontimeupdate should be blocked. +PASS Event handler div.ontoggle should be blocked. +PASS Event handler div.onvolumechange should be blocked. +PASS Event handler div.onwaiting should be blocked. +PASS Event handler div.onwebkitanimationend should be blocked. +PASS Event handler div.onwebkitanimationiteration should be blocked. +PASS Event handler div.onwebkitanimationstart should be blocked. +PASS Event handler div.onwebkittransitionend should be blocked. +PASS Event handler div.onwheel should be blocked. +PASS Event handler div.onmousewheel should be blocked. +PASS Event handler div.onanimationstart should be blocked. +PASS Event handler div.onanimationiteration should be blocked. +PASS Event handler div.onanimationend should be blocked. +PASS Event handler div.onanimationcancel should be blocked. +PASS Event handler div.ontransitionrun should be blocked. +PASS Event handler div.ontransitionstart should be blocked. +PASS Event handler div.ontransitionend should be blocked. +PASS Event handler div.ontransitioncancel should be blocked. +PASS Event handler div.ongotpointercapture should be blocked. +PASS Event handler div.onlostpointercapture should be blocked. +PASS Event handler div.onpointerdown should be blocked. +PASS Event handler div.onpointermove should be blocked. +PASS Event handler div.onpointerup should be blocked. +PASS Event handler div.onpointercancel should be blocked. +PASS Event handler div.onpointerover should be blocked. +PASS Event handler div.onpointerout should be blocked. +PASS Event handler div.onpointerenter should be blocked. +PASS Event handler div.onpointerleave should be blocked. +PASS Event handler div.onselectstart should be blocked. +PASS Event handler div.onselectionchange should be blocked. FAIL Event handler div.onfullscreenchange should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw FAIL Event handler div.onfullscreenerror should be blocked. assert_throws_js: function "_ => element.setAttribute(name, "2+2")" did not throw -PASS Non-event handler div.innerHTML should not be blocked. -PASS Non-event handler div.previousElementSibling should not be blocked. -PASS Non-event handler div.nextElementSibling should not be blocked. -PASS Non-event handler div.children should not be blocked. -PASS Non-event handler div.firstElementChild should not be blocked. -PASS Non-event handler div.lastElementChild should not be blocked. -PASS Non-event handler div.childElementCount should not be blocked. -PASS Non-event handler div.assignedSlot should not be blocked. -PASS Non-event handler div.hasAttributes should not be blocked. -PASS Non-event handler div.getAttributeNames should not be blocked. -PASS Non-event handler div.getAttribute should not be blocked. -PASS Non-event handler div.getAttributeNS should not be blocked. -PASS Non-event handler div.setAttribute should not be blocked. -PASS Non-event handler div.setAttributeNS should not be blocked. -PASS Non-event handler div.removeAttribute should not be blocked. -PASS Non-event handler div.removeAttributeNS should not be blocked. -PASS Non-event handler div.toggleAttribute should not be blocked. -PASS Non-event handler div.hasAttribute should not be blocked. -PASS Non-event handler div.hasAttributeNS should not be blocked. -PASS Non-event handler div.getAttributeNode should not be blocked. -PASS Non-event handler div.getAttributeNodeNS should not be blocked. -PASS Non-event handler div.setAttributeNode should not be blocked. -PASS Non-event handler div.setAttributeNodeNS should not be blocked. -PASS Non-event handler div.removeAttributeNode should not be blocked. -PASS Non-event handler div.attachShadow should not be blocked. -PASS Non-event handler div.closest should not be blocked. -PASS Non-event handler div.matches should not be blocked. -PASS Non-event handler div.webkitMatchesSelector should not be blocked. -PASS Non-event handler div.getElementsByTagName should not be blocked. -PASS Non-event handler div.getElementsByTagNameNS should not be blocked. -PASS Non-event handler div.getElementsByClassName should not be blocked. -PASS Non-event handler div.insertAdjacentElement should not be blocked. -PASS Non-event handler div.insertAdjacentText should not be blocked. -PASS Non-event handler div.animate should not be blocked. -PASS Non-event handler div.getAnimations should not be blocked. -PASS Non-event handler div.before should not be blocked. -PASS Non-event handler div.after should not be blocked. -PASS Non-event handler div.replaceWith should not be blocked. -PASS Non-event handler div.remove should not be blocked. -PASS Non-event handler div.getClientRects should not be blocked. -PASS Non-event handler div.getBoundingClientRect should not be blocked. -PASS Non-event handler div.checkVisibility should not be blocked. -PASS Non-event handler div.scrollIntoView should not be blocked. -PASS Non-event handler div.scroll should not be blocked. -PASS Non-event handler div.scrollTo should not be blocked. -PASS Non-event handler div.scrollBy should not be blocked. -PASS Non-event handler div.scrollIntoViewIfNeeded should not be blocked. -PASS Non-event handler div.computedStyleMap should not be blocked. -PASS Non-event handler div.insertAdjacentHTML should not be blocked. -PASS Non-event handler div.requestFullscreen should not be blocked. -PASS Non-event handler div.webkitRequestFullScreen should not be blocked. -PASS Non-event handler div.webkitRequestFullscreen should not be blocked. -PASS Non-event handler div.setPointerCapture should not be blocked. -PASS Non-event handler div.releasePointerCapture should not be blocked. -PASS Non-event handler div.hasPointerCapture should not be blocked. -PASS Non-event handler div.requestPointerLock should not be blocked. -PASS Non-event handler div.setHTMLUnsafe should not be blocked. -PASS Non-event handler div.prepend should not be blocked. -PASS Non-event handler div.append should not be blocked. -PASS Non-event handler div.replaceChildren should not be blocked. -PASS Non-event handler div.querySelector should not be blocked. -PASS Non-event handler div.querySelectorAll should not be blocked. -PASS Non-event handler div.nodeType should not be blocked. -PASS Non-event handler div.nodeName should not be blocked. -PASS Non-event handler div.baseURI should not be blocked. -PASS Non-event handler div.isConnected should not be blocked. -PASS Non-event handler div.ownerDocument should not be blocked. -PASS Non-event handler div.parentNode should not be blocked. -PASS Non-event handler div.parentElement should not be blocked. -PASS Non-event handler div.childNodes should not be blocked. -PASS Non-event handler div.firstChild should not be blocked. -PASS Non-event handler div.lastChild should not be blocked. -PASS Non-event handler div.previousSibling should not be blocked. -PASS Non-event handler div.nextSibling should not be blocked. -PASS Non-event handler div.nodeValue should not be blocked. -PASS Non-event handler div.textContent should not be blocked. -PASS Non-event handler div.getRootNode should not be blocked. -PASS Non-event handler div.hasChildNodes should not be blocked. -PASS Non-event handler div.normalize should not be blocked. -PASS Non-event handler div.cloneNode should not be blocked. -PASS Non-event handler div.isEqualNode should not be blocked. -PASS Non-event handler div.isSameNode should not be blocked. -PASS Non-event handler div.compareDocumentPosition should not be blocked. -PASS Non-event handler div.contains should not be blocked. -PASS Non-event handler div.lookupPrefix should not be blocked. -PASS Non-event handler div.lookupNamespaceURI should not be blocked. -PASS Non-event handler div.isDefaultNamespace should not be blocked. -PASS Non-event handler div.insertBefore should not be blocked. -PASS Non-event handler div.appendChild should not be blocked. -PASS Non-event handler div.replaceChild should not be blocked. -PASS Non-event handler div.removeChild should not be blocked. -PASS Non-event handler div.ELEMENT_NODE should not be blocked. -PASS Non-event handler div.ATTRIBUTE_NODE should not be blocked. -PASS Non-event handler div.TEXT_NODE should not be blocked. -PASS Non-event handler div.CDATA_SECTION_NODE should not be blocked. -PASS Non-event handler div.ENTITY_REFERENCE_NODE should not be blocked. -PASS Non-event handler div.ENTITY_NODE should not be blocked. -PASS Non-event handler div.PROCESSING_INSTRUCTION_NODE should not be blocked. -PASS Non-event handler div.COMMENT_NODE should not be blocked. -PASS Non-event handler div.DOCUMENT_NODE should not be blocked. -PASS Non-event handler div.DOCUMENT_TYPE_NODE should not be blocked. -PASS Non-event handler div.DOCUMENT_FRAGMENT_NODE should not be blocked. -PASS Non-event handler div.NOTATION_NODE should not be blocked. -PASS Non-event handler div.DOCUMENT_POSITION_DISCONNECTED should not be blocked. -PASS Non-event handler div.DOCUMENT_POSITION_PRECEDING should not be blocked. -PASS Non-event handler div.DOCUMENT_POSITION_FOLLOWING should not be blocked. -PASS Non-event handler div.DOCUMENT_POSITION_CONTAINS should not be blocked. -PASS Non-event handler div.DOCUMENT_POSITION_CONTAINED_BY should not be blocked. -PASS Non-event handler div.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC should not be blocked. -PASS Non-event handler div.addEventListener should not be blocked. -PASS Non-event handler div.removeEventListener should not be blocked. -PASS Non-event handler div.dispatchEvent should not be blocked. diff --git a/LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-event-handlers.html b/LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-event-handlers.html index 9dd7133cbb0b5..8dd70757e34d8 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-event-handlers.html +++ b/LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-event-handlers.html @@ -46,10 +46,15 @@ _ => element.setAttribute(name, "2+2")); }, `Event handler div.${name} should be blocked.`); } else { - test(t => { - element.setAttribute(name, "2+2"); - }, `Non-event handler div.${name} should not be blocked.`); + // Rather than going through all the non-event handler, we randomly choose + // a few examples to test. + if (name == "align" || name == "title" || name == "inert" || name == "draggable") { + test(t => { + element.setAttribute(name, "2+2"); + }, `Non-event handler div.${name} should not be blocked.`); + } } } + diff --git a/LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-svg-script-set-href-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-svg-script-set-href-expected.txt index 1270b0c77c76c..62b5d032d7dff 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-svg-script-set-href-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/trusted-types/trusted-types-svg-script-set-href-expected.txt @@ -1,14 +1,12 @@ CONSOLE MESSAGE: This requires a TrustedScriptURL value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScriptURL value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" +CONSOLE MESSAGE: This requires a TrustedScriptURL value else it violates the following Content Security Policy directive: "require-trusted-types-for 'script'" PASS Assign string to SVGScriptElement.href.baseVal. PASS Assign TrustedScriptURL to SVGScriptElement.href.baseVal. -FAIL Assign string to non-attached SVGScriptElement.href via setAttribute. assert_throws_js: function "_ => { - elem.setAttribute("href", "about:blank"); - }" did not throw +PASS Assign string to non-attached SVGScriptElement.href via setAttribute. PASS Assign TrustedScriptURL to non-attached SVGScriptElement.href via setAttribute. -FAIL Assign string to attached SVGScriptElement.href via setAttribute. assert_throws_js: function "_ => { - elem.setAttribute("href", "about:blank"); - }" did not throw +PASS Assign string to attached SVGScriptElement.href via setAttribute. PASS Assign TrustedScriptURL to attached SVGScriptElement.href via setAttribute. PASS Setup default policy PASS Assign String to SVGScriptElement.innerHTML w/ default policy. diff --git a/LayoutTests/platform/gtk/TestExpectations b/LayoutTests/platform/gtk/TestExpectations index 42f9a8fe11092..09bbf0885bfa3 100644 --- a/LayoutTests/platform/gtk/TestExpectations +++ b/LayoutTests/platform/gtk/TestExpectations @@ -2337,14 +2337,6 @@ fast/mediastream/mediastreamtrack-video-frameRate-clone-decreasing.html [ Crash # Trusted Types aren't implemented yet webkit.org/b/266630 imported/w3c/web-platform-tests/trusted-types/trusted-types-reporting-check-report.html [ Failure Pass ] webkit.org/b/266630 imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-attribute-via-attribute-node.html [ Failure Pass ] -webkit.org/b/266630 imported/w3c/web-platform-tests/trusted-types/Element-setAttribute.html [ Failure ] -webkit.org/b/266630 imported/w3c/web-platform-tests/trusted-types/WorkerGlobalScope-eval.html [ Failure ] -webkit.org/b/266630 imported/w3c/web-platform-tests/trusted-types/WorkerGlobalScope-importScripts.html [ Failure ] -webkit.org/b/266630 imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-Element-setAttribute.html [ Failure ] -webkit.org/b/266630 imported/w3c/web-platform-tests/trusted-types/block-string-assignment-to-HTMLElement-generic.html [ Failure ] -webkit.org/b/266630 imported/w3c/web-platform-tests/trusted-types/default-policy-report-only.html [ Failure ] -webkit.org/b/266630 imported/w3c/web-platform-tests/trusted-types/default-policy.html [ Failure ] -webkit.org/b/266630 imported/w3c/web-platform-tests/trusted-types/worker-constructor.https.html [ Failure ] # Flaky tests on Aug-2023 webkit.org/b/261024 animations/change-completed-animation-transform.html [ ImageOnlyFailure Pass ] diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp index f3dce52266bd8..31ff08a533deb 100644 --- a/Source/WebCore/dom/Element.cpp +++ b/Source/WebCore/dom/Element.cpp @@ -146,6 +146,7 @@ #include "StyleTreeResolver.h" #include "TextIterator.h" #include "TouchAction.h" +#include "TrustedType.h" #include "TypedElementDescendantIteratorInlines.h" #include "VisibilityAdjustment.h" #include "VoidCallback.h" @@ -1953,6 +1954,50 @@ const AtomString& Element::getAttributeNS(const AtomString& namespaceURI, const return getAttribute(QualifiedName(nullAtom(), localName, namespaceURI)); } +static ExceptionOr trustedTypesCompliantAttributeValue(const String attributeType, const TrustedTypeOrString& value, Element* element, String sink) +{ + auto stringValueHolder = WTF::switchOn(value, + [&](const String& string) -> ExceptionOr { + if (attributeType.isNull()) + return String(string); + return trustedTypeCompliantString(stringToTrustedType(attributeType), *(element->document().scriptExecutionContext()), string, sink); + }, + [&](const RefPtr& trustedHTML) -> ExceptionOr { + if (attributeType.isNull() || attributeType == "TrustedHTML"_s) + return trustedHTML->toString(); + return trustedTypeCompliantString(stringToTrustedType(attributeType), *(element->document().scriptExecutionContext()), trustedHTML->toString(), sink); + }, + [&](const RefPtr& trustedScript) -> ExceptionOr { + if (attributeType.isNull() || attributeType == "TrustedScript"_s) + return trustedScript->toString(); + return trustedTypeCompliantString(stringToTrustedType(attributeType), *(element->document().scriptExecutionContext()), trustedScript->toString(), sink); + + }, + [&](const RefPtr& trustedScriptURL) -> ExceptionOr { + if (attributeType.isNull() || attributeType == "TrustedScriptURL"_s) + return trustedScriptURL->toString(); + return trustedTypeCompliantString(stringToTrustedType(attributeType), *(element->document().scriptExecutionContext()), trustedScriptURL->toString(), sink); + } + ); + if (stringValueHolder.hasException()) + return stringValueHolder.releaseException(); + + return stringValueHolder.releaseReturnValue(); +} + +ALWAYS_INLINE unsigned Element::validateAttributeIndex(unsigned index, const QualifiedName& qname) const +{ + if (index == ElementData::attributeNotFound) + return index; + + ASSERT(elementData()); + + if ((index < elementData()->length()) && (elementData()->attributeAt(index).name() == qname)) + return index; + + return elementData()->findAttributeIndexByName(qname.localName(), false); +} + // https://dom.spec.whatwg.org/#dom-element-toggleattribute ExceptionOr Element::toggleAttribute(const AtomString& qualifiedName, std::optional force) { @@ -1965,7 +2010,19 @@ ExceptionOr Element::toggleAttribute(const AtomString& qualifiedName, std: unsigned index = elementData() ? elementData()->findAttributeIndexByName(caseAdjustedQualifiedName, false) : ElementData::attributeNotFound; if (index == ElementData::attributeNotFound) { if (!force || *force) { - setAttributeInternal(index, QualifiedName { nullAtom(), caseAdjustedQualifiedName, nullAtom() }, emptyAtom(), InSynchronizationOfLazyAttribute::No); + auto name = QualifiedName { nullAtom(), caseAdjustedQualifiedName, nullAtom() }; + if (!document().scriptExecutionContext()->settingsValues().trustedTypesEnabled) + setAttributeInternal(index, name, emptyAtom(), InSynchronizationOfLazyAttribute::No); + else { + auto attributeTypeAndSink = trustedTypeForAttribute(nodeName(), name.localName().convertToASCIILowercase(), this->namespaceURI(), name.namespaceURI()); + auto attributeValue = trustedTypesCompliantAttributeValue(attributeTypeAndSink.attributeType, emptyAtom(), this, attributeTypeAndSink.sink); + + if (attributeValue.hasException()) + return attributeValue.releaseException(); + + index = validateAttributeIndex(index, name); + setAttributeInternal(index, name, AtomString(attributeValue.releaseReturnValue()), InSynchronizationOfLazyAttribute::No); + } return true; } return false; @@ -1979,6 +2036,11 @@ ExceptionOr Element::toggleAttribute(const AtomString& qualifiedName, std: } ExceptionOr Element::setAttribute(const AtomString& qualifiedName, const AtomString& value) +{ + return setAttribute(qualifiedName, TrustedTypeOrString { value }); +} + +ExceptionOr Element::setAttribute(const AtomString& qualifiedName, const TrustedTypeOrString& value) { if (!Document::isValidName(qualifiedName)) return Exception { ExceptionCode::InvalidCharacterError, makeString("Invalid qualified name: '"_s, qualifiedName, '\'') }; @@ -1987,8 +2049,18 @@ ExceptionOr Element::setAttribute(const AtomString& qualifiedName, const A auto caseAdjustedQualifiedName = shouldIgnoreAttributeCase(*this) ? qualifiedName.convertToASCIILowercase() : qualifiedName; unsigned index = elementData() ? elementData()->findAttributeIndexByName(caseAdjustedQualifiedName, false) : ElementData::attributeNotFound; auto name = index != ElementData::attributeNotFound ? attributeAt(index).name() : QualifiedName { nullAtom(), caseAdjustedQualifiedName, nullAtom() }; - setAttributeInternal(index, name, value, InSynchronizationOfLazyAttribute::No); + if (!document().scriptExecutionContext()->settingsValues().trustedTypesEnabled) + setAttributeInternal(index, name, std::get(value), InSynchronizationOfLazyAttribute::No); + else { + auto attributeTypeAndSink = trustedTypeForAttribute(nodeName(), name.localName().convertToASCIILowercase(), this->namespaceURI(), name.namespaceURI()); + auto attributeValue = trustedTypesCompliantAttributeValue(attributeTypeAndSink.attributeType, value, this, attributeTypeAndSink.sink); + + if (attributeValue.hasException()) + return attributeValue.releaseException(); + index = validateAttributeIndex(index, name); + setAttributeInternal(index, name, AtomString(attributeValue.releaseReturnValue()), InSynchronizationOfLazyAttribute::No); + } return { }; } @@ -2289,7 +2361,7 @@ void Element::setElementsArrayAttribute(const QualifiedName& attributeName, std: auto newElements = copyToVectorOf>(*elements); explicitlySetAttrElementsMap().set(attributeName, WTFMove(newElements)); - + if (CheckedPtr cache = document().existingAXObjectCache()) { for (auto element : elements.value()) { // FIXME: Should this pass `element` instead of `*this`? @@ -3212,7 +3284,7 @@ static void appendAttributes(StringBuilder& builder, const Element& element) classNamesToDump = maxNumClassNames; addEllipsis = true; } - + for (size_t i = 0; i < classNamesToDump; ++i) { if (i > 0) builder.append(' '); @@ -3280,12 +3352,21 @@ ExceptionOr> Element::setAttributeNode(Attr& attrNode) auto& elementData = ensureUniqueElementData(); - auto existingAttributeIndex = elementData.findAttributeIndexByName(attrNode.qualifiedName()); - // Attr::value() will return its 'm_standaloneValue' member any time its Element is set to nullptr. We need to cache this value // before making changes to attrNode's Element connections. auto attrNodeValue = attrNode.value(); + if (document().scriptExecutionContext()->settingsValues().trustedTypesEnabled) { + auto attributeTypeAndSink = trustedTypeForAttribute(nodeName(), attrNode.qualifiedName().localName().convertToASCIILowercase(), this->namespaceURI(), attrNode.qualifiedName().namespaceURI()); + auto attributeNodeValue = trustedTypesCompliantAttributeValue(attributeTypeAndSink.attributeType, attrNodeValue, this, attributeTypeAndSink.sink); + + if (attributeNodeValue.hasException()) + return attributeNodeValue.releaseException(); + attrNodeValue = AtomString(attributeNodeValue.releaseReturnValue()); + } + + auto existingAttributeIndex = elementData.findAttributeIndexByName(attrNode.qualifiedName()); + if (existingAttributeIndex == ElementData::attributeNotFound) { attachAttributeNodeIfNeeded(attrNode); setAttributeInternal(elementData.findAttributeIndexByName(attrNode.qualifiedName()), attrNode.qualifiedName(), attrNodeValue, InSynchronizationOfLazyAttribute::No); @@ -3324,6 +3405,16 @@ ExceptionOr> Element::setAttributeNodeNS(Attr& attrNode) // before making changes to attrNode's Element connections. auto attrNodeValue = attrNode.value(); unsigned index = 0; + + if (document().scriptExecutionContext()->settingsValues().trustedTypesEnabled) { + auto attributeTypeAndSink = trustedTypeForAttribute(nodeName(), attrNode.qualifiedName().localName(), this->namespaceURI(), attrNode.qualifiedName().namespaceURI()); + auto attributeNodeValue = trustedTypesCompliantAttributeValue(attributeTypeAndSink.attributeType, attrNodeValue, this, attributeTypeAndSink.sink); + + if (attributeNodeValue.hasException()) + return attributeNodeValue.releaseException(); + attrNodeValue = AtomString(attributeNodeValue.releaseReturnValue()); + } + { ScriptDisallowedScope::InMainThread scriptDisallowedScope; synchronizeAllAttributes(); @@ -3381,11 +3472,28 @@ ExceptionOr Element::parseAttributeName(const AtomString& namespa } ExceptionOr Element::setAttributeNS(const AtomString& namespaceURI, const AtomString& qualifiedName, const AtomString& value) +{ + return setAttributeNS(namespaceURI, qualifiedName, TrustedTypeOrString { value }); +} + +ExceptionOr Element::setAttributeNS(const AtomString& namespaceURI, const AtomString& qualifiedName, const TrustedTypeOrString& value) { auto result = parseAttributeName(namespaceURI, qualifiedName); if (result.hasException()) return result.releaseException(); - setAttribute(result.releaseReturnValue(), value); + if (!document().scriptExecutionContext()->settingsValues().trustedTypesEnabled) + setAttribute(result.releaseReturnValue(), std::get(value)); + else { + QualifiedName parsedAttributeName = result.returnValue(); + auto attributeTypeAndSink = trustedTypeForAttribute(nodeName(), parsedAttributeName.localName(), this->namespaceURI(), parsedAttributeName.namespaceURI()); + auto attributeValue = trustedTypesCompliantAttributeValue(attributeTypeAndSink.attributeType, value, this, attributeTypeAndSink.sink); + + if (attributeValue.hasException()) + return attributeValue.releaseException(); + + setAttribute(result.releaseReturnValue(), AtomString(attributeValue.releaseReturnValue())); + } + return { }; } diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h index 0f4241457c46e..9dbed9a6e953d 100644 --- a/Source/WebCore/dom/Element.h +++ b/Source/WebCore/dom/Element.h @@ -82,6 +82,9 @@ class SpaceSplitString; class StylePropertyMap; class StylePropertyMapReadOnly; class Text; +class TrustedHTML; +class TrustedScript; +class TrustedScriptURL; class UniqueElementData; class ValidatedFormListedElement; class WebAnimation; @@ -131,6 +134,7 @@ struct ShadowRootInit; using ElementName = NodeName; using ExplicitlySetAttrElementsMap = HashMap>>; +using TrustedTypeOrString = std::variant, RefPtr, RefPtr, AtomString>; // https://drafts.csswg.org/css-contain/#relevant-to-the-user enum class ContentRelevancy : uint8_t { @@ -204,8 +208,11 @@ class Element : public ContainerNode { inline AtomString getAttributeNSForBindings(const AtomString& namespaceURI, const AtomString& localName, ResolveURLs = ResolveURLs::NoExcludingURLsForPrivacy) const; WEBCORE_EXPORT ExceptionOr setAttribute(const AtomString& qualifiedName, const AtomString& value); + ExceptionOr setAttribute(const AtomString& qualifiedName, const TrustedTypeOrString& value); + unsigned validateAttributeIndex(unsigned index, const QualifiedName& qname) const; static ExceptionOr parseAttributeName(const AtomString& namespaceURI, const AtomString& qualifiedName); WEBCORE_EXPORT ExceptionOr setAttributeNS(const AtomString& namespaceURI, const AtomString& qualifiedName, const AtomString& value); + ExceptionOr setAttributeNS(const AtomString& namespaceURI, const AtomString& qualifiedName, const TrustedTypeOrString& value); ExceptionOr toggleAttribute(const AtomString& qualifiedName, std::optional force); diff --git a/Source/WebCore/dom/Element.idl b/Source/WebCore/dom/Element.idl index d0220b77a96d7..40cc8fb070fc2 100644 --- a/Source/WebCore/dom/Element.idl +++ b/Source/WebCore/dom/Element.idl @@ -42,8 +42,8 @@ sequence getAttributeNames(); [DOMJIT=ReadDOM, ImplementedAs=getAttributeForBindings] DOMString? getAttribute([AtomString] DOMString qualifiedName); [ImplementedAs=getAttributeNSForBindings] DOMString? getAttributeNS([AtomString] DOMString? namespaceURI, [AtomString] DOMString localName); - [CEReactions=Needed] undefined setAttribute([AtomString] DOMString qualifiedName, [AtomString] DOMString value); - [CEReactions=Needed] undefined setAttributeNS([AtomString] DOMString? namespaceURI, [AtomString] DOMString qualifiedName, [AtomString] DOMString value); + [CEReactions=Needed] undefined setAttribute([AtomString] DOMString qualifiedName, (TrustedType or [AtomString] DOMString) value); + [CEReactions=Needed] undefined setAttributeNS([AtomString] DOMString? namespaceURI, [AtomString] DOMString qualifiedName, (TrustedType or [AtomString] DOMString) value); [CEReactions=Needed, ImplementedAs=removeAttributeForBindings] undefined removeAttribute([AtomString] DOMString qualifiedName); [CEReactions=Needed, ImplementedAs=removeAttributeNSForBindings] undefined removeAttributeNS([AtomString] DOMString? namespaceURI, [AtomString] DOMString localName); [CEReactions=Needed] boolean toggleAttribute([AtomString] DOMString qualifiedName, optional boolean force); @@ -106,3 +106,5 @@ Element includes NonDocumentTypeChildNode; Element includes ParentNode; Element includes Slotable; Element includes InnerHTML; + +typedef (TrustedHTML or TrustedScript or TrustedScriptURL) TrustedType; diff --git a/Source/WebCore/dom/TrustedScript.h b/Source/WebCore/dom/TrustedScript.h index ba1c1d06e2a7c..7c1c7cd784568 100644 --- a/Source/WebCore/dom/TrustedScript.h +++ b/Source/WebCore/dom/TrustedScript.h @@ -29,7 +29,7 @@ namespace WebCore { -class TrustedScript final : public ScriptWrappable, public RefCounted { +class WEBCORE_EXPORT TrustedScript final : public ScriptWrappable, public RefCounted { WTF_MAKE_ISO_ALLOCATED(TrustedScript); public: static Ref create(const String& data); diff --git a/Source/WebCore/dom/TrustedScriptURL.h b/Source/WebCore/dom/TrustedScriptURL.h index fb2cbf4eadaf7..a0deb79cf2202 100644 --- a/Source/WebCore/dom/TrustedScriptURL.h +++ b/Source/WebCore/dom/TrustedScriptURL.h @@ -31,7 +31,7 @@ namespace WebCore { -class TrustedScriptURL : public ScriptWrappable, public RefCounted { +class WEBCORE_EXPORT TrustedScriptURL : public ScriptWrappable, public RefCounted { WTF_MAKE_ISO_ALLOCATED(TrustedScriptURL); public: static Ref create(const String& data); diff --git a/Source/WebCore/dom/TrustedType.cpp b/Source/WebCore/dom/TrustedType.cpp index b3fb60bdd9dc1..17a7bd54b4eae 100644 --- a/Source/WebCore/dom/TrustedType.cpp +++ b/Source/WebCore/dom/TrustedType.cpp @@ -37,6 +37,7 @@ #include "TrustedTypePolicyFactory.h" #include "WindowOrWorkerGlobalScopeTrustedTypes.h" #include "WorkerGlobalScope.h" +#include "XLinkNames.h" #include #include #include @@ -84,6 +85,19 @@ ASCIILiteral trustedTypeToString(TrustedType trustedType) return { }; } +TrustedType stringToTrustedType(String str) +{ + if (str == "TrustedHTML"_s) + return TrustedType::TrustedHTML; + if (str == "TrustedScript"_s) + return TrustedType::TrustedScript; + if (str == "TrustedScriptURL"_s) + return TrustedType::TrustedScriptURL; + + ASSERT_NOT_REACHED(); + return { }; +} + ASCIILiteral trustedTypeToCallbackName(TrustedType trustedType) { switch (trustedType) { @@ -199,6 +213,42 @@ ExceptionOr trustedTypeCompliantString(ScriptExecutionContext& scriptExe ); } +AttributeTypeAndSink trustedTypeForAttribute(const String& elementName, const String& attributeName, const String& elementNamespace, const String& attributeNamespace) +{ + AttributeTypeAndSink returnValues; + auto localName = elementName.convertToASCIILowercase(); + + AtomString elementNS = elementNamespace.isEmpty() ? HTMLNames::xhtmlNamespaceURI : AtomString(elementNamespace); + AtomString attributeNS = attributeNamespace.isEmpty() ? nullAtom() : AtomString(attributeNamespace); + + QualifiedName element(nullAtom(), AtomString(localName), elementNS); + QualifiedName attribute(nullAtom(), AtomString(attributeName), attributeNS); + + if (attributeNS.isNull() && !attributeName.isNull()) { + auto& eventName = HTMLElement::eventNameForEventHandlerAttribute(attribute); + if (!eventName.isNull()) { + returnValues.sink = "Element "_s + attributeName; + returnValues.attributeType = trustedTypeToString(TrustedType::TrustedScript); + return returnValues; + } + } + + if (element.matches(HTMLNames::iframeTag) && attribute.matches(HTMLNames::srcdocAttr)) { + returnValues.sink = "HTMLIFrameElement srcdoc"_s; + returnValues.attributeType = trustedTypeToString(TrustedType::TrustedHTML); + } + if (element.matches(HTMLNames::scriptTag) && attribute.matches(HTMLNames::srcAttr)) { + returnValues.sink = "HTMLScriptElement src"_s; + returnValues.attributeType = trustedTypeToString(TrustedType::TrustedScriptURL); + } + if (element.matches(SVGNames::scriptTag) && (attribute.matches(SVGNames::hrefAttr) || attribute.matches(XLinkNames::hrefAttr))) { + returnValues.sink = "SVGScriptElement href"_s; + returnValues.attributeType = trustedTypeToString(TrustedType::TrustedScriptURL); + } + + return returnValues; +} + // https://w3c.github.io/trusted-types/dist/spec/#require-trusted-types-for-pre-navigation-check ExceptionOr requireTrustedTypesForPreNavigationCheckPasses(ScriptExecutionContext& scriptExecutionContext, const String& urlString) { diff --git a/Source/WebCore/dom/TrustedType.h b/Source/WebCore/dom/TrustedType.h index 3b548f8bed727..4d6abeee9474d 100644 --- a/Source/WebCore/dom/TrustedType.h +++ b/Source/WebCore/dom/TrustedType.h @@ -44,7 +44,13 @@ enum class TrustedType : int8_t { TrustedScriptURL, }; +struct AttributeTypeAndSink { + String attributeType; + String sink; +}; + ASCIILiteral trustedTypeToString(TrustedType); +TrustedType stringToTrustedType(String); ASCIILiteral trustedTypeToCallbackName(TrustedType); WEBCORE_EXPORT std::variant, Ref, Ref> processValueWithDefaultPolicy(ScriptExecutionContext&, TrustedType, const String& input, const String& sink); @@ -59,4 +65,5 @@ ExceptionOr trustedTypeCompliantString(ScriptExecutionContext&, std::var ExceptionOr> processNodeOrStringAsTrustedType(Ref, RefPtr parent, std::variant, String, RefPtr>); +WEBCORE_EXPORT AttributeTypeAndSink trustedTypeForAttribute(const String& elementName, const String& attributeName, const String& elementNamespace, const String& attributeNamespace); } // namespace WebCore diff --git a/Source/WebCore/dom/TrustedTypePolicyFactory.cpp b/Source/WebCore/dom/TrustedTypePolicyFactory.cpp index e475f5a75595e..9fc1a13cce074 100644 --- a/Source/WebCore/dom/TrustedTypePolicyFactory.cpp +++ b/Source/WebCore/dom/TrustedTypePolicyFactory.cpp @@ -108,26 +108,7 @@ Ref TrustedTypePolicyFactory::emptyScript() const String TrustedTypePolicyFactory::getAttributeType(const String& tagName, const String& attributeParameter, const String& elementNamespace, const String& attributeNamespace) const { - auto localName = tagName.convertToASCIILowercase(); - auto attributeName = attributeParameter.convertToASCIILowercase(); - - if (attributeName.startsWith("on"_s)) - return trustedTypeToString(TrustedType::TrustedScript); - - AtomString elementNS = elementNamespace.isEmpty() ? HTMLNames::xhtmlNamespaceURI : AtomString(elementNamespace); - AtomString attributeNS = attributeNamespace.isEmpty() ? nullAtom() : AtomString(attributeNamespace); - - QualifiedName element(nullAtom(), AtomString(localName), elementNS); - QualifiedName attribute(nullAtom(), AtomString(attributeName), attributeNS); - - if (element.matches(HTMLNames::iframeTag) && attribute.matches(HTMLNames::srcdocAttr)) - return trustedTypeToString(TrustedType::TrustedHTML); - if (element.matches(HTMLNames::scriptTag) && attribute.matches(HTMLNames::srcAttr)) - return trustedTypeToString(TrustedType::TrustedScriptURL); - if (element.matches(SVGNames::scriptTag) && (attribute.matches(SVGNames::hrefAttr) || attribute.matches(XLinkNames::hrefAttr))) - return trustedTypeToString(TrustedType::TrustedScriptURL); - - return nullString(); + return trustedTypeForAttribute(tagName, attributeParameter.convertToASCIILowercase(), elementNamespace, attributeNamespace).attributeType; } String TrustedTypePolicyFactory::getPropertyType(const String& tagName, const String& property, const String& elementNamespace) const diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMElement.mm b/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMElement.mm index 9456dc2662595..ede4e123a9165 100644 --- a/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMElement.mm +++ b/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMElement.mm @@ -43,7 +43,7 @@ - (NSString *)getAttribute:(NSString *)attribute - (void)setAttribute:(NSString *)name value:(NSString *)value { - downcast(*_impl).setAttribute(name, value); + downcast(*_impl).setAttribute(name, AtomString { value }); } - (NSString *)tagName diff --git a/Source/WebKitLegacy/mac/DOM/DOMElement.mm b/Source/WebKitLegacy/mac/DOM/DOMElement.mm index db762888c876e..d357a0ca4b4b4 100644 --- a/Source/WebKitLegacy/mac/DOM/DOMElement.mm +++ b/Source/WebKitLegacy/mac/DOM/DOMElement.mm @@ -281,7 +281,7 @@ - (NSString *)getAttribute:(NSString *)name - (void)setAttribute:(NSString *)name value:(NSString *)value { WebCore::JSMainThreadNullState state; - raiseOnDOMError(unwrap(*self).setAttribute(name, value)); + raiseOnDOMError(unwrap(*self).setAttribute(name, AtomString { value })); } - (void)removeAttribute:(NSString *)name @@ -331,7 +331,7 @@ - (NSString *)getAttributeNS:(NSString *)namespaceURI localName:(NSString *)loca - (void)setAttributeNS:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName value:(NSString *)value { WebCore::JSMainThreadNullState state; - raiseOnDOMError(unwrap(*self).setAttributeNS(namespaceURI, qualifiedName, value)); + raiseOnDOMError(unwrap(*self).setAttributeNS(namespaceURI, qualifiedName, AtomString { value })); } - (void)removeAttributeNS:(NSString *)namespaceURI localName:(NSString *)localName