Looking at the entire diff, I have feeling that this code (above and below) can be simplified to something like:

```
    var pixelsInViewport = viewport.width * viewport.height;
    if (PDFJS.maxCanvasPixels > 0 && pixelsInViewport > PDFJS.maxCanvasPixels) {
      var correction = Math.sqrt(PDFJS.maxCanvasPixels / pixelsInViewport);
      outputScale.sx *= correction;
      outputScale.sy *= correction;
      outputScale.scaled = true;
    }
```