All Posts

Evaluating the Streams API’s Asynchronous Read Function

For a while now Google’s Domenic Denicola, Takeshi Yoshino, and others have been working on a new specification for streaming data in the browser. The Streams API is important because it allows large resources to be processed in a memory efficient way. Currently, browser APIs like XMLHttpRequest do not support this kind of processing.

Mozilla is very interested in implementing some kind of streaming data interface. To that end we’ve been evaluating the proposed Streams spec to determine if its the right way forward for Firefox.

In particular, we had a concern about how the proposed read() function was defined to always be asynchronous and return a promise. Given how often data is read() from a stream, it seemed like this might introduce excessive overhead that could not be easily optimized away. To try to address that concern we wrote some rough benchmarks to see how the spec might perform.

TL;DR: The benchmarks suggest that the Streams API’s asynchronous read() will not cause performance problems in practice.

written in mozilla,streams Read on →

Introducing Firefox Service Worker Builds

About two months ago I wrote that the Service Worker Cache code was entering code review. Our thought at the time was to quickly transition all of the work that had been done on the maple project branch back into Nightly. The project branch wasn’t really needed any more and the code could more easily be tested by the community on Nightly.

Fast forward to today and, unfortunately, we are still working to make this transition. Much of the code from maple is still in review. Meanwhile, the project branch has languished and is not particularly useful any more. Obviously, this is a bad situation as it has made testing Service Workers with Firefox nearly impossible.

To address this we are going to begin posting periodic builds of Nightly with the relevant Service Worker code included. These builds can be found here:

Firefox Service Worker Builds

written in cache, dom, fetch, mozilla, serviceworker Read on →

Implementing the Service Worker Cache API in Gecko

For the last few months I’ve been heads down, implementing the Service Worker Cache API in gecko. All the work to this point has been done on a project branch, but the code is finally reaching a point where it can land in mozilla-central. Before this can happen, of course, it needs to be peer reviewed. Unfortunately this patch is going to be large and complex. To ease the pain for the reviewer I thought it would be helpful to provide a high-level description of how things are put together.

written in cache, dom, mozilla, serviceworker Read on →

Writing Node.js Unit Tests With Recorded Network Data

Automated unit tests are a wonderful thing. They help give you the confidence to make difficult changes and are your first line of defense against regressions. Unfortunately, however, unit tests typically only validate code against the same expectations and pre-conceived notions we used to write the code in the first place. All to often we later find our expectations do not match reality.

One way to minimize this problem is to write your tests using real world data. In the case of network code, this can be done by recording traffic to a pcap file and then playing it back as the input to your test.

In this post I will discuss how to do this in node.js using the pcap-socket module.

written Read on →

Making Progress on Personal Projects

Sometimes I wonder how many people consider personal projects, but never even get started because they feel they don’t have the time? How many amazing and interesting ideas lie unrealized due to day-to-day commitments?

written Read on →

Time Machine and Npm

Do you develop npm modules on Mac OS X? Do you also use Time Machine to backup your work?

If you answered yes to both those questions, then there is a good chance you will be looking at this dialogue box at some point.

written Read on →