mozilla/pdf.js — pull request #3820 by Snuffleupagus (2013-10-17 19:29:31+00:00)
Title: Disable Presentation Mode until the document has started rendering

Currently if the user enters Presentation Mode when the document is loading, __and before__ it has begun to render, things will not work properly.
First of all, the "page-fit" zoom setting will not be applied. Secondly, when exiting Presentation Mode the zoom level will not be set correctly, since `PresentationMode.args.previousScale` will be undefined.

This patch simply avoids these issues, by disabling Presentation Mode until the document has actually begun to render.

*Note that I considered adding a promise, to enter Presentation Mode once the document has become available. I decide against that approach, because it would add unnecessary complexity to the code. Since trying to enter Presentation Mode before the document is available should be an edge case anyway, a simple workaround should suffice.*