mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1761981 - tests, r=smaug
Depends on D142596 Differential Revision: https://phabricator.services.mozilla.com/D142597
This commit is contained in:
parent
84361993fd
commit
89bea3ab53
@ -0,0 +1,18 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<script src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<title>Test window for top navigation with no script</title>
|
||||
</head>
|
||||
<body>
|
||||
<iframe sandbox="allow-same-origin allow-top-navigation-by-user-activation"
|
||||
srcdoc="<a href='javascript:top.opener.ok(false, `the JS ran!`)' target=_top>click</a>"></iframe>
|
||||
<script>
|
||||
onload = () => {
|
||||
opener.info("clicking on link");
|
||||
synthesizeMouseAtCenter(frames[0].document.body.querySelector("a"), {});
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -28,3 +28,6 @@ support-files =
|
||||
file_top_navigation_by_user_activation_iframe.html
|
||||
skip-if =
|
||||
http3
|
||||
[test_top_navigation_no_script.html]
|
||||
support-files =
|
||||
file_top_navigation_no_script.html
|
||||
|
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Iframe sandbox top navigation noscript</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
add_task(async function() {
|
||||
let testWin;
|
||||
let promise = new Promise((resolve) => {
|
||||
SpecialPowers.addObserver(function obs(subject) {
|
||||
ok(subject == testWin, "the blocked window should be our pop-up window");
|
||||
SpecialPowers.removeObserver(obs, "javascript-uri-blocked-by-sandbox");
|
||||
resolve();
|
||||
}, "javascript-uri-blocked-by-sandbox");
|
||||
});
|
||||
testWin = window.open("file_top_navigation_no_script.html");
|
||||
await promise;
|
||||
testWin.close();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user