Removing unused code

This commit is contained in:
Tim van der Meij 2014-07-18 22:16:35 +02:00
parent 4be90c35f8
commit 34728ee49b
12 changed files with 30 additions and 86 deletions

View File

@ -100,7 +100,7 @@ var AnnotationUtils = (function AnnotationUtilsClosure() {
return element;
}
function getHtmlElementForTextAnnotation(item, commonObjs) {
function getHtmlElementForTextAnnotation(item) {
var rect = item.rect;
// sanity check because of OOo-generated PDFs
@ -217,8 +217,7 @@ var AnnotationUtils = (function AnnotationUtilsClosure() {
return container;
}
function getHtmlElementForLinkAnnotation(item, commonObjs) {
function getHtmlElementForLinkAnnotation(item) {
var container = initContainer(item);
container.className = 'annotLink';
@ -238,9 +237,9 @@ var AnnotationUtils = (function AnnotationUtilsClosure() {
case AnnotationType.WIDGET:
return getHtmlElementForTextWidgetAnnotation(data, objs);
case AnnotationType.TEXT:
return getHtmlElementForTextAnnotation(data, objs);
return getHtmlElementForTextAnnotation(data);
case AnnotationType.LINK:
return getHtmlElementForLinkAnnotation(data, objs);
return getHtmlElementForLinkAnnotation(data);
default:
throw new Error('Unsupported annotationType: ' + data.annotationType);
}

View File

@ -16,7 +16,7 @@
*/
/* globals error, PDFJS, assert, info, shadow, TextRenderingMode,
FONT_IDENTITY_MATRIX, Uint32ArrayView, IDENTITY_MATRIX, ImageData,
ImageKind, isArray, isNum, TilingPattern, OPS, Promise, Util, warn,
ImageKind, isArray, isNum, TilingPattern, OPS, Util, warn,
getShadingPatternFromIR, WebGLUtils */
'use strict';

View File

@ -384,7 +384,7 @@ var Type2Parser = function type2Parser(aFilePath) {
error('Need to support CFFExpertSubsetCharset');
} else {
aStream.pos = charsetEntry;
var charset = readCharset(aStream, charStrings);
readCharset(aStream, charStrings);
}
};
};

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS, getPdf, combineUrl, StatTimer, SpecialPowers, Promise */
/* globals PDFJS, combineUrl, StatTimer, SpecialPowers, Promise */
'use strict';
@ -274,8 +274,6 @@ function nextPage(task, loadError) {
return;
}
var page = null;
if (!failure) {
try {
log(' loading page ' + task.pageNum + '/' + task.pdfDoc.numPages +

View File

@ -25,7 +25,6 @@ var path = require('path');
var fs = require('fs');
var os = require('os');
var url = require('url');
var spawn = require('child_process').spawn;
var testUtils = require('./testutils.js');
function parseOptions() {
@ -630,22 +629,6 @@ function startBrowsers(url, initSessionCallback) {
});
}
function stopBrowsers(callback) {
var count = sessions.length;
sessions.forEach(function (session) {
if (session.closed) {
return;
}
session.browser.stop(function () {
session.closed = true;
count--;
if (count === 0 && callback) {
callback();
}
});
});
}
function getServerBaseAddress() {
return 'http://' + host + ':' + server.port;
}
@ -690,7 +673,6 @@ function closeSession(browser) {
function ensurePDFsDownloaded(callback) {
var downloadUtils = require('./downloadutils.js');
var downloadManifestFiles = downloadUtils.downloadManifestFiles;
var manifest = JSON.parse(fs.readFileSync(options.manifestFile));
downloadUtils.downloadManifestFiles(manifest, function () {
downloadUtils.verifyManifestFiles(manifest, function (hasErrors) {

View File

@ -1,6 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* globals PDFJS, expect, it, describe, Promise, combineUrl, waitsFor, runs */
/* globals PDFJS, expect, it, describe, Promise, combineUrl, waitsFor */
'use strict';

View File

@ -1,6 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* globals expect, it, describe, StringStream, Lexer, CMapFactory, Name */
/* globals expect, it, describe, StringStream, CMapFactory, Name */
'use strict';
@ -95,8 +95,7 @@ describe('cmap', function() {
expect(cmap.vertical).toEqual(true);
});
it('loads built in cmap', function() {
var cmap = CMapFactory.create(new Name('Adobe-Japan1-1'),
'../../external/cmaps/',
CMapFactory.create(new Name('Adobe-Japan1-1'), '../../external/cmaps/',
null);
});
});

View File

@ -601,20 +601,15 @@ describe('CipherTransformFactory', function() {
describe('#ctor', function() {
describe('AES256 Revision 5', function () {
it('should accept user password', function () {
var factory = new CipherTransformFactory(new DictMock(aes256Map),
fileID1,
'user');
new CipherTransformFactory(new DictMock(aes256Map), fileID1, 'user');
});
it('should accept owner password', function () {
var factory = new CipherTransformFactory(new DictMock(aes256Map),
fileID1,
'owner');
new CipherTransformFactory(new DictMock(aes256Map), fileID1, 'owner');
});
it('should not accept wrong password', function () {
var thrown = false;
try {
var factory = new CipherTransformFactory(new DictMock(aes256Map),
fileID1,
new CipherTransformFactory(new DictMock(aes256Map), fileID1,
'wrong');
} catch (e) {
thrown = true;
@ -622,27 +617,23 @@ describe('CipherTransformFactory', function() {
expect(thrown).toEqual(true);
});
it('should accept blank password', function () {
var factory = new CipherTransformFactory(new DictMock(aes256BlankMap),
fileID1);
new CipherTransformFactory(new DictMock(aes256BlankMap), fileID1);
});
});
describe('AES256 Revision 6', function () {
it('should accept user password', function () {
var factory = new CipherTransformFactory(new DictMock(aes256IsoMap),
fileID1,
new CipherTransformFactory(new DictMock(aes256IsoMap), fileID1,
'user');
});
it('should accept owner password', function () {
var factory = new CipherTransformFactory(new DictMock(aes256IsoMap),
fileID1,
new CipherTransformFactory(new DictMock(aes256IsoMap), fileID1,
'owner');
});
it('should not accept wrong password', function () {
var thrown = false;
try {
var factory = new CipherTransformFactory(new DictMock(aes256IsoMap),
fileID1,
new CipherTransformFactory(new DictMock(aes256IsoMap), fileID1,
'wrong');
} catch (e) {
thrown = true;
@ -650,25 +641,21 @@ describe('CipherTransformFactory', function() {
expect(thrown).toEqual(true);
});
it('should accept blank password', function () {
var factory = new CipherTransformFactory(new DictMock(aes256IBlankMap),
fileID1);
new CipherTransformFactory(new DictMock(aes256IBlankMap), fileID1);
});
});
it('should accept user password', function() {
var factory = new CipherTransformFactory(new DictMock(map1), fileID1,
'123456');
new CipherTransformFactory(new DictMock(map1), fileID1, '123456');
});
it('should accept owner password', function() {
var factory = new CipherTransformFactory(new DictMock(map1), fileID1,
'654321');
new CipherTransformFactory(new DictMock(map1), fileID1, '654321');
});
it('should not accept wrong password', function() {
var thrown = false;
try {
var factory = new CipherTransformFactory(new DictMock(map1), fileID1,
'wrong');
new CipherTransformFactory(new DictMock(map1), fileID1, 'wrong');
} catch (e) {
thrown = true;
}
@ -676,7 +663,7 @@ describe('CipherTransformFactory', function() {
});
it('should accept no password', function() {
var factory = new CipherTransformFactory(new DictMock(map2), fileID2);
new CipherTransformFactory(new DictMock(map2), fileID2);
});
});
});

View File

@ -6,17 +6,6 @@
'use strict';
describe('font', function() {
function hexDump(bytes) {
var line = '';
for (var i = 0, ii = bytes.length; i < ii; ++i) {
var b = bytes[i].toString(16);
if (b.length < 2) {
b = '0' + b;
}
line += b.toString(16);
}
return line;
}
// This example font comes from the CFF spec:
// http://www.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5176.CFF.pdf
var exampleFont = '0100040100010101134142434445462b' +
@ -41,14 +30,6 @@ describe('font', function() {
}
};
function bytesToString(bytesArray) {
var str = '';
for (var i = 0, ii = bytesArray.length; i < ii; i++) {
str += String.fromCharCode(bytesArray[i]);
}
return str;
}
describe('CFFParser', function() {
var parser = new CFFParser(fontData, {});
var cff = parser.parse();
@ -381,7 +362,7 @@ describe('font', function() {
'/FontMatrix [0.001 0 0 0.001 0 0 ]readonly def\n');
var parser = new Type1Parser(stream);
var props = {};
var program = parser.extractFontHeader(props);
parser.extractFontHeader(props);
expect(props.fontMatrix).toEqual([0.001, 0, 0, 0.001, 0, 0]);
});
it('parses font header encoding', function() {
@ -392,7 +373,7 @@ describe('font', function() {
'readonly def\n');
var parser = new Type1Parser(stream);
var props = { overridableEncoding: true };
var program = parser.extractFontHeader(props);
parser.extractFontHeader(props);
expect(props.builtInEncoding[33]).toEqual('arrowright');
});
});

View File

@ -66,7 +66,6 @@ WebServer.prototype = {
this.server = null;
},
_handler: function (req, res) {
var agent = req.headers['user-agent'];
var url = req.url;
var urlParts = /([^?]*)((?:\?(.*))?)/.exec(url);
var pathPart = decodeURI(urlParts[1]), queryPart = urlParts[3];

View File

@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals */
'use strict';

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals mozL10n, GrabToPan, PDFView, Preferences, SecondaryToolbar */
/* globals mozL10n, GrabToPan, Preferences, SecondaryToolbar */
'use strict';