diff --git a/testing/web-platform/tests/attribution-reporting/request-format.sub.https.html b/testing/web-platform/tests/attribution-reporting/request-format.sub.https.html index 19942f8693f7d..01d0b9220a38b 100644 --- a/testing/web-platform/tests/attribution-reporting/request-format.sub.https.html +++ b/testing/web-platform/tests/attribution-reporting/request-format.sub.https.html @@ -53,6 +53,28 @@ ? method = +area +& +expected +- +eligible += +navigation +- +source +" +> +< +meta +name += +variant +content += +" +? +method += img & expected diff --git a/testing/web-platform/tests/attribution-reporting/resources/helpers.js b/testing/web-platform/tests/attribution-reporting/resources/helpers.js index a58aa974a9e03..1ed0212e9fa52 100644 --- a/testing/web-platform/tests/attribution-reporting/resources/helpers.js +++ b/testing/web-platform/tests/attribution-reporting/resources/helpers.js @@ -428,6 +428,96 @@ true ) ; } +function +prepareAnchorOrArea +( +tag +referrerPolicy +eligible +url +) +{ +const +el += +document +. +createElement +( +tag +) +; +el +. +referrerPolicy += +referrerPolicy +; +el +. +target += +' +_blank +' +; +el +. +textContent += +' +link +' +; +if +( +eligible += += += +null +) +{ +el +. +attributionSrc += +url +; +el +. +href += +blankURL +( +) +; +} +else +{ +el +. +attributionSrc += +' +' +; +el +. +href += +url +; +} +return +el +; +} +let +nextMapId += +0 +; / * * @@ -1200,6 +1290,7 @@ case img ' : +{ const img = @@ -1255,6 +1346,7 @@ return event ' ; +} case ' script @@ -1332,91 +1424,163 @@ a const a = -document -. -createElement +prepareAnchorOrArea ( ' a ' +referrerPolicy +eligible +url ) ; -a +document . -referrerPolicy -= -referrerPolicy -; +body +. +appendChild +( a +) +; +test_driver . -target -= +click +( +a +) +; +return ' -_blank +navigation ' ; -a -. -textContent -= +case ' -link +area ' -; -if +: +{ +const +area += +prepareAnchorOrArea ( +' +area +' +referrerPolicy eligible +url +) +; +const +size = +100 +; +area +. +coords = -= -null -) +0 +0 { -a +size +} +{ +size +} +; +area . -attributionSrc +shape = -url +' +rect +' ; -a -. -href +const +map = -blankURL +document +. +createElement ( +' +map +' ) ; -} -else +map +. +name += +map +- { -a +nextMapId ++ ++ +} +; +map . -attributionSrc +append +( +area +) +; +const +img = +document +. +createElement +( ' +img ' +) ; -a +img . -href +width = -url +size ; +img +. +height += +size +; +img +. +useMap += +# +{ +map +. +name } +; document . body . -appendChild +append ( -a +map +img ) ; test_driver . click ( -a +area ) ; return @@ -1424,6 +1588,7 @@ return navigation ' ; +} case ' open