[Pkg-javascript-commits] [pdf.js] 48/115: Improve the comment and deprecation warning for `PDFJS.openExternalLinksInNewWindow`

David Prévot taffit at moszumanska.debian.org
Wed Dec 16 20:03:14 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 27c8e1e22fc930b8424bafdaa744a6f283c516f3
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Mon Nov 23 12:57:53 2015 +0100

    Improve the comment and deprecation warning for `PDFJS.openExternalLinksInNewWindow`
    
    This patch:
     - Updates the JSDoc comment in `api.js`, to more clearly point out that `PDFJS.openExternalLinksInNewWindow` is deprecated, and explains what to use instead.
    
     - Changes the `warn`, in `isExternalLinkTargetSet()`, to use the new `deprecated` function instead. Also updates the message with more detailed information about what to use instead.
    
     - Changes the pre-processor tag to ensure the deprecation warning is seen in all build types where it could possibly matter (in case people are using `PDFJS.openExternalLinksInNewWindow` in e.g. custom-built extensions).
    
    These changes were prompted by seeing http://stackoverflow.com/questions/33813373/pdf-js-how-to-open-hyperlinks-in-a-new-tab-window, since it seems to me that the current comments/warnings might not be worded well enough.
---
 src/display/api.js | 3 +++
 src/shared/util.js | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/display/api.js b/src/display/api.js
index 450483e..a4a4713 100644
--- a/src/display/api.js
+++ b/src/display/api.js
@@ -173,6 +173,9 @@ PDFJS.maxCanvasPixels = (PDFJS.maxCanvasPixels === undefined ?
 /**
  * (Deprecated) Opens external links in a new window if enabled.
  * The default behavior opens external links in the PDF.js window.
+ *
+ * NOTE: This property has been deprecated, please use
+ *       `PDFJS.externalLinkTarget = PDFJS.LinkTarget.BLANK` instead.
  * @var {boolean}
  */
 PDFJS.openExternalLinksInNewWindow = (
diff --git a/src/shared/util.js b/src/shared/util.js
index 6845a5f..9f5c071 100644
--- a/src/shared/util.js
+++ b/src/shared/util.js
@@ -360,10 +360,10 @@ var LinkTargetStringMap = [
 ];
 
 function isExternalLinkTargetSet() {
-//#if GENERIC
+//#if !MOZCENTRAL
   if (PDFJS.openExternalLinksInNewWindow) {
-    warn('PDFJS.openExternalLinksInNewWindow is deprecated, ' +
-         'use PDFJS.externalLinkTarget instead.');
+    deprecated('PDFJS.openExternalLinksInNewWindow, please use ' +
+               '"PDFJS.externalLinkTarget = PDFJS.LinkTarget.BLANK" instead.');
     if (PDFJS.externalLinkTarget === LinkTarget.NONE) {
       PDFJS.externalLinkTarget = LinkTarget.BLANK;
     }

-- 
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