instanceof HTMLElement does not work in jsdom node.js module.
Merge pull request #3416 from peerlibrary/noHTMLElement

instanceof HTMLElement does not work in jsdom node.js module.
Add mozPrintCallback shim

This shim does the following:
1. Intercept window.print()
2. For a window.print() call (if allowed, ie. no previous print job):
   1. Dispatch the beforeprint event.
   2. Render a printg progress dialog.
   3. For each canvas, call mozPrintCallback if existent (one at a time, async).
   4. During each mozPrintCallback callback, update the progress dialog.
   5. When all <canvas>es have been rendered, invoke the real window.print().
   6. Dispatch the afterprint event.

The shim is not included in Firefox through the preprocessor.

Keyboard shortcuts (Ctrl/Cmd + P) are intercepted and default behavior
(i.e. printing) is prevented, and the steps for window.print() are run.
window.attachEvent is used, in order to cancel printing in IE10 and
earlier (courtesy of Stack Overflow - http://stackoverflow.com/a/15302847).
Unfortunately, this doesn't work in IE11 - if Ctrl + P is used, the
print dialog will be shown twice: Once because of Ctrl + P, and again
when all pages have finished rendering.

This logic of this polyfill is not specific to PDF.js, so it can also
be used in other projects.

There's one additional modification in PDF.js's viewer.js: The printed
<canvas> element is wrapped in a <div>. This is needed, because Chrome
would otherwise print one canvas on two pages.
Resolved severe memory leak (mozPrintCallback)

Do NOT save the temporary <canvas> element as `this.canvas`.
`PDFViewer.pages[i].canvas` appears to be used to generate the thumbnail
icons. Well, that's no justification for preventing GC of those
temporary <canvas> elements used during mozPrintCallback.

With a document consisting of 79 pages, this resulted in a 600-700MB
leaked memory.
Enabling clicking to close the context menu in Presentation Mode, without going to the next page
Merge pull request #3670 from Rob--W/mozPrintCallback-polyfill

Polyfill for mozPrintCallback
Merge pull request #3774 from Snuffleupagus/contextMenu-PresentationMode

Enabling clicking to close the context menu in Presentation Mode, without going to the next page