[Pkg-javascript-commits] [pdf.js] 151/161: Fixes lint for windows; adds test/font/fontutils.js

David Prévot taffit at moszumanska.debian.org
Sat Apr 19 14:16:41 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 63f438006bff8b9b50a8c6529fea9d412cd1d450
Author: Yury Delendik <ydelendik at mozilla.com>
Date:   Mon Mar 31 08:50:53 2014 -0500

    Fixes lint for windows; adds test/font/fontutils.js
---
 make.js                | 10 +++++++++-
 test/font/fontutils.js | 41 +++++++++++++++++++++++++++++++++--------
 2 files changed, 42 insertions(+), 9 deletions(-)

diff --git a/make.js b/make.js
index 0b7ee6e..6be2eac 100644
--- a/make.js
+++ b/make.js
@@ -1269,7 +1269,15 @@ target.lint = function() {
                     'external/crlfchecker/',
                     'src/',
                     'web/',
-                    'test/*.js',
+                    'test/downloadutils.js',
+                    'test/driver.js',
+                    'test/reporter.js',
+                    'test/test.js',
+                    'test/testutils.js',
+                    'test/webbrowser.js',
+                    'test/webserver.js',
+                    'test/font/fontutils.js',
+                    'test/font/ttxdriver.js',
                     'test/unit/',
                     'extensions/firefox/',
                     'extensions/chromium/'
diff --git a/test/font/fontutils.js b/test/font/fontutils.js
index f8cd97c..14a1829 100644
--- a/test/font/fontutils.js
+++ b/test/font/fontutils.js
@@ -1,7 +1,25 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
+/*
+ * Copyright 2013 Mozilla Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
-var base64alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+'use strict';
+
+var base64alphabet =
+  'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
 
 function decodeFontData(base64) {
   var result = [];
@@ -9,14 +27,20 @@ function decodeFontData(base64) {
   var bits = 0, bitsLength = 0;
   for (var i = 0, ii = base64.length; i < ii; i++) {
     var ch = base64[i];
-    if (ch <= " ") continue;
+    if (ch <= ' ') {
+      continue;
+    }
     var index = base64alphabet.indexOf(ch);
-    if (index < 0) throw "Invalid character";
-    if (index >= 64) break;
+    if (index < 0) {
+      throw new Error('Invalid character');
+    }
+    if (index >= 64) {
+      break;
+    }
     bits = (bits << 6) | index;
     bitsLength += 6;
     if (bitsLength >= 8) {
-      bitsLength -= 8
+      bitsLength -= 8;
       var code = (bits >> bitsLength) & 0xFF;
       result.push(code);
     }
@@ -45,8 +69,8 @@ function ttx(data, callback) {
   xhr.open('POST', '/ttx');
 
   var encodedData = encodeFontData(data);
-  xhr.setRequestHeader("Content-type", "text/plain");
-  xhr.setRequestHeader("Content-length", encodedData.length);
+  xhr.setRequestHeader('Content-type', 'text/plain');
+  xhr.setRequestHeader('Content-length', encodedData.length);
 
   xhr.onreadystatechange = function getPdfOnreadystatechange(e) {
     if (xhr.readyState === 4) {
@@ -62,6 +86,7 @@ function ttx(data, callback) {
 
 function verifyTtxOutput(output) {
   var m = /^<error>(.*?)<\/error>/.exec(output);
-  if (m)
+  if (m) {
     throw m[1];
+  }
 }

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