Browse Source

'use strict' everywhere

Artur Adib 14 years ago
parent
commit
e71b6188c6
  1. 2
      Makefile
  2. 3
      src/canvas.js
  3. 2
      src/charsets.js
  4. 2
      src/cidmaps.js
  5. 5
      src/colorspace.js
  6. 13
      src/core.js
  7. 2
      src/crypto.js
  8. 5
      src/evaluator.js
  9. 2
      src/fonts.js
  10. 5
      src/function.js
  11. 2
      src/glyphlist.js
  12. 5
      src/image.js
  13. 2
      src/metrics.js
  14. 5
      src/obj.js
  15. 5
      src/parser.js
  16. 5
      src/pattern.js
  17. 5
      src/stream.js
  18. 5
      src/util.js
  19. 8
      src/worker.js
  20. 5
      src/worker_loader.js

2
Makefile

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

3
src/canvas.js

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

2
src/charsets.js

@ -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: */ /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var ISOAdobeCharset = [ var ISOAdobeCharset = [
'.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', '.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar',
'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright', 'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright',

2
src/cidmaps.js

@ -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: */ /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var CIDToUnicodeMaps = { var CIDToUnicodeMaps = {
'Adobe-Japan1': [[32, 160], {f: 12, c: 33}, [45, 8209], {f: 46, c: 46}, 165, '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], {f: 2, c: 93}, [95, 818], [96, 768], {f: 27, c: 97}, 166, 125, [732, 771],

5
src/colorspace.js

@ -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() { var ColorSpace = (function colorSpaceColorSpace() {
// Constructor should define this.numComps, this.defaultColor, this.name // Constructor should define this.numComps, this.defaultColor, this.name
function constructor() { function constructor() {

13
src/core.js

@ -1,16 +1,19 @@
/* -*- 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: */
'use strict';
var globalScope = (typeof window === 'undefined') ? this : window;
var ERRORS = 0, WARNINGS = 1, TODOS = 5; var ERRORS = 0, WARNINGS = 1, TODOS = 5;
var verbosity = WARNINGS; var verbosity = WARNINGS;
var useWorker = false; var useWorker = false;
// The global PDF object exposes the API // The global PDF object exposes the API
// In production, it will be declared outside a global wrapper // In production, it will be declared outside a global wrapper
// In development, it will be declared here // In development, it will be declared here
if (typeof PDF === 'undefined') { if (!globalScope.PDF) {
PDF = {}; globalScope.PDF = {};
} }
// getPdf() // getPdf()
@ -46,7 +49,7 @@ function getPdf(arg, callback) {
}; };
xhr.send(null); xhr.send(null);
} }
PDF.getPdf = getPdf; globalScope.PDF.getPdf = getPdf;
var Page = (function pagePage() { var Page = (function pagePage() {
function constructor(xref, pageNumber, pageDict, ref) { function constructor(xref, pageNumber, pageDict, ref) {
@ -605,4 +608,4 @@ var PDFDoc = (function() {
return constructor; return constructor;
})(); })();
PDF.PDFDoc = PDFDoc; globalScope.PDF.PDFDoc = PDFDoc;

2
src/crypto.js

@ -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: */ /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var ARCFourCipher = (function arcFourCipher() { var ARCFourCipher = (function arcFourCipher() {
function constructor(key) { function constructor(key) {
this.a = 0; this.a = 0;

5
src/evaluator.js

@ -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() { var PartialEvaluator = (function partialEvaluator() {
function constructor(xref, handler, uniquePrefix) { function constructor(xref, handler, uniquePrefix) {
this.state = new EvalState(); this.state = new EvalState();

2
src/fonts.js

@ -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: */ /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var isWorker = (typeof window == 'undefined'); var isWorker = (typeof window == 'undefined');
/** /**

5
src/function.js

@ -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 PDFFunction = (function() {
var CONSTRUCT_SAMPLED = 0; var CONSTRUCT_SAMPLED = 0;
var CONSTRUCT_INTERPOLATED = 2; var CONSTRUCT_INTERPOLATED = 2;

2
src/glyphlist.js

@ -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: */ /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var GlyphsUnicode = { var GlyphsUnicode = {
A: 0x0041, A: 0x0041,
AE: 0x00C6, AE: 0x00C6,

5
src/image.js

@ -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() { var PDFImage = (function pdfImage() {
function constructor(xref, res, image, inline) { function constructor(xref, res, image, inline) {
this.image = image; this.image = image;

2
src/metrics.js

@ -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: */ /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var Metrics = { var Metrics = {
'Courier': 600, 'Courier': 600,
'Courier-Bold': 600, 'Courier-Bold': 600,

5
src/obj.js

@ -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() { var Name = (function nameName() {
function constructor(name) { function constructor(name) {
this.name = name; this.name = name;

5
src/parser.js

@ -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 = {}; var EOF = {};
function isEOF(v) { function isEOF(v) {

5
src/pattern.js

@ -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() { var Pattern = (function patternPattern() {
// Constructor should define this.getPattern // Constructor should define this.getPattern
function constructor() { function constructor() {

5
src/stream.js

@ -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() { var Stream = (function streamStream() {
function constructor(arrayBuffer, start, length, dict) { function constructor(arrayBuffer, start, length, dict) {
this.bytes = new Uint8Array(arrayBuffer); this.bytes = new Uint8Array(arrayBuffer);

5
src/util.js

@ -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) { function log(msg) {
if (console && console.log) if (console && console.log)
console.log(msg); console.log(msg);

8
src/worker.js

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

5
src/worker_loader.js

@ -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/core.js');
importScripts('../src/util.js'); importScripts('../src/util.js');
importScripts('../src/canvas.js'); importScripts('../src/canvas.js');

Loading…
Cancel
Save