Skip to content

Commit

Permalink
Cleanup and safe element checks (#2218)
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore authored Nov 23, 2024
1 parent 3ae30f9 commit 7eb04a3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/chrome/webdriver/devtools/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
export const elementTimeLine = `
(function () {
const observer = new PerformanceObserver(list => { });
observer.observe({ type: 'element', buffered: true, includeSoftNavigationObservations: true });
observer.observe({ type: 'element', buffered: true });
const entries = observer.takeRecords();
for (let entry of entries) {
performance.mark(entry.identifier, {
Expand Down
2 changes: 1 addition & 1 deletion lib/chrome/webdriver/devtools/fcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
export const fcpTimeLine = `
(function () {
const observer = new PerformanceObserver(list => { });
observer.observe({ type: 'paint', buffered: true, includeSoftNavigationObservations: true });
observer.observe({ type: 'paint', buffered: true });
const entries = observer.takeRecords();
for (let entry of entries) {
performance.mark(entry.name === 'first-contentful-paint' ? 'FCP': 'FP', {
Expand Down
2 changes: 1 addition & 1 deletion lib/chrome/webdriver/devtools/inp.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const inpTimeLine = `
(function() {
const observer = new PerformanceObserver(list => {});
for (const type of ['event']) {
observer.observe({ type, buffered: true, durationThreshold: 0, includeSoftNavigationObservations: true });
observer.observe({ type, buffered: true, durationThreshold: 0});
}
let inpEventCount = 0;
const entries = observer.takeRecords();
Expand Down
14 changes: 7 additions & 7 deletions lib/chrome/webdriver/devtools/lcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
export const lcpTimeLine = `
(function () {
const observer = new PerformanceObserver(list => { });
observer.observe({ type: 'largest-contentful-paint', buffered: true, durationThreshold: 0, includeSoftNavigationObservations: true });
observer.observe({ type: 'largest-contentful-paint', buffered: true });
const entries = observer.takeRecords();
entries.forEach((entry, index) => {
if (index === entries.length - 1) {
Expand All @@ -16,11 +16,11 @@ export const lcpTimeLine = `
track: 'Metrics',
trackGroup: 'Browsertime Timeline',
color: 'primary-dark',
tooltipText: 'LCP ' + entry.element ? entry.element.className : '',
tooltipText: 'LCP ' + (entry.element?.tagName || ''),
properties: [
['size', '' + entry.size],
['tagName', '' + entry.element ? entry.element.tagName : ''],
['className', '' + entry.element ? entry.element.className : ''],
['tagName', '' + (entry.element?.tagName || '')],
['className', '' + (entry.element?.className || '')],
['URL', '' + entry.url],
['Render', Math.max(entry.renderTime, entry.loadTime)]
],
Expand All @@ -37,11 +37,11 @@ export const lcpTimeLine = `
track: 'LCP',
trackGroup: 'Browsertime Timeline',
color: 'primary-dark',
tooltipText: 'LCP Candidate ' + entry.element ? entry.element.className : '',
tooltipText: 'LCP Candidate ' + (entry.element?.tagName || ''),
properties: [
['size', '' + entry.size],
['tagName', '' + entry.element ? entry.element.tagName : ''],
['className', '' + entry.element ? entry.element.className : ''],
['tagName', '' + (entry.element?.tagName || '')],
['className', '' + (entry.element?.className || '')],
['URL', '' + entry.url]
],
}
Expand Down

0 comments on commit 7eb04a3

Please sign in to comment.