{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/pdf.js/issues/6608","labels_url":"https://api.github.com/repos/mozilla/pdf.js/issues/6608/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/pdf.js/issues/6608/comments","events_url":"https://api.github.com/repos/mozilla/pdf.js/issues/6608/events","html_url":"https://github.com/mozilla/pdf.js/pull/6608","id":115744830,"number":6608,"title":"Improve error message for non-existent local files","user":{"login":"Rob--W","id":1365071,"avatar_url":"https://avatars.githubusercontent.com/u/1365071?v=3","gravatar_id":"","url":"https://api.github.com/users/Rob--W","html_url":"https://github.com/Rob--W","followers_url":"https://api.github.com/users/Rob--W/followers","following_url":"https://api.github.com/users/Rob--W/following{/other_user}","gists_url":"https://api.github.com/users/Rob--W/gists{/gist_id}","starred_url":"https://api.github.com/users/Rob--W/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rob--W/subscriptions","organizations_url":"https://api.github.com/users/Rob--W/orgs","repos_url":"https://api.github.com/users/Rob--W/repos","events_url":"https://api.github.com/users/Rob--W/events{/privacy}","received_events_url":"https://api.github.com/users/Rob--W/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mozilla/pdf.js/labels/4-chrome-specific","name":"4-chrome-specific","color":"e102d8"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-11-08T17:10:44Z","updated_at":"2015-11-09T21:40:48Z","closed_at":"2015-11-09T21:40:41Z","pull_request":{"url":"https://api.github.com/repos/mozilla/pdf.js/pulls/6608","html_url":"https://github.com/mozilla/pdf.js/pull/6608","diff_url":"https://github.com/mozilla/pdf.js/pull/6608.diff","patch_url":"https://github.com/mozilla/pdf.js/pull/6608.patch"},"body":"I received multiple reports about the following cryptic error in the Chrome extension when the user tried to open a local file:\r\n\r\n> PDF.js v1.1.527 (build: 2096a2a)\r\n> Message: Cannot read property 'Symbol(Symbol.iterator)' of null\r\n\r\nThis error most likely originated from core/stream.js:\r\n\r\n    function Stream(arrayBuffer, start, length, dict) {\r\n      this.bytes = (arrayBuffer instanceof Uint8Array ?\r\n                    arrayBuffer : new Uint8Array(arrayBuffer));\r\n                                                 ^^^^^^^^^^^\r\n`arrayBuffer` is `null`, and that in turn is caused by the fact that for non-existing files, there is no data. I've applied two fixes:\r\n\r\n1. Never call onDone with a void buffer, but call the error handler\r\n   instead.\r\n2. Show a sensible error message for local files with status = 0.\r\n\r\nTo get the error, simply install the Chrome extension, open any PDF file to get the extension URL, and then append some non-existent local file. E.g. `chrome-extension://oemmndcbldboiebfnladdacbdfmadadm/file:///tmp/doesnotexist.pdf`"},"comment":{"url":"https://api.github.com/repos/mozilla/pdf.js/issues/comments/155206830","html_url":"https://github.com/mozilla/pdf.js/pull/6608#issuecomment-155206830","issue_url":"https://api.github.com/repos/mozilla/pdf.js/issues/6608","id":155206830,"user":{"login":"yurydelendik","id":1523410,"avatar_url":"https://avatars.githubusercontent.com/u/1523410?v=3","gravatar_id":"","url":"https://api.github.com/users/yurydelendik","html_url":"https://github.com/yurydelendik","followers_url":"https://api.github.com/users/yurydelendik/followers","following_url":"https://api.github.com/users/yurydelendik/following{/other_user}","gists_url":"https://api.github.com/users/yurydelendik/gists{/gist_id}","starred_url":"https://api.github.com/users/yurydelendik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurydelendik/subscriptions","organizations_url":"https://api.github.com/users/yurydelendik/orgs","repos_url":"https://api.github.com/users/yurydelendik/repos","events_url":"https://api.github.com/users/yurydelendik/events{/privacy}","received_events_url":"https://api.github.com/users/yurydelendik/received_events","type":"User","site_admin":false},"created_at":"2015-11-09T21:40:48Z","updated_at":"2015-11-09T21:40:48Z","body":"Thank you for the patch"}}