Skip to content

Commit 6cf5455

Browse files
committed
Merge pull request #4543 from yurydelendik/winlint
Fixes lint for windows; adds test/font/fontutils.js
2 parents 3e71b3a + 63f4380 commit 6cf5455

File tree

2 files changed

+42
-9
lines changed

2 files changed

+42
-9
lines changed

make.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,15 @@ target.lint = function() {
12691269
'external/crlfchecker/',
12701270
'src/',
12711271
'web/',
1272-
'test/*.js',
1272+
'test/downloadutils.js',
1273+
'test/driver.js',
1274+
'test/reporter.js',
1275+
'test/test.js',
1276+
'test/testutils.js',
1277+
'test/webbrowser.js',
1278+
'test/webserver.js',
1279+
'test/font/fontutils.js',
1280+
'test/font/ttxdriver.js',
12731281
'test/unit/',
12741282
'extensions/firefox/',
12751283
'extensions/chromium/'

test/font/fontutils.js

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,46 @@
11
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
22
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
3+
/*
4+
* Copyright 2013 Mozilla Foundation
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
318

4-
var base64alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
19+
'use strict';
20+
21+
var base64alphabet =
22+
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
523

624
function decodeFontData(base64) {
725
var result = [];
826

927
var bits = 0, bitsLength = 0;
1028
for (var i = 0, ii = base64.length; i < ii; i++) {
1129
var ch = base64[i];
12-
if (ch <= " ") continue;
30+
if (ch <= ' ') {
31+
continue;
32+
}
1333
var index = base64alphabet.indexOf(ch);
14-
if (index < 0) throw "Invalid character";
15-
if (index >= 64) break;
34+
if (index < 0) {
35+
throw new Error('Invalid character');
36+
}
37+
if (index >= 64) {
38+
break;
39+
}
1640
bits = (bits << 6) | index;
1741
bitsLength += 6;
1842
if (bitsLength >= 8) {
19-
bitsLength -= 8
43+
bitsLength -= 8;
2044
var code = (bits >> bitsLength) & 0xFF;
2145
result.push(code);
2246
}
@@ -45,8 +69,8 @@ function ttx(data, callback) {
4569
xhr.open('POST', '/ttx');
4670

4771
var encodedData = encodeFontData(data);
48-
xhr.setRequestHeader("Content-type", "text/plain");
49-
xhr.setRequestHeader("Content-length", encodedData.length);
72+
xhr.setRequestHeader('Content-type', 'text/plain');
73+
xhr.setRequestHeader('Content-length', encodedData.length);
5074

5175
xhr.onreadystatechange = function getPdfOnreadystatechange(e) {
5276
if (xhr.readyState === 4) {
@@ -62,6 +86,7 @@ function ttx(data, callback) {
6286

6387
function verifyTtxOutput(output) {
6488
var m = /^<error>(.*?)<\/error>/.exec(output);
65-
if (m)
89+
if (m) {
6690
throw m[1];
91+
}
6792
}

0 commit comments

Comments
 (0)