[Pkg-javascript-commits] [pdf.js] 101/119: Prevent Firefox from warning about |unreachable code after return statement|

David Prévot taffit at moszumanska.debian.org
Wed May 13 21:27:46 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 66b12974c9b4169b57667026b706f8cd35ef8197
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Wed Apr 29 19:09:58 2015 +0200

    Prevent Firefox from warning about |unreachable code after return statement|
    
    *This is a follow-up to PR 5966.*
    
    Now that https://bugzilla.mozilla.org/show_bug.cgi?id=1151931 has landed, we're unfortunately in a situation where Firefox warns about `unreachable code after return statement` multiple times when using the PDF.js code in `node make server` mode.
    
    I'm really sorry about the churn in this code!
    However I don't think it's a good idea to let Firefox continue to printing these warnings in the console, since it increases the risk of missing actual errors.
---
 web/viewer.js | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/web/viewer.js b/web/viewer.js
index 60cd5a3..2dc8bf1 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -598,10 +598,12 @@ var PDFViewerApplication = {
   },
 
   fallback: function pdfViewFallback(featureId) {
-//#if !(FIREFOX || MOZCENTRAL)
-    /* jshint -W027 */
-    return;
-//#else
+//#if !PRODUCTION
+    if (true) {
+      return;
+    }
+//#endif
+//#if (FIREFOX || MOZCENTRAL)
     // Only trigger the fallback once so we don't spam the user with messages
     // for one PDF.
     if (this.fellback) {
@@ -1037,8 +1039,9 @@ var PDFViewerApplication = {
       }
 
 //#if !PRODUCTION
-      /* jshint -W027 */
-      return;
+      if (true) {
+        return;
+      }
 //#endif
 //#if (FIREFOX || MOZCENTRAL)
       var versionId = String(info.PDFFormatVersion).slice(-1) | 0;
@@ -1316,8 +1319,9 @@ var PDFViewerApplication = {
     }
 
 //#if !PRODUCTION
-    /* jshint -W027 */
-    return;
+    if (true) {
+      return;
+    }
 //#endif
 //#if (FIREFOX || MOZCENTRAL)
     FirefoxCom.request('reportTelemetry', JSON.stringify({
@@ -1694,8 +1698,9 @@ document.addEventListener('pagerendered', function (e) {
   }
 
 //#if !PRODUCTION
-  /* jshint -W027 */
-  return;
+  if (true) {
+    return;
+  }
 //#endif
 //#if (FIREFOX || MOZCENTRAL)
   FirefoxCom.request('reportTelemetry', JSON.stringify({
@@ -1716,8 +1721,9 @@ document.addEventListener('textlayerrendered', function (e) {
   var pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex);
 
 //#if !PRODUCTION
-  /* jshint -W027 */
-  return;
+  if (true) {
+    return;
+  }
 //#endif
 //#if (FIREFOX || MOZCENTRAL)
   if (pageView.textLayer && pageView.textLayer.textDivs &&
@@ -1805,7 +1811,7 @@ window.addEventListener('hashchange', function webViewerHashchange(evt) {
   }
 });
 
-//#if !(FIREFOX || MOZCENTRAL || CHROME)
+//#if GENERIC
 window.addEventListener('change', function webViewerChange(evt) {
   var files = evt.target.files;
   if (!files || files.length === 0) {

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