{"action":"created","comment":{"url":"https://api.github.com/repos/hypothesis/h/pulls/comments/37410379","id":37410379,"diff_hunk":"@@ -103,39 +109,14 @@\n       });\n     }\n \n-    function injectIntoLocalDocument(tab) {\n-      if (isPDFURL(tab.url)) {\n-        return injectIntoLocalPDF(tab);\n-      } else {\n-        return Promise.reject(new h.LocalFileError('Local non-PDF files are not supported'));\n-      }\n-    }\n-\n-    function injectIntoRemoteDocument(tab) {\n-      return isPDFURL(tab.url) ? injectIntoPDF(tab) : injectIntoHTML(tab);\n-    }\n-\n-    function injectIntoPDF(tab) {\n-      return new Promise(function (resolve, reject) {\n-        if (!isPDFViewerURL(tab.url)) {\n-          chromeTabs.update(tab.id, {url: getPDFViewerURL(tab.url)}, function () {\n-            resolve();\n-          });\n-        } else {\n-          resolve();\n-        }\n-      });\n+     function injectIntoLocalDocument(tab) {\n+      return Promise.reject(new h.LocalFileError('Local non-PDF files are not supported'));\n     }\n \n-    function injectIntoLocalPDF(tab) {\n-      return new Promise(function (resolve, reject) {\n-        isAllowedFileSchemeAccess(function (isAllowed) {\n-          if (isAllowed) {\n-            resolve(injectIntoPDF(tab));\n-          } else {\n-            reject(new h.NoFileAccessError('Local file scheme access denied'));\n-          }\n-        });\n+    function reloadPDF(tab) {","path":"h/browser/chrome/lib/sidebar-injector.js","position":77,"original_position":77,"commit_id":"38788567822102b8b6ca961f6ee1bcad4e16b673","original_commit_id":"38788567822102b8b6ca961f6ee1bcad4e16b673","user":{"login":"BigBlueHat","id":43209,"avatar_url":"https://avatars.githubusercontent.com/u/43209?v=3","gravatar_id":"","url":"https://api.github.com/users/BigBlueHat","html_url":"https://github.com/BigBlueHat","followers_url":"https://api.github.com/users/BigBlueHat/followers","following_url":"https://api.github.com/users/BigBlueHat/following{/other_user}","gists_url":"https://api.github.com/users/BigBlueHat/gists{/gist_id}","starred_url":"https://api.github.com/users/BigBlueHat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BigBlueHat/subscriptions","organizations_url":"https://api.github.com/users/BigBlueHat/orgs","repos_url":"https://api.github.com/users/BigBlueHat/repos","events_url":"https://api.github.com/users/BigBlueHat/events{/privacy}","received_events_url":"https://api.github.com/users/BigBlueHat/received_events","type":"User","site_admin":false},"body":"The extension no longer \"takes over\" all PDFs like it used to. This is currently handling the scenario (using the old URL sniffing method) for reloading a PDF when annotating is enabled.","created_at":"2015-08-19T12:55:00Z","updated_at":"2015-08-19T12:55:00Z","html_url":"https://github.com/hypothesis/h/pull/2437#discussion_r37410379","pull_request_url":"https://api.github.com/repos/hypothesis/h/pulls/2437","_links":{"self":{"href":"https://api.github.com/repos/hypothesis/h/pulls/comments/37410379"},"html":{"href":"https://github.com/hypothesis/h/pull/2437#discussion_r37410379"},"pull_request":{"href":"https://api.github.com/repos/hypothesis/h/pulls/2437"}}},"pull_request":{"url":"https://api.github.com/repos/hypothesis/h/pulls/2437","id":42020494,"html_url":"https://github.com/hypothesis/h/pull/2437","diff_url":"https://github.com/hypothesis/h/pull/2437.diff","patch_url":"https://github.com/hypothesis/h/pull/2437.patch","issue_url":"https://api.github.com/repos/hypothesis/h/issues/2437","number":2437,"state":"open","locked":false,"title":"Load PDF.js viewer for PDF media types","user":{"login":"BigBlueHat","id":43209,"avatar_url":"https://avatars.githubusercontent.com/u/43209?v=3","gravatar_id":"","url":"https://api.github.com/users/BigBlueHat","html_url":"https://github.com/BigBlueHat","followers_url":"https://api.github.com/users/BigBlueHat/followers","following_url":"https://api.github.com/users/BigBlueHat/following{/other_user}","gists_url":"https://api.github.com/users/BigBlueHat/gists{/gist_id}","starred_url":"https://api.github.com/users/BigBlueHat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BigBlueHat/subscriptions","organizations_url":"https://api.github.com/users/BigBlueHat/orgs","repos_url":"https://api.github.com/users/BigBlueHat/repos","events_url":"https://api.github.com/users/BigBlueHat/events{/privacy}","received_events_url":"https://api.github.com/users/BigBlueHat/received_events","type":"User","site_admin":false},"body":"Fixes #1900\r\n\r\nThe PDF.js Viewer + our embed.js code will be used for\r\nall PDFs--which means our extension does not currently\r\nconsider the toggle button state for PDFs.\r\n\r\nThree files were copied (verbatim) from\r\nhttp://github.com/mozilla/pdf.js\r\ncommit sha: f943b290e67bf27ae6cc27509b480ddd150f8ebc\r\nhttps://raw.githubusercontent.com/mozilla/pdf.js/f943b290e67bf27ae6cc27509b480ddd150f8ebc/extensions/chromium/preserve-referer.js\r\nhttps://raw.githubusercontent.com/mozilla/pdf.js/f943b290e67bf27ae6cc27509b480ddd150f8ebc/extensions/chromium/feature-detect.js\r\nhttps://raw.githubusercontent.com/mozilla/pdf.js/f943b290e67bf27ae6cc27509b480ddd150f8ebc/extensions/chromium/pdfHandler.js\r\n\r\nThe previous URL sniffing and inject code for the\r\nPDF viewer has been remoted from our code (in favor\r\nof this upstream detection code).\r\n\r\nThe following permissions were added as need by the upstream code:\r\n`fileBrowserHandler`, `webRequest`, `webRequestBlocking`, and `storage`.","created_at":"2015-08-10T13:37:27Z","updated_at":"2015-08-19T12:55:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a334f63bb5145459bdbea2dd208ae7994912e3b8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hypothesis/h/pulls/2437/commits","review_comments_url":"https://api.github.com/repos/hypothesis/h/pulls/2437/comments","review_comment_url":"https://api.github.com/repos/hypothesis/h/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hypothesis/h/issues/2437/comments","statuses_url":"https://api.github.com/repos/hypothesis/h/statuses/38788567822102b8b6ca961f6ee1bcad4e16b673","head":{"label":"hypothesis:detect-pdf-in-chrome-ext","ref":"detect-pdf-in-chrome-ext","sha":"38788567822102b8b6ca961f6ee1bcad4e16b673","user":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars.githubusercontent.com/u/1243215?v=3","gravatar_id":"","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"repo":{"id":3910945,"name":"h","full_name":"hypothesis/h","owner":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars.githubusercontent.com/u/1243215?v=3","gravatar_id":"","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hypothesis/h","description":"The Internet, peer reviewed.","fork":false,"url":"https://api.github.com/repos/hypothesis/h","forks_url":"https://api.github.com/repos/hypothesis/h/forks","keys_url":"https://api.github.com/repos/hypothesis/h/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hypothesis/h/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hypothesis/h/teams","hooks_url":"https://api.github.com/repos/hypothesis/h/hooks","issue_events_url":"https://api.github.com/repos/hypothesis/h/issues/events{/number}","events_url":"https://api.github.com/repos/hypothesis/h/events","assignees_url":"https://api.github.com/repos/hypothesis/h/assignees{/user}","branches_url":"https://api.github.com/repos/hypothesis/h/branches{/branch}","tags_url":"https://api.github.com/repos/hypothesis/h/tags","blobs_url":"https://api.github.com/repos/hypothesis/h/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hypothesis/h/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hypothesis/h/git/refs{/sha}","trees_url":"https://api.github.com/repos/hypothesis/h/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hypothesis/h/statuses/{sha}","languages_url":"https://api.github.com/repos/hypothesis/h/languages","stargazers_url":"https://api.github.com/repos/hypothesis/h/stargazers","contributors_url":"https://api.github.com/repos/hypothesis/h/contributors","subscribers_url":"https://api.github.com/repos/hypothesis/h/subscribers","subscription_url":"https://api.github.com/repos/hypothesis/h/subscription","commits_url":"https://api.github.com/repos/hypothesis/h/commits{/sha}","git_commits_url":"https://api.github.com/repos/hypothesis/h/git/commits{/sha}","comments_url":"https://api.github.com/repos/hypothesis/h/comments{/number}","issue_comment_url":"https://api.github.com/repos/hypothesis/h/issues/comments{/number}","contents_url":"https://api.github.com/repos/hypothesis/h/contents/{+path}","compare_url":"https://api.github.com/repos/hypothesis/h/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hypothesis/h/merges","archive_url":"https://api.github.com/repos/hypothesis/h/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hypothesis/h/downloads","issues_url":"https://api.github.com/repos/hypothesis/h/issues{/number}","pulls_url":"https://api.github.com/repos/hypothesis/h/pulls{/number}","milestones_url":"https://api.github.com/repos/hypothesis/h/milestones{/number}","notifications_url":"https://api.github.com/repos/hypothesis/h/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hypothesis/h/labels{/name}","releases_url":"https://api.github.com/repos/hypothesis/h/releases{/id}","created_at":"2012-04-02T19:56:59Z","updated_at":"2015-08-17T06:41:39Z","pushed_at":"2015-08-19T08:59:29Z","git_url":"git://github.com/hypothesis/h.git","ssh_url":"git@github.com:hypothesis/h.git","clone_url":"https://github.com/hypothesis/h.git","svn_url":"https://github.com/hypothesis/h","homepage":"https://hypothes.is/","size":45646,"stargazers_count":465,"watchers_count":465,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":121,"mirror_url":null,"open_issues_count":118,"forks":121,"open_issues":118,"watchers":465,"default_branch":"master"}},"base":{"label":"hypothesis:master","ref":"master","sha":"35884f8a3d794d62889b701c79483d206a09c2c2","user":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars.githubusercontent.com/u/1243215?v=3","gravatar_id":"","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"repo":{"id":3910945,"name":"h","full_name":"hypothesis/h","owner":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars.githubusercontent.com/u/1243215?v=3","gravatar_id":"","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hypothesis/h","description":"The Internet, peer reviewed.","fork":false,"url":"https://api.github.com/repos/hypothesis/h","forks_url":"https://api.github.com/repos/hypothesis/h/forks","keys_url":"https://api.github.com/repos/hypothesis/h/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hypothesis/h/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hypothesis/h/teams","hooks_url":"https://api.github.com/repos/hypothesis/h/hooks","issue_events_url":"https://api.github.com/repos/hypothesis/h/issues/events{/number}","events_url":"https://api.github.com/repos/hypothesis/h/events","assignees_url":"https://api.github.com/repos/hypothesis/h/assignees{/user}","branches_url":"https://api.github.com/repos/hypothesis/h/branches{/branch}","tags_url":"https://api.github.com/repos/hypothesis/h/tags","blobs_url":"https://api.github.com/repos/hypothesis/h/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hypothesis/h/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hypothesis/h/git/refs{/sha}","trees_url":"https://api.github.com/repos/hypothesis/h/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hypothesis/h/statuses/{sha}","languages_url":"https://api.github.com/repos/hypothesis/h/languages","stargazers_url":"https://api.github.com/repos/hypothesis/h/stargazers","contributors_url":"https://api.github.com/repos/hypothesis/h/contributors","subscribers_url":"https://api.github.com/repos/hypothesis/h/subscribers","subscription_url":"https://api.github.com/repos/hypothesis/h/subscription","commits_url":"https://api.github.com/repos/hypothesis/h/commits{/sha}","git_commits_url":"https://api.github.com/repos/hypothesis/h/git/commits{/sha}","comments_url":"https://api.github.com/repos/hypothesis/h/comments{/number}","issue_comment_url":"https://api.github.com/repos/hypothesis/h/issues/comments{/number}","contents_url":"https://api.github.com/repos/hypothesis/h/contents/{+path}","compare_url":"https://api.github.com/repos/hypothesis/h/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hypothesis/h/merges","archive_url":"https://api.github.com/repos/hypothesis/h/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hypothesis/h/downloads","issues_url":"https://api.github.com/repos/hypothesis/h/issues{/number}","pulls_url":"https://api.github.com/repos/hypothesis/h/pulls{/number}","milestones_url":"https://api.github.com/repos/hypothesis/h/milestones{/number}","notifications_url":"https://api.github.com/repos/hypothesis/h/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hypothesis/h/labels{/name}","releases_url":"https://api.github.com/repos/hypothesis/h/releases{/id}","created_at":"2012-04-02T19:56:59Z","updated_at":"2015-08-17T06:41:39Z","pushed_at":"2015-08-19T08:59:29Z","git_url":"git://github.com/hypothesis/h.git","ssh_url":"git@github.com:hypothesis/h.git","clone_url":"https://github.com/hypothesis/h.git","svn_url":"https://github.com/hypothesis/h","homepage":"https://hypothes.is/","size":45646,"stargazers_count":465,"watchers_count":465,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":121,"mirror_url":null,"open_issues_count":118,"forks":121,"open_issues":118,"watchers":465,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hypothesis/h/pulls/2437"},"html":{"href":"https://github.com/hypothesis/h/pull/2437"},"issue":{"href":"https://api.github.com/repos/hypothesis/h/issues/2437"},"comments":{"href":"https://api.github.com/repos/hypothesis/h/issues/2437/comments"},"review_comments":{"href":"https://api.github.com/repos/hypothesis/h/pulls/2437/comments"},"review_comment":{"href":"https://api.github.com/repos/hypothesis/h/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hypothesis/h/pulls/2437/commits"},"statuses":{"href":"https://api.github.com/repos/hypothesis/h/statuses/38788567822102b8b6ca961f6ee1bcad4e16b673"}}}}