]> git.parisson.com Git - pdf.js.git/commitdiff
'use strict' everywhere
authorArtur Adib <arturadib@gmail.com>
Wed, 26 Oct 2011 01:18:22 +0000 (18:18 -0700)
committerArtur Adib <arturadib@gmail.com>
Wed, 26 Oct 2011 01:18:22 +0000 (18:18 -0700)
20 files changed:
Makefile
src/canvas.js
src/charsets.js
src/cidmaps.js
src/colorspace.js
src/core.js
src/crypto.js
src/evaluator.js
src/fonts.js
src/function.js
src/glyphlist.js
src/image.js
src/metrics.js
src/obj.js
src/parser.js
src/pattern.js
src/stream.js
src/util.js
src/worker.js
src/worker_loader.js

index 515fe6c5f4181b0eb5db48dba1f8f61df8e1fed3..1347e409e869b3061cd62ff2c15e382b4ee9178f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -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; \
index 4139f29ba9cfb6dee10a8af16df77a8a139db51b..70dd65e3df25efd9d7999d2e0b5e6b4eb6b41c5b 100644 (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?
index 21554d769eed85cab665bdb2dcf46663e2dc8eb8..7f54ab32753156dffacc855c9c4a00b87646db1f 100644 (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',
index 9efb3669efb510103775dc3c4d8534e4a43207b6..7de3d14f6d46e346271292692bacf88f699d443b 100644 (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],
index c49117d909777ac30b6ac2433c3351b0567b2517..3ce383a0954bb19ff6b4fdaace2981ae737ecd55 100644 (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() {
index 55525c788a24c1215109d8616b39c6d3ff29e42f..be43fc269796b0ef62aade94290a261ec4d923b9 100644 (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;
index 7721556b4b1ec49c99a4af88ea2d54a96eb62bc2..5699ea1df9eaca6b7b39196a6b93ddce305f3af3 100644 (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;
index e8ac4e60df7ca7a42483d5512be322093d5b7be7..1327b3a6915be5178b20917ef01e3d7ab510a509 100644 (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();
index 56e2fc1b0b4d1798d18d05610e6868e84c80a3bb..1663fe750962c4596fe81638ab1abb72349b1f42 100644 (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');
 
 /**
index 26c2af834e4f13463dd1823af4726dd2cd2e0af5..0f0ec8643b9d41742303eefc4b2f8fa9fbad0766 100644 (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;
index d81d4c138101d91b3ad44abb2325979c0c1e99b6..5691f85461ea9dfb2aa64c485bfc20b92f87f870 100644 (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,
index 31580f51a6a3114e1d9f550f94809496d032c430..b997245a3e669fe5cc3711b75464e5af2f34eb6a 100644 (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;
index 9cb8eb0e61e7a2c5109351192f7b6290b6f81ced..d4d07ec0d036230411419e69d0094cf1d0c7f5f9 100644 (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,
index 54e5254b4e48be6c69c4a8a79b6d4d9eb016ac00..8716d465d1a8cd74faa6bffdd5186801bd71c71c 100644 (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;
index e5be024ad40a6e816840e46edecf1b8662e222ca..677eaad9419f98e5d4c36478f3ec693546fafc70 100644 (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) {
index dcfe783797410c2b87db2f4af4d663087fcacc46..a551ac411cc7d11e7733ae02b95e247d5da2ae69 100644 (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() {
index 88dc5dd2e22c05c1d394ff4958eac268aa47603b..baebc3190af07dc4171d940efbfa3e941348cedb 100644 (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);
index 6ea01307953a6b630cc36f895f0d246367c2e916..344b99e53fe90f49f6ae1a99d795e3bc4d666a5a 100644 (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);
index bedb6a6f597c3cc1ab80d99c79a1f045350c8655..d1ab4845881faf2f871a71878c01f8324e287db6 100644 (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);
 }
index 0119996a7491bcd9d3aef229d29041095d2a24bb..f3646e5309938f840832ebc8e69e684eab9c1411 100644 (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');