Style nits: please use strict equalities when comparing, also always use braces even for single line statements.
See: https://github.com/mozilla/pdf.js/wiki/Style-Guide.

These comments applies below as well.
When addressing this, please squash the commits: https://github.com/mozilla/pdf.js/wiki/Squashing-Commits.