Skip to content

Instantly share code, notes, and snippets.

Self-Review Questionnaire: Security and Privacy

styleDuration, layoutDuration, forcedStyleDuration, and forcedLayoutDuration attributes

Answers to the W3C Security and Privacy Self-Review Questionnaire for the newly added timing duration attributes in the Long Animation Frames API.

These attributes break down existing aggregate timing into finer-grained style and layout components:

  • PerformanceLongAnimationFrameTiming.styleDuration / layoutDuration: Time spent in style recalculation and layout during the rendering phase of a long animation frame.
  • PerformanceScriptTiming.forcedStyleDuration / forcedLayoutDuration: Time spent in synchronous (forced) style recalculation and layout triggered during script execution (e.g., by calling getComputedStyle() or getBoundingClientRect()).
@yoavweiss
yoavweiss / css_cost.js
Created January 15, 2026 17:38
Extracting CSS costs from RUM
const totalStyleCost = async () => {
return new Promise(resolve => {
let total = 0;
const obs = new PerformanceObserver(entryList => {
const entries = entryList.getEntries();
for (const entry of entries) {
if (entry.paintTime) {
total += entry.paintTime - entry.styleAndLayoutStart;
} else {
total += entry.startTime + entry.duration - entry.styleAndLayoutStart;
@yoavweiss
yoavweiss / notes.md
Created October 20, 2024 11:21
Autofill API meeting - October 17th 2024 - notes

Participants

Yoav Weiss

Rouslan Solomakhin (Google)

Darwin Yang (Google)

(Shopify)

WICG: Address Autofill

  • TPAC

Attendees: Westin, Martin Lechner, Yoav Weiss, Anne van Kesteren, Christian Indra, Rick Byers, Adam Rice, Michal Mocny, Dominic Batre

  • Yoav: Discuss Address Autofill
  • autofill is a key feature for login and web forms etc

Joel: Welcome! Gonna show a live use case for FedCM

Demo to bootstrap the conversation

Shop.app is the buyer-facing identity at Shopify

Reaching checkout when you’re not authenticated can be complicated

Buyers that reach checkout authenticated, they’re more likely to successfully complete checkout

@yoavweiss
yoavweiss / es_module_integrity_example.js
Last active August 1, 2024 10:03
ES module intergity example
<script type="importmap">
{
"imports": {
"square": "./module/shapes/square.js"
},
"integrity": {
"./module/shapes/square.js": "sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC"
}
}

noopener-allow-popups Cross-Origin-Opener-Policy value

Some origins can contain different applications with different levels of security requirements. In those cases, it can be beneficial to prevent scripts running in one application from being able to open and script pages of another same-origin application. Such a document need to ensure its opener cannot script it, even if the opener document is a same-origin one.

The noopener-allow-popups Cross-Origin-Opener-Policy value severs the opener relationship between the document loaded with this policy and its opener. At the same time, the opened document can open further documents (as the "allow-popups" in the name suggests) and maintain its opener relationship with them, assuming that their COOP policy allows it.

@yoavweiss
yoavweiss / Remap_esc_key.sh
Created October 7, 2018 20:14
Remap § to Esc and Esc to F24
#!/bin/bash
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000029}, {"HIDKeyboardModifierMappingSrc":0x700000029,"HIDKeyboardModifierMappingDst":0x700000073}]}'
@yoavweiss
yoavweiss / preload_feature_detection.js
Last active July 24, 2020 19:31
Preload feature detection
var DOMTokenListSupports = function(tokenList, token) {
if (!tokenList || !tokenList.supports) {
return;
}
try {
return tokenList.supports(token);
} catch (e) {
if (e instanceof TypeError) {
console.log("The DOMTokenList doesn't have a supported tokens list");
} else {