Google Docs in a clean-room browser

With the news that Google would be phasing in a new version of Google Docs I thought we ought to get the current version working in Flow. Because of many bug fixes in Flow for other websites, Google Docs now seemed to load mostly fine, though it rendered without word wrap and you couldn’t actually type into it.

Screenshot of Flow editing a document in Google Docs.

Like Google Mail, Google Docs almost entirely consists of obfuscated JavaScript, some of it common between the two. Its HTML structure is quite simple, though it uses hidden iframes for various purposes (one for key input and another for calculating word widths, amongst others). Over the course of the couple of months I identified over 30 distinct issues that needed fixing, and I’ll discuss the more interesting ones in the second section of this blog.

When I tried Google Docs many months ago some obscure exceptions were thrown to the console. Since then, some fixes we have done for other websites have meant these have almost entirely gone away. It’s not obvious which, but it’s always helpful – fix a bug for a test case or website and various other websites start working better without spending time specifically on them.

As with Gmail, I believe Flow is the only browser engine written after Google Docs that can run Google Docs. While still not quite perfect, it is definitely very usable – this blog has been created, written and edited entirely in Google Docs using Flow on a Raspberry Pi 400. The grammar checking and even the collaborative working features that are so useful work flawlessly (these all use XHR). Spell checking works but the underlines don’t appear as we don’t yet support SVGPatternElement.

Happily, the preview of the new canvas-based Google Docs also seems to render correctly in Flow, though their example page isn’t editable. When the full version has rolled out we’ll try it out and look to fix any bugs.