From 8d80e024d8347772183c6edff7abbf74f886c4cd Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Fri, 4 Oct 2019 13:05:31 +0000 Subject: [PATCH] Bug 1550197 [wpt PR 16330] - HTML: ensure BarProps are visible for noopener/noreferrer, a=testonly Automatic update from web-platform-tests HTML: ensure BarProps are visible for noopener/noreferrer For https://github.com/whatwg/html/pull/3297. -- wpt-commits: ce675f004d08b1dfd7f4bbf3dbb422229addedac wpt-pr: 16330 UltraBlame original commit: 5e1ab479dde3882aa3d4661a4f3336df60d8dec8 --- .../noopener-noreferrer-BarProp.window.js | 197 ++++++++++++++++++ .../support/BarProp-target.html | 149 +++++++++++++ 2 files changed, 346 insertions(+) create mode 100644 testing/web-platform/tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window.js create mode 100644 testing/web-platform/tests/html/browsers/the-window-object/support/BarProp-target.html diff --git a/testing/web-platform/tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window.js b/testing/web-platform/tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window.js new file mode 100644 index 0000000000000..dadbe25022c8a --- /dev/null +++ b/testing/web-platform/tests/html/browsers/the-window-object/noopener-noreferrer-BarProp.window.js @@ -0,0 +1,197 @@ +const +barProps += +[ +" +locationbar +" +" +menubar +" +" +personalbar +" +" +scrollbars +" +" +statusbar +" +" +toolbar +" +] +; +test +( +( +) += +> +{ +for +( +const +prop +of +barProps +) +{ +assert_true +( +window +[ +prop +] +. +visible +) +; +} +} +" +All +bars +visible +" +) +; +[ +" +noopener +" +" +noreferrer +" +] +. +forEach +( +openerStyle += +> +{ +async_test +( +t += +> +{ +const +channelName += +" +5454 +" ++ +openerStyle ++ +" +34324 +" +; +const +channel += +new +BroadcastChannel +( +channelName +) +; +window +. +open +( +" +support +/ +BarProp +- +target +. +html +? +" ++ +channelName +" +" +openerStyle +) +; +channel +. +onmessage += +t +. +step_func_done +( +e += +> +{ +/ +/ +Send +message +first +so +if +asserts +throw +the +popup +is +still +closed +channel +. +postMessage +( +null +) +; +for +( +const +prop +of +barProps +) +{ +assert_true +( +e +. +data +[ +prop +] +) +; +} +} +) +; +} +window +. +open +( +) +with +{ +openerStyle +} +should +have +all +bars +visible +) +; +} +) +; diff --git a/testing/web-platform/tests/html/browsers/the-window-object/support/BarProp-target.html b/testing/web-platform/tests/html/browsers/the-window-object/support/BarProp-target.html new file mode 100644 index 0000000000000..6e660efdb58ae --- /dev/null +++ b/testing/web-platform/tests/html/browsers/the-window-object/support/BarProp-target.html @@ -0,0 +1,149 @@ +< +! +DOCTYPE +html +> +< +script +> +const +barProps += +[ +" +locationbar +" +" +menubar +" +" +personalbar +" +" +scrollbars +" +" +statusbar +" +" +toolbar +" +] +; +const +barPropsObj += +{ +} +; +const +channelName += +location +. +search +. +substr +( +1 +) +; +const +channel += +new +BroadcastChannel +( +channelName +) +; +for +( +const +prop +of +barProps +) +{ +barPropsObj +[ +prop +] += +window +[ +prop +] +. +visible +; +} +channel +. +postMessage +( +barPropsObj +) +; +/ +/ +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 +>