summaryrefslogtreecommitdiffstats
path: root/dom/security/test/general/test_block_toplevel_data_img_navigation.html
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-22 19:03:22 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-22 19:03:22 +0200
commitf1e5578718ea8883438cfea06d3c55d25f5c0278 (patch)
tree5afce22662aad4e58a894d061ed65ac3ce68cee7 /dom/security/test/general/test_block_toplevel_data_img_navigation.html
parent1b4c4256ee7705724b02919b4d432b2a391bcd04 (diff)
downloadUXP-f1e5578718ea8883438cfea06d3c55d25f5c0278.tar
UXP-f1e5578718ea8883438cfea06d3c55d25f5c0278.tar.gz
UXP-f1e5578718ea8883438cfea06d3c55d25f5c0278.tar.lz
UXP-f1e5578718ea8883438cfea06d3c55d25f5c0278.tar.xz
UXP-f1e5578718ea8883438cfea06d3c55d25f5c0278.zip
moebius#226: Consider blocking top level window data: URIs (part 2/2 without tests)
https://github.com/MoonchildProductions/moebius/pull/226
Diffstat (limited to 'dom/security/test/general/test_block_toplevel_data_img_navigation.html')
-rw-r--r--dom/security/test/general/test_block_toplevel_data_img_navigation.html18
1 files changed, 10 insertions, 8 deletions
diff --git a/dom/security/test/general/test_block_toplevel_data_img_navigation.html b/dom/security/test/general/test_block_toplevel_data_img_navigation.html
index 2b8f62760..7f8dfc748 100644
--- a/dom/security/test/general/test_block_toplevel_data_img_navigation.html
+++ b/dom/security/test/general/test_block_toplevel_data_img_navigation.html
@@ -34,15 +34,17 @@ function test_toplevel_data_image_svg() {
const DATA_SVG =
"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2Ij4KICA8cGF0aCBkPSJNOCwxMkwzLDcsNCw2bDQsNCw0LTQsMSwxWiIgZmlsbD0iIzZBNkE2QSIgLz4KPC9zdmc+Cg==";
let win2 = window.open(DATA_SVG);
- let wrappedWin2 = SpecialPowers.wrap(win2);
- setTimeout(function () {
- isnot(wrappedWin2.document.documentElement.localName, "svg",
- "Loading data:image/svg+xml should be blocked");
- wrappedWin2.close();
- SimpleTest.finish();
- }, 1000);
+ // Unfortunately we can't detect whether the window was closed using some event,
+ // hence we are constantly polling till we see that win == null.
+ // Test times out on failure.
+ var win2Closed = setInterval(function() {
+ if (win2 == null || win2.closed) {
+ clearInterval(win2Closed);
+ ok(true, "Loading data:image/svg+xml should be blocked");
+ SimpleTest.finish();
+ }
+ }, 200);
}
-
// fire up the tests
test_toplevel_data_image();