pkg: Fix race with delayed loading of pages

Because pages load via AMD they are not necessarily ready to use when
their onload event fires. We define a convention that a page shows its
<body> element when it is ready to use, or at least when it wants to
start interacting with the user.

In the future the shell could use this to determine when to display the
page and/or show a loading spinner.

For now we just use this from tests.