mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 14:48:08 +02:00
[CRX] Clean up file/ftp handler
Merge ftp and file handler now their implementations are identical. Remove redundant comment (the referenced Chrome bug has been fixed a long time ago - https://crbug.com/302548 ).
This commit is contained in:
parent
85378fc982
commit
838573abd4
1 changed files with 3 additions and 21 deletions
|
@ -140,32 +140,12 @@ chrome.webRequest.onHeadersReceived.addListener(
|
|||
},
|
||||
['blocking', 'responseHeaders']);
|
||||
|
||||
chrome.webRequest.onBeforeRequest.addListener(
|
||||
function onBeforeRequestForFTP(details) {
|
||||
if (isPdfDownloadable(details)) {
|
||||
return;
|
||||
}
|
||||
var viewerUrl = getViewerURL(details.url);
|
||||
return { redirectUrl: viewerUrl, };
|
||||
},
|
||||
{
|
||||
urls: [
|
||||
'ftp://*/*.pdf',
|
||||
'ftp://*/*.PDF'
|
||||
],
|
||||
types: ['main_frame', 'sub_frame'],
|
||||
},
|
||||
['blocking']);
|
||||
|
||||
chrome.webRequest.onBeforeRequest.addListener(
|
||||
function(details) {
|
||||
if (isPdfDownloadable(details)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// NOTE: The manifest file has declared an empty content script
|
||||
// at file://*/* to make sure that the viewer can load the PDF file
|
||||
// through XMLHttpRequest. Necessary to deal with http://crbug.com/302548
|
||||
var viewerUrl = getViewerURL(details.url);
|
||||
|
||||
return { redirectUrl: viewerUrl, };
|
||||
|
@ -173,7 +153,9 @@ chrome.webRequest.onBeforeRequest.addListener(
|
|||
{
|
||||
urls: [
|
||||
'file://*/*.pdf',
|
||||
'file://*/*.PDF'
|
||||
'file://*/*.PDF',
|
||||
'ftp://*/*.pdf',
|
||||
'ftp://*/*.PDF',
|
||||
],
|
||||
types: ['main_frame', 'sub_frame'],
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue