Refactor jpg.js and include forceRGBoutput, correct style of image.js

This refactors getData to be more readable and extracts all the color
conversion algorithms to their own functions. The resulting code was then
cleaned up.
This also introduces a flag `forceRGBoutput` to getData, that allows to always
get the data as a `width * height * 3` bytes long RGB buffer
Move the colour conversion to jpg.js

Benchmarking shows that this improves performance for the invitation document
from https://github.com/mozilla/pdf.js/issues/3809 by 35%
Force Unix line endings for all files in new commits
[Firefox] Workaround for sessionStorage error when the preference network.cookie.lifetimePolicy is set to 1 (bug 1000777)
Merge pull request #4679 from Snuffleupagus/bug-1000777

[Firefox] Workaround for sessionStorage error when the preference network.cookie.lifetimePolicy is set to 1 (bug 1000777)
Add writeToStorage method to ViewHistory
Add support for setting multiple values at once in ViewHistory
Converts attachment items to buttons instead of links
Merge pull request #4686 from timvandermeij/attachments-button

Converts attachment items to buttons instead of links
Providing content type for attachment downloads
Fix the display of the indeterminate progress bar when the loaded percentage is NaN (issue 4696)
Merge pull request #4697 from Snuffleupagus/issue-4696

Fix the display of the indeterminate progress bar when the loaded percentage is NaN (issue 4696)
Merge pull request #4687 from timvandermeij/attachments-content-type

Providing content type for attachment downloads
Merge pull request #4676 from timvandermeij/line-endings

Force Unix line endings for text files
Merge pull request #4692 from Snuffleupagus/viewHistory-setMultiple

Add support for setting multiple values at once in ViewHistory
Ensure that the viewer loads even if there are errors when the preferences are read
Merge pull request #4528 from bthorben/lessColorConversion

Less color conversion
Merge pull request #4693 from Snuffleupagus/preferences-reject

Ensure that the viewer loads even if there are errors when the preferences are read
Reduces memory used during testing
Merge pull request #4699 from yurydelendik/testmem

Reduces memory used during testing