Bug 1405961 - Remove assertion and ensure PerformanceNavigationTiming can be used before onLoad completes r=baku

MozReview-Commit-ID: FsEeeAOqDwY

--HG--
extra : rebase_source : 7b93f5967e184b4f7a86e07dd61c0d7af0fcf867
This commit is contained in:
Valentin Gosu 2017-10-18 14:52:03 +02:00
parent b447b85ab8
commit 128fd96763
3 changed files with 31 additions and 1 deletions

View File

@ -165,7 +165,6 @@ public:
inline DOMHighResTimeStamp TimeStampToDOMHighRes(mozilla::TimeStamp aStamp) const
{
MOZ_ASSERT(!aStamp.IsNull(), "The timestamp should not be null");
if (aStamp.IsNull()) {
return 0;
}

View File

@ -114,6 +114,7 @@ support-files = test_offsets.js
[test_paste_selection.html]
[test_performance_now.html]
[test_performance_timeline.html]
[test_performance_nav_timing_before_onload.html]
[test_picture_apng.html]
[test_picture_mutations.html]
[test_pointerPreserves3D.html]

View File

@ -0,0 +1,30 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test for Bug 1405961 - Using PerformanceNavigationTiming before onload</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<div id="content"> </div>
<script>
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.enable_performance_navigation_timing", true]]}, start);
function start() {
var p = performance.getEntriesByName("document")[0];
ok(!!p, "There should be an entry for the document");
document.getElementById("content").textContent += JSON.stringify(p);
SimpleTest.finish();
}
</script>
</body>
</html>