receive two navigation notifications of PerformanceObserver
Categories
(Core :: Performance, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr68 | --- | unaffected |
firefox-esr78 | --- | wontfix |
firefox79 | --- | wontfix |
firefox80 | --- | wontfix |
firefox81 | --- | fixed |
People
(Reporter: bh7578, Assigned: sefeng)
References
(Regression)
Details
(Keywords: regression)
Attachments
(4 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Steps to reproduce:
I wrote a page, use the PerformanceObserver to get the content load and load time of the page, the sample page is attached. You can open it with Firefox 77 to reproduce it. Also I tried the developer version firefox 79.0b7, it also has the same behavior. However on the Firefox 71, it only receive one time notification. Not sure it's a bug or not.
Actual results:
Assumed I only can receive one time navigation notification when open this page, but actually I received two times, and the first time happened before document receive DOMContentLoaded event.
Following is the page code:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="timeInfo" style="padding-left:20px"></div>
<script>
function addNavigationResult(entry) {
console.log(JSON.stringify(entry.toJSON()));
document.getElementById("timeInfo").innerHTML += "<BR><span id='unload'> Unload time: " + (entry.unloadEventEnd - entry.unloadEventStart) +
" (ms) </span><BR><span id='dom_content_loaded'> DOM Content Loaded: " + (entry.domContentLoadedEventEnd - entry.domContentLoadedEventStart) + " (ms) </span>";
if ((entry.domInteractive - entry.connectStart) > 0) {
document.getElementById("timeInfo").innerHTML += " <BR><span id='dom_interactive'> DOM Interactive: " + (entry.domInteractive - entry.connectStart) + " (ms) </span>";
}
document.getElementById("timeInfo").innerHTML += " <BR> <span id='load'> Load time: " +
(entry.loadEventEnd - entry.loadEventStart) + " (ms) </span><BR><BR>";
}
function addPerformanceObserver() {
function perf_observer(list, observer) {
var entries = list.getEntries();
for (var i = 0; i < entries.length; i++) {
if (entries[i].entryType === "navigation") {
addNavigationResult(entries[i]);
}
}
}
var observer = new PerformanceObserver(perf_observer);
observer.observe({entryTypes: ["navigation"]});
}
document.addEventListener('DOMContentLoaded', function(){
console.log("*** DOMContentLoaded ***");
});
window.addEventListener('load', function(){
console.log("*** load ***");
});
addPerformanceObserver();
</script>
</body>
</html>
Expected results:
I only can receive one time navigation notification.
Comment 3•4 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Comment 4•4 years ago
|
||
Currently, we are not only updating the timing, but also sending
the timing to observers, which is not correct. According
to the Processing Modal of PerformanceNavigationTiming
(https://www.w3.org/TR/navigation-timing-2/#processing-model),
Queuing the task should be happened after user agent completes
the load event.
Assignee | ||
Updated•4 years ago
|
Updated•4 years ago
|
Pushed by sefeng@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5b5c9a90187b Update PerformanceNavigationTiming before load event fires r=baku
Comment 6•4 years ago
|
||
bugherder |
Updated•4 years ago
|
Comment 7•4 years ago
|
||
Since the regressor bug was found and the issue is already fixed, I'm removing [qa-regression-triage].
Description
•