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

Attempt to throw MissingPDFException when applicable in node_stream.js (issue 9791) #9964

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Aug 5, 2018

While I'm not very familiar with Node.js, this patch should (hopefully) cover the multiple ways in which files can be loaded in Node.js environments; while also taking into account e.g. the differences between the XMLHttpRequest and the {http, https}.request methods.
Furthermore, the creates pdf doc from non-existent URL API unit-test now passes in Node.js/Travis.

Fixes #9791.

@Snuffleupagus Snuffleupagus force-pushed the node-MissingPDFException branch from 6510a6d to ac93db4 Compare August 5, 2018 18:49
@timvandermeij
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Aug 5, 2018

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/415d83cddba0a36/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Aug 5, 2018

From: Bot.io (Windows)


Received

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

Live output at: http://54.215.176.217:8877/e674a5fb39052e5/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Aug 5, 2018

From: Bot.io (Windows)


Success

Full output at http://54.215.176.217:8877/e674a5fb39052e5/output.txt

Total script time: 28.75 mins

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

@pdfjsbot
Copy link

pdfjsbot commented Aug 5, 2018

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/415d83cddba0a36/output.txt

Total script time: 35.81 mins

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

let handleResponse = (response) => {
if (response.statusCode === 404) {
const error = new MissingPDFException(`Missing PDF "${this._url}".`);
this._storedError = error;
Copy link
Contributor

@timvandermeij timvandermeij Aug 5, 2018

Choose a reason for hiding this comment

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

I think we might need return after this too to avoid setting the readable stream to a failed response, just like above.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, that seems reasonable; fixed now.

@Snuffleupagus Snuffleupagus force-pushed the node-MissingPDFException branch from ac93db4 to f78efd8 Compare August 6, 2018 08:00
@timvandermeij timvandermeij merged commit 13b9874 into mozilla:master Aug 6, 2018
@timvandermeij
Copy link
Contributor

Nice work!

@Snuffleupagus Snuffleupagus deleted the node-MissingPDFException branch August 6, 2018 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants