Bug 1695135 - Add test for window focus by calling window.close() and window.open(); r=hsivonen

Differential Revision: https://phabricator.services.mozilla.com/D107934
This commit is contained in:
Edgar Chen 2021-03-31 14:56:48 +00:00
Родитель 64b6a0c73b
Коммит 6c05f39c1e
3 изменённых файлов: 49 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body>
<script>
SimpleTest.waitForFocus(() => {
finished();
});
</script>
</body>
</html>

Просмотреть файл

@ -834,6 +834,8 @@ support-files =
[test_window_element_enumeration.html]
[test_window_enumeration.html]
[test_window_extensible.html]
[test_window_focus_by_close_and_open.html]
support-files = file_window_focus_by_close_and_open.html
[test_window_indexing.html]
[test_window_keys.html]
[test_window_named_frame_enumeration.html]

Просмотреть файл

@ -0,0 +1,34 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>test for window focus by window.close() and window.open()</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<script>
SimpleTest.waitForExplicitFinish();
function start() {
var w = window.open("", "_blank");
w.finished = function() {
ok(true, "1st new window had focus");
w.close();
w = window.open("", "_blank");
w.finished = function() {
ok(true, "2nd new window had focus");
w.close();
SimpleTest.finish();
};
w.location = "file_window_focus_by_close_and_open.html";
};
w.location = "file_window_focus_by_close_and_open.html";
}
</script>
</head>
<body onload="setTimeout(start)">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1695135">Mozilla Bug 1695135</a>
<p id="display"></p>
<div id="content"></div>
<pre id="test"></pre>
</body>
</html>