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.
This commit is contained in:
parent
39b962e3b0
commit
610df45bad
@ -32,5 +32,6 @@ var DEFAULT_PREFERENCES = {
|
|||||||
disableAutoFetch: false,
|
disableAutoFetch: false,
|
||||||
disableFontFace: false,
|
disableFontFace: false,
|
||||||
disableTextLayer: false,
|
disableTextLayer: false,
|
||||||
useOnlyCssZoom: false
|
useOnlyCssZoom: false,
|
||||||
|
externalLinkTarget: 0,
|
||||||
};
|
};
|
||||||
|
@ -288,12 +288,24 @@ var PDFViewerApplication = {
|
|||||||
}),
|
}),
|
||||||
Preferences.get('useOnlyCssZoom').then(function resolved(value) {
|
Preferences.get('useOnlyCssZoom').then(function resolved(value) {
|
||||||
PDFJS.useOnlyCssZoom = 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
|
// TODO move more preferences and other async stuff here
|
||||||
]).catch(function (reason) { });
|
]).catch(function (reason) { });
|
||||||
|
|
||||||
return initializedPromise.then(function () {
|
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;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user