Extending a helping hand to sites using outdated libraries
Web compatibility can be a tricky beast to tame. Ideally, when a site has a problem they can just deploy a fix. But what if it is not one site with the problem, but rather is a library used by many sites? Then there is no guarantee that all users of the library are even known, let alone that they will all update in a timely fashion. And what about sites that are no longer maintained? What if the library version is no longer maintained? As you might imagine, it can be a very messy situation.
Take for example the recent case of the mobile video library PDK, which is now part of Comcast's MPX video management system. Older versions of PDK do not function correctly on Firefox for Android, resulting in sites like CNBC, National Geographic, Rotten Tomatoes, and even Cooking Channel TV having a broken player on Firefox for Android.
Our web-compat team diagnosed the issue, and found out that it could be theoretically fixed by having Firefox pretend to be Chrome. But that is an unpleasant solution, because the sites will suddenly see all of their Firefox for Android users completely "vanish" in their site analytics, in favor of more Chrome users. Plus, spoofing as Chrome can actually cause other problems on a page, since it will affect the entire page (not just the PDK video player). And so we dug in deeper, and discovered that the problem could also be adequately fixed by changing one single script in affected versions of PDK, so that it simply uses a different variable name. But of course we do not host or control any of those scripts, so we would have to get creative if we wanted to offer a fix to Android users of Firefox.
Thankfully, the script in question is normally hosted on sites in a predictable way. That made it possible for a normal Firefox add-on to be created, which detects whenever an affected copy of the script is being downloaded from any site and patches it on-the-fly, all transparently to the user. In one fell swoop, CNBC, National Geographic, Rotten Tomatoes, and even Cooking Channel TV's video players could work on Firefox for Android. Best of all, the fix should work just as well on any other site that hosts an affected version of PDK the usual way; we do not have to wait for our users to report each and every affected site.
After testing and polishing the fix, we added it to our existing Web Compat add-on which is bundled with Firefox for Android (and should also soon be bundled with the Firefox Preview). And so, video on Firefox for Android now "works" on affected sites, while the sites themselves can focus their energies on upgrading to a newer version of PDK which does not require the fix. The good news is that at least CNBC has since upgraded, which is exactly how these "site patches" are supposed to work: a temporary helping hand for sites and our users.