diff --git a/testing/web-platform/tests/html/semantics/forms/form-submission-target/rel-base-target.html b/testing/web-platform/tests/html/semantics/forms/form-submission-target/rel-base-target.html new file mode 100644 index 0000000000000..be81990c0c6d7 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/form-submission-target/rel-base-target.html @@ -0,0 +1,153 @@ +< +! +DOCTYPE +html +> +< +title +> +& +lt +; +form +rel +> +with +& +lt +; +base +target +> +< +/ +title +> +< +script +src += +" +/ +resources +/ +testharness +. +js +" +> +< +/ +script +> +< +script +src += +" +/ +resources +/ +testharnessreport +. +js +" +> +< +/ +script +> +< +script +src += +resources +/ +reltester +. +js +> +< +/ +script +> +< +base +target += +_blank +> +< +div +id += +log +> +< +/ +div +> +< +form +action += +resources +/ +endpoint +. +html +> +< +input +type += +hidden +name += +channelname +> +< +/ +form +> +< +script +> +const +submitter += +document +. +querySelector +( +" +form +" +) +channelInput += +document +. +querySelector +( +" +input +" +) +; +relTester +( +submitter +channelInput +" +< +base +target +> +" +) +; +< +/ +script +> diff --git a/testing/web-platform/tests/html/semantics/forms/form-submission-target/rel-button-target.html b/testing/web-platform/tests/html/semantics/forms/form-submission-target/rel-button-target.html new file mode 100644 index 0000000000000..5637b7fb7da3a --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/form-submission-target/rel-button-target.html @@ -0,0 +1,156 @@ +< +! +DOCTYPE +html +> +< +title +> +& +lt +; +form +rel +> +with +& +lt +; +button +formtarget +> +< +/ +title +> +< +script +src += +" +/ +resources +/ +testharness +. +js +" +> +< +/ +script +> +< +script +src += +" +/ +resources +/ +testharnessreport +. +js +" +> +< +/ +script +> +< +script +src += +resources +/ +reltester +. +js +> +< +/ +script +> +< +div +id += +log +> +< +/ +div +> +< +form +action += +resources +/ +endpoint +. +html +> +< +input +type += +hidden +name += +channelname +> +< +button +type += +submit +formtarget += +_blank +> +< +/ +form +> +< +script +> +const +submitter += +document +. +querySelector +( +" +button +" +) +channelInput += +document +. +querySelector +( +" +input +" +) +; +relTester +( +submitter +channelInput +" +< +button +formtarget +> +" +) +; +< +/ +script +> diff --git a/testing/web-platform/tests/html/semantics/forms/form-submission-target/rel-form-target.html b/testing/web-platform/tests/html/semantics/forms/form-submission-target/rel-form-target.html new file mode 100644 index 0000000000000..78b4096688242 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/form-submission-target/rel-form-target.html @@ -0,0 +1,144 @@ +< +! +DOCTYPE +html +> +< +title +> +& +lt +; +form +rel +target +> +< +/ +title +> +< +script +src += +" +/ +resources +/ +testharness +. +js +" +> +< +/ +script +> +< +script +src += +" +/ +resources +/ +testharnessreport +. +js +" +> +< +/ +script +> +< +script +src += +resources +/ +reltester +. +js +> +< +/ +script +> +< +div +id += +log +> +< +/ +div +> +< +form +action += +resources +/ +endpoint +. +html +target += +_blank +> +< +input +type += +hidden +name += +channelname +> +< +/ +form +> +< +script +> +const +submitter += +document +. +querySelector +( +" +form +" +) +channelInput += +document +. +querySelector +( +" +input +" +) +; +relTester +( +submitter +channelInput +" +< +form +target +> +" +) +; +< +/ +script +> diff --git a/testing/web-platform/tests/html/semantics/forms/form-submission-target/rel-input-target.html b/testing/web-platform/tests/html/semantics/forms/form-submission-target/rel-input-target.html new file mode 100644 index 0000000000000..5f6614ef61542 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/form-submission-target/rel-input-target.html @@ -0,0 +1,167 @@ +< +! +DOCTYPE +html +> +< +title +> +& +lt +; +form +rel +> +with +& +lt +; +input +formtarget +> +< +/ +title +> +< +script +src += +" +/ +resources +/ +testharness +. +js +" +> +< +/ +script +> +< +script +src += +" +/ +resources +/ +testharnessreport +. +js +" +> +< +/ +script +> +< +script +src += +resources +/ +reltester +. +js +> +< +/ +script +> +< +base +target += +_blank +> +< +div +id += +log +> +< +/ +div +> +< +form +action += +resources +/ +endpoint +. +html +> +< +input +type += +hidden +name += +channelname +> +< +input +type += +submit +formtarget += +_blank +> +< +/ +form +> +< +script +> +const +submitter += +document +. +querySelector +( +" +input +[ +type += +submit +] +" +) +channelInput += +document +. +querySelector +( +" +input +" +) +; +relTester +( +submitter +channelInput +" +< +input +formtarget +> +" +) +; +< +/ +script +> diff --git a/testing/web-platform/tests/html/semantics/forms/form-submission-target/resources/endpoint.html b/testing/web-platform/tests/html/semantics/forms/form-submission-target/resources/endpoint.html new file mode 100644 index 0000000000000..fbf92c9cc2cb4 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/form-submission-target/resources/endpoint.html @@ -0,0 +1,110 @@ +< +script +> +const +channelName += +new +URL +( +location +) +. +searchParams +. +get +( +" +channelname +" +) +channel += +new +BroadcastChannel +( +channelName +) +; +channel +. +postMessage +( +{ +haveOpener +: +window +. +opener +! += += +null +referrer +: +document +. +referrer +} +) +; +/ +/ +Because +messages +are +not +delivered +synchronously +and +because +closing +a +/ +/ +browsing +context +prompts +the +eventual +clearing +of +all +task +sources +this +/ +/ +document +should +not +be +closed +until +the +opener +document +has +confirmed +/ +/ +receipt +. +channel +. +onmessage += +( +) += +> +window +. +close +( +) +; +< +/ +script +> diff --git a/testing/web-platform/tests/html/semantics/forms/form-submission-target/resources/reltester.js b/testing/web-platform/tests/html/semantics/forms/form-submission-target/resources/reltester.js new file mode 100644 index 0000000000000..630b039dd1d8a --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/form-submission-target/resources/reltester.js @@ -0,0 +1,377 @@ +function +relTester +( +submitter +channelInput +title +) +{ +[ +{ +rel +: +" +" +exposed +: +" +all +" +} +{ +rel +: +" +noopener +" +exposed +: +" +noopener +" +} +{ +rel +: +" +noreferrer +" +exposed +: +" +noreferrer +" +} +{ +rel +: +" +opener +" +exposed +: +" +all +" +} +{ +rel +: +" +noopener +noreferrer +" +exposed +: +" +noreferrer +" +} +{ +rel +: +" +noreferrer +opener +" +exposed +: +" +noreferrer +" +} +{ +rel +: +" +opener +noopener +" +exposed +: +" +noopener +" +} +] +. +forEach +( +relTest += +> +{ +/ +/ +Use +promise_test +to +submit +only +after +one +test +concluded +promise_test +( +t += +> +{ +return +new +Promise +( +resolve += +> +{ +const +channelName += +Date +. +now +( +) ++ +relTest +. +rel +channel += +new +BroadcastChannel +( +channelName +) +; +let +form += +submitter +; +if +( +submitter +. +localName +! += += +" +form +" +) +{ +form += +submitter +. +form +; +} +form +. +rel += +relTest +. +rel +; +channelInput +. +value += +channelName +; +if +( +submitter +. +localName +! += += +" +form +" +) +{ +submitter +. +click +( +) +; +} +else +{ +submitter +. +submit +( +) +; +} +channel +. +onmessage += +t +. +step_func +( +e += +> +{ +if +( +relTest +. +exposed += += += +" +all +" +| +| +relTest +. +exposed += += += +" +noopener +" +) +{ +assert_equals +( +e +. +data +. +referrer +window +. +location +. +href +" +referrer +" +) +; +} +else +{ +assert_equals +( +e +. +data +. +referrer +" +" +" +referrer +" +) +; +} +if +( +relTest +. +exposed += += += +" +all +" +) +{ +assert_true +( +e +. +data +. +haveOpener +" +opener +" +) +; +} +else +{ +assert_false +( +e +. +data +. +haveOpener +" +opener +" +) +; +} +resolve +( +) +; +} +) +; +t +. +add_cleanup +( +( +) += +> +channel +. +postMessage +( +null +) +) +; +} +) +; +} +< +form +rel += +" +{ +relTest +. +rel +} +" +> +with +{ +title +} +) +; +} +) +; +} diff --git a/testing/web-platform/tests/html/semantics/rellist-feature-detection.html b/testing/web-platform/tests/html/semantics/rellist-feature-detection.html index 9cb0845c2af43..c98ab614a61fc 100644 --- a/testing/web-platform/tests/html/semantics/rellist-feature-detection.html +++ b/testing/web-platform/tests/html/semantics/rellist-feature-detection.html @@ -205,6 +205,9 @@ ' noopener ' +' +opener +' ] unsupported : @@ -313,6 +316,20 @@ ' ] ; +link_support_table +[ +' +form +' +] += +link_support_table +[ +' +form +' +] +; function test_rellist ( @@ -1054,6 +1071,19 @@ ] ) ; +test_rellist +( +' +FORM +' +link_support_table +[ +' +form +' +] +) +; } ' Make