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

View File

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

View File

@ -384,7 +384,7 @@ var Type2Parser = function type2Parser(aFilePath) {
error('Need to support CFFExpertSubsetCharset'); error('Need to support CFFExpertSubsetCharset');
} else { } else {
aStream.pos = charsetEntry; 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 * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* globals PDFJS, getPdf, combineUrl, StatTimer, SpecialPowers, Promise */ /* globals PDFJS, combineUrl, StatTimer, SpecialPowers, Promise */
'use strict'; 'use strict';
@ -274,8 +274,6 @@ function nextPage(task, loadError) {
return; return;
} }
var page = null;
if (!failure) { if (!failure) {
try { try {
log(' loading page ' + task.pageNum + '/' + task.pdfDoc.numPages + log(' loading page ' + task.pageNum + '/' + task.pdfDoc.numPages +

View File

@ -25,7 +25,6 @@ var path = require('path');
var fs = require('fs'); var fs = require('fs');
var os = require('os'); var os = require('os');
var url = require('url'); var url = require('url');
var spawn = require('child_process').spawn;
var testUtils = require('./testutils.js'); var testUtils = require('./testutils.js');
function parseOptions() { 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() { function getServerBaseAddress() {
return 'http://' + host + ':' + server.port; return 'http://' + host + ':' + server.port;
} }
@ -690,7 +673,6 @@ function closeSession(browser) {
function ensurePDFsDownloaded(callback) { function ensurePDFsDownloaded(callback) {
var downloadUtils = require('./downloadutils.js'); var downloadUtils = require('./downloadutils.js');
var downloadManifestFiles = downloadUtils.downloadManifestFiles;
var manifest = JSON.parse(fs.readFileSync(options.manifestFile)); var manifest = JSON.parse(fs.readFileSync(options.manifestFile));
downloadUtils.downloadManifestFiles(manifest, function () { downloadUtils.downloadManifestFiles(manifest, function () {
downloadUtils.verifyManifestFiles(manifest, function (hasErrors) { downloadUtils.verifyManifestFiles(manifest, function (hasErrors) {

View File

@ -1,6 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ /* 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'; 'use strict';

View File

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

View File

@ -601,74 +601,61 @@ describe('CipherTransformFactory', function() {
describe('#ctor', function() { describe('#ctor', function() {
describe('AES256 Revision 5', function () { describe('AES256 Revision 5', function () {
it('should accept user password', function () { it('should accept user password', function () {
var factory = new CipherTransformFactory(new DictMock(aes256Map), new CipherTransformFactory(new DictMock(aes256Map), fileID1, 'user');
fileID1,
'user');
}); });
it('should accept owner password', function () { it('should accept owner password', function () {
var factory = new CipherTransformFactory(new DictMock(aes256Map), new CipherTransformFactory(new DictMock(aes256Map), fileID1, 'owner');
fileID1,
'owner');
}); });
it('should not accept wrong password', function () { it('should not accept wrong password', function () {
var thrown = false; var thrown = false;
try { try {
var factory = new CipherTransformFactory(new DictMock(aes256Map), new CipherTransformFactory(new DictMock(aes256Map), fileID1,
fileID1, 'wrong');
'wrong');
} catch (e) { } catch (e) {
thrown = true; thrown = true;
} }
expect(thrown).toEqual(true); expect(thrown).toEqual(true);
}); });
it('should accept blank password', function () { it('should accept blank password', function () {
var factory = new CipherTransformFactory(new DictMock(aes256BlankMap), new CipherTransformFactory(new DictMock(aes256BlankMap), fileID1);
fileID1);
}); });
}); });
describe('AES256 Revision 6', function () { describe('AES256 Revision 6', function () {
it('should accept user password', function () { it('should accept user password', function () {
var factory = new CipherTransformFactory(new DictMock(aes256IsoMap), new CipherTransformFactory(new DictMock(aes256IsoMap), fileID1,
fileID1, 'user');
'user');
}); });
it('should accept owner password', function () { it('should accept owner password', function () {
var factory = new CipherTransformFactory(new DictMock(aes256IsoMap), new CipherTransformFactory(new DictMock(aes256IsoMap), fileID1,
fileID1, 'owner');
'owner');
}); });
it('should not accept wrong password', function () { it('should not accept wrong password', function () {
var thrown = false; var thrown = false;
try { try {
var factory = new CipherTransformFactory(new DictMock(aes256IsoMap), new CipherTransformFactory(new DictMock(aes256IsoMap), fileID1,
fileID1, 'wrong');
'wrong');
} catch (e) { } catch (e) {
thrown = true; thrown = true;
} }
expect(thrown).toEqual(true); expect(thrown).toEqual(true);
}); });
it('should accept blank password', function () { it('should accept blank password', function () {
var factory = new CipherTransformFactory(new DictMock(aes256IBlankMap), new CipherTransformFactory(new DictMock(aes256IBlankMap), fileID1);
fileID1);
}); });
}); });
it('should accept user password', function() { it('should accept user password', function() {
var factory = new CipherTransformFactory(new DictMock(map1), fileID1, new CipherTransformFactory(new DictMock(map1), fileID1, '123456');
'123456');
}); });
it('should accept owner password', function() { it('should accept owner password', function() {
var factory = new CipherTransformFactory(new DictMock(map1), fileID1, new CipherTransformFactory(new DictMock(map1), fileID1, '654321');
'654321');
}); });
it('should not accept wrong password', function() { it('should not accept wrong password', function() {
var thrown = false; var thrown = false;
try { try {
var factory = new CipherTransformFactory(new DictMock(map1), fileID1, new CipherTransformFactory(new DictMock(map1), fileID1, 'wrong');
'wrong');
} catch (e) { } catch (e) {
thrown = true; thrown = true;
} }
@ -676,7 +663,7 @@ describe('CipherTransformFactory', function() {
}); });
it('should accept no password', 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'; 'use strict';
describe('font', function() { 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: // This example font comes from the CFF spec:
// http://www.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5176.CFF.pdf // http://www.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5176.CFF.pdf
var exampleFont = '0100040100010101134142434445462b' + 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() { describe('CFFParser', function() {
var parser = new CFFParser(fontData, {}); var parser = new CFFParser(fontData, {});
var cff = parser.parse(); var cff = parser.parse();
@ -381,7 +362,7 @@ describe('font', function() {
'/FontMatrix [0.001 0 0 0.001 0 0 ]readonly def\n'); '/FontMatrix [0.001 0 0 0.001 0 0 ]readonly def\n');
var parser = new Type1Parser(stream); var parser = new Type1Parser(stream);
var props = {}; var props = {};
var program = parser.extractFontHeader(props); parser.extractFontHeader(props);
expect(props.fontMatrix).toEqual([0.001, 0, 0, 0.001, 0, 0]); expect(props.fontMatrix).toEqual([0.001, 0, 0, 0.001, 0, 0]);
}); });
it('parses font header encoding', function() { it('parses font header encoding', function() {
@ -392,7 +373,7 @@ describe('font', function() {
'readonly def\n'); 'readonly def\n');
var parser = new Type1Parser(stream); var parser = new Type1Parser(stream);
var props = { overridableEncoding: true }; var props = { overridableEncoding: true };
var program = parser.extractFontHeader(props); parser.extractFontHeader(props);
expect(props.builtInEncoding[33]).toEqual('arrowright'); expect(props.builtInEncoding[33]).toEqual('arrowright');
}); });
}); });

View File

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

View File

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

View File

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