Bug 1254688 - Test that loaded in onunload shouldn't show up in the next page performance object r=bz

MozReview-Commit-ID: ApFxoKmwoji
This commit is contained in:
Valentin Gosu 2017-09-13 14:55:15 +02:00
Родитель 3f5330962d
Коммит 825c888826
4 изменённых файлов: 110 добавлений и 0 удалений

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

@ -0,0 +1,42 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<script type="application/javascript">
function is(received, expected, message) {
window.opener.is(received, expected, message);
}
window.onload = function() {
var entries = window.performance.getEntries();
is(entries.length, 1, "Only one entry should be found");
if (entries.length > 0) {
is(entries[0].name, "http://mochi.test:8888/tests/image/test/mochitest/over.png", "Entry must have correct name");
}
location.href = "file_resource_timing_unload2.html";
}
window.onunload = function() {
new Image().src = "http://mochi.test:8888/tests/image/test/mochitest/damon.png";
}
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1254688"
title="Resource timing during unload handler">
Bug #1254688 - Resource timing during unload handler
</a>
<p id="display"></p>
<div id="content">
<img src="http://mochi.test:8888/tests/image/test/mochitest/over.png">
</div>
</body>
</html>

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

@ -0,0 +1,27 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<script type="application/javascript">
function is(received, expected, message) {
window.opener.is(received, expected, message);
}
window.onload = function() {
is(window.performance.getEntries().length, 0, "Should not have any entries");
window.opener.finishTests();
}
</script>
</head>
<body>
<p id="display"></p>
<div id="content">
</div>
</body>
</html>

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

@ -58,6 +58,8 @@ support-files =
!/image/test/mochitest/red.png
!/dom/base/test/file_empty.html
file_focusrings.html
file_resource_timing_unload1.html
file_resource_timing_unload2.html
[test_497898.html]
skip-if = toolkit == 'android'
@ -120,6 +122,7 @@ support-files = test_offsets.js
[test_resource_timing.html]
[test_resource_timing_cross_origin.html]
[test_resource_timing_frameset.html]
[test_resource_timing_unload.html]
[test_selectevents.html]
skip-if = toolkit == 'android' # bug 1230232 - Mouse doesn't select in the same way
[test_showModalDialog_removed.html]

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

@ -0,0 +1,38 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1254688
-->
<head>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
// Resource timing is prefed off by default, so we had to use this workaround
SpecialPowers.pushPrefEnv({"set": [["dom.enable_resource_timing", true]]}, start);
var subwindow = null;
function start() {
subwindow = window.open("file_resource_timing_unload1.html");
}
function finishTests() {
subwindow.close();
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>