// Chrome 157 vs 158: paste into the DevTools console on any https:// page and press Enter.
// Each line prints "<change> <check> = <value>". Expected values: clearcotelabs.com/chrome-releases/158
(async () => {
const checks = [
["grease-brand", () => navigator.userAgentData.brands.map((b) => `${b.brand};v=${b.version}`).join(', ')],
["xslt-removed", () => typeof XSLTProcessor],
["web-install", () => typeof HTMLInstallElement],
["web-install", () => typeof navigator.install],
["web-install", () => 'oninstallresult' in window],
["permissions-policy-features", () => document.featurePolicy.features().includes('focus-without-user-activation')],
["permissions-policy-features", () => document.featurePolicy.features().includes('web-app-installation')],
["unload-deprecated", () => document.featurePolicy.allowsFeature('unload')],
["css-media-element-pseudos", () => CSS.supports('selector(:playing)')],
["css-highlight-universal", () => CSS.supports('selector(::highlight(*))')],
["css-flow-start-end", () => CSS.supports('align-self', 'flow-start')],
["offline-audio-context-close", () => 'close' in OfflineAudioContext.prototype],
["loaf-style-layout-duration", () => 'styleDuration' in PerformanceLongAnimationFrameTiming.prototype],
["loaf-style-layout-duration", () => 'forcedLayoutDuration' in PerformanceScriptTiming.prototype],
["sw-router-source-timing", () => 'workerMatchedRouterSource' in PerformanceResourceTiming.prototype],
["sw-router-source-timing", () => 'workerFinalRouterSource' in PerformanceResourceTiming.prototype],
["svg-textpath-side", () => 'side' in SVGTextPathElement.prototype],
["webtransport-draining-streams", () => 'draining' in WebTransport.prototype],
["webtransport-draining-streams", () => 'anticipatedConcurrentIncomingBidirectionalStreams' in WebTransport.prototype],
["v8-error-message-arguments", () => (() => { try { Atomics.load(new Int32Array(4), 10); } catch (e) { return e.message; } })()],
["v8-error-message-arguments", () => (() => { try { Intl.NumberFormat.prototype.resolvedOptions.call({}); } catch (e) { return e.message; } })()],
["v8-error-message-arguments", () => (() => { try { Object.fromEntries(null); } catch (e) { return e.message; } })()],
["strict-call-assignment-early-error", () => (() => { try { new Function('"use strict"; if (0) f() = 1;'); return 'ok'; } catch (e) { return e.name; } })()],
["regexp-vi-ascii-casefold", () => new RegExp('\\p{ASCII}', 'vi').test('K')],
["intl-numberformat-long-input", () => (() => { try { return new Intl.NumberFormat('en').format('1.' + '0'.repeat(1e6)); } catch (e) { return e.name; } })()],
["nodeiterator-removal", () => (() => { const r = document.createElement('div'); r.innerHTML = '<a></a><b><i></i></b>'; const it = document.createNodeIterator(r); it.nextNode(); it.nextNode(); it.nextNode(); it.previousNode(); r.lastChild.remove(); return it.referenceNode.nodeName + ',' + it.pointerBeforeReferenceNode; })()],
["neutral-keyframe-easing", () => (() => { const e = document.body.appendChild(document.createElement('div')); e.style.left = '100px'; const a = e.animate([{ easing: 'steps(2, start)' }, { left: '200px' }], 1e3); a.pause(); a.currentTime = 0; const v = getComputedStyle(e).left; e.remove(); return v; })()],
["elementsfrompoint-culled-inline", () => (() => { const d = document.body.appendChild(document.createElement('div')); d.style.cssText = 'position:fixed;left:0;top:0;z-index:2147483647'; d.innerHTML = '<span id="cc158a"><span style="position:relative">Text</span></span>'; const r = d.querySelector('[style]').getBoundingClientRect(); const hit = document.elementsFromPoint(r.left + 1, r.top + r.height / 2).some((e) => e.id === 'cc158a'); d.remove(); return hit; })()],
["webgl-pixel-local-storage", () => document.createElement('canvas').getContext('webgl2').getSupportedExtensions().includes('WEBGL_shader_pixel_local_storage')],
];
const out = [];
for (const [id, f] of checks) {
let v;
try { v = await f(); } catch (e) { v = "throws " + e.name; }
const expr = f.toString().replace(/^\(\)\s*=>\s*/, "");
out.push(id.padEnd(28) + expr + " = " + (typeof v === "string" ? JSON.stringify(v) : String(v)));
}
console.log(out.join("\n"));
})();