From e0f430a881999cad0a509ec7fbbfe996875bc2a4 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Fri, 4 Oct 2019 02:57:34 +0000 Subject: [PATCH] Bug 1527584 [wpt PR 15352] - HTML: window.open("", "", "noreferrer"), a=testonly Automatic update from web-platform-tests HTML: window.open("", "", "noreferrer") For https://github.com/whatwg/html/pull/4331. -- wpt-commits: 22abb9c5c4a78f5deecc49417f5e57ba27f404cb wpt-pr: 15352 UltraBlame original commit: 5c6bfad36ca045e19786e7eb97104d31a04d81fd --- .../open-features-tokenization-noopener.html | 155 +----------------- ...open-features-tokenization-noreferrer.html | 11 ++ .../tokenization-noopener-noreferrer.js | 152 +++++++++++++++++ .../support/noreferrer-target.html | 13 ++ .../window-open-noreferrer.html | 20 +++ 5 files changed, 198 insertions(+), 153 deletions(-) create mode 100644 testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noreferrer.html create mode 100644 testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/resources/tokenization-noopener-noreferrer.js create mode 100644 testing/web-platform/tests/html/browsers/the-window-object/support/noreferrer-target.html create mode 100644 testing/web-platform/tests/html/browsers/the-window-object/window-open-noreferrer.html diff --git a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noopener.html b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noopener.html index c31e75fdf57e..c955e677899e 100644 --- a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noopener.html +++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noopener.html @@ -5,158 +5,7 @@ + diff --git a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noreferrer.html b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noreferrer.html new file mode 100644 index 000000000000..4807f634fdac --- /dev/null +++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noreferrer.html @@ -0,0 +1,11 @@ + + +HTML: window.open `features`: tokenization -- `noreferrer` + + + + + + diff --git a/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/resources/tokenization-noopener-noreferrer.js b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/resources/tokenization-noopener-noreferrer.js new file mode 100644 index 000000000000..8a27fd631298 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/resources/tokenization-noopener-noreferrer.js @@ -0,0 +1,152 @@ +function booleanTests(feature) { + const windowURL = 'resources/close-self.html'; + + + + const featureUpper = feature.toUpperCase(), + featureSplitBegin = feature.slice(0, 2), + featureSplitEnd = feature.slice(2), + featureMixedCase = featureSplitBegin.toUpperCase() + featureSplitEnd; + featureMixedCase2 = featureSplitBegin + featureSplitEnd.toUpperCase(); + + test (t => { + + + [ + ` ${feature}`, + `=${feature}`, + `,,${feature}`, + `,=, ${feature}`, + `\n=${feature}=`, + `\t${feature}`, + `\r,,,=${feature}`, + `\u000C${feature}` + ].forEach(variant => { + const win = window.open(windowURL, "", variant); + assert_equals(win, null, `"${variant}" should activate feature "${feature}"`); + }); + }, `Tokenization of "${feature}" should skip window features separators before feature`); + + test (t => { + + + + + [ + `${featureUpper}`, + `${featureMixedCase}`, + ` ${featureMixedCase2}`, + `=${featureUpper}`, + `${featureUpper}=1`, + `${featureUpper}=1`, + `${featureUpper}=yes`, + `${feature}=YES`, + ].forEach(variant => { + const win = window.open(windowURL, '', variant); + assert_equals(win, null, `"${variant}" should activate feature "${feature}"`); + }); + }, `Feature "${feature}" should be converted to ASCII lowercase`); + + test (t => { + + + + + [ + `${feature}`, + ` ${feature}\r`, + `${feature}\n =`, + `${feature},`, + `${feature} =,`, + `, ${feature} =`, + `${feature},=`, + `${feature} foo`, + `foo ${feature}=1`, + `foo=\u000Cbar\u000C${feature}` + ].forEach(variant => { + const win = window.open(windowURL, '', variant); + assert_equals(win, null, `"${variant}" should activate feature "${feature}"`); + }); + }, `After "${feature}", tokenization should skip window features separators that are not "=" or ","`); + + test (t => { + + + + + [ + `${feature}= yes`, + `${feature}==,`, + `${feature}=\n ,`, + `${feature} = \t ,`, + `${feature}\n=\r 1,`, + `${feature}=,yes`, + `${feature}= yes=,`, + `${feature} = \u000Cyes` + ].forEach(variant => { + const win = window.open(windowURL, '', variant); + assert_equals(win, null, `"${variant}" should activate feature "${feature}"`); + }); + }, `Tokenizing "${feature}" should ignore window feature separators except "," after initial "=" and before value`); + + test (t => { + + [ + `${feature}=1`, + `${feature}=yes`, + `${feature} = yes ,`, + `${feature}=\nyes ,`, + `${feature}=yes yes`, + `${feature}=yes\ts`, + `${feature}==`, + `${feature}=1\n,`, + `==${feature}===`, + `${feature}==\u000C` + ].forEach(variant => { + const win = window.open(windowURL, '', variant); + assert_equals(win, null, `"${variant}" should set "${feature}"`); + }); + }, `Tokenizing "${feature}" should read characters until first window feature separator as \`value\``); + + test (t => { + [ + `${feature}=1`, + `${feature}=2`, + `${feature}=12345`, + `${feature}=1.5`, + `${feature}=-1`, + ].forEach(variant => { + const win = window.open(windowURL, '', variant); + assert_equals(win, null, `"${variant}" should activate feature "${feature}"`); + }); + }, 'Integer values other than 0 should activate the feature'); + + test (t => { + [ + `${feature}=0`, + `${feature}=0.5`, + `${feature}=error`, + ].forEach(variant => { + const win = window.open(windowURL, '', variant); + assert_not_equals(win, null, `"${variant}" should NOT activate feature "${feature}"`); + }); + }, `Integer value of 0 should not activate "${feature}"`); + + test (t => { + [ + `-${feature}`, + `${featureUpper}RRR`, + `${featureMixedCase}R`, + `${featureSplitBegin}_${featureSplitEnd}`, + ` ${featureSplitBegin} ${featureSplitEnd}`, + `${featureSplitBegin}\n${featureSplitEnd}`, + `${featureSplitBegin},${featureSplitEnd}`, + `\0${feature}`, + `${feature}\u0000=yes`, + `foo=\u000C${feature}` + ].forEach(variant => { + const win = window.open(windowURL, '', variant); + assert_not_equals(win, null, `"${variant}" should NOT activate feature "${feature}"`); + }); + }, `Invalid feature names should not tokenize as "${feature}"`); +} diff --git a/testing/web-platform/tests/html/browsers/the-window-object/support/noreferrer-target.html b/testing/web-platform/tests/html/browsers/the-window-object/support/noreferrer-target.html new file mode 100644 index 000000000000..c2446c6fe958 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/the-window-object/support/noreferrer-target.html @@ -0,0 +1,13 @@ + diff --git a/testing/web-platform/tests/html/browsers/the-window-object/window-open-noreferrer.html b/testing/web-platform/tests/html/browsers/the-window-object/window-open-noreferrer.html new file mode 100644 index 000000000000..92b72cdb5f1e --- /dev/null +++ b/testing/web-platform/tests/html/browsers/the-window-object/window-open-noreferrer.html @@ -0,0 +1,20 @@ + + +window.open() with "noreferrer" tests + + +