Mozilla has provided more detail on the work it had to do to get its Firefox browser ported to the Apple silicon used in its new Macs.
Gian-Carlo Pascutto, a security engineer at Mozilla Corporation, has detailed how it managed to port the Firefox browser to the new architecture, while noting some issues around Apple's Rosetta emulator, and enabling support for Netflix and digital rights management (DRM).
For example Google was very quick to release a version of Chrome with native support for Apple's new silicon Macs. It beat Firefox by a month, but Mozilla explained why it avoided some of Google's troubles by going later. Browsers are very complex pieces of software, so it's perhaps not surprising that Firefox and Chrome have run into some problems on the road to natively supporting Apple's new Arm-based silicon Macs.
SEE: Guide to Becoming a Digital Transformation Champion (TechRepublic Premium)
It's a long post with lots of fascinating details about the choices and trade-offs Mozilla engineers needed to make in order to bring out a version of Firefox with native Apple silicon support in time for the first Apple silicon-based Macs. Engineering work started when Apple unveiled its silicon in June, but few knew the precise date Apple would release its first Arm-based Macs. Apple announced Apple Silicon Macs on November 17.
The most interesting problem was around Rosetta, and Firefox support for Netflix, Hulu and other video-streaming services. Key to getting Firefox ready for Apple silicon was ensuring proper support for DRM anti-piracy software, and support from decoders, such as Google's Widevine. At the time, Widevine hadn't announced support for Apple silicon.
"As a significant number of our users use the browser to watch video online, this presented a potential showstopper for a native Apple Silicon release," writes Pascutto.
Part of the solution to the DRM challenge may have required using Rosetta 2, Apple's translation process or emulator that lets apps for Intel chips run on Apple silicon. Apple doesn't pre-install Rosetta 2 on silicon Macs; installation is triggered when a user tries to run an Intel app.
As Pascutto notes, Google's first version of Chrome with native Apple silicon support ran into a problem related to this issue with Rosetta 2. Google released that edition of Chrome one day after Apple unveiled its first silicon Macs, but users immediately reported the browser was unexpectedly crashing.
"Triggering the installation of Rosetta programmatically works, but some of our colleagues found out the hard way it is not very reliable," writes Pascutto.
That's why Mozilla decided against a similar approach to the Chromium project and has an error message instead, advising Apple silicon users to install Rosetta. Mozilla released Firefox 84, its first version with native Apple silicon support, a month after Chrome with native Apple silicon support.
Chromium engineers fixed the crashing issue quickly but said in Gerrit notes for the fix: "Don't trust callbacks from the Rosetta installer. Every so often, the Rosetta installer will call back the provided "installation done" block more than once. Protect against that."
Separately, as Pascutto notes, Mozilla engineers knew roughly what they were in for with Apple silicon after having supported Arm on Android and Linux for some time. And in 2019, Mozilla released Firefox for Windows 10 on Arm.
SEE: Programming languages: Microsoft TypeScript leaps ahead of C#, PHP and C++ on GitHub
However, he was concerned about parts of Firefox written in Rust and the need to ensure it had a solid Rust compiler in time for the first Apple silicon Macs, which would happen in mid-November. But at the time Rust support for Apple silicon was underway, Apple hadn't revealed the release date.
"Although Apple Silicon support for Rust was underway, it took until mid-August for there to be functional compiler builds, which limited the amount of progress possible for Firefox," says Pascutto.
"Once the compiler was working, a similar exercise needed to be done with all the Rust crates we depend on. The need to update the compiler and the reliance of some crates on the exact compiler version, especially parts dealing with SIMD support, would end up biting us later on as it made it hard to push Apple Silicon support forward to an earlier release of Firefox without potentially affecting other platforms."
Engineers also didn't know whether to make Firefox a universal binary, or one that supports both Apple's Arm silicon and Macs with Intel chipsets with the same executable.