Closed Bug 1653165 Opened 7 months ago Closed 6 months ago

receive two navigation notifications of PerformanceObserver


(Core :: Performance, defect, P3)

77 Branch



81 Branch
Tracking Status
firefox-esr68 --- unaffected
firefox-esr78 --- wontfix
firefox79 --- wontfix
firefox80 --- wontfix
firefox81 --- fixed


(Reporter: bh7578, Assigned: sefeng)




(Keywords: regression)


(4 files)

Attached file per_observer_test.html

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>
<div id="timeInfo" style="padding-left:20px"></div>

function addNavigationResult(entry) {
    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") {

    var observer = new PerformanceObserver(perf_observer);
    observer.observe({entryTypes: ["navigation"]});

document.addEventListener('DOMContentLoaded', function(){
	console.log("*** DOMContentLoaded ***");

window.addEventListener('load', function(){
	console.log("*** load ***");



Expected results:

I only can receive one time navigation notification.

Attached image ff71.0b5.png
Attached image ff77.png

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
Component: DOM: Core & HTML → Performance
Severity: -- → S3
Has Regression Range: --- → no
Has STR: --- → yes
Ever confirmed: true
Priority: -- → P3
Regressed by: 1613140

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
Queuing the task should be happened after user agent completes
the load event.

Assignee: nobody → sefeng
QA Whiteboard: [qa-regression-triage]
Pushed by
Update PerformanceNavigationTiming before load event fires r=baku
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 81 Branch

Since the regressor bug was found and the issue is already fixed, I'm removing [qa-regression-triage].

QA Whiteboard: [qa-regression-triage]
You need to log in before you can comment on or make changes to this bug.