Andrea Giammarchi's Avatar

Andrea Giammarchi

@webreflection.bsky.social

898 Followers  |  20 Following  |  122 Posts  |  Joined: 21.08.2023  |  1.9925

Latest posts by webreflection.bsky.social on Bluesky

in other news, uhtml v5 is ready:
* it's nearly as fast as v4 for keyed results except it doesn't need specialized URLs or buils: <el key=${k} /> it is
* it's faster in non-keyed scenarios
* it has components backed into core
* components have (alien) signals reactivity
* it's 5K

31.07.2025 22:26 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

if I misunderstood my apologies but the described situation shows that by standard a module can import modules, it's the way it breaks and the way it cannot be asynchronous that is absurd, not the fact a module can import other modules from CDNs, that works already so I don't understand your point.

29.07.2025 06:26 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

last from me, in case it helps: the code you see in that post is *ALREADY RUNNING IN A SERVICE WORKER* ... it has nothing to do with SW hijacked from CDNs or whatsoever ... again, a great chance to learn more about this topic, or feel free to miss it with your wrong premises πŸ₯²

28.07.2025 21:24 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

if my post was to blame, yes, it was for people knowing Service Workers already, not for people not understanding that post is about loading a CDN module *after* the Service Worker bootstrapped already
yet, the post itself, never claims the issue is 3rd party Service Worker cause that's impossible 🀷

28.07.2025 21:20 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

no, like I've said, you have no experience with Service Workers and you think you know them already.

A good hint to stop this conversation to me and *maybe* one for you to learn more about Service Worker, I work with those daily πŸ‘‹

28.07.2025 21:15 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

in short, you commented on something you have zero experience about because having Service Worker mandatory on *YOUR SERVER/HOST* is the first law of Service Workers.

28.07.2025 21:11 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

that's wher your logic falls apart ... like I've said, by design, service workers cannot be anywhere else but your server so your premises are not correct.

Many wished to have Service Workers as CDN link, security begged to differ, it's either your own host or nothing, and that's the solution.

28.07.2025 21:08 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 2    πŸ“Œ 0

> If a hijacked SW loads from these ...

impossible by design unless your whole server is already compromised so I am not sure I am following, or share at all, your feelings ...

that being said, this has nothing to do with my post? πŸ€”

28.07.2025 19:56 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

iframe.src = `data:text/html;charset=utf-8,${yourStuff}` is *NOT* the way to go as it loses all privileges granted from the page creating such iframe.

const blob = new Blob([yourStuff], {type: 'text/html'});
iframe.src = URL.createObjectURL(blob);

though works like a charm πŸ˜‡

28.07.2025 19:54 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

I am not really following ... please help landing that proposal in places where it helps landing that proposal, with all the amends you like, thank you πŸ™

24.07.2025 12:58 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Preview
Taming JS Proxy API With the plethora of libraries dealing with remote references and the amount of WASM targeting runtimes it’s time to get this story right…

another day in "Proxy land", about the time to publish this: webreflection.medium.com/taming-js-pr...

15.07.2025 10:11 β€” πŸ‘ 3    πŸ” 1    πŸ’¬ 0    πŸ“Œ 1
Preview
DOM handleEvent: a cross-platform standard since year 2000 I’ve recently read long twitter threads about how to bind components methods, how to use arrow function per each method at class…

to clarify, it's not uhtml being magic there, it's how the Web works since 2000 😁

webreflection.medium.com/dom-handleev...

27.06.2025 12:23 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

lovely ... would it return a file path or a URL that needs to be converted? hopefully the former!

27.06.2025 11:46 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

btw it's

const view = html`<button @ click=${this}>Hello!</button>`;

not

const view = html`<button @ click=${this.handleEvent}>Hello!</button>`;

handleEvent is natively "handled" by the listener

πŸ˜‰

27.06.2025 11:38 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Preview
import.meta.resolve() - JavaScript | MDN import.meta.resolve() is a built-in function defined on the import.meta object of a JavaScript module that resolves a module specifier to a URL using the current module's URL as base.

TIL: import.meta.resolve('./relative/path')

Goodbye:
new URL('./relative/path', import.meta.url).href

πŸ₯³

developer.mozilla.org/en-US/docs/W...

27.06.2025 11:35 β€” πŸ‘ 3    πŸ” 1    πŸ’¬ 1    πŸ“Œ 0
1752287 - MessagePort.postMessage for received MessagePorts will fail to send messages if blocking APIs (Sync XHR, Atomics) are used prior to to the Entangling state machine stabilizing; workaround is... ASSIGNED (bugmail) in Core - DOM: postMessage. Last updated 2025-05-06.

The related 3yo bug
bugzilla.mozilla.org/show_bug.cgi...

23.06.2025 21:03 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

MessageChannel, BroadcastChannel, synchronous XHR are all broken in @firefox workers: it literally blocks that worker until whatever blocking operation happens between a send data and such data returned 🀦

Only global postData works in there, watch out your advanced logic 🀷

23.06.2025 19:45 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Some Service Worker Absurdity It’s been years since this lovely primitive landed on all relevant browsers but the current state feels stuck in the 90s’ and is hostile…

that's a wrap for today (around this topic)
webreflection.medium.com/some-service...

19.06.2025 13:51 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 1
Preview
GitHub - WebReflection/coincident: An Atomics based Proxy to simplify, and synchronize, Worker related tasks. An Atomics based Proxy to simplify, and synchronize, Worker related tasks. - WebReflection/coincident

Biggest milestone? A round trip worker to main and back of 2MB ArrayBuffer inside F32 went down from 150ms to just 2ms 🀯

Everything else is 0.x time 🍻

github.com/WebReflectio...

17.06.2025 18:32 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Post image

I am factoring out coincident/window (soon to be updated) to fully separate concerns and provide a standalone sub-project to nail that part of the stack.

If interested, I started explaining what's behind the scene here πŸ‘‹
github.com/WebReflectio...

10.06.2025 11:50 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Post image

If you load this page it contacts 82 IP addresses executing 256 separate HTTP transactions to download 18MB of data writing 64 cookies to your device to tell you β€œno”

24.05.2025 10:37 β€” πŸ‘ 15161    πŸ” 4555    πŸ’¬ 151    πŸ“Œ 246
using timeout = {
  $: setTimeout(() => controller.abort('timeout'), 5000),
  [Symbol.dispose]() {
    clearTimeout(this.$);
  }
};

using timeout = { $: setTimeout(() => controller.abort('timeout'), 5000), [Symbol.dispose]() { clearTimeout(this.$); } };

nice and clean via Explicit Resource Management πŸ₯³

v8.dev/features/exp...

21.05.2025 14:16 β€” πŸ‘ 5    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Preview
Error cause underspecified in Structured Clone algorithm Β· Issue #11321 Β· whatwg/html What is the issue with the HTML Standard? In step 17 of StructuredSerializeInternal it's mentioned that, beside type, message and name (not super useful for developers): User agents should attach a...

if interested, this is the related "bug" filed for @blog.whatwg.org.web.brid.gy :

github.com/whatwg/html/...

20.05.2025 08:09 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

… and just like that, turns out that Error cause is cloned in Chromium and ignored in WebKit (or at least Bun) 🀦

It’s always the same: I find a cool/elegant way to solve issues via native APIs … native APIs are not the same across engines 😭

Here is WHATWG specs to blame 😒

20.05.2025 05:41 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 3    πŸ“Œ 0
Preview
Surviving the Structured Clone algorithm Used internally by IndexedDB, Workers and other APIs, this algorithm lacks user-land flexibility: here my proposal to fix all the issues!

hopefully I've explained it all in this post ... please help me out landing this proposal, the polyfill is already code-covered 100% and it works shamelessly workers to NodeJS or main thread context πŸ₯³

webreflection.medium.com/surviving-th...

19.05.2025 14:41 β€” πŸ‘ 5    πŸ” 2    πŸ’¬ 1    πŸ“Œ 0
Preview
GitHub - WebReflection/serialization-registry: A proposal to transport structured clone and post message complex references. A proposal to transport structured clone and post message complex references. - WebReflection/serialization-registry

for the time being this proposal landed in my own repo but if it lands in WHATWG and TC39 it would be **HUGE** πŸ₯³

github.com/WebReflectio...

19.05.2025 10:41 β€” πŸ‘ 4    πŸ” 1    πŸ’¬ 0    πŸ“Œ 0

a utility to safely invoke?

before 2016:
const { call } = Function;
const apply = call.bind(call, Function.apply);
apply(callback, context, args);

after 2016:
const { apply } = Reflect;
apply(callback, context, args);

I often forget myself I can just trap Reflect utilities🀦

16.05.2025 20:22 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

my ugly workaround is similar to:

let name=($,_={}.toString.call($).slice(8,-1))=>(_ in self)?_:name(Object.getPrototypeOf($));

and then

if (name(ref) === 'Object') ... loop props to do things

does anyone has a better/faster way around? πŸ€”

16.05.2025 16:14 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

there is one particular dance JS engines do on structured-clone algorithm to understand if a reference is a plain object (or degraded as such) or an instance of a native class (also degraded, but less so) and I wonder where on earth is that API to know if an object is "literal" !

16.05.2025 16:03 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

This patch is just one step forward to help me out intercepting WASM runtimes’ proxies or my own all at once! I still need brand check somehow (instanceof or other ways) but at least I won’t see Proxy errors on postMessage on my side of affairs πŸ₯³

16.05.2025 11:11 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

@webreflection is following 20 prominent accounts