Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change src/core/jpg.js to use the error utility function instead of throwing #7591

Merged
merged 1 commit into from
Sep 4, 2016
Merged

Change src/core/jpg.js to use the error utility function instead of throwing #7591

merged 1 commit into from
Sep 4, 2016

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Sep 3, 2016

This allows us to remove the try/catch statements used in src/core/stream.js when parsing JPEG images.
As far as I can tell, the only reason for the current usage of plain throw is that jpg.js originally was external code. Given that this code now lives in our repo, this patch brings the JPEG code more in line with e.g. src/core/jpx.js and src/core/jbig2.js.

Edit: Easier reviewing with https://github.com/mozilla/pdf.js/pull/7591/files?w=1.

@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Sep 3, 2016

From: Bot.io (Linux)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://107.21.233.14:8877/b70804968c25b57/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Sep 3, 2016

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://107.22.172.223:8877/8998885e69eedf0/output.txt

@Snuffleupagus
Copy link
Collaborator Author

Please note: I pushed a new version of the patch that only removed a superfluous newline at the top of the file. Obviously I didn't see this until I had already triggered testing :-(

@pdfjsbot
Copy link

pdfjsbot commented Sep 3, 2016

From: Bot.io (Windows)


Failed

Full output at http://107.22.172.223:8877/8998885e69eedf0/output.txt

Total script time: 24.04 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://107.22.172.223:8877/8998885e69eedf0/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

pdfjsbot commented Sep 3, 2016

From: Bot.io (Linux)


Failed

Full output at http://107.21.233.14:8877/b70804968c25b57/output.txt

Total script time: 29.24 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://107.21.233.14:8877/b70804968c25b57/reftest-analyzer.html#web=eq.log

@timvandermeij timvandermeij self-assigned this Sep 3, 2016
jpegImage.decodeTransform = transform;
var jpegImage = new JpegImage();

// Checking if values needs to be transformed before conversion.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: need to be transformed

Copy link
Collaborator Author

@Snuffleupagus Snuffleupagus Sep 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this comment was pre-existing, I only capitalized the first letter and added a period at the end, but somehow I didn't notice the other grammatical issue here.
Fixed now, thanks for spotting this!

@timvandermeij
Copy link
Contributor

Looks good, but after #7407 lands this needs to be adjusted to convert the newly introduced throw to use error as well.

@timvandermeij
Copy link
Contributor

timvandermeij commented Sep 4, 2016

This now needs an update to include the change from the PR mentioned above.

…of `throw`ing

This allows us to remove the `try/catch` statements used in `src/core/stream.js` when parsing JPEG images.
As far as I can tell, the only reason for the current usage of plain `throw` is that `jpg.js` originally was external code. Given that this code now lives in our repo, this patch brings the JPEG code more in line with e.g. `src/core/jpx.js` and `src/core/jbig2.js`.
@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Sep 4, 2016

From: Bot.io (Linux)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://107.21.233.14:8877/35173d8fe8dff19/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Sep 4, 2016

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/35173d8fe8dff19/output.txt

Total script time: 1.22 mins

Published

@timvandermeij
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Sep 4, 2016

From: Bot.io (Windows)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://107.22.172.223:8877/026faa12c4b7b0d/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Sep 4, 2016

From: Bot.io (Linux)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://107.21.233.14:8877/18e9efb01923a67/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Sep 4, 2016

From: Bot.io (Windows)


Failed

Full output at http://107.22.172.223:8877/026faa12c4b7b0d/output.txt

Total script time: 23.82 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://107.22.172.223:8877/026faa12c4b7b0d/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

pdfjsbot commented Sep 4, 2016

From: Bot.io (Linux)


Failed

Full output at http://107.21.233.14:8877/18e9efb01923a67/output.txt

Total script time: 39.02 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://107.21.233.14:8877/18e9efb01923a67/reftest-analyzer.html#web=eq.log

@timvandermeij timvandermeij merged commit 7db1983 into mozilla:master Sep 4, 2016
@timvandermeij
Copy link
Contributor

Good to have this, thank you!

@Snuffleupagus Snuffleupagus deleted the jpeg-error branch September 4, 2016 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants