mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
47.14k stars 9.82k forks source link

Unexpected server response while opening local PDF on Firefox for Android #18252

Closed shivaprsd closed 2 weeks ago

shivaprsd commented 2 weeks ago

Attach (recommended) or Link to PDF file here: Any local PDF on the device

Configuration:

Steps to reproduce the problem:

  1. Open the demo page (legacy or modern)
  2. Open a local PDF from device via the overflow menu => Open

What is the expected behavior? (add screenshot) The PDF should open.

What went wrong? (add screenshot) Shows nothing.

It works if you try a second time, even after a page reload.

Trying the same in the Nightly while debugging from Firefox I see the following errors in the console:

Unexpected server response.

PDF.js v4.4.46 (build: ebb2db7be)
Message: Unexpected server response (0) while retrieving PDF "blob:https://mozilla.github.io/143557be-9635-4460-8540-10f5913b0e18". app.js:1203:12
----
Uncaught (in promise) 
Object { message: 'Unexpected server response (0) while retrieving PDF "blob:https://mozilla.github.io/143557be-9635-4460-8540-10f5913b0e18".', name: "UnexpectedResponseException", status: 0, stack: "BaseExceptionClosure@https://mozilla.github.io/pdf.js/build/pdf.mjs:455:29\n@https://mozilla.github.io/pdf.js/build/pdf.mjs:458:2\n" }

Traceback:

_otherError app.js:1203
_documentError app.js:1164
open app.js:1067
(Async: promise callback)
open app.js:1050
webViewerFileInputChange app.js:2399
dispatch event_utils.js:115
run app.js:668

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension): NA

Snuffleupagus commented 2 weeks ago

It works if you try a second time, even after a page reload.

Wouldn't this suggest a browser bug, given that it apparently works in some cases, rather than a PDF.js one?

shivaprsd commented 2 weeks ago

@Snuffleupagus You are right, it could be. I just thought it might be related to the way PDF.js handles blob: urls, looking at the console messages.

I tried with an older Fenix version and could not reproduce the issue. I then did a bisect with Fenix versions and found that the first bad version is 124.0b1.

Thanks for the tip. I will open a bug in Bugzilla. You may close this.