A blog post about window.controllers being removed from then re-added to Firefox.

08 Jul 2014

Bug 794943 documents removing access to the XUL window.controllers property to the web (along with some other junk). But as you can see in 1010577, removing that breaks the web. Sadly window.controllers is used by many, many sites as a proxy sniff for Gecko-based browsers.

Here’s an example from the Ace editor’s useragent.js:

// Is this Firefox or related?
exports.isGecko = exports.isMozilla = (window.Controllers || window.controllers) && window.navigator.product === "Gecko";

It turns out you can’t just break websites and rich text editors for all your users—years of HCI research suggests that just makes them sad. But what you can do is add back a fake controllers object, such that window.controllers === "[object XULControllers]", but only for release builds.

Now when developers are testing their sites in Nightly or Aurora and they notice their sniffy scripts are breaking, a console warning will let them know what’s up.

And since you’re all testing your sites and apps in Aurora I don’t need to link to the download page.