blog
Weekly notes 5 — Sniffing and glue
in

Another week of staying at home, another week of web nonsense with a side of history.

Mozilla

Gecko

One of the projects I’ve been working on 9 years ago during my second Mozilla internship was to do binary sniffing of media files, when they are served without a Content-Type header, so that Firefox can determine what type of media file is being downloaded, and play it. This was a rather interesting deep-dive into file-formats and the security considerations inherent to determining the type of a resource. When I started my first internship (circa 2011), it wasn’t clear what to do. Other browsers were sniffing, Firefox was not sniffing, and it caused compatibility issues (file simply wouldn’t be recognized and wouldn’t play). After some time, it was decided that Firefox would sniff if:

After more time, and much disagreement,it was decided in 2014 that browsers would always sniff, ignoring the Content-Type header altogether. I’m currently making Firefox respect the spec, and this is accomplished simply by removing lines of codes from the browser, which is always satisfying. Most of the work is adjusting all the tests and test expectations.

There is a specification for sniffing files on the Web, to which I’ve contributed, and need to get back, because some of my changes there are incorrect. I believe however that an implementer will spot the mistake and find what to do, so it’s not the highest on my priority list.

Fun anecdote about this initial effort, 9 years ago. A mp3 file without a ID3 container (not the most common, but certainly common enough) share the same byte pattern as a text file encoded in UTF-16 with a Byte-Order-Mark. When landing this patch, quite a few websites started to be downloaded as a file with an mp3 extension instead of being displayed. My initial patch was promptly amended. A saying goes that breaking the web is a rite of passage when working on a web browser. Although it was only in Firefox Nightly for less than a day, it was a bit stressful for 23 year old me.

Specifications

Lots of specification work still, this time on all the specs around Web Codecs, to ensure that this set of new low-level spec will meet authors needs and expectations.

Personal

Not much again. I’m making a small piece of furniture for the new living room, to drop off our keys, headphones, and whatever is needed when going out, or coming back in. For example, a box of surgical masks and vials of hydroalcoholic solution.

It’s a very simply design, I’m using beech wood, dowels and glue. It’s quite satisfying when the fit is perfect:

Two planks of beech wood forming a square angle, precisly adjusted

That’s pretty deep in terms of pandemic boredom.