Implement document load tracking.

Improves on the state of the art for #1416. Images, XHR, stylesheets, and scripts now block the document load event from firing, and DOMContentLoaded is dispatched after parsing is complete.
Why are scripts ever loaded synchronously? Do these appear to be async from the point of view of JS (i.e. the JS event loop gets to spin during the script fetch) and this just happens to be synchronous only from the point of view of a separate non-JS thread/task parser task that actually blocks on parser-blocking scripts? But what is the task being blocked, then? Is there yet another task that proceeds to speculatively parse HTML?