buffered-flag.window.js (913B)
1 async_test(t => { 2 function checkEntryList(entries) { 3 assert_equals(entries.length, 1, "Only one navigation timing entry"); 4 assert_equals(entries[0].entryType, "navigation", "entryType is \"navigation\""); 5 assert_equals(entries[0].name, window.location.toString(), "name is the address of the document"); 6 } 7 // First observer creates second in callback to ensure the entry has been dispatched by the time 8 // the second observer begins observing. 9 new PerformanceObserver(t.step_func(entryList => { 10 checkEntryList(entryList.getEntries()); 11 // Second observer requires 'buffered: true' to see the navigation entry. 12 new PerformanceObserver(t.step_func_done(list => { 13 checkEntryList(list.getEntries()); 14 })).observe({type: 'navigation', buffered: true}); 15 })).observe({entryTypes: ["navigation"]}); 16 }, "PerformanceObserver with buffered flag sees previous navigation entry.");