Commit Graph

277 Commits

Author SHA1 Message Date
Jonas Jenwald
c158894d94 Improve handling of preferences in Firefox 2014-03-05 11:58:12 +01:00
Yury Delendik
192f09cd69 Merge pull request #4343 from brendandahl/ff-cleanup
Use only one resource url for moz central build.
2014-03-04 20:29:27 -06:00
Mitar
2c82e720b8 Updated to current latest stable version of jshint. 2014-03-01 13:31:25 -08:00
Brendan Dahl
b8f7bcaf02 Use only one resource url for moz central build. 2014-02-27 14:11:39 -08:00
Brendan Dahl
0af0c6c99d Merge pull request #4229 from Rob--W/crx-stream-progress
Get progress bar for PDF streams in Chromium by passing the expected content length to the page
2014-02-26 11:12:34 -08:00
Tim van der Meij
569bb131e5 Merge pull request #4328 from Snuffleupagus/b2g-remove-pageNumber-spinner
[B2G] Remove the spinner from the pageNumber field
2014-02-24 21:52:14 +01:00
Brendan Dahl
cc46cea7cb Merge pull request #4262 from yurydelendik/issue4257
Removes -moz-box-sizing usage
2014-02-24 12:47:27 -08:00
Jonas Jenwald
78e2d7cceb [B2G] Remove the spinner from the pageNumber field 2014-02-15 16:02:53 +01:00
Gabriele Svelto
f4d54517c4 Bug 972435 - Recompress all PNG assets 2014-02-13 17:57:10 +01:00
Yury Delendik
4563f6cd58 Merge pull request #4191 from Rob--W/crx-chrome-os
Register PDF Viewer as PDF handler in Chrome OS's file browser
2014-02-11 12:51:36 -06:00
Yury Delendik
894c82cec9 Removes -moz-box-sizing usage 2014-02-10 15:06:03 -06:00
Yury Delendik
3fa15c0f46 Merge pull request #4241 from brendandahl/csp
Remove inline script warnings.
2014-02-03 14:24:27 -08:00
Brendan Dahl
e477958b74 Remove inline script warnings. 2014-02-03 14:14:54 -08:00
Rob Wu
a01556665e Firefox addon: Let XHR respect private mode 2014-01-31 22:23:45 +01:00
Rob Wu
eaf7daf7db [CRX] Pass expected length of stream to viewer
To get a progress bar for POST/FTP requests in Chromium.
2014-01-30 23:03:15 +01:00
Rob Wu
7f0fc8557e [CRX] Support <embed type="application/pdf"> 2014-01-26 00:33:06 +01:00
Rob Wu
60fb28caf0 Register as File browser handler in Chrome OS 2014-01-25 22:37:19 +01:00
Rob Wu
aeaf11ca43 [CRX] Fall back to sender.tab.url if !tab.url
sender.url is relatively new (Chromium 29)
 ( https://chromiumcodereview.appspot.com/14301016 )
2014-01-25 20:15:43 +01:00
Rob Wu
fa965269ea Remove unused file from Chromium extension
extensions/chromium/patch-worker.js was already redundant
since edd4bae903.
2014-01-23 19:26:23 +01:00
Yury Delendik
ba1eb4d1d1 Merge pull request #4126 from Rob--W/crx-using-streams-api
Chromium extension using streamsPrivate API!
2014-01-22 05:12:07 -08:00
Jonas Jenwald
181e06f30a Fix regression that disabled the "Open With Different Viewer" button on the fallback bar 2014-01-16 13:49:39 +01:00
Rob Wu
b754f9d878 Make streamsPrivate optional; remove manifest key
Use streamsPrivate API when available.
When the API is not available, the extension will still work on
on http/https/file URLs, but not for POST requests or FTP.

As of writing, the Chromium project has still not whitelisted
the PDF Viewer extension in the Chrome Web Store.
 (extension ID oemmndcbldboiebfnladdacbdfmadadm)
Request to whitelist PDF.js in Chromium:
 https://code.google.com/p/chromium/issues/detail?id=326949

Opera 19 has whitelisted the PDF Viewer extension from
 https://addons.opera.com/extensions/details/pdf-viewer/
 (extension ID encfpfilknmenlmjemepncnlbbjlabkc)
 (https://github.com/Rob--W/pdf.js/issues/1#issuecomment-32357302)

If you want to test the streamsPrivate feature in Chrome,
edit the build/extensions/manifest.json and add the "key" again
 (see this commit for the value of this "key" field).
2014-01-16 00:30:39 +01:00
Rob Wu
af31ace940 Work-around for http://crbug.com/276898
When a new incognito session is started, the onExecuteMimeTypeHandler event is
often not dispatched in time. Instead, it's triggered in the non-incognito profile.

This commit offers a work-around that allows new incognito instances to view PDF files.
2014-01-15 23:04:29 +01:00
Rob Wu
94ba01c8aa Use tab-specific stream storage
Also:
- Use webNavigation.getAllFrames to find out whether the navigation has
  already started. This is (at least) needed for top-level navigation to
  a stream. The webNavigation.onErrorOccurred event has become obsolete,
  and has been removed.
2014-01-15 23:04:29 +01:00
Rob Wu
32313b9149 Insert dummy content script at every location.
This is needed for propagating the extension's permissions
to the extension's iframe, in the rare event that the PDF is
loaded in a sub frame, and the extension does not have access to the
top frame. For instance, when a http:-PDF file is embedded in a
local file, while "Allow access to local URLs" is disabled.

Note: Propagating permissions by inserting content scripts is an
 undocumented feature (http://crbug.com/302548).

Whenever it breaks, the issue (cross-domain permissions for XHR)
can be solved by using a content script that gets the blob using
the XMLHttpRequest API, followed by `postMessage` (via transferables)
to efficiently pass the arraybuffer back to the PDF Viewer.
2014-01-15 23:04:29 +01:00
Rob Wu
cdadb0db4d Proof of concept using chrome.streamsPrivate API
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?).
2014-01-15 23:04:15 +01:00
Rob Wu
18e4d32c11 Update chrome.tabs.executeScriptInFrame dependency
References:
- https://github.com/Rob--W/chrome-api/issues/1
- 4c5a598c0b...f211d2d679
2014-01-13 21:21:02 +01:00
Brendan Dahl
5d080a03bb Show a different warning for PDF’s with forms. 2014-01-07 16:03:45 -08:00
fkaelberer
1b35bf6c5e Recompressed PNG assets 2014-01-02 21:11:01 +01:00
Yury Delendik
02671decf2 Merge pull request #4066 from Rob--W/crx-pageaction-html-typo
Added missing <html> tag to page action
2014-01-02 10:22:56 -08:00
Yury Delendik
85281d3afc Merge pull request #4059 from glasserc/add-conkeror
add support for Conkeror
2014-01-02 09:45:26 -08:00
Rob Wu
ac8b8079a4 Added missing <html> tag to page action 2014-01-02 18:44:38 +01:00
Rob Wu
e20bc529c8 Remove superfluos <!DOCTYPE html> from page action
Fixes #4064
2014-01-02 18:04:47 +01:00
Ethan Glasser-Camp
9b887f5bf3 add support for Conkeror 2013-12-29 16:06:55 -05:00
Rob Wu
8526d3c600 [CRX] Add a pageAction to omnibox showing PDF URL
In Chromium extensions, the viewer's URL looks like this:
chrome-extension://oemmndcbldboiebfnladdacbdfmadadm/http://example.com/file.pdf

Furthermore, the PDF Viewer itself can also add something to the reference fragment:
chrome-extension://oemmndcbldboiebfnladdacbdfmadadm/http://example.com/file.pdf#page=2

Consequently, it is difficult to copy a clean URL (e.g. for sharing over mail)
without having to tidy-up the URL manually.

This commit solves this issue by adding a button to the omnibox,
which shows the clean PDF URL on click.
2013-12-16 19:00:32 +01:00
Rob Wu
91dd664732 [CRX] Reload extension tab after session restore 2013-11-22 11:44:43 +01:00
Yury Delendik
124eb30e8d Merge pull request #3936 from brendandahl/initial-data
Leave initial request open until the viewer is ready to switch to range requests.
2013-11-21 06:22:24 -08:00
Jonas Jenwald
ba67158c94 Fix error in 'PdfStreamConverter.js' that prevents the user from setting a boolean preference to false 2013-11-19 01:33:48 +01:00
Jonas Jenwald
60610cd625 Implement default preferences 2013-11-18 23:51:06 +01:00
Brendan Dahl
0385131a9a Leave initial request open until the viewer is ready to switch to range requests. 2013-11-18 11:17:26 -08:00
Brendan Dahl
ca1806025c Merge pull request #3794 from brendandahl/b2g-fix
Fix the B2G viewer and enable bot preview.
2013-10-17 14:14:17 -07:00
Rob Wu
83b780af81 [CRX] Show nicely formatted URL in omnibox
Before commit:
chrome-extension://EXTENSIONID/content/web/viewer.html?file=http%3A%2F%2Fexample.com%2Ffile.pdf

After commit:
chrome-extension://EXTENSIONID/http://example/file.pdf

Technical details:
- The extension's background page uses the webRequest API to intercept
  requests for <extension host>/<real path to pdf>, and redirect it to
  the viewer's URL.
- viewer.js uses history.replaceState to rewrite the URL, so that it's
  easier for users to recognize and copy-paste URLs.
- The fake paths /http:, /https:, /file:, etc. have been added to the
  web_accessible_resources section of the manifest file, in order to
  avoid seeing chrome-extension://invalid/ instead of the actual URL
  when using history back/forward to navigate from/to the PDF viewer.
- Since the relative path resolving doesn't work because relative URLs
  are inaccurate, a <base> tag has been added. This method has already
  been proven to work in the Firefox add-on.

Notes:
- This commit has been cherry-picked from crx-using-streams-api.
- Need to merge https://github.com/mozilla/pdf.js/pull/3582 to deal with
  a bug in Chrome <=30
- In Chrome, getting the contents of a FTP file is not possible, so
  there's no support for FTP files, even though the extension router
  recognizes the ftp: scheme.
2013-10-16 23:14:46 +02:00
Rob Wu
e9cb91de39 [CRX] split:incognito is used, so update file:-handler
The current stable Chromium version is 29. Since the critical
bug that prevented use of incognito:split has been fixed, and
incognito:split is actually used, it's safe to drop the code
that disables the extension in incognito mode.

( fixed bug = http:/crbug.com/224094 )
2013-10-16 23:14:43 +02:00
Rob Wu
edd4bae903 [CRX] Change Viewer insertion method
And use split incognito mode

Previous method:
- Rewrite content type to XHTML, followed by a content script
  to cancel and replace the document with the viewer.
  ( https://github.com/mozilla/pdf.js/pull/3017 )

New method:
- Cancel loading of the document, followed by a redirect to the viewer

Disadvantage of new method:
- URLs are no longer "nice". This will be addressed by cherry-picking
  a commit from the crx-using-streams-api branch.

Advantages of new method:
- Idle time is minimal. In some cases (with large documents),
  it took too much time before the content script was activated.
  During this period, the page looked blank, and the contents of
  the PDF file were still retrieved and **discarded**.
  With the new method, the idle time is minimal, because the request
  is immediately cancelled.
- No FOUXEP (Flash of unhidden XML error page), because the XHTML
  Content-Type hack is no longer used.
2013-10-16 23:14:16 +02:00
Rob Wu
820b95416b chrome.runtime -> chrome.extension when needed
Some Ubuntu users are still stuck at Chromium 25.
2013-10-14 17:52:49 +02:00
Rob Wu
6070a37788 chrome.extension -> chrome.runtime for Ubuntu
Addresses issue #3800, where a bug specific to Ubuntu builds of Chromium
break PDF.js
https://bugs.launchpad.net/ubuntu/+source/chromium-browser/+bug/1232575
2013-10-13 12:23:31 +02:00
Brendan Dahl
c79acf5861 Fix the B2G viewer and enable bot preview. 2013-10-09 15:04:58 -07:00
Brendan Dahl
6f61a9c83e Merge pull request #3727 from brendandahl/css-zoom2
Use css to initially scale on zoom.
2013-10-08 20:34:22 -07:00
Brendan Dahl
df249da923 Use css to initially scale on zoom. 2013-10-02 09:05:46 -07:00
Jonas Jenwald
8ae2205783 [B2G] Remove the remaining occurrences of -webkit prefixes from the CSS 2013-09-29 20:45:11 +02:00