We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why is this code always running even on file:/// urls? it causes exceptions immediately every time I try to step through my clientside code...
!function() { "use strict"; let e = -1; const t = () => e , n = t => { addEventListener("pageshow", (n => { n.persisted && (e = n.timeStamp, t(n)) } ), !0) } , r = () => { const e = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0]; if (e && e.responseStart > 0 && e.responseStart < performance.now()) return e } , i = () => { const e = r(); return e && e.activationStart || 0 } , a = (e, n) => { const a = r(); let o = "navigate"; return t() >= 0 ? o = "back-forward-cache" : a && (document.prerendering || i() > 0 ? o = "prerender" : document.wasDiscarded ? o = "restore" : a.type && (o = a.type.replace(/_/g, "-"))), { name: e, value: void 0 === n ? -1 : n, rating: "good", delta: 0, entries: [], id: `v4-${Date.now()}-${Math.floor(8999999999999 * Math.random()) + 1e12}`, navigationType: o } } , o = (e, t, n) => { try { if (PerformanceObserver.supportedEntryTypes.includes(e)) { const r = new PerformanceObserver((e => { Promise.resolve().then(( () => { t(e.getEntries()) } )) } )); return r.observe(Object.assign({ type: e, buffered: !0 }, n || {})), r } } catch (e) {} } , s = (e, t, n, r) => { let i, a; return o => { t.value >= 0 && (o || r) && (a = t.value - (i || 0), (a || void 0 === i) && (i = t.value, t.delta = a, t.rating = ( (e, t) => e > t[1] ? "poor" : e > t[0] ? "needs-improvement" : "good")(t.value, n), e(t))) } } , c = e => { requestAnimationFrame(( () => requestAnimationFrame(( () => e())))) } , l = e => { document.addEventListener("visibilitychange", ( () => { "hidden" === document.visibilityState && e() } )) } , u = e => { let t = !1; return () => { t || (e(), t = !0) } } ; let d = -1; const m = () => "hidden" !== document.visibilityState || document.prerendering ? 1 / 0 : 0 , p = e => { "hidden" === document.visibilityState && d > -1 && (d = "visibilitychange" === e.type ? e.timeStamp : 0, f()) } , h = () => { addEventListener("visibilitychange", p, !0), addEventListener("prerenderingchange", p, !0) } , f = () => { removeEventListener("visibilitychange", p, !0), removeEventListener("prerenderingchange", p, !0) } , g = () => (d < 0 && (d = m(), h(), n(( () => { setTimeout(( () => { d = m(), h() } ), 0) } ))), { get firstHiddenTime() { return d } }) , v = e => { document.prerendering ? addEventListener("prerenderingchange", ( () => e()), !0) : e() } , y = [1800, 3e3] , T = (e, t) => { t = t || {}, v(( () => { const r = g(); let l, u = a("FCP"); const d = o("paint", (e => { e.forEach((e => { "first-contentful-paint" === e.name && (d.disconnect(), e.startTime < r.firstHiddenTime && (u.value = Math.max(e.startTime - i(), 0), u.entries.push(e), l(!0))) } )) } )); d && (l = s(e, u, y, t.reportAllChanges), n((n => { u = a("FCP"), l = s(e, u, y, t.reportAllChanges), c(( () => { u.value = performance.now() - n.timeStamp, l(!0) } )) } ))) } )) } , E = [.1, .25]; let b = 0 , S = 1 / 0 , L = 0; const D = e => { e.forEach((e => { e.interactionId && (S = Math.min(S, e.interactionId), L = Math.max(L, e.interactionId), b = L ? (L - S) / 7 + 1 : 0) } )) } ; let C; const I = () => C ? b : performance.interactionCount || 0 , w = [] , P = new Map; let M = 0; const F = [] , x = e => { if (F.forEach((t => t(e))), !e.interactionId && "first-input" !== e.entryType) return; const t = w[w.length - 1] , n = P.get(e.interactionId); if (n || w.length < 10 || e.duration > t.latency) { if (n) e.duration > n.latency ? (n.entries = [e], n.latency = e.duration) : e.duration === n.latency && e.startTime === n.entries[0].startTime && n.entries.push(e); else { const t = { id: e.interactionId, latency: e.duration, entries: [e] }; P.set(t.id, t), w.push(t) } w.sort(( (e, t) => t.latency - e.latency)), w.length > 10 && w.splice(10).forEach((e => P.delete(e.id))) } } , _ = e => { const t = self.requestIdleCallback || self.setTimeout; let n = -1; return e = u(e), "hidden" === document.visibilityState ? e() : (n = t(e), l(e)), n } , A = [200, 500] , k = (e, t) => { "PerformanceEventTiming"in self && "interactionId"in PerformanceEventTiming.prototype && (t = t || {}, v(( () => { "interactionCount"in performance || C || (C = o("event", D, { type: "event", buffered: !0, durationThreshold: 0 })); let r, i = a("INP"); const c = e => { _(( () => { e.forEach(x); const t = ( () => { const e = Math.min(w.length - 1, Math.floor((I() - M) / 50)); return w[e] } )(); t && t.latency !== i.value && (i.value = t.latency, i.entries = t.entries, r()) } )) } , u = o("event", c, { durationThreshold: t.durationThreshold ?? 40 }); r = s(e, i, A, t.reportAllChanges), u && (u.observe({ type: "first-input", buffered: !0 }), l(( () => { c(u.takeRecords()), r(!0) } )), n(( () => { M = I(), w.length = 0, P.clear(), i = a("INP"), r = s(e, i, A, t.reportAllChanges) } ))) } ))) } , N = [2500, 4e3] , O = {} , B = [800, 1800] , R = e => { document.prerendering ? v(( () => R(e))) : "complete" !== document.readyState ? addEventListener("load", ( () => R(e)), !0) : setTimeout(e, 0) } ; let j, q, W, z; const H = { passive: !0, capture: !0 } , $ = new Date , G = (e, t) => { j || (j = t, q = e, W = new Date, V(removeEventListener), J()) } , J = () => { if (q >= 0 && q < W - $) { const e = { entryType: "first-input", name: j.type, target: j.target, cancelable: j.cancelable, startTime: j.timeStamp, processingStart: j.timeStamp + q }; z.forEach((function(t) { t(e) } )), z = [] } } , U = e => { if (e.cancelable) { const t = (e.timeStamp > 1e12 ? new Date : performance.now()) - e.timeStamp; "pointerdown" == e.type ? ( (e, t) => { const n = () => { G(e, t), i() } , r = () => { i() } , i = () => { removeEventListener("pointerup", n, H), removeEventListener("pointercancel", r, H) } ; addEventListener("pointerup", n, H), addEventListener("pointercancel", r, H) } )(t, e) : G(t, e) } } , V = e => { ["mousedown", "keydown", "touchstart", "pointerdown"].forEach((t => e(t, U, H))) } , K = [100, 300] , Q = e => { if ("loading" === document.readyState) return "loading"; { const t = r(); if (t) { if (e < t.domInteractive) return "loading"; if (0 === t.domContentLoadedEventStart || e < t.domContentLoadedEventStart) return "dom-interactive"; if (0 === t.domComplete || e < t.domComplete) return "dom-content-loaded" } } return "complete" } , X = e => { const t = e.nodeName; return 1 === e.nodeType ? t.toLowerCase() : t.toUpperCase().replace(/^#/, "") } , Y = (e, t) => { let n = ""; try { for (; e && 9 !== e.nodeType; ) { const r = e , i = r.id ? "#" + r.id : X(r) + (r.classList && r.classList.value && r.classList.value.trim() && r.classList.value.trim().length ? "." + r.classList.value.trim().replace(/\s+/g, ".") : ""); if (n.length + i.length > (t || 100) - 1) return n || i; if (n = n ? i + ">" + n : i, r.id) break; e = r.parentNode } } catch (e) {} return n } ; let Z, ee = [], te = [], ne = 0; const re = new WeakMap , ie = new Map; let ae = -1; const oe = e => { ee = ee.concat(e), se() } , se = () => { ae < 0 && (ae = _(ce)) } , ce = () => { ie.size > 10 && ie.forEach(( (e, t) => { P.has(t) || ie.delete(t) } )); const e = w.map((e => re.get(e.entries[0]))) , t = te.length - 50; te = te.filter(( (n, r) => r >= t || e.includes(n))); const n = new Set; for (let e = 0; e < te.length; e++) { const t = te[e]; le(t.startTime, t.processingEnd).forEach((e => { n.add(e) } )) } const r = ee.length - 1 - 50; ee = ee.filter(( (e, t) => e.startTime > ne && t > r || n.has(e))), ae = -1 } ; F.push((e => {} ), (e => { const t = e.startTime + e.duration; let n; ne = Math.max(ne, e.processingEnd); for (let r = te.length - 1; r >= 0; r--) { const i = te[r]; if (Math.abs(t - i.renderTime) <= 8) { n = i, n.startTime = Math.min(e.startTime, n.startTime), n.processingStart = Math.min(e.processingStart, n.processingStart), n.processingEnd = Math.max(e.processingEnd, n.processingEnd), n.entries.push(e); break } } n || (n = { startTime: e.startTime, processingStart: e.processingStart, processingEnd: e.processingEnd, renderTime: t, entries: [e] }, te.push(n)), (e.interactionId || "first-input" === e.entryType) && re.set(e, n), se() } )); const le = (e, t) => { const n = []; for (let r, i = 0; r = ee[i]; i++) if (!(r.startTime + r.duration < e)) { if (r.startTime > t) break; n.push(r) } return n } , ue = e => { const t = e.entries[0] , n = re.get(t) , r = t.processingStart , i = n.processingEnd , a = n.entries.sort(( (e, t) => e.processingStart - t.processingStart)) , o = le(t.startTime, i) , s = e.entries.find((e => e.target)) , c = s && s.target || ie.get(t.interactionId) , l = [t.startTime + t.duration, i].concat(o.map((e => e.startTime + e.duration))) , u = Math.max.apply(Math, l) , d = { interactionTarget: Y(c), interactionTargetElement: c, interactionType: t.name.startsWith("key") ? "keyboard" : "pointer", interactionTime: t.startTime, nextPaintTime: u, processedEventEntries: a, longAnimationFrameEntries: o, inputDelay: r - t.startTime, processingDuration: i - r, presentationDelay: Math.max(u - i, 0), loadState: Q(t.startTime) }; return Object.assign(e, { attribution: d }) } ; var de = Object.freeze({ __proto__: null, CLSThresholds: E, FCPThresholds: y, FIDThresholds: K, INPThresholds: A, LCPThresholds: N, TTFBThresholds: B, onCLS: (e, t) => { ( (e, t) => { t = t || {}, T(u(( () => { let r, i = a("CLS", 0), u = 0, d = []; const m = e => { e.forEach((e => { if (!e.hadRecentInput) { const t = d[0] , n = d[d.length - 1]; u && e.startTime - n.startTime < 1e3 && e.startTime - t.startTime < 5e3 ? (u += e.value, d.push(e)) : (u = e.value, d = [e]) } } )), u > i.value && (i.value = u, i.entries = d, r()) } , p = o("layout-shift", m); p && (r = s(e, i, E, t.reportAllChanges), l(( () => { m(p.takeRecords()), r(!0) } )), n(( () => { u = 0, i = a("CLS", 0), r = s(e, i, E, t.reportAllChanges), c(( () => r())) } )), setTimeout(r, 0)) } ))) } )((t => { const n = (e => { let t = {}; if (e.entries.length) { const r = e.entries.reduce(( (e, t) => e && e.value > t.value ? e : t)); if (r && r.sources && r.sources.length) { const e = (n = r.sources).find((e => e.node && 1 === e.node.nodeType)) || n[0]; e && (t = { largestShiftTarget: Y(e.node), largestShiftTime: r.startTime, largestShiftValue: r.value, largestShiftSource: e, largestShiftEntry: r, loadState: Q(r.startTime) }) } } var n; return Object.assign(e, { attribution: t }) } )(t); e(n) } ), t) } , onFCP: (e, n) => { T((n => { const i = (e => { let n = { timeToFirstByte: 0, firstByteToFCP: e.value, loadState: Q(t()) }; if (e.entries.length) { const t = r() , i = e.entries[e.entries.length - 1]; if (t) { const r = t.activationStart || 0 , a = Math.max(0, t.responseStart - r); n = { timeToFirstByte: a, firstByteToFCP: e.value - a, loadState: Q(e.entries[0].startTime), navigationEntry: t, fcpEntry: i } } } return Object.assign(e, { attribution: n }) } )(n); e(i) } ), n) } , onFID: (e, t) => { ( (e, t) => { t = t || {}, v(( () => { const r = g(); let i, c = a("FID"); const d = e => { e.startTime < r.firstHiddenTime && (c.value = e.processingStart - e.startTime, c.entries.push(e), i(!0)) } , m = e => { e.forEach(d) } , p = o("first-input", m); i = s(e, c, K, t.reportAllChanges), p && (l(u(( () => { m(p.takeRecords()), p.disconnect() } ))), n(( () => { var n; c = a("FID"), i = s(e, c, K, t.reportAllChanges), z = [], q = -1, j = null, V(addEventListener), n = d, z.push(n), J() } ))) } )) } )((t => { const n = (e => { const t = e.entries[0] , n = { eventTarget: Y(t.target), eventType: t.name, eventTime: t.startTime, eventEntry: t, loadState: Q(t.startTime) }; return Object.assign(e, { attribution: n }) } )(t); e(n) } ), t) } , onINP: (e, t) => { Z || (Z = o("long-animation-frame", oe)), k((t => { const n = ue(t); e(n) } ), t) } , onLCP: (e, t) => { ( (e, t) => { t = t || {}, v(( () => { const r = g(); let d, m = a("LCP"); const p = e => { t.reportAllChanges || (e = e.slice(-1)), e.forEach((e => { e.startTime < r.firstHiddenTime && (m.value = Math.max(e.startTime - i(), 0), m.entries = [e], d()) } )) } , h = o("largest-contentful-paint", p); if (h) { d = s(e, m, N, t.reportAllChanges); const r = u(( () => { O[m.id] || (p(h.takeRecords()), h.disconnect(), O[m.id] = !0, d(!0)) } )); ["keydown", "click"].forEach((e => { addEventListener(e, ( () => _(r)), { once: !0, capture: !0 }) } )), l(r), n((n => { m = a("LCP"), d = s(e, m, N, t.reportAllChanges), c(( () => { m.value = performance.now() - n.timeStamp, O[m.id] = !0, d(!0) } )) } )) } } )) } )((t => { const n = (e => { let t = { timeToFirstByte: 0, resourceLoadDelay: 0, resourceLoadDuration: 0, elementRenderDelay: e.value }; if (e.entries.length) { const n = r(); if (n) { const r = n.activationStart || 0 , i = e.entries[e.entries.length - 1] , a = i.url && performance.getEntriesByType("resource").filter((e => e.name === i.url))[0] , o = Math.max(0, n.responseStart - r) , s = Math.max(o, a ? (a.requestStart || a.startTime) - r : 0) , c = Math.max(s, a ? a.responseEnd - r : 0) , l = Math.max(c, i.startTime - r); t = { element: Y(i.element), timeToFirstByte: o, resourceLoadDelay: s - o, resourceLoadDuration: c - s, elementRenderDelay: l - c, navigationEntry: n, lcpEntry: i }, i.url && (t.url = i.url), a && (t.lcpResourceEntry = a) } } return Object.assign(e, { attribution: t }) } )(t); e(n) } ), t) } , onTTFB: (e, t) => { ( (e, t) => { t = t || {}; let o = a("TTFB") , c = s(e, o, B, t.reportAllChanges); R(( () => { const l = r(); l && (o.value = Math.max(l.responseStart - i(), 0), o.entries = [l], c(!0), n(( () => { o = a("TTFB", 0), c = s(e, o, B, t.reportAllChanges), c(!0) } ))) } )) } )((t => { const n = (e => { let t = { waitingDuration: 0, cacheDuration: 0, dnsDuration: 0, connectionDuration: 0, requestDuration: 0 }; if (e.entries.length) { const n = e.entries[0] , r = n.activationStart || 0 , i = Math.max((n.workerStart || n.fetchStart) - r, 0) , a = Math.max(n.domainLookupStart - r, 0) , o = Math.max(n.connectStart - r, 0) , s = Math.max(n.connectEnd - r, 0); t = { waitingDuration: i, cacheDuration: a - i, dnsDuration: o - a, connectionDuration: s - o, requestDuration: e.value - s, navigationEntry: n } } return Object.assign(e, { attribution: t }) } )(t); e(n) } ), t) } }); var me = Object.freeze({ __proto__: null, onEachInteraction: function(e) { F.push((t => { Promise.resolve().then(( () => { if (t.interactionId) { const n = ue({ entries: [t], name: "INP", rating: "good", value: t.duration, delta: t.duration, navigationType: "navigate", id: "N/A" }); e(n) } } )) } )) } }); var pe = Object.freeze({ __proto__: null, onEachLayoutShift: function(e) { new PerformanceObserver((t => { const n = t.getEntries().filter((e => "hadRecentInput"in e)); for (const t of n) { if (t.hadRecentInput) continue; const n = t.sources.map((e => e.node)).filter((e => e instanceof Node)); e({ attribution: { affectedNodes: n }, entry: t, value: t.value }) } } )).observe({ type: "layout-shift", buffered: !0 }) } }); const he = "__chromium_devtools_metrics_reporter" , fe = 10; function ge(e) { return `layout-shift-${e.value}-${e.startTime}` } const {onLCP: ve, onCLS: ye, onINP: Te} = de , {onEachInteraction: Ee} = me , {onEachLayoutShift: be} = pe , Se = [] , Le = [] , De = [] , Ce = Window.prototype.addEventListener; Window.prototype.addEventListener = function(...e) { return Se.push(e), Ce.call(this, ...e) } ; const Ie = Document.prototype.addEventListener; Document.prototype.addEventListener = function(...e) { return Le.push(e), Ie.call(this, ...e) } ; class we extends PerformanceObserver { constructor(...e) { super(...e), De.push(this) } } globalThis.PerformanceObserver = we; let Pe = !1; function Me(e) { const t = JSON.stringify(e); window[he](t) } window.__chromium_devtools_kill_live_metrics = () => { if (!Pe) { for (const e of De) e.disconnect(); for (const e of Se) window.removeEventListener(...e); for (const e of Le) document.removeEventListener(...e); Pe = !0 } } ; const Fe = []; function xe(e) { const t = Fe.length; return Fe.push(new WeakRef(e)), t } window.getNodeForIndex = e => Fe[e].deref(), Me({ name: "reset" }), n(( () => { Me({ name: "reset" }) } )), ve((e => { const t = { name: "LCP", value: e.value, phases: { timeToFirstByte: e.attribution.timeToFirstByte, resourceLoadDelay: e.attribution.resourceLoadDelay, resourceLoadTime: e.attribution.resourceLoadDuration, elementRenderDelay: e.attribution.elementRenderDelay } } , n = e.attribution.lcpEntry?.element; n && (t.nodeIndex = xe(n)), Me(t) } ), { reportAllChanges: !0 }), ye((e => { Me({ name: "CLS", value: e.value, clusterShiftIds: e.entries.map(ge) }) } ), { reportAllChanges: !0 }), Te((e => { e.attribution.interactionTargetElement = void 0, Me({ name: "INP", value: e.value, phases: { inputDelay: e.attribution.inputDelay, processingDuration: e.attribution.processingDuration, presentationDelay: e.attribution.presentationDelay }, startTime: e.entries[0].startTime, entryGroupId: e.entries[0].interactionId, interactionType: e.attribution.interactionType }) } ), { reportAllChanges: !0, durationThreshold: 0 }), Ee((e => { const t = { name: "InteractionEntry", duration: e.value, phases: { inputDelay: e.attribution.inputDelay, processingDuration: e.attribution.processingDuration, presentationDelay: e.attribution.presentationDelay }, startTime: e.entries[0].startTime, entryGroupId: e.entries[0].interactionId, nextPaintTime: e.attribution.nextPaintTime, interactionType: e.attribution.interactionType, eventName: e.entries[0].name, longAnimationFrameEntries: (n = e.attribution.longAnimationFrameEntries.slice(-5).map((e => e.toJSON())), n.map((e => { const t = []; for (const n of e.scripts) { if (t.length < fe) { t.push(n); continue } const e = t.findIndex((e => e.duration < n.duration)); -1 !== e && (t[e] = n) } return t.sort(( (e, t) => e.startTime - t.startTime)), e.scripts = t, e } ))) }; var n; const r = e.attribution.interactionTargetElement; r && (t.nodeIndex = xe(r)), Me(t) } )), be((e => { Me({ name: "LayoutShift", score: e.value, uniqueLayoutShiftId: ge(e.entry), affectedNodeIndices: e.attribution.affectedNodes.map(xe) }) } )) }();
The text was updated successfully, but these errors were encountered:
Can you please raise this issue with the DevTools team ideally with more details on how to reproduce this.
Sorry, something went wrong.
No branches or pull requests
Why is this code always running even on file:/// urls? it causes exceptions immediately every time I try to step through my clientside code...
The text was updated successfully, but these errors were encountered: