diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-01-21 20:00:48 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-01-21 21:36:54 -0500 |
commit | a9290ef91ec408fa7886b99cc59be40b413a0ce0 (patch) | |
tree | 1fa82c7349a85865717c83dedbba38aae87fe8b9 /dom/html/test | |
parent | 722161775b9ec9314d1b02f567e42b83115cf993 (diff) | |
download | uxp-a9290ef91ec408fa7886b99cc59be40b413a0ce0.tar.gz |
Issue #1366 - Completely remove showModalDialog
Diffstat (limited to 'dom/html/test')
-rw-r--r-- | dom/html/test/file_iframe_sandbox_c_if4.html | 11 | ||||
-rw-r--r-- | dom/html/test/file_iframe_sandbox_j_if1.html | 30 | ||||
-rw-r--r-- | dom/html/test/file_iframe_sandbox_j_if2.html | 28 | ||||
-rw-r--r-- | dom/html/test/file_iframe_sandbox_j_if3.html | 27 | ||||
-rw-r--r-- | dom/html/test/mochitest.ini | 10 | ||||
-rw-r--r-- | dom/html/test/test_bug391777.html | 25 | ||||
-rw-r--r-- | dom/html/test/test_iframe_sandbox_general.html | 2 | ||||
-rw-r--r-- | dom/html/test/test_iframe_sandbox_modal.html | 122 |
8 files changed, 3 insertions, 252 deletions
diff --git a/dom/html/test/file_iframe_sandbox_c_if4.html b/dom/html/test/file_iframe_sandbox_c_if4.html index 53bf49559e..828592d630 100644 --- a/dom/html/test/file_iframe_sandbox_c_if4.html +++ b/dom/html/test/file_iframe_sandbox_c_if4.html @@ -12,7 +12,7 @@ } function doStuff() { - // try to open a new window via target="_blank", target="BC341604", window.open(), and showModalDialog() + // try to open a new window via target="_blank", target="BC341604", and window.open() // the window we try to open closes itself once it opens sendMouseEvent({type:'click'}, 'target_blank'); sendMouseEvent({type:'click'}, 'target_BC341604'); @@ -25,15 +25,6 @@ } ok(threw, "window.open threw a JS exception and was not allowed"); - - threw = false; - try { - window.showModalDialog("about:blank"); - } catch(error) { - threw = true; - } - - ok(threw, "window.showModalDialog threw a JS exception and was not allowed"); } </script> <body onLoad="doStuff()"> diff --git a/dom/html/test/file_iframe_sandbox_j_if1.html b/dom/html/test/file_iframe_sandbox_j_if1.html deleted file mode 100644 index 6d4347dfcf..0000000000 --- a/dom/html/test/file_iframe_sandbox_j_if1.html +++ /dev/null @@ -1,30 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <meta charset="utf-8"> - <title>Test for Bug 766282</title> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> - -<script type="text/javascript"> - function doStuff() { - // Open a new window via showModalDialog(). - try { - window.showModalDialog("file_iframe_sandbox_k_if5.html"); - } catch(e) { - window.parent.ok_wrapper(false, "iframes sandboxed with allow-popups and allow-modals should be able to open a modal dialog"); - } - - // Open a new window via showModalDialog(). - try { - window.showModalDialog("file_iframe_sandbox_k_if7.html"); - } catch(e) { - window.parent.ok_wrapper(false, "iframes sandboxed with allow-popups and allow-modals should be able to open a modal dialog"); - } - } -</script> - -<body onLoad="doStuff()"> - I am sandboxed with "allow-scripts allow-popups allow-same-origin allow-forms allow-top-navigation". -</body> -</html> diff --git a/dom/html/test/file_iframe_sandbox_j_if2.html b/dom/html/test/file_iframe_sandbox_j_if2.html deleted file mode 100644 index 9552307eed..0000000000 --- a/dom/html/test/file_iframe_sandbox_j_if2.html +++ /dev/null @@ -1,28 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <meta charset="utf-8"> - <title>Test for Bug 766282</title> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> - -<script type="text/javascript"> - function doSubOpens() { - // Open a new window showModalDialog(). - try { - window.showModalDialog("file_iframe_sandbox_k_if9.html"); - } catch(e) { - window.parent.ok_wrapper(false, "iframes sandboxed with allow-popups and allow-modals should be able to open a modal dialog"); - } - } - - window.doSubOpens = doSubOpens; -</script> - -<body> - I am sandboxed but with "allow-scripts allow-popups allow-same-origin". - After my initial load, "allow-same-origin" is removed and then I open file_iframe_sandbox_k_if9.html, - which attemps to call a function in my parent. - This should succeed since the new sandbox flags shouldn't have taken affect on me until I'm reloaded. -</body> -</html> diff --git a/dom/html/test/file_iframe_sandbox_j_if3.html b/dom/html/test/file_iframe_sandbox_j_if3.html deleted file mode 100644 index 07c5b66c18..0000000000 --- a/dom/html/test/file_iframe_sandbox_j_if3.html +++ /dev/null @@ -1,27 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <meta charset="utf-8"> - <title>Tests for Bug 766282</title> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> - -</head> -<script type="text/javascript"> - function ok(result, desc) { - window.parent.ok_wrapper(result, desc); - } - - function doStuff() { - // Try to open a new window via showModalDialog(). - // The window we try to open closes itself once it opens. - try { - window.showModalDialog("file_iframe_sandbox_open_window_pass.html"); - } catch(e) { - ok(false, "iframes sandboxed with allow-popups and allow-modals should be able to open a modal dialog"); - } - } -</script> -<body onLoad="doStuff()"> - I am sandboxed but with "allow-popups allow-scripts allow-same-origin" -</body> -</html> diff --git a/dom/html/test/mochitest.ini b/dom/html/test/mochitest.ini index 024de1cd91..4a50a9c3f5 100644 --- a/dom/html/test/mochitest.ini +++ b/dom/html/test/mochitest.ini @@ -154,9 +154,6 @@ support-files = file_iframe_sandbox_form_pass.html file_iframe_sandbox_g_if1.html file_iframe_sandbox_h_if1.html - file_iframe_sandbox_j_if1.html - file_iframe_sandbox_j_if2.html - file_iframe_sandbox_j_if3.html file_iframe_sandbox_k_if1.html file_iframe_sandbox_k_if2.html file_iframe_sandbox_k_if3.html @@ -471,9 +468,6 @@ skip-if = toolkit == 'android' # just copy the conditions from the test above tags = openwindow [test_iframe_sandbox_inheritance.html] tags = openwindow -[test_iframe_sandbox_modal.html] -tags = openwindow -skip-if = toolkit == 'android' || e10s #modal tests fail on android [test_iframe_sandbox_navigation.html] tags = openwindow [test_iframe_sandbox_navigation2.html] @@ -540,8 +534,6 @@ skip-if = toolkit == 'android' #bug 811644 [test_bug369370.html] skip-if = toolkit == "android" || toolkit == "windows" # disabled on Windows because of bug 1234520 [test_bug380383.html] -[test_bug391777.html] -skip-if = toolkit == 'android' || e10s [test_bug402680.html] [test_bug403868.html] [test_bug403868.xhtml] @@ -607,4 +599,4 @@ skip-if = os == "android" # up/down arrow keys not supported on android [test_script_module.html] support-files = file_script_module.html - file_script_nomodule.html
\ No newline at end of file + file_script_nomodule.html diff --git a/dom/html/test/test_bug391777.html b/dom/html/test/test_bug391777.html deleted file mode 100644 index aa01a45de7..0000000000 --- a/dom/html/test/test_bug391777.html +++ /dev/null @@ -1,25 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=391777 ---> -<head> - <title>Test for Bug 391777</title> - <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=391777">Mozilla Bug 391777</a> -<p id="display"></p> -<script class="testbody" type="text/javascript"> - -/** Test for Bug 391777 **/ -var arg = {}; -arg.testVal = "foo"; -var result = window.showModalDialog("javascript:window.returnValue = window.dialogArguments.testVal; window.close(); 'This window should close on its own.';", arg); -ok(true, "We should get here without user interaction"); -is(result, "foo", "Unexpected result from showModalDialog"); - -</script> -</body> -</html> diff --git a/dom/html/test/test_iframe_sandbox_general.html b/dom/html/test/test_iframe_sandbox_general.html index 6d3a190eef..83f0e9045d 100644 --- a/dom/html/test/test_iframe_sandbox_general.html +++ b/dom/html/test/test_iframe_sandbox_general.html @@ -41,7 +41,7 @@ function ok_wrapper(result, desc) { passedTests++; } - if (completedTests == 33) { + if (completedTests == 32) { is(passedTests, completedTests, "There are " + completedTests + " general tests that should pass"); SimpleTest.finish(); } diff --git a/dom/html/test/test_iframe_sandbox_modal.html b/dom/html/test/test_iframe_sandbox_modal.html deleted file mode 100644 index 1307ea9a50..0000000000 --- a/dom/html/test/test_iframe_sandbox_modal.html +++ /dev/null @@ -1,122 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=766282 -implement allow-popups directive for iframe sandbox ---> -<head> - <meta charset="utf-8"> - <title>Tests for Bug 766282</title> - <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> - -<script> - -SimpleTest.waitForExplicitFinish(); -SimpleTest.requestFlakyTimeout("untriaged"); - -// A postMessage handler that is used by sandboxed iframes without -// 'allow-same-origin' to communicate pass/fail back to this main page. -window.addEventListener("message", receiveMessage, false); - -function receiveMessage(event) { - switch (event.data.type) { - case "attempted": - testAttempted(); - break; - case "ok": - ok_wrapper(event.data.ok, event.data.desc, event.data.addToAttempted); - break; - default: - // allow for old style message - if (event.data.ok != undefined) { - ok_wrapper(event.data.ok, event.data.desc, event.data.addToAttempted); - } - } -} - -var attemptedTests = 0; -var passedTests = 0; -var totalTestsToPass = 5; -var totalTestsToAttempt = 5; - -function ok_wrapper(result, desc, addToAttempted = true) { - ok(result, desc); - - if (result) { - passedTests++; - } - - if (addToAttempted) { - testAttempted(); - } -} - -// Added so that tests that don't register unless they fail, -// can at least notify that they've attempted to run. -function testAttempted() { - attemptedTests++; - if (attemptedTests == totalTestsToAttempt) { - // Make sure all tests have had a chance to complete. - setTimeout(function() {finish();}, 1000); - } -} - -var finishCalled = false; - -function finish() { - if (!finishCalled) { - finishCalled = true; - is(passedTests, totalTestsToPass, "There are " + totalTestsToPass + " modal tests that should pass"); - - SimpleTest.finish(); - } -} - -function doTest() { - // passes if good and fails if bad - // 1) A window opened from inside an iframe that has sandbox = "allow-scripts allow-popups - // allow-same-origin" should not have its origin sandbox flag set and be able to access - // document.cookie. (Done by file_iframe_sandbox_k_if5.html opened from - // file_iframe_sandbox_j_if1.html) using showModalDialog.) - - // passes if good - // 2) A window opened from inside an iframe that has sandbox = "allow-scripts allow-popups - // allow-top-navigation" should not have its top-level navigation sandbox flag set and be able to - // navigate top. (Done by file_iframe_sandbox_k_if5.html (and if6) opened from - // file_iframe_sandbox_j_if1.html) using showModalDialog.) - - // passes if good - // 3) A window opened from inside an iframe that has sandbox = "allow-scripts allow-popups - // all-forms" should not have its forms sandbox flag set and be able to submit forms. - // (Done by file_iframe_sandbox_k_if7.html opened from - // file_iframe_sandbox_j_if1.html) using showModalDialog.) - - // passes if good - // 4) Make sure that the sandbox flags copied to a new browsing context are taken from the - // current active document not the browsing context (iframe / docShell). - // This is done by removing allow-same-origin and calling doSubOpens from file_iframe_sandbox_j_if2.html, - // which opens file_iframe_sandbox_k_if9.html using showModalDialog. - var if_2 = document.getElementById('if_2'); - if_2.sandbox = 'allow-scripts allow-popups'; - if_2.contentWindow.doSubOpens(); - - // passes if good - // 5) Test that a sandboxed iframe with "allow-popups" can open a new window using window.ShowModalDialog. - // This is done via file_iframe_sandbox_j_if3.html which is sandboxed with "allow-popups allow-scripts - // allow-same-origin". The window it attempts to open calls window.opener.ok(true, ...) and - // file_iframe_j_if3.html has an ok() function that calls window.parent.ok_wrapper. -} - -addLoadEvent(doTest); -</script> - -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=766282">Mozilla Bug 766282</a> - implement allow-popups directive for iframe sandbox -<p id="display"></p> -<div id="content"> -<iframe sandbox="allow-scripts allow-popups allow-modals allow-same-origin allow-forms allow-top-navigation" id="if_1" src="file_iframe_sandbox_j_if1.html" height="10" width="10"></iframe> -<iframe sandbox="allow-scripts allow-popups allow-modals allow-same-origin" id="if_2" src="file_iframe_sandbox_j_if2.html" height="10" width="10"></iframe> -<iframe sandbox="allow-popups allow-modals allow-same-origin allow-scripts" id="if_3" src="file_iframe_sandbox_j_if3.html" height="10" width="10"></iframe> -</div> |