[Pkg-javascript-commits] [pdf.js] 61/174: Prevent external links from "replacing" the viewer when it's embedded (bug 976541)
David Prévot
taffit at moszumanska.debian.org
Thu Nov 19 18:45:12 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 610df45bad214e3edab140978a3988dab4d28d81
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Sun Apr 19 12:40:46 2015 +0200
Prevent external links from "replacing" the viewer when it's embedded (bug 976541)
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=976541.
This patch also adds a `externalLinkTarget` preference, to make the behaviour user configurable.
---
web/default_preferences.js | 3 ++-
web/viewer.js | 16 ++++++++++++++--
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/web/default_preferences.js b/web/default_preferences.js
index 1047414..ea2d4ae 100644
--- a/web/default_preferences.js
+++ b/web/default_preferences.js
@@ -32,5 +32,6 @@ var DEFAULT_PREFERENCES = {
disableAutoFetch: false,
disableFontFace: false,
disableTextLayer: false,
- useOnlyCssZoom: false
+ useOnlyCssZoom: false,
+ externalLinkTarget: 0,
};
diff --git a/web/viewer.js b/web/viewer.js
index 514e0c3..4b25ffe 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -288,12 +288,24 @@ var PDFViewerApplication = {
}),
Preferences.get('useOnlyCssZoom').then(function resolved(value) {
PDFJS.useOnlyCssZoom = value;
- })
+ }),
+ Preferences.get('externalLinkTarget').then(function resolved(value) {
+ if (PDFJS.isExternalLinkTargetSet()) {
+ return;
+ }
+ PDFJS.externalLinkTarget = value;
+ }),
// TODO move more preferences and other async stuff here
]).catch(function (reason) { });
return initializedPromise.then(function () {
- PDFViewerApplication.initialized = true;
+ if (self.isViewerEmbedded && !PDFJS.isExternalLinkTargetSet()) {
+ // Prevent external links from "replacing" the viewer,
+ // when it's embedded in e.g. an iframe or an object.
+ PDFJS.externalLinkTarget = PDFJS.LinkTarget.TOP;
+ }
+
+ self.initialized = true;
});
},
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list