[Pkg-javascript-commits] [pdf.js] 77/141: Fixes lint warning W004 in /test

David Prévot taffit at moszumanska.debian.org
Sat Apr 19 22:40:32 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 7a2cb7cddd1ddd5d6e9296a41b3cb3742b6f69b9
Author: Tim van der Meij <timvandermeij at gmail.com>
Date:   Mon Apr 7 22:43:07 2014 +0200

    Fixes lint warning W004 in /test
---
 test/downloadutils.js  | 5 +++--
 test/test.js           | 7 ++++---
 test/testutils.js      | 9 +++++----
 test/unit/font_spec.js | 8 ++++----
 4 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/test/downloadutils.js b/test/downloadutils.js
index 483734e..486ecff 100644
--- a/test/downloadutils.js
+++ b/test/downloadutils.js
@@ -28,19 +28,20 @@ function downloadFile(file, url, callback, redirects) {
   var completed = false;
   var protocol = /^https:\/\//.test(url) ? https : http;
   protocol.get(url, function (response) {
+    var redirectTo;
     if (response.statusCode === 301 || response.statusCode === 302 ||
         response.statusCode === 307 || response.statusCode === 308) {
       if (redirects > 10) {
         callback('Too many redirects');
       }
-      var redirectTo = response.headers.location;
+      redirectTo = response.headers.location;
       redirectTo = require('url').resolve(url, redirectTo);
       downloadFile(file, redirectTo, callback, (redirects || 0) + 1);
       return;
     }
     if (response.statusCode === 404 && url.indexOf('web.archive.org') < 0) {
       // trying waybackmachine
-      var redirectTo = 'http://web.archive.org/web/' + url;
+      redirectTo = 'http://web.archive.org/web/' + url;
       downloadFile(file, redirectTo, callback, (redirects || 0) + 1);
       return;
     }
diff --git a/test/test.js b/test/test.js
index 9f06f63..1c3160b 100644
--- a/test/test.js
+++ b/test/test.js
@@ -438,10 +438,11 @@ function refTestPostHandler(req, res) {
     res.writeHead(200, {'Content-Type': 'text/plain'});
     res.end();
 
+    var session;
     if (pathname === '/tellMeToQuit') {
       // finding by path
       var browserPath = parsedUrl.query.path;
-      var session = sessions.filter(function (session) {
+      session = sessions.filter(function (session) {
         return session.config.path === browserPath;
       })[0];
       monitorBrowserTimeout(session, null);
@@ -463,7 +464,7 @@ function refTestPostHandler(req, res) {
     var snapshot = data.snapshot;
     var lastPageNum = data.lastPageNum;
 
-    var session = getSession(browser);
+    session = getSession(browser);
     monitorBrowserTimeout(session, handleSessionTimeout);
 
     var taskResults = session.taskResults[id];
@@ -720,4 +721,4 @@ var host = '127.0.0.1';
 var options = parseOptions();
 var stats;
 
-main();
\ No newline at end of file
+main();
diff --git a/test/testutils.js b/test/testutils.js
index 9a9d1bb..5048a88 100644
--- a/test/testutils.js
+++ b/test/testutils.js
@@ -75,14 +75,15 @@ var stdinBuffer = '', endOfStdin = false, stdinInitialized = false;
 var stdinOnLineCallbacks = [];
 
 function handleStdinBuffer() {
+  var callback;
   if (endOfStdin) {
     if (stdinBuffer && stdinOnLineCallbacks.length > 0) {
-      var callback = stdinOnLineCallbacks.shift();
+      callback = stdinOnLineCallbacks.shift();
       callback(stdinBuffer);
       stdinBuffer = null;
     }
     while (stdinOnLineCallbacks.length > 0) {
-      var callback = stdinOnLineCallbacks.shift();
+      callback = stdinOnLineCallbacks.shift();
       callback();
     }
     return;
@@ -92,7 +93,7 @@ function handleStdinBuffer() {
     if (i < 0) {
       return;
     }
-    var callback = stdinOnLineCallbacks.shift();
+    callback = stdinOnLineCallbacks.shift();
     var result = stdinBuffer.substring(0, i + 1);
     stdinBuffer = stdinBuffer.substring(i + 1);
     callback(result);
@@ -143,4 +144,4 @@ exports.confirm = function confirm(message, callback) {
       confirm(message, callback);
     }
   });
-};
\ No newline at end of file
+};
diff --git a/test/unit/font_spec.js b/test/unit/font_spec.js
index 15d1ce1..45c480c 100644
--- a/test/unit/font_spec.js
+++ b/test/unit/font_spec.js
@@ -196,7 +196,7 @@ describe('font', function() {
       expect(charset.charset[1]).toEqual('exclam');
 
       // CID font
-      var charset = parser.parseCharsets(3, 2, new CFFStrings(), true);
+      charset = parser.parseCharsets(3, 2, new CFFStrings(), true);
       expect(charset.charset[1]).toEqual(2);
     });
 
@@ -212,7 +212,7 @@ describe('font', function() {
       expect(charset.charset).toEqual(['.notdef', 'quoteright', 'parenleft']);
 
       // CID font
-      var charset = parser.parseCharsets(3, 2, new CFFStrings(), true);
+      charset = parser.parseCharsets(3, 2, new CFFStrings(), true);
       expect(charset.charset).toEqual(['.notdef', 8, 9]);
     });
 
@@ -229,7 +229,7 @@ describe('font', function() {
       expect(charset.charset).toEqual(['.notdef', 'quoteright', 'parenleft']);
 
       // CID font
-      var charset = parser.parseCharsets(3, 2, new CFFStrings(), true);
+      charset = parser.parseCharsets(3, 2, new CFFStrings(), true);
       expect(charset.charset).toEqual(['.notdef', 8, 9]);
     });
 
@@ -349,7 +349,7 @@ describe('font', function() {
       var parser = new Type1Parser(stream);
       expect(parser.readNumberArray()).toEqual([1, 2]);
       // Variation on spacing.
-      var stream = new StringStream('[ 1 2 ]');
+      stream = new StringStream('[ 1 2 ]');
       parser = new Type1Parser(stream);
       expect(parser.readNumberArray()).toEqual([1, 2]);
     });

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