Commit Graph

439 Commits

Author SHA1 Message Date
Jonas Jenwald
e12c48b73f Add a enhanceTextSelection preference
Please note that this is a hack, but I think that it should be OK for now to atleast get the preference landed. Refer to the code comment for further information.

Re: issue 7584 and PR 7586.
2016-09-08 10:22:01 +02:00
Tim van der Meij
e686db250c Render interactive form (AcroForm) text widget annotations
This patch is the first step towards implementing support for
interactive forms (AcroForms). It makes it possible to render text
widget annotations exactly like Adobe Reader/Acrobat.

Everything we implement for AcroForms is disabled by default using a
preference, mainly because it is not ready to use yet, but has to
implemented in many steps to avoid complexity. The preference allows us
to work with the code while not exposing the behavior by default. Mainly
storing entered values and printing them is still absent, which would be
minimal requirements for enabling this by default.
2016-09-07 15:37:28 +02:00
Tim van der Meij
a2525a8ba3 Revert "Add a enhanceTextSelection preference to the viewer"
This reverts commit 15e45d772f.
2016-09-03 20:26:46 +02:00
Jonas Jenwald
15e45d772f Add a enhanceTextSelection preference to the viewer 2016-09-02 14:38:51 +02:00
Brendan Dahl
815c3a822f Bug 1291709 - PdfjsChromeUtils.jsm leaks browser.xul windows. 2016-08-03 14:18:40 -07:00
Tim van der Meij
a9dd2ab0ab Move B2G viewer to the examples folder 2016-07-27 17:31:52 +02:00
Tim van der Meij
e65606d271 Remove previousPageNumber from the B2G viewer 2016-07-27 15:55:40 +02:00
klemens
6f03f62327 trivial spelling fixes 2016-07-17 14:33:41 +02:00
Peter Dave Hello
625d637297 optimize png images using zopflipng 2016-07-10 17:49:16 +08:00
Jonas Jenwald
87229a086f Update mxr.mozilla.org links to point to dxr.mozilla.org instead
Given that MXR has been officially retired, see https://groups.google.com/forum/#!topic/mozilla.dev.platform/_k-ditFrne4, we've got a couple of links that are no longer working.
2016-07-06 11:42:16 +02:00
Yury Delendik
3cba2cb258 Fixes SeaMonkey version 2016-06-29 17:54:11 -05:00
Jonas Jenwald
9fbde18880 [Firefox addon] Feature detect originAttributes to make it Seamonkey 2.40 compatible
Fixes 7245.
2016-06-24 17:05:53 +02:00
Jonas Jenwald
6d7f6f1b86 Upstream the changes from Bug 1242730 - Convert callsites to use channel.async0pen2() within browser/extensions/pdfjs (issue 7386)
Please see https://bugzilla.mozilla.org/show_bug.cgi?id=1242730.

Fixes 7386.
2016-06-15 14:50:56 +02:00
Jonas Jenwald
d3d3bb9695 [Firefox addon] Change the minimum supported version to Firefox 38 and remove a bunch old no longer necessary fallback code
From the discussion in issue 7386, it wasn't really clear if we can restrict addon support to Firefox `45` (i.e. the version that corresponds to the *current* ESR version).

However, we have a bunch of code for *very* old Firefox versions. Hence this patch changes the minimum supported version to Firefox `38` (which was released on `2015-05-12`, and correspond to the *previous* ESR version), and removes code that only applies to old Firefox versions.

Regardless what we end up deciding regarding addon support for previous Firefox versions, given the amount of code that even the Firefox `>= 38` condition lets us remove, I certainly think that there is value in doing this.
2016-06-15 09:54:41 +02:00
Rob Wu
08ad551a01 Force inline block display style for <object>.
Test:
1. Build the Chrome extension and load it.
2. Visit https://robwu.nl/pdfjs/object-embed.html
3. Verify that all displayed blocks have the same width and
   height as the reference ("Expected dimension").
2016-06-11 15:54:16 +02:00
Rob Wu
60438399e0 Fix typo in telemetry.js, follow-up to #7370 2016-06-03 23:28:01 +02:00
Rob Wu
724308c57a Add opt-out telemetry to the Chrome extension
Privacy policy: https://github.com/Rob--W/pdfjs-telemetry#privacy-policy

Unit tests (offline):

```
node test/chromium/test-telemetry.js
```

Server tests (requires that Nginx is installed):

```
git clone https://github.com/Rob--W/pdfjs-telemetry.git
cd pdfjs-telemetry/
python testserver.py TestHttp TestHttps
```

Integration test (extension + server):

- Build the extension
- Edit build/chromium/telemetry.js and remove the check for
  chrome.runtime.id.
- Start Chrome (preferably a new profile):
  chromium --user-data-dir=/tmp/pdftest --no-first-run
- Open chrome://net-internals#events
- Visit chrome://extensions and enable Developer mode.
- Load unpacked extension, select build/chromium.
- Go to the chrome://net-internals tab and filter on pdfjs.robwu.nl.
- Click on URL_REQUEST and verify that the server replied with 204.
- Reload the extension.
- Verify that chrome://net-internals did not contain a new log request.
2016-06-03 20:36:57 +02:00
Rob Wu
0be8e72d6f Support syncing of settings in Chrome extension
Use chrome.storage.sync to store preferences instead of
chrome.storage.local, to allow settings to be synchronized if the user
chooses to sign in in Chrome and enables synchronization of extension
preferences.
2016-05-25 00:51:51 +02:00
Tim van der Meij
fdfaa43f5e Resolve a regression in the Chromium extension's preferences handling
Commit df10513e10 unfortunately broke the options dialog of the Chromium extension because the logic required to work with the preference was not added. This patch adds the required logic to show the preference in the options dialog and to persist it to the preferences storage.

Verified using Chromium 50 on Arch Linux.
2016-05-25 00:32:32 +02:00
Tim van der Meij
6316ca0299 Merge pull request #7344 from Rob--W/crx-cleanup-compat-frame
Remove support for frames in old Chromium versions
2016-05-25 00:04:45 +02:00
Yury Delendik
df10513e10 Moves DEFAULT_PREFENCES into JSON format. 2016-05-11 17:58:17 -05:00
Rob Wu
9394fc133c Remove support for frames in old Chromium versions
Frames are only supported (via redirectUrl) in Chrome 35.0.1911.0+
2016-05-10 22:40:07 +02:00
Tim van der Meij
8dcc727be1 Merge pull request #7244 from Rob--W/crx-pdf-embed-object-no-shadow-dom
Don't use shadow DOM for rendering <object>/<embed>
2016-05-09 23:59:28 +02:00
Rob Wu
fc658a718c Remove streamsPrivate usage
This was only ever useful for the Opera extension because the API
requires a whitelisted extension ID. Opera ditched PDF.js from their
extension gallery, so we don't need to keep this in the tree.
2016-05-09 22:49:47 +02:00
Yury Delendik
148102b626 Refactors firefoxcom dependency on app and l10n. 2016-04-24 08:25:55 -05:00
Rob Wu
b45e6a7cc9 Don't use shadow DOM for rendering <object>/<embed>
Multiple shadow roots are not supported any more in Chrome 51+
(https://crbug.com/603448#c6), so this patch changes the way that PDFs
are rendered in `<embed>` / `<object>` tags.

I used shadow roots because their content is not visible from the web
page, so the odds of conflicts were minimal. Now I have to render the
PDF frame directly in the page, which can be observed from the page
(unfortunately).

Now the following happens when an embedded PDF tag is detected:

- `<embed>` tags: The type and src attributes are updated.
- `<object>` tags: The type attribute is changed and the fallback
  content is set and displayed.
2016-04-23 23:52:22 +02:00
Dave Huseby
867a5ea1b0 Make pdf.js use the correct principal origin attributes when loading subresources. 2016-04-04 14:12:51 -07:00
Yury Delendik
2b246192e1 Removes frontWindow usage from the stream converter. 2016-03-24 11:47:34 -05:00
Jonas Jenwald
41efb92d3a Merge pull request #6988 from timvandermeij/fileattachment-annotation
Implement support for FileAttachment annotations
2016-02-24 12:58:06 +01:00
Tim van der Meij
0351c7eff4 Move the getFileName helper function to the core
This is required to be able to use it in the annotation display code,
where we now apply it to sanitize the filename of the FileAttachment
annotation. The PDF file from https://bugzilla.mozilla.org/show_bug.cgi?id=1230933 has shown that some PDF generators include the path of the file rather than the filename, which causes filenames with weird initial characters. PDF viewers handle this differently (for example Foxit Reader just replaces forward slashes with spaces), but we think it's better to only show the filename as intended.

Additionally we add unit tests for the `getFilenameFromUrl` helper
function.
2016-02-23 22:49:53 +01:00
Tim van der Meij
6a33dfd13a Implement support for FileAttachment annotations 2016-02-23 22:49:53 +01:00
Jonas Jenwald
f64113c927 [Addon] Catch errors in getFindBar (in PdfStreamConverter.jsm) to fix loading of PDF files in the bookmark sidebar (bug 1248959)
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1248959.
2016-02-18 13:59:18 +01:00
Yury Delendik
2f145d8db4 Republish addon 2016-02-11 15:36:32 -06:00
Yury Delendik
2addcc7957 Republish addon 2016-02-11 15:21:15 -06:00
Rob Wu
0ec82d4a50 Allow local PDF files to be viewed in local frames
The Chrome extension enforces that local files cannot be embedded in
non-local web pages. The previous check was too strict (because the
origin of a file:-URL is "null"), and prevented local PDF from being
viewed in local files).

This patch fixes that problem, by querying the actual tab URL via the
background page.

Steps to verify:
1. Create a HTML file: `<iframe src=test.pdf width=100% height=100%>`
2. Build and load the extension.
3. Allow file access to the extension at `chrome://extensions`
4. Open the HTML file from a file:// URL.
5. VERIFY: The extension should attempt to load the PDF file.

6. Now open the following (replace ID with the extension ID, which you
   can find at `chrome://extensions`):
  `data:text/html,<iframe src="chrome-extension://ID/file:///test.pdf">`
7. VERIFY: The next error should be displayed:
   "Refused to load a local file in a non-local page for security reasons."
2016-02-10 14:52:54 +01:00
Yury Delendik
49437c879d Republish the extension. 2015-12-18 10:33:12 -06:00
Yury Delendik
479d96eb24 Testing ability to auto-upgrade the addons. 2015-12-18 10:05:20 -06:00
Yury Delendik
e7311cdc6e Fixes versions in update.rdf. 2015-12-18 09:44:18 -06:00
Yury Delendik
d98105fdbd Fixes update extension github link. 2015-12-18 09:32:46 -06:00
Yury Delendik
2fb9baf6f1 Changing Firefox Addon ID
.. to allow AMO publishing to the unlisted extensions for automatic signing.
2015-12-18 09:06:23 -06:00
Manas
a2ba1b8189 Uses editorconfig to maintain consistent coding styles
Removes the following as they unnecessary
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
2015-11-14 07:32:18 +05:30
Yury Delendik
c8c211602b Merge pull request #6073 from Snuffleupagus/bug-1170063
[Firefox] Handle the user modifying the "mousewheel.with_meta.action" and "mousewheel.with_control.action" prefs (bug 1170063)
2015-10-30 11:54:04 -05:00
Yury Delendik
59c13b32aa Adds destroy method to the document loading task.
Also renames PDFPageProxy.destroy method to cleanup.
2015-10-23 08:57:14 -05:00
Jonas Jenwald
49389c2d30 Follow-up to PR 6489 - Upstream changes from Bug 1202902
I somehow managed miss including one of the upstream changes in PR 6489; hence this patch. Sorry about the unnecessary churn in this code!
2015-10-05 12:31:53 +02:00
Yury Delendik
82f73dfed5 Merge pull request #6473 from Snuffleupagus/bug-1165272
Upstream the changes from Bug 1165272 - unify Get*CodebasePrincipal with createCodebasePrincipal in nsIScriptSecurityManager
2015-10-01 11:47:12 -05:00
Jonas Jenwald
26ec36ba4c Upstream changes from Bug 1202902 - Give loader scripts and XUL frame scripts a lexical scope that doesn't break everything?
One of the patches in https://bugzilla.mozilla.org/show_bug.cgi?id=1202902, specifically [`Mass replace toplevel 'let' with 'var' in preparation for global lexical scope. (rs=jorendorff)`](https://hg.mozilla.org/mozilla-central/rev/380817d573cd), touches PDF.js code. Unfortunately it was landed upstream without, as far as I can tell, notifying us about it.

This patch uplifts the relevant changes to avoid future merge conflicts, and for consistency also tweaks `PdfJs-stub.jsm`.
2015-10-01 10:03:10 +02:00
Jonas Jenwald
0be1f449ee Upstream the changes from Bug 1165272 - unify Get*CodebasePrincipal with createCodebasePrincipal in nsIScriptSecurityManager
One of the patches in https://bugzilla.mozilla.org/show_bug.cgi?id=1165272, specifically https://hg.mozilla.org/mozilla-central/rev/5a29e8bc51ca, touches PDF.js code. Unfortunately it was landed upstream without, as far as I can tell, notifying us about it.
This patch uplifts the relevant changes, and also adds preprocessor tags to avoid including unnecessary code in mozilla-central.
2015-09-24 18:25:27 +02:00
Jonas Jenwald
421289c7bc Merge pull request #6233 from Rob--W/crx-local-files
Improve support for viewing PDFs from file://-URLs in the Chrome extension
2015-08-15 14:15:36 +02:00
Rob Wu
32e7a8adba Don't reload after updating if a tab is in use 2015-08-14 19:00:12 +02:00
Rob Wu
4ac8863e30 Restore extension tab after reload
Work-around for https://crbug.com/511670
2015-08-14 19:00:12 +02:00