cdadb0db4d
This method captures all application/pdf streams, loads the viewer and passes the stream to the PDF.js viewer. This commit shows a proof of concept using the chrome.streamsPrivate API. Advantages of new method: - Access to the response body of the original request, thus fewer network requests. - PDFs from non-GET requests (e.g. POST) are now supported. - FTP files are also supported. Possible improvements: - Use declared content scripts instead of dynamic chrome.tabs.executeScript. This allows the extension to render the viewer in frames when the extension is disallowed to run executeScript for the top URL. - Use chrome.declarativeWebRequest instead of webRequest, and replace background page with event page (don't forget to profile the difference & will the background/event page still work as intended?).
21 lines
767 B
HTML
21 lines
767 B
HTML
<!doctype html>
|
|
<!--
|
|
Copyright 2012 Mozilla Foundation
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
-->
|
|
<script src="chrome.tabs.executeScriptInFrame.js"></script>
|
|
<script src="pdfHandler.js"></script>
|
|
<script src="extension-router.js"></script>
|
|
<script src="pdfHandler-v2.js"></script>
|