fix(event): save inline rx.download data through a blob url

AB
2d ago
+164-0

iOS WebKit (Safari, every other iOS browser and installed PWAs) ignores the download attribute of data: urls and only displays the file instead of saving it. rx.download(data=...) always produces a data: url, so it never saves a file on iOS.

The _download event now turns a data: url into a blob: url before clicking the link, and attaches the link to the document first. Downloads of regular urls are unchanged.

Tests: a Playwright test downloads inline text from a frontend event and bytes from a backend event and asserts the blob url, file name and exact content. It fails without the fix.