'use strict' everywhere

This commit is contained in:
Artur Adib 2011-10-25 18:18:22 -07:00
parent 0aae9ef880
commit e71b6188c6
20 changed files with 79 additions and 9 deletions

View File

@ -45,7 +45,7 @@ test: pdfjs shell-test browser-test
# Create production output (pdf.js, and corresponding changes to web files)
#
production: | bundle
@echo "Preparing production viewer..."; \
@echo "Preparing viewer-production.html..."; \
cd web; \
sed '/PDFJSSCRIPT_REMOVE/d' viewer.html > viewer-1.tmp; \
sed '/PDFJSSCRIPT_INCLUDE_BUILD/ r viewer-snippet.html' viewer-1.tmp > viewer-production.html; \

View File

@ -1,5 +1,8 @@
// <canvas> contexts store most of the state we need natively.
// However, PDF needs a bit more state, which we store here.
'use strict';
var CanvasExtraState = (function canvasExtraState() {
function constructor(old) {
// Are soft masks and alpha values shapes or opacities?

View File

@ -1,6 +1,8 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var ISOAdobeCharset = [
'.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar',
'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright',

View File

@ -1,6 +1,8 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var CIDToUnicodeMaps = {
'Adobe-Japan1': [[32, 160], {f: 12, c: 33}, [45, 8209], {f: 46, c: 46}, 165,
{f: 2, c: 93}, [95, 818], [96, 768], {f: 27, c: 97}, 166, 125, [732, 771],

View File

@ -1,3 +1,8 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var ColorSpace = (function colorSpaceColorSpace() {
// Constructor should define this.numComps, this.defaultColor, this.name
function constructor() {

View File

@ -1,16 +1,19 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var globalScope = (typeof window === 'undefined') ? this : window;
var ERRORS = 0, WARNINGS = 1, TODOS = 5;
var verbosity = WARNINGS;
var useWorker = false;
// The global PDF object exposes the API
// In production, it will be declared outside a global wrapper
// In development, it will be declared here
if (typeof PDF === 'undefined') {
PDF = {};
if (!globalScope.PDF) {
globalScope.PDF = {};
}
// getPdf()
@ -46,7 +49,7 @@ function getPdf(arg, callback) {
};
xhr.send(null);
}
PDF.getPdf = getPdf;
globalScope.PDF.getPdf = getPdf;
var Page = (function pagePage() {
function constructor(xref, pageNumber, pageDict, ref) {
@ -605,4 +608,4 @@ var PDFDoc = (function() {
return constructor;
})();
PDF.PDFDoc = PDFDoc;
globalScope.PDF.PDFDoc = PDFDoc;

View File

@ -1,6 +1,8 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var ARCFourCipher = (function arcFourCipher() {
function constructor(key) {
this.a = 0;

View File

@ -1,3 +1,8 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var PartialEvaluator = (function partialEvaluator() {
function constructor(xref, handler, uniquePrefix) {
this.state = new EvalState();

View File

@ -1,6 +1,8 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var isWorker = (typeof window == 'undefined');
/**

View File

@ -1,3 +1,8 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var PDFFunction = (function() {
var CONSTRUCT_SAMPLED = 0;
var CONSTRUCT_INTERPOLATED = 2;

View File

@ -1,6 +1,8 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var GlyphsUnicode = {
A: 0x0041,
AE: 0x00C6,

View File

@ -1,3 +1,8 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var PDFImage = (function pdfImage() {
function constructor(xref, res, image, inline) {
this.image = image;

View File

@ -1,6 +1,8 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var Metrics = {
'Courier': 600,
'Courier-Bold': 600,

View File

@ -1,3 +1,8 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var Name = (function nameName() {
function constructor(name) {
this.name = name;

View File

@ -1,3 +1,8 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var EOF = {};
function isEOF(v) {

View File

@ -1,3 +1,8 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var Pattern = (function patternPattern() {
// Constructor should define this.getPattern
function constructor() {

View File

@ -1,3 +1,8 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var Stream = (function streamStream() {
function constructor(arrayBuffer, start, length, dict) {
this.bytes = new Uint8Array(arrayBuffer);

View File

@ -1,3 +1,8 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
function log(msg) {
if (console && console.log)
console.log(msg);

View File

@ -1,6 +1,8 @@
/* -*- 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: */
'use strict';
function MessageHandler(name, comObj) {
this.name = name;
this.comObj = comObj;
@ -172,9 +174,9 @@ var workerConsole = {
// Worker thread?
if (typeof window === 'undefined') {
console = workerConsole;
globalScope.console = workerConsole;
// Listen for messages from the main thread.
var handler = new MessageHandler('worker_processor', this);
var handler = new MessageHandler('worker_processor', globalScope);
WorkerProcessorHandler.setup(handler);
}

View File

@ -1,3 +1,8 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
importScripts('../src/core.js');
importScripts('../src/util.js');
importScripts('../src/canvas.js');