From a17b13019b17f71a55c47e829dbbc59b815eb158 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ionu=C8=9B=20G=2E=20Stan?= <ionut.g.stan@gmail.com>
Date: Thu, 27 Oct 2011 02:47:18 +0300
Subject: [PATCH 01/25] Fix strict mode syntax error in Safari

This happens in Safari 5.1 and Mobile Safari on iOS 5.

Apparently, Safari considers the function name as part of the ECMA's
FormalParameterList and applies the strict mode rules from section 13.1
of the specification.

> It is a SyntaxError if any Identifier value occurs more than once
> within a FormalParameterList of a strict mode
> FunctionDeclaration or FunctionExpression.
---
 pdf.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pdf.js b/pdf.js
index f45993210..05a21538d 100644
--- a/pdf.js
+++ b/pdf.js
@@ -7522,19 +7522,19 @@ var Promise = (function() {
   Promise.prototype = {
     hasData: false,
 
-    set data(data) {
-      if (data === undefined) {
+    set data(value) {
+      if (value === undefined) {
         return;
       }
       if (this._data !== EMPTY_PROMISE) {
         throw 'Promise ' + this.name +
                                 ': Cannot set the data of a promise twice';
       }
-      this._data = data;
+      this._data = value;
       this.hasData = true;
 
       if (this.onDataCallback) {
-        this.onDataCallback(data);
+        this.onDataCallback(value);
       }
     },
 

From 56b9a3543dfd365fb065a85ac056d29064c72797 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ionu=C8=9B=20G=2E=20Stan?= <ionut.g.stan@gmail.com>
Date: Thu, 27 Oct 2011 03:08:11 +0300
Subject: [PATCH 02/25] Close path in `closeFillStroke` and `closeEOFillStroke`

See Chapter 4, page 230, Table 4.10 of the PDF specification.
---
 pdf.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pdf.js b/pdf.js
index 05a21538d..43df4a168 100644
--- a/pdf.js
+++ b/pdf.js
@@ -5643,10 +5643,12 @@ var CanvasGraphics = (function canvasGraphics() {
       this.restoreFillRule(savedFillRule);
     },
     closeFillStroke: function canvasGraphicsCloseFillStroke() {
-      return this.fillStroke();
+      this.closePath();
+      this.fillStroke();
     },
     closeEOFillStroke: function canvasGraphicsCloseEOFillStroke() {
       var savedFillRule = this.setEOFillRule();
+      this.closePath();
       this.fillStroke();
       this.restoreFillRule(savedFillRule);
     },

From 0c321466dce4377f58a038515260c66a0f74603b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ionu=C8=9B=20G=2E=20Stan?= <ionut.g.stan@gmail.com>
Date: Thu, 27 Oct 2011 05:45:10 +0300
Subject: [PATCH 03/25] Set DeviceGray as initial value for color space
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

See the PDF reference, section 4.3 Graphics State, table 4.2, third row.

> The current color space in which color values are to be interpreted
> (see Section 4.5, “Color Spaces”). There are two separate color space
> parameters: one for stroking and one for all other painting opera-
> tions. Initial value: DeviceGray.

The problem before was that certain PDFs didn't explicitly set the
color space, so a call to `setFillColor` or `setStrokeColor` were failing
when the `getRgb` method was call, as the color space was null.

See source code of CanvasGraphics.prototype.setFillColor/setStrokeColor.
---
 pdf.js | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pdf.js b/pdf.js
index 43df4a168..cb3ca3dc5 100644
--- a/pdf.js
+++ b/pdf.js
@@ -5344,6 +5344,9 @@ var CanvasExtraState = (function canvasExtraState() {
     this.strokeColor = '#000000';
 
     this.old = old;
+
+    this.fillColorSpace = new DeviceGrayCS;
+    this.strokeColorSpace = new DeviceGrayCS;
   }
 
   constructor.prototype = {

From 7e6a589074e912693e10e7c802ed627ec7918480 Mon Sep 17 00:00:00 2001
From: Kalervo Kujala <kkujala@com>
Date: Thu, 27 Oct 2011 21:51:10 +0300
Subject: [PATCH 04/25] Fix js strict warning in worker.js.

Also fix a few minor nits.
---
 src/canvas.js        |  8 ++++++--
 src/cidmaps.js       |  1 +
 src/colorspace.js    |  2 ++
 src/core.js          |  2 ++
 src/crypto.js        |  1 +
 src/evaluator.js     |  1 +
 src/fonts.js         |  1 +
 src/function.js      |  1 +
 src/image.js         |  1 +
 src/metrics.js       |  1 +
 src/obj.js           |  1 +
 src/parser.js        |  1 +
 src/pattern.js       |  1 +
 src/pdf.js           |  1 +
 src/stream.js        |  1 +
 src/util.js          |  2 ++
 src/worker.js        | 11 ++++++-----
 src/worker_loader.js |  1 +
 18 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/src/canvas.js b/src/canvas.js
index 70dd65e3d..b7045dc39 100644
--- a/src/canvas.js
+++ b/src/canvas.js
@@ -1,8 +1,11 @@
-// <canvas> contexts store most of the state we need natively.
-// However, PDF needs a bit more state, which we store here.
+/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
 
 'use strict';
 
+// <canvas> contexts store most of the state we need natively.
+// However, PDF needs a bit more state, which we store here.
+
 var CanvasExtraState = (function canvasExtraState() {
   function constructor(old) {
     // Are soft masks and alpha values shapes or opacities?
@@ -838,3 +841,4 @@ var CanvasGraphics = (function canvasGraphics() {
 
   return constructor;
 })();
+
diff --git a/src/cidmaps.js b/src/cidmaps.js
index 7de3d14f6..226843b71 100644
--- a/src/cidmaps.js
+++ b/src/cidmaps.js
@@ -6930,3 +6930,4 @@ var CIDToUnicodeMaps = {
     {f: 39, c: 19576}, {f: 111, c: 19620}, {f: 148, c: 19738},
     {f: 7, c: 19887}]
 };
+
diff --git a/src/colorspace.js b/src/colorspace.js
index 3ce383a09..1c5c291f4 100644
--- a/src/colorspace.js
+++ b/src/colorspace.js
@@ -397,5 +397,7 @@ var DeviceCmykCS = (function deviceCmykCS() {
       return rgbBuf;
     }
   };
+
   return constructor;
 })();
+
diff --git a/src/core.js b/src/core.js
index 4b411cff5..e7241acfa 100644
--- a/src/core.js
+++ b/src/core.js
@@ -608,4 +608,6 @@ var PDFDoc = (function() {
 
   return constructor;
 })();
+
 globalScope.PDFJS.PDFDoc = PDFDoc;
+
diff --git a/src/crypto.js b/src/crypto.js
index 5699ea1df..2c86038f0 100644
--- a/src/crypto.js
+++ b/src/crypto.js
@@ -595,3 +595,4 @@ var CipherTransformFactory = (function cipherTransformFactory() {
 
   return constructor;
 })();
+
diff --git a/src/evaluator.js b/src/evaluator.js
index 5007394b4..48e12c83d 100644
--- a/src/evaluator.js
+++ b/src/evaluator.js
@@ -918,3 +918,4 @@ var EvalState = (function evalState() {
   };
   return constructor;
 })();
+
diff --git a/src/fonts.js b/src/fonts.js
index f123b5f4c..b027b766a 100644
--- a/src/fonts.js
+++ b/src/fonts.js
@@ -3272,3 +3272,4 @@ var Type2CFF = (function type2CFF() {
 
   return constructor;
 })();
+
diff --git a/src/function.js b/src/function.js
index 0d4976ab0..e2b191274 100644
--- a/src/function.js
+++ b/src/function.js
@@ -304,3 +304,4 @@ var PDFFunction = (function() {
     }
   };
 })();
+
diff --git a/src/image.js b/src/image.js
index b997245a3..b281e21c1 100644
--- a/src/image.js
+++ b/src/image.js
@@ -254,3 +254,4 @@ var JpegImage = (function() {
 
   return JpegImage;
 })();
+
diff --git a/src/metrics.js b/src/metrics.js
index d4d07ec0d..c21b4aed1 100644
--- a/src/metrics.js
+++ b/src/metrics.js
@@ -2941,3 +2941,4 @@ var Metrics = {
     'a191': 918
   }
 };
+
diff --git a/src/obj.js b/src/obj.js
index 03fbf2e0a..8d5684ec2 100644
--- a/src/obj.js
+++ b/src/obj.js
@@ -739,3 +739,4 @@ var PDFObjects = (function() {
   };
   return PDFObjects;
 })();
+
diff --git a/src/parser.js b/src/parser.js
index 79a336d7f..a740615ed 100644
--- a/src/parser.js
+++ b/src/parser.js
@@ -633,3 +633,4 @@ var Linearization = (function linearizationLinearization() {
 
   return constructor;
 })();
+
diff --git a/src/pattern.js b/src/pattern.js
index a551ac411..8e7760e51 100644
--- a/src/pattern.js
+++ b/src/pattern.js
@@ -287,3 +287,4 @@ var TilingPattern = (function tilingPattern() {
 
   return TilingPattern;
 })();
+
diff --git a/src/pdf.js b/src/pdf.js
index b2b8df7aa..34e163967 100644
--- a/src/pdf.js
+++ b/src/pdf.js
@@ -12,3 +12,4 @@ var PDFJS = {};
   /* PDFJSSCRIPT_INCLUDE_ALL */
 
 })();
+
diff --git a/src/stream.js b/src/stream.js
index baebc3190..2b10e2fbd 100644
--- a/src/stream.js
+++ b/src/stream.js
@@ -2073,3 +2073,4 @@ var LZWStream = (function lzwStream() {
 
   return constructor;
 })();
+
diff --git a/src/util.js b/src/util.js
index 344b99e53..d8d50337b 100644
--- a/src/util.js
+++ b/src/util.js
@@ -281,5 +281,7 @@ var Promise = (function() {
       }
     }
   };
+
   return Promise;
 })();
+
diff --git a/src/worker.js b/src/worker.js
index d1ab48458..a83f31668 100644
--- a/src/worker.js
+++ b/src/worker.js
@@ -122,11 +122,11 @@ var WorkerProcessorHandler = {
       var obj = new Font(font.name, font.file, font.properties);
 
       var str = '';
-      var data = obj.data;
-      if (data) {
-        var length = data.length;
-        for (var j = 0; j < length; j++)
-          str += String.fromCharCode(data[j]);
+      var objData = obj.data;
+      if (objData) {
+        var length = objData.length;
+        for (var j = 0; j < length; ++j)
+          str += String.fromCharCode(objData[j]);
       }
 
       obj.str = str;
@@ -180,3 +180,4 @@ if (typeof window === 'undefined') {
   var handler = new MessageHandler('worker_processor', globalScope);
   WorkerProcessorHandler.setup(handler);
 }
+
diff --git a/src/worker_loader.js b/src/worker_loader.js
index f3646e530..fb37ca9c4 100644
--- a/src/worker_loader.js
+++ b/src/worker_loader.js
@@ -21,3 +21,4 @@ importScripts('../src/parser.js');
 importScripts('../src/pattern.js');
 importScripts('../src/stream.js');
 importScripts('../src/worker.js');
+

From 009d6a8863fae350c8b95f1a6f0936f7b3fbf12d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ionu=C8=9B=20G=2E=20Stan?= <ionut.g.stan@gmail.com>
Date: Fri, 28 Oct 2011 14:27:41 +0300
Subject: [PATCH 05/25] Log error stacktrace only when available

Safari does not provide a `stack` property on Error instances.
---
 pdf.js | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/pdf.js b/pdf.js
index cb3ca3dc5..4a8b9a091 100644
--- a/pdf.js
+++ b/pdf.js
@@ -22,16 +22,15 @@ function warn(msg) {
 }
 
 function backtrace() {
-  var stackStr;
   try {
     throw new Error();
   } catch (e) {
-    stackStr = e.stack;
+    return e.stack ? e.stack.split('\n').slice(2).join('\n') : "";
   }
-  return stackStr.split('\n').slice(1).join('\n');
 }
 
 function error(msg) {
+  log("Error: " + msg);
   log(backtrace());
   throw new Error(msg);
 }

From 8a6cf185fd71ea6132bc305ac8282141aab86914 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ionu=C8=9B=20G=2E=20Stan?= <ionut.g.stan@gmail.com>
Date: Fri, 28 Oct 2011 16:38:55 +0300
Subject: [PATCH 06/25] Add eq test for close path rendering bug

See: 56b9a3543dfd365fb065a85ac056d29064c72797
---
 test/pdfs/.gitignore         |  2 +-
 test/pdfs/close-path-bug.pdf | 69 ++++++++++++++++++++++++++++++++++++
 test/test_manifest.json      |  5 +++
 3 files changed, 75 insertions(+), 1 deletion(-)
 create mode 100644 test/pdfs/close-path-bug.pdf

diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore
index e7eb0da43..49267e36f 100644
--- a/test/pdfs/.gitignore
+++ b/test/pdfs/.gitignore
@@ -12,4 +12,4 @@
 !rotation.pdf
 !simpletype3font.pdf
 !sizes.pdf
-
+!close-path-bug.pdf
diff --git a/test/pdfs/close-path-bug.pdf b/test/pdfs/close-path-bug.pdf
new file mode 100644
index 000000000..994d4e572
--- /dev/null
+++ b/test/pdfs/close-path-bug.pdf
@@ -0,0 +1,69 @@
+%PDF-1.4
+1 0 obj
+  <</Type /Catalog/Outlines 2 0 R/Pages 3 0 R>>
+endobj
+
+2 0 obj
+  <</Type /Outlines/Count 0>>
+endobj
+
+3 0 obj
+  <</Type /Pages/Kids [4 0 R]/Count 1>>
+endobj
+
+4 0 obj
+  <</Type /Page/Parent 3 0 R/MediaBox [0 0 612 792]/Contents 5 0 R/Resources << /ProcSet 6 0 R >>>>
+endobj
+
+5 0 obj
+  << /Length 885 >>
+stream
+   % Draw a black line segment, using the default line width.
+   150 250 m
+   150 350 l
+   S
+   
+   % Draw a thicker, dashed line segment.
+   4 w                                        % Set line width to 4 points
+   [4 6] 0 d                                  % Set dash pattern to 4 units on, 6 units off
+   150 250 m
+   400 250 l
+   S
+   
+   [] 0 d                                     % Reset dash pattern to a solid line
+   1 w                                        % Reset line width to 1 unit
+   
+   % Draw a rectangle with a 1−unit red border, filled with light blue.
+   1.0 0.0 0.0 RG                             % Red for stroke color
+   0.5 0.75 1.0 rg                            % Light blue for fill color
+   200 300 50 75 re
+   B
+   
+   % Draw a curve filled with gray and with a colored border.
+   0.5 0.1 0.2 RG
+   0.7 g
+   300 300 m
+   300 400 400 400 400 300 c
+   b
+endstream
+endobj
+
+6 0 obj
+  [/PDF]
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000009 00000 n
+0000000074 00000 n
+0000000120 00000 n
+0000000179 00000 n
+0000000300 00000 n
+0000001532 00000 n
+
+trailer
+  <</Size 7/Root 1 0 R>>
+startxref
+1556
+%%EOF
diff --git a/test/test_manifest.json b/test/test_manifest.json
index d7ac34cef..4837dd2b7 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -217,5 +217,10 @@
        "link": false,
        "rounds": 1,
        "type": "eq"
+    },
+    {  "id": "close-path-bug",
+       "file": "pdfs/close-path-bug.pdf",
+       "rounds": 1,
+       "type": "eq"
     }
 ]

From 068e77bdec03281a5189c82b1595d2de5b26a0b7 Mon Sep 17 00:00:00 2001
From: Kalervo Kujala <kkujala@com>
Date: Fri, 28 Oct 2011 21:23:30 +0300
Subject: [PATCH 07/25] Name anonymous functions in worker.js.

---
 src/worker.js | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/worker.js b/src/worker.js
index a83f31668..d62e0c86b 100644
--- a/src/worker.js
+++ b/src/worker.js
@@ -8,14 +8,14 @@ function MessageHandler(name, comObj) {
   this.comObj = comObj;
   var ah = this.actionHandler = {};
 
-  ah['console_log'] = [function(data) {
+  ah['console_log'] = [function ahConsoleLog(data) {
       console.log.apply(console, data);
   }];
-  ah['console_error'] = [function(data) {
+  ah['console_error'] = [function ahConsoleError(data) {
       console.error.apply(console, data);
   }];
 
-  comObj.onmessage = function(event) {
+  comObj.onmessage = function messageHandlerComObjOnMessage(event) {
     var data = event.data;
     if (data.action in ah) {
       var action = ah[data.action];
@@ -27,15 +27,15 @@ function MessageHandler(name, comObj) {
 }
 
 MessageHandler.prototype = {
-  on: function(actionName, handler, scope) {
+  on: function messageHandlerOn(actionName, handler, scope) {
     var ah = this.actionHandler;
     if (ah[actionName]) {
-      throw "There is already an actionName called '" + actionName + "'";
+      throw 'There is already an actionName called "' + actionName + '"';
     }
     ah[actionName] = [handler, scope];
   },
 
-  send: function(actionName, data) {
+  send: function messageHandlerSend(actionName, data) {
     this.comObj.postMessage({
       action: actionName,
       data: data
@@ -44,16 +44,16 @@ MessageHandler.prototype = {
 };
 
 var WorkerProcessorHandler = {
-  setup: function(handler) {
+  setup: function wphSetup(handler) {
     var pdfDoc = null;
 
-    handler.on('doc', function(data) {
+    handler.on('doc', function wphSetupDoc(data) {
       // Create only the model of the PDFDoc, which is enough for
       // processing the content of the pdf.
       pdfDoc = new PDFDocModel(new Stream(data));
     });
 
-    handler.on('page_request', function(pageNum) {
+    handler.on('page_request', function wphSetupPageRequest(pageNum) {
       pageNum = parseInt(pageNum);
 
       var page = pdfDoc.getPage(pageNum);
@@ -89,7 +89,7 @@ var WorkerProcessorHandler = {
       });
     }, this);
 
-    handler.on('font', function(data) {
+    handler.on('font', function wphSetupFont(data) {
       var objId = data[0];
       var name = data[1];
       var file = data[2];
@@ -159,11 +159,11 @@ var workerConsole = {
     });
   },
 
-  time: function(name) {
+  time: function time(name) {
     consoleTimer[name] = Date.now();
   },
 
-  timeEnd: function(name) {
+  timeEnd: function timeEnd(name) {
     var time = consoleTimer[name];
     if (time == null) {
       throw 'Unkown timer name ' + name;

From 5cb64fbab7f20a53b48582be5a582f6df8e5f747 Mon Sep 17 00:00:00 2001
From: Brendan Dahl <brendan.dahl@gmail.com>
Date: Fri, 28 Oct 2011 14:10:10 -0700
Subject: [PATCH 08/25] Initial alpha transparency support.

---
 src/canvas.js            |  54 ++++++++++++++++++---------------------
 src/evaluator.js         |   4 +--
 test/pdfs/alphatrans.pdf | Bin 0 -> 16910 bytes
 3 files changed, 27 insertions(+), 31 deletions(-)
 create mode 100644 test/pdfs/alphatrans.pdf

diff --git a/src/canvas.js b/src/canvas.js
index 70dd65e3d..3c7551404 100644
--- a/src/canvas.js
+++ b/src/canvas.js
@@ -28,6 +28,9 @@ var CanvasExtraState = (function canvasExtraState() {
     // Default fore and background colors
     this.fillColor = '#000000';
     this.strokeColor = '#000000';
+    // Note: fill alpha applies to all non-stroking operations
+    this.fillAlpha = 1;
+    this.strokeAlpha = 1;
 
     this.old = old;
   }
@@ -206,6 +209,13 @@ var CanvasGraphics = (function canvasGraphics() {
           case 'Font':
             this.setFont(state[1], state[2]);
             break;
+          case 'CA':
+            this.current.strokeAlpha = state[1];
+            break;
+          case 'ca':
+            this.current.fillAlpha = state[1];
+            this.ctx.globalAlpha = state[1];
+            break;
         }
       }
     },
@@ -254,9 +264,13 @@ var CanvasGraphics = (function canvasGraphics() {
     rectangle: function canvasGraphicsRectangle(x, y, width, height) {
       this.ctx.rect(x, y, width, height);
     },
-    stroke: function canvasGraphicsStroke() {
+    stroke: function canvasGraphicsStroke(consumePath) {
+      consumePath = typeof consumePath !== 'undefined' ? consumePath : true;
       var ctx = this.ctx;
       var strokeColor = this.current.strokeColor;
+      // For stroke we want to temporarily change the global alpha to the
+      // stroking alpha.
+      ctx.globalAlpha = this.current.strokeAlpha;
       if (strokeColor && strokeColor.hasOwnProperty('type') &&
           strokeColor.type === 'Pattern') {
         // for patterns, we transform to pattern space, calculate
@@ -268,14 +282,17 @@ var CanvasGraphics = (function canvasGraphics() {
       } else {
         ctx.stroke();
       }
-
-      this.consumePath();
+      if (consumePath)
+        this.consumePath();
+      // Restore the global alpha to the fill alpha
+      ctx.globalAlpha = this.current.fillAlpha;
     },
     closeStroke: function canvasGraphicsCloseStroke() {
       this.closePath();
       this.stroke();
     },
-    fill: function canvasGraphicsFill() {
+    fill: function canvasGraphicsFill(consumePath) {
+      consumePath = typeof consumePath !== 'undefined' ? consumePath : true;
       var ctx = this.ctx;
       var fillColor = this.current.fillColor;
 
@@ -288,8 +305,8 @@ var CanvasGraphics = (function canvasGraphics() {
       } else {
         ctx.fill();
       }
-
-      this.consumePath();
+      if (consumePath)
+        this.consumePath();
     },
     eoFill: function canvasGraphicsEoFill() {
       var savedFillRule = this.setEOFillRule();
@@ -297,29 +314,8 @@ var CanvasGraphics = (function canvasGraphics() {
       this.restoreFillRule(savedFillRule);
     },
     fillStroke: function canvasGraphicsFillStroke() {
-      var ctx = this.ctx;
-
-      var fillColor = this.current.fillColor;
-      if (fillColor && fillColor.hasOwnProperty('type') &&
-          fillColor.type === 'Pattern') {
-        ctx.save();
-        ctx.fillStyle = fillColor.getPattern(ctx);
-        ctx.fill();
-        ctx.restore();
-      } else {
-        ctx.fill();
-      }
-
-      var strokeColor = this.current.strokeColor;
-      if (strokeColor && strokeColor.hasOwnProperty('type') &&
-          strokeColor.type === 'Pattern') {
-        ctx.save();
-        ctx.strokeStyle = strokeColor.getPattern(ctx);
-        ctx.stroke();
-        ctx.restore();
-      } else {
-        ctx.stroke();
-      }
+      this.fill(false);
+      this.stroke(false);
 
       this.consumePath();
     },
diff --git a/src/evaluator.js b/src/evaluator.js
index 5007394b4..ea152717a 100644
--- a/src/evaluator.js
+++ b/src/evaluator.js
@@ -405,6 +405,8 @@ var PartialEvaluator = (function partialEvaluator() {
                     case 'D':
                     case 'RI':
                     case 'FL':
+                    case 'CA':
+                    case 'ca':
                       gsStateObj.push([key, value]);
                       break;
                     case 'Font':
@@ -428,8 +430,6 @@ var PartialEvaluator = (function partialEvaluator() {
                     case 'SA':
                     case 'BM':
                     case 'SMask':
-                    case 'CA':
-                    case 'ca':
                     case 'AIS':
                     case 'TK':
                       TODO('graphic state operator ' + key);
diff --git a/test/pdfs/alphatrans.pdf b/test/pdfs/alphatrans.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..6274ce3ac67ad08df9f2097455db2679230086f9
GIT binary patch
literal 16910
zcmdUXc|4R~`~TRNiU=VxF|r#owjukz?^;k9W-yGIF*Ej1Dk1w?5(&{_&04f5OA>|b
zO4g8yqDcJi8MHm0=lOho-|zGL<2Uni&wZbBo$H+II@fibb6>CbA!?;(AOn+CW)&SB
z>*!)t1j~W(E}pDvYG9~cAOQ`AS|Q!3S0Wlm2E%}A8!*%iNg|u$Q5ZK28U+^DQ-#aH
zU@$p20w%AZ3{#MiQx=nx6O#Z#ZO|mVFVPiE0>d{Nnxjz|qz*m+>?kKICkLip6jc;u
z;RrB70Va!3ISPjA67ht;A<@C2(Wt+nu_I!<|As`HNd6lNT|ABq$V~z(ZH(UrPezi_
zz&+HEi1#Icf2wKY8EOltjfljN2uMI*u7Q9wK#3mO595lqG1LKTXn>*GI2<0}=m=Jz
z@&qKdasU*op}~sAp(whi^tCYuPy-B>j3$Di23Vk5J+vzx1<ZvR8s|>-04u=Y06P+y
zh(>y|24q&IJhT{-+Zpj8FnXPt(@fn@;I5Gqt0{vRYa&96{cH_QRmEV%O^?^1V&+{b
z-e2^h#``X|od|PNixZx;(s^UhbYSl}I2yhJUnoq!N@{dAH`ymRX2^g2G*hH2jXguk
zD0><2{`U=1`=L;IwY|e<-)%pShJE8}U#1_celniP(yW`Oe4Nuqqd)TV`JLDH@RfTB
zmNRh>y_M>pd?-z3>!*wCQ@S)8Z!Igy^suSUKF@lI=h{<Clxb9gNSak8t-=@K-7jlq
zHTgcQBv$9SAm*M(mhQUSJRKxU8)RJ&*3q)tTJYhz@N6@Wv{70-nbFwZeND)=y3Kom
z=eFpfw&H@r7qC%_$0qB_OzduV`%U2L#9ZeW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&kLm`QqD*E9b|JY1{00!)^e{-#W
zXrRV`W4fb>e>DClM*5E<=)XAie>Ey-0}&5Jje7qzZ6dw@oQQv@OiDKB|6ff4i5%+N
zA+Xf~W6^$S?0?TbU4OFvLqGp-HM<cT|3`szqv_ALEQ)je*aH5#soEg?{XJo$40!nm
z@(s`*2?yZeN6G>)T6JN6N<sp-`{MxbzaGQY1(G6IJa8KIAeu<oTY`ZNmNF%Q=?)x!
z-%NvAQ1)e%L*tY@*Fg;0A5F9ZHdScKS@Deus2+w0Wb&x(&EQ-4LwB?pG7!ip07(}h
zS&Kz)oym7c18-Eo!Bl$^+5$L+3Wiz|&^Yal=8hYOh=Eh7WFs)n7mEe5a6gha)Wi;j
zJ4G}~>NNlu1}l&?M6gm)d>bFIlA@x#BG?VQRfa$SJSiVAZnF#~r=keR_FEb7vZ(+h
z{eCM0{yl&akP!W?40xa<_x>nTkOOj{f0U^x07=l_%Ygqj@Go>QIVE6P{-A>^06DDR
z%3yMe^8Z?<1iY*LNvA9i<a7UMivSX=f0V%#;D3$}21CgGDH}`)h5*vkTl~mGBnFEn
zQvcI}EhY#J=pM-8;_;Mo#~WE>W5CzJ)chxqT?STJN3hz~n;PXsjq;vGc}@HEEluN}
bkWh2)z;Z?;Q)eBfB(DNv6&2ODG+_Nd7c+O^

literal 0
HcmV?d00001


From 11b843325b6e3412e67bdd98f884cf8567744f0a Mon Sep 17 00:00:00 2001
From: Brendan Dahl <brendan.dahl@gmail.com>
Date: Fri, 28 Oct 2011 14:11:14 -0700
Subject: [PATCH 09/25] Add the alpha trans test pdf.

---
 test/pdfs/.gitignore    | 1 +
 test/test_manifest.json | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore
index e7eb0da43..09618a7e6 100644
--- a/test/pdfs/.gitignore
+++ b/test/pdfs/.gitignore
@@ -12,4 +12,5 @@
 !rotation.pdf
 !simpletype3font.pdf
 !sizes.pdf
+!alphatrans.pdf
 
diff --git a/test/test_manifest.json b/test/test_manifest.json
index d7ac34cef..1d51c935f 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -217,5 +217,11 @@
        "link": false,
        "rounds": 1,
        "type": "eq"
+    },
+    {  "id": "alphatrans",
+       "file": "pdfs/alphatrans.pdf",
+       "link": false,
+       "rounds": 1,
+       "type": "eq"
     }
 ]

From 56789aea47efa22912034d4f337f14b23be23699 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ionu=C8=9B=20G=2E=20Stan?= <ionut.g.stan@gmail.com>
Date: Sat, 29 Oct 2011 01:26:55 +0300
Subject: [PATCH 10/25] Fix lint errors

Single quotes instead of double quotes
---
 src/util.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util.js b/src/util.js
index 953732057..9765914ca 100644
--- a/src/util.js
+++ b/src/util.js
@@ -19,12 +19,12 @@ function backtrace() {
   try {
     throw new Error();
   } catch (e) {
-    return e.stack ? e.stack.split('\n').slice(2).join('\n') : "";
+    return e.stack ? e.stack.split('\n').slice(2).join('\n') : '';
   }
 }
 
 function error(msg) {
-  log("Error: " + msg);
+  log('Error: ' + msg);
   log(backtrace());
   throw new Error(msg);
 }

From 7e762169cf183792e83a65c81ada5d0d2f74076a Mon Sep 17 00:00:00 2001
From: Kalervo Kujala <kkujala@com>
Date: Sat, 29 Oct 2011 13:20:48 +0300
Subject: [PATCH 11/25] Name a few anonymous functions.

Also rename some functions.
---
 src/pattern.js | 12 ++++++------
 src/stream.js  |  2 +-
 src/util.js    |  8 ++++----
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/pattern.js b/src/pattern.js
index 8e7760e51..2539a288e 100644
--- a/src/pattern.js
+++ b/src/pattern.js
@@ -43,7 +43,7 @@ var Shadings = {};
 
 // Radial and axial shading have very similar implementations
 // If needed, the implementations can be broken into two classes
-Shadings.RadialAxial = (function radialAxialShading() {
+Shadings.RadialAxial = (function radialAxialShadings() {
   function constructor(dict, matrix, xref, res, ctx) {
     this.matrix = matrix;
     this.coordsArr = dict.get('Coords');
@@ -97,7 +97,7 @@ Shadings.RadialAxial = (function radialAxialShading() {
     this.colorStops = colorStops;
   }
 
-  constructor.fromIR = function(ctx, raw) {
+  constructor.fromIR = function radialAxialShadingsGetIR(ctx, raw) {
     var type = raw[1];
     var colorStops = raw[2];
     var p0 = raw[3];
@@ -129,7 +129,7 @@ Shadings.RadialAxial = (function radialAxialShading() {
   }
 
   constructor.prototype = {
-    getIR: function RadialAxialShading_getIR() {
+    getIR: function radialAxialShadingsGetIR() {
       var coordsArr = this.coordsArr;
       var type = this.shadingType;
       if (type == 2) {
@@ -159,17 +159,17 @@ Shadings.RadialAxial = (function radialAxialShading() {
   return constructor;
 })();
 
-Shadings.Dummy = (function dummyShading() {
+Shadings.Dummy = (function dummyShadings() {
   function constructor() {
     this.type = 'Pattern';
   }
 
-  constructor.fromIR = function() {
+  constructor.fromIR = function dummyShadingsFromIR() {
     return 'hotpink';
   }
 
   constructor.prototype = {
-    getIR: function dummpy_getir() {
+    getIR: function dummyShadingsGetIR() {
       return ['Dummy'];
     }
   };
diff --git a/src/stream.js b/src/stream.js
index 2b10e2fbd..73b096f1e 100644
--- a/src/stream.js
+++ b/src/stream.js
@@ -801,7 +801,7 @@ var JpegStream = (function jpegStream() {
   }
 
   constructor.prototype = {
-    getIR: function() {
+    getIR: function jpegStreamGetIR() {
       return this.src;
     },
     getChar: function jpegStreamGetChar() {
diff --git a/src/util.js b/src/util.js
index 9765914ca..41ae4cc96 100644
--- a/src/util.js
+++ b/src/util.js
@@ -197,7 +197,7 @@ function isPDFFunction(v) {
  * can be set. If any of these happens twice or the data is required before
  * it was set, an exception is throw.
  */
-var Promise = (function() {
+var Promise = (function promise() {
   var EMPTY_PROMISE = {};
 
   /**
@@ -244,7 +244,7 @@ var Promise = (function() {
       return this._data;
     },
 
-    onData: function(callback) {
+    onData: function promiseOnData(callback) {
       if (this._data !== EMPTY_PROMISE) {
         callback(this._data);
       } else {
@@ -252,7 +252,7 @@ var Promise = (function() {
       }
     },
 
-    resolve: function(data) {
+    resolve: function promiseResolve(data) {
       if (this.isResolved) {
         throw 'A Promise can be resolved only once ' + this.name;
       }
@@ -266,7 +266,7 @@ var Promise = (function() {
       }
     },
 
-    then: function(callback) {
+    then: function promiseThen(callback) {
       if (!callback) {
         throw 'Requiring callback' + this.name;
       }

From 8a5516c96cddcb6f06e9a829e237a29c727c6f9e Mon Sep 17 00:00:00 2001
From: Kalervo Kujala <kkujala@com>
Date: Sat, 29 Oct 2011 17:57:31 +0300
Subject: [PATCH 12/25] Rename Shanding related functions with better name
 names.

---
 src/pattern.js | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/pattern.js b/src/pattern.js
index 2539a288e..2a31fec4a 100644
--- a/src/pattern.js
+++ b/src/pattern.js
@@ -43,7 +43,7 @@ var Shadings = {};
 
 // Radial and axial shading have very similar implementations
 // If needed, the implementations can be broken into two classes
-Shadings.RadialAxial = (function radialAxialShadings() {
+Shadings.RadialAxial = (function radialAxialShading() {
   function constructor(dict, matrix, xref, res, ctx) {
     this.matrix = matrix;
     this.coordsArr = dict.get('Coords');
@@ -97,7 +97,7 @@ Shadings.RadialAxial = (function radialAxialShadings() {
     this.colorStops = colorStops;
   }
 
-  constructor.fromIR = function radialAxialShadingsGetIR(ctx, raw) {
+  constructor.fromIR = function radialAxialShadingGetIR(ctx, raw) {
     var type = raw[1];
     var colorStops = raw[2];
     var p0 = raw[3];
@@ -129,7 +129,7 @@ Shadings.RadialAxial = (function radialAxialShadings() {
   }
 
   constructor.prototype = {
-    getIR: function radialAxialShadingsGetIR() {
+    getIR: function radialAxialShadingGetIR() {
       var coordsArr = this.coordsArr;
       var type = this.shadingType;
       if (type == 2) {
@@ -159,17 +159,17 @@ Shadings.RadialAxial = (function radialAxialShadings() {
   return constructor;
 })();
 
-Shadings.Dummy = (function dummyShadings() {
+Shadings.Dummy = (function dummyShading() {
   function constructor() {
     this.type = 'Pattern';
   }
 
-  constructor.fromIR = function dummyShadingsFromIR() {
+  constructor.fromIR = function dummyShadingFromIR() {
     return 'hotpink';
   }
 
   constructor.prototype = {
-    getIR: function dummyShadingsGetIR() {
+    getIR: function dummyShadingGetIR() {
       return ['Dummy'];
     }
   };

From b9748a91f1030ff37629cf987bdb617627c580d7 Mon Sep 17 00:00:00 2001
From: Kalervo Kujala <kkujala@com>
Date: Sat, 29 Oct 2011 20:31:56 +0300
Subject: [PATCH 13/25] Name anonymous functions in obj.js.

---
 src/obj.js | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/obj.js b/src/obj.js
index 8d5684ec2..fd1579280 100644
--- a/src/obj.js
+++ b/src/obj.js
@@ -642,7 +642,7 @@ var XRef = (function xRefXRef() {
  * inside of a worker. The `PDFObjects` implements some basic functions to
  * manage these objects.
  */
-var PDFObjects = (function() {
+var PDFObjects = (function pdfObjects() {
   function PDFObjects() {
     this.objs = {};
   }
@@ -655,7 +655,7 @@ var PDFObjects = (function() {
      * Ensures there is an object defined for `objId`. Stores `data` on the
      * object *if* it is created.
      */
-    ensureObj: function(objId, data) {
+    ensureObj: function pdfObjectsEnsureObj(objId, data) {
       if (this.objs[objId])
         return this.objs[objId];
       return this.objs[objId] = new Promise(objId, data);
@@ -670,7 +670,7 @@ var PDFObjects = (function() {
      * function and the object is already resolved, the callback gets called
      * right away.
      */
-    get: function(objId, callback) {
+    get: function pdfObjectsGet(objId, callback) {
       // If there is a callback, then the get can be async and the object is
       // not required to be resolved right now
       if (callback) {
@@ -695,7 +695,7 @@ var PDFObjects = (function() {
     /**
      * Resolves the object `objId` with optional `data`.
      */
-    resolve: function(objId, data) {
+    resolve: function pdfObjectsResolve(objId, data) {
       var objs = this.objs;
 
       // In case there is a promise already on this object, just resolve it.
@@ -706,11 +706,11 @@ var PDFObjects = (function() {
       }
     },
 
-    onData: function(objId, callback) {
+    onData: function pdfObjectsOnData(objId, callback) {
       this.ensureObj(objId).onData(callback);
     },
 
-    isResolved: function(objId) {
+    isResolved: function pdfObjectsIsResolved(objId) {
       var objs = this.objs;
       if (!objs[objId]) {
         return false;
@@ -719,7 +719,7 @@ var PDFObjects = (function() {
       }
     },
 
-    hasData: function(objId) {
+    hasData: function pdfObjectsHasData(objId) {
       var objs = this.objs;
       if (!objs[objId]) {
         return false;
@@ -731,7 +731,7 @@ var PDFObjects = (function() {
     /**
      * Sets the data of an object but *doesn't* resolve it.
      */
-    setData: function(objId, data) {
+    setData: function pdfObjectsSetData(objId, data) {
       // Watchout! If you call `this.ensureObj(objId, data)` you're going to
       // create a *resolved* promise which shouldn't be the case!
       this.ensureObj(objId).data = data;

From dc15019248d5fcfbf71099c77f1516d1e48ccffc Mon Sep 17 00:00:00 2001
From: Kalervo Kujala <kkujala@com>
Date: Sat, 29 Oct 2011 20:59:49 +0300
Subject: [PATCH 14/25] Name anonymous funtions in function.js.

---
 src/function.js | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/function.js b/src/function.js
index e2b191274..a8c797a29 100644
--- a/src/function.js
+++ b/src/function.js
@@ -3,14 +3,15 @@
 
 'use strict';
 
-var PDFFunction = (function() {
+var PDFFunction = (function pdfFunction() {
   var CONSTRUCT_SAMPLED = 0;
   var CONSTRUCT_INTERPOLATED = 2;
   var CONSTRUCT_STICHED = 3;
   var CONSTRUCT_POSTSCRIPT = 4;
 
   return {
-    getSampleArray: function(size, outputSize, bps, str) {
+    getSampleArray: function pdfFunctionGetSampleArray(size, outputSize, bps,
+                                                       str) {
       var length = 1;
       for (var i = 0; i < size.length; i++)
         length *= size[i];
@@ -35,7 +36,7 @@ var PDFFunction = (function() {
       return array;
     },
 
-    getIR: function(xref, fn) {
+    getIR: function pdfFunctionGetIR(xref, fn) {
       var dict = fn.dict;
       if (!dict)
         dict = fn;
@@ -54,7 +55,7 @@ var PDFFunction = (function() {
       return typeFn.call(this, fn, dict, xref);
     },
 
-    fromIR: function(IR) {
+    fromIR: function pdfFunctionFromIR(IR) {
       var type = IR[0];
       switch (type) {
         case CONSTRUCT_SAMPLED:
@@ -69,12 +70,12 @@ var PDFFunction = (function() {
       }
     },
 
-    parse: function(xref, fn) {
+    parse: function pdfFunctionParse(xref, fn) {
       var IR = this.getIR(xref, fn);
       return this.fromIR(IR);
     },
 
-    constructSampled: function(str, dict) {
+    constructSampled: function pdfFunctionConstructSampled(str, dict) {
       var domain = dict.get('Domain');
       var range = dict.get('Range');
 
@@ -116,7 +117,7 @@ var PDFFunction = (function() {
       ];
     },
 
-    constructSampledFromIR: function(IR) {
+    constructSampledFromIR: function pdfFunctionConstructSampledFromIR(IR) {
       var inputSize = IR[1];
       var domain = IR[2];
       var encode = IR[3];
@@ -127,8 +128,8 @@ var PDFFunction = (function() {
       var bps = IR[8];
       var range = IR[9];
 
-      return function(args) {
-        var clip = function(v, min, max) {
+      return function constructSampledFromIRResult(args) {
+        var clip = function constructSampledFromIRClip(v, min, max) {
           if (v > max)
             v = max;
           else if (v < min)
@@ -212,7 +213,7 @@ var PDFFunction = (function() {
 
       var length = diff.length;
 
-      return function(args) {
+      return function constructInterpolatedFromIRResult(args) {
         var x = n == 1 ? args[0] : Math.pow(args[0], n);
 
         var out = [];
@@ -257,8 +258,8 @@ var PDFFunction = (function() {
         fns.push(PDFFunction.fromIR(fnsIR[i]));
       }
 
-      return function(args) {
-        var clip = function(v, min, max) {
+      return function constructStichedFromIRResult(args) {
+        var clip = function constructStichedFromIRClip(v, min, max) {
           if (v > max)
             v = max;
           else if (v < min)
@@ -298,7 +299,7 @@ var PDFFunction = (function() {
 
     constructPostScriptFromIR: function pdfFunctionConstructPostScriptFromIR() {
       TODO('unhandled type of function');
-      return function() {
+      return function constructPostScriptFromIRResult() {
         return [255, 105, 180];
       };
     }

From 0912959503cc566af7ac04f0d277931fb6647dea Mon Sep 17 00:00:00 2001
From: notmasteryet <async.processingjs@yahoo.com>
Date: Sat, 29 Oct 2011 16:00:13 -0500
Subject: [PATCH 15/25] Fixing 'compatibility.js' load order; add Object.keys
 emulation

---
 web/compatibility.js | 15 +++++++++++++++
 web/viewer.html      |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/web/compatibility.js b/web/compatibility.js
index ad4c8f8a9..7d1d72553 100644
--- a/web/compatibility.js
+++ b/web/compatibility.js
@@ -83,6 +83,21 @@
   };
 })();
 
+// Object.keys() ?
+(function checkObjectKeysCompatibility() {
+  if (typeof Object.keys !== 'undefined')
+    return;
+
+  Object.keys = function objectKeys(obj) {
+    var result = [];
+    for (var i in obj) {
+      if (obj.hasOwnProperty(i))
+        result.push(i);
+    }
+    return result;
+  };
+})();
+
 // No XMLHttpRequest.response ?
 (function checkXMLHttpRequestResponseCompatibility() {
   var xhrPrototype = XMLHttpRequest.prototype;
diff --git a/web/viewer.html b/web/viewer.html
index f7a5378ed..0c6ab385e 100644
--- a/web/viewer.html
+++ b/web/viewer.html
@@ -3,6 +3,7 @@
     <head>
         <title>Simple pdf.js page viewer</title>
         <link rel="stylesheet" href="viewer.css"/>
+        <script type="text/javascript" src="compatibility.js"></script>
         
         <!-- PDFJSSCRIPT_INCLUDE_BUILD -->
         
@@ -25,7 +26,6 @@
         <script type="text/javascript" src="../src/stream.js"></script>  <!-- PDFJSSCRIPT_REMOVE -->
         <script type="text/javascript" src="../src/worker.js"></script>  <!-- PDFJSSCRIPT_REMOVE -->
 
-        <script type="text/javascript" src="compatibility.js"></script>
         <script type="text/javascript" src="viewer.js"></script>
   </head>
 

From ce3f9ae3e8134f33917740e38ad1a0fcc0641a20 Mon Sep 17 00:00:00 2001
From: Kalervo Kujala <kkujala@com>
Date: Sun, 30 Oct 2011 12:41:55 +0200
Subject: [PATCH 16/25] Name anonymous functions in core.js.

---
 src/core.js | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/src/core.js b/src/core.js
index e7241acfa..09d665972 100644
--- a/src/core.js
+++ b/src/core.js
@@ -153,7 +153,7 @@ var Page = (function pagePage() {
       return shadow(this, 'rotate', rotate);
     },
 
-    startRenderingFromIRQueue: function startRenderingFromIRQueue(
+    startRenderingFromIRQueue: function pageStartRenderingFromIRQueue(
                                                 IRQueue, fonts) {
       var self = this;
       this.IRQueue = IRQueue;
@@ -173,12 +173,13 @@ var Page = (function pagePage() {
         });
       };
 
-      this.ensureFonts(fonts, function() {
+      this.ensureFonts(fonts,
+                       function pageStartRenderingFromIRQueueEnsureFonts() {
         displayContinuation();
       });
     },
 
-    getIRQueue: function(handler, dependency) {
+    getIRQueue: function pageGetIRQueue(handler, dependency) {
       if (this.IRQueue) {
         // content was compiled
         return this.IRQueue;
@@ -202,7 +203,7 @@ var Page = (function pagePage() {
                                 content, resources, IRQueue, dependency);
     },
 
-    ensureFonts: function(fonts, callback) {
+    ensureFonts: function pageEnsureFonts(fonts, callback) {
       // Convert the font names to the corresponding font obj.
       for (var i = 0; i < fonts.length; i++) {
         fonts[i] = this.objs.objs[fonts[i]].data;
@@ -211,7 +212,7 @@ var Page = (function pagePage() {
       // Load all the fonts
       var fontObjs = FontLoader.bind(
         fonts,
-        function(fontObjs) {
+        function pageEnsureFontsFontObjs(fontObjs) {
           this.stats.fonts = Date.now();
 
           callback.call(this);
@@ -220,7 +221,7 @@ var Page = (function pagePage() {
       );
     },
 
-    display: function(gfx, callback) {
+    display: function pageDisplay(gfx, callback) {
       var xref = this.xref;
       var resources = xref.fetchIfRef(this.resources);
       var mediaBox = xref.fetchIfRef(this.mediaBox);
@@ -305,7 +306,7 @@ var Page = (function pagePage() {
       }
       return links;
     },
-    startRendering: function(ctx, callback)  {
+    startRendering: function pageStartRendering(ctx, callback)  {
       this.ctx = ctx;
       this.callback = callback;
 
@@ -446,7 +447,7 @@ var PDFDocModel = (function pdfDoc() {
   return constructor;
 })();
 
-var PDFDoc = (function() {
+var PDFDoc = (function pdfDoc() {
   function constructor(arg, callback) {
     var stream = null;
     var data = null;
@@ -475,10 +476,10 @@ var PDFDoc = (function() {
     } else {
       // If we don't use a worker, just post/sendMessage to the main thread.
       var worker = {
-        postMessage: function(obj) {
+        postMessage: function pdfDocPostMessage(obj) {
           worker.onmessage({data: obj});
         },
-        terminate: function() {}
+        terminate: function pdfDocTerminate() {}
       };
     }
     this.worker = worker;
@@ -488,7 +489,7 @@ var PDFDoc = (function() {
     var processorHandler = this.processorHandler =
                                         new MessageHandler('main', worker);
 
-    processorHandler.on('page', function(data) {
+    processorHandler.on('page', function pdfDocPage(data) {
       var pageNum = data.pageNum;
       var page = this.pageCache[pageNum];
       var depFonts = data.depFonts;
@@ -496,7 +497,7 @@ var PDFDoc = (function() {
       page.startRenderingFromIRQueue(data.IRQueue, depFonts);
     }, this);
 
-    processorHandler.on('obj', function(data) {
+    processorHandler.on('obj', function pdfDocObj(data) {
       var id = data[0];
       var type = data[1];
 
@@ -540,7 +541,7 @@ var PDFDoc = (function() {
       }
     }, this);
 
-    processorHandler.on('font_ready', function(data) {
+    processorHandler.on('font_ready', function pdfDocFontReady(data) {
       var id = data[0];
       var font = new FontShape(data[1]);
 
@@ -559,7 +560,7 @@ var PDFDoc = (function() {
     }
 
     this.workerReadyPromise = new Promise('workerReady');
-    setTimeout(function() {
+    setTimeout(function pdfDocFontReadySetTimeout() {
       processorHandler.send('doc', this.data);
       this.workerReadyPromise.resolve(true);
     }.bind(this));
@@ -570,14 +571,14 @@ var PDFDoc = (function() {
       return this.pdf.numPages;
     },
 
-    startRendering: function(page) {
+    startRendering: function pdfDocStartRendering(page) {
       // The worker might not be ready to receive the page request yet.
-      this.workerReadyPromise.then(function() {
+      this.workerReadyPromise.then(function pdfDocStartRenderingThen() {
         this.processorHandler.send('page_request', page.pageNumber + 1);
       }.bind(this));
     },
 
-    getPage: function(n) {
+    getPage: function pdfDocGetPage(n) {
       if (this.pageCache[n])
         return this.pageCache[n];
 
@@ -589,7 +590,7 @@ var PDFDoc = (function() {
       return this.pageCache[n] = page;
     },
 
-    destroy: function() {
+    destroy: function pdfDocDestroy() {
       if (this.worker)
         this.worker.terminate();
 

From 11098d66dc6868759940b99eb54ac90b463f175e Mon Sep 17 00:00:00 2001
From: Kalervo Kujala <kkujala@com>
Date: Sun, 30 Oct 2011 13:07:38 +0200
Subject: [PATCH 17/25] Name anonymous functions in image.js.

---
 src/image.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/image.js b/src/image.js
index b281e21c1..71aa0f113 100644
--- a/src/image.js
+++ b/src/image.js
@@ -229,12 +229,12 @@ var PDFImage = (function pdfImage() {
   return constructor;
 })();
 
-var JpegImage = (function() {
+var JpegImage = (function jpegImage() {
   function JpegImage(objId, imageData, objs) {
     var src = 'data:image/jpeg;base64,' + window.btoa(imageData);
 
     var img = new Image();
-    img.onload = (function() {
+    img.onload = (function jpegImageOnload() {
       this.loaded = true;
 
       objs.resolve(objId, this);
@@ -247,7 +247,7 @@ var JpegImage = (function() {
   }
 
   JpegImage.prototype = {
-    getImage: function() {
+    getImage: function jpegImageGetImage() {
       return this.domImage;
     }
   };

From 8f3448e9a8cea057b775a00678d5758bf4fe42e1 Mon Sep 17 00:00:00 2001
From: Kalervo Kujala <kkujala@com>
Date: Sun, 30 Oct 2011 13:44:10 +0200
Subject: [PATCH 18/25] Name anonymous functions in colorspace.js.

---
 src/colorspace.js | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/colorspace.js b/src/colorspace.js
index 1c5c291f4..6bfad4c39 100644
--- a/src/colorspace.js
+++ b/src/colorspace.js
@@ -12,17 +12,17 @@ var ColorSpace = (function colorSpaceColorSpace() {
   constructor.prototype = {
     // Input: array of size numComps representing color component values
     // Output: array of rgb values, each value ranging from [0.1]
-    getRgb: function cs_getRgb(color) {
+    getRgb: function colorSpaceGetRgb(color) {
       error('Should not call ColorSpace.getRgb: ' + color);
     },
     // Input: Uint8Array of component values, each value scaled to [0,255]
     // Output: Uint8Array of rgb values, each value scaled to [0,255]
-    getRgbBuffer: function cs_getRgbBuffer(input) {
+    getRgbBuffer: function colorSpaceGetRgbBuffer(input) {
       error('Should not call ColorSpace.getRgbBuffer: ' + input);
     }
   };
 
-  constructor.parse = function colorspace_parse(cs, xref, res) {
+  constructor.parse = function colorSpaceParse(cs, xref, res) {
     var IR = constructor.parseToIR(cs, xref, res, true);
     if (IR instanceof SeparationCS)
       return IR;
@@ -30,7 +30,7 @@ var ColorSpace = (function colorSpaceColorSpace() {
     return constructor.fromIR(IR);
   };
 
-  constructor.fromIR = function(IR) {
+  constructor.fromIR = function colorSpaceFromIR(IR) {
     var name;
     if (isArray(IR)) {
       name = IR[0];
@@ -71,7 +71,8 @@ var ColorSpace = (function colorSpaceColorSpace() {
     return null;
   }
 
-  constructor.parseToIR = function colorspace_parse(cs, xref, res, parseOnly) {
+  constructor.parseToIR = function colorSpaceParseToIR(cs, xref, res,
+                                                       parseOnly) {
     if (isName(cs)) {
       var colorSpaces = xref.fetchIfRef(res.get('ColorSpace'));
       if (isDict(colorSpaces)) {

From a7690dea0a162738c9f458156343d45a054ab960 Mon Sep 17 00:00:00 2001
From: Kalervo Kujala <kkujala@com>
Date: Sun, 30 Oct 2011 13:46:15 +0200
Subject: [PATCH 19/25] Name anonymous functions in canvas.js.

---
 src/canvas.js | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/canvas.js b/src/canvas.js
index 23258b71f..d40368a9e 100644
--- a/src/canvas.js
+++ b/src/canvas.js
@@ -541,8 +541,7 @@ var CanvasGraphics = (function canvasGraphics() {
     },
 
     // Color
-    setStrokeColorSpace:
-    function canvasGraphicsSetStrokeColorSpacefunction(raw) {
+    setStrokeColorSpace: function canvasGraphicsSetStrokeColorSpace(raw) {
       this.current.strokeColorSpace = ColorSpace.fromIR(raw);
     },
     setFillColorSpace: function canvasGraphicsSetFillColorSpace(raw) {
@@ -553,7 +552,7 @@ var CanvasGraphics = (function canvasGraphics() {
       var color = cs.getRgb(arguments);
       this.setStrokeRGBColor.apply(this, color);
     },
-    getColorN_IR_Pattern: function(IR, cs) {
+    getColorN_IR_Pattern: function canvasGraphicsGetColorN_IR_Pattern(IR, cs) {
       if (IR[0] == 'TilingPattern') {
         var args = IR[1];
         var base = cs.base;
@@ -669,8 +668,8 @@ var CanvasGraphics = (function canvasGraphics() {
       error('Should not call beginImageData');
     },
 
-    paintFormXObjectBegin:
-    function canvasGraphicsPaintFormXObject(matrix, bbox) {
+    paintFormXObjectBegin: function canvasGraphicsPaintFormXObjectBegin(matrix,
+                                                                        bbox) {
       this.save();
 
       if (matrix && isArray(matrix) && 6 == matrix.length)
@@ -685,11 +684,11 @@ var CanvasGraphics = (function canvasGraphics() {
       }
     },
 
-    paintFormXObjectEnd: function() {
+    paintFormXObjectEnd: function canvasGraphicsPaintFormXObjectEnd() {
       this.restore();
     },
 
-    paintJpegXObject: function(objId, w, h) {
+    paintJpegXObject: function canvasGraphicsPaintJpegXObject(objId, w, h) {
       var image = this.objs.get(objId);
       if (!image) {
         error('Dependent image isn\'t ready yet');
@@ -708,7 +707,8 @@ var CanvasGraphics = (function canvasGraphics() {
       this.restore();
     },
 
-    paintImageMaskXObject: function(imgArray, inverseDecode, width, height) {
+    paintImageMaskXObject: function canvasGraphicsPaintImageMaskXObject(
+                             imgArray, inverseDecode, width, height) {
       function applyStencilMask(buffer, inverseDecode) {
         var imgArrayPos = 0;
         var i, j, mask, buf;
@@ -756,7 +756,7 @@ var CanvasGraphics = (function canvasGraphics() {
       this.restore();
     },
 
-    paintImageXObject: function(imgData) {
+    paintImageXObject: function canvasGraphicsPaintImageXObject(imgData) {
       this.save();
       var ctx = this.ctx;
       var w = imgData.width;

From 0331847927a26449555843339a9c7060941563d8 Mon Sep 17 00:00:00 2001
From: Vivien Nicolas <21@vingtetun.org>
Date: Mon, 31 Oct 2011 13:18:30 +0100
Subject: [PATCH 20/25] Add support for disabling the firefox extension on the
 fly

---
 extensions/firefox/bootstrap.js                | 18 ++++++++++++++----
 .../firefox/components/pdfContentHandler.js    |  3 +++
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/extensions/firefox/bootstrap.js b/extensions/firefox/bootstrap.js
index 5384a05df..e51df28f8 100644
--- a/extensions/firefox/bootstrap.js
+++ b/extensions/firefox/bootstrap.js
@@ -16,21 +16,31 @@ function log(str) {
 
 function startup(aData, aReason) {
   let manifestPath = 'chrome.manifest';
-  let file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsILocalFile);
+  let manifest = Cc['@mozilla.org/file/local;1']
+                   .createInstance(Ci.nsILocalFile);
   try {
-    file.initWithPath(aData.installPath.path);
-    file.append(manifestPath);
-    Cm.QueryInterface(Ci.nsIComponentRegistrar).autoRegister(file);
+    manifest.initWithPath(aData.installPath.path);
+    manifest.append(manifestPath);
+    Cm.QueryInterface(Ci.nsIComponentRegistrar).autoRegister(manifest);
+    Services.prefs.setBoolPref('extensions.pdf.js.active', true);
   } catch (e) {
     log(e);
   }
 }
 
 function shutdown(aData, aReason) {
+  if (Services.prefs.getBoolPref('extensions.pdf.js.active'))
+    Services.prefs.setBoolPref('extensions.pdf.js.active', false);
 }
 
 function install(aData, aReason) {
   let url = 'chrome://pdf.js/content/web/viewer.html?file=%s';
   Services.prefs.setCharPref('extensions.pdf.js.url', url);
+  Services.prefs.setBoolPref('extensions.pdf.js.active', false);
+}
+
+function uninstall(aData, aReason) {
+  Services.prefs.clearUserPref('extensions.pdf.js.url');
+  Services.prefs.clearUserPref('extensions.pdf.js.active');
 }
 
diff --git a/extensions/firefox/components/pdfContentHandler.js b/extensions/firefox/components/pdfContentHandler.js
index 7746e41b6..a23461085 100644
--- a/extensions/firefox/components/pdfContentHandler.js
+++ b/extensions/firefox/components/pdfContentHandler.js
@@ -32,6 +32,9 @@ pdfContentHandler.prototype = {
     if (!(aRequest instanceof Ci.nsIChannel))
       throw NS_ERROR_WONT_HANDLE_CONTENT;
 
+    if (!Services.prefs.getBoolPref('extensions.pdf.js.active'))
+      throw NS_ERROR_WONT_HANDLE_CONTENT;
+
     let window = null;
     let callbacks = aRequest.notificationCallbacks ||
                     aRequest.loadGroup.notificationCallbacks;

From 0d02ab5098f3b3ae92ea710d27a43b2ad2132605 Mon Sep 17 00:00:00 2001
From: gigaherz <gigaherz@gmail.com>
Date: Mon, 31 Oct 2011 20:44:29 +0100
Subject: [PATCH 21/25] The extension should urlencode the pdf when sending it
 over to the viewer.

---
 extensions/firefox/components/pdfContentHandler.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/extensions/firefox/components/pdfContentHandler.js b/extensions/firefox/components/pdfContentHandler.js
index a23461085..5f659bd9c 100644
--- a/extensions/firefox/components/pdfContentHandler.js
+++ b/extensions/firefox/components/pdfContentHandler.js
@@ -56,7 +56,8 @@ pdfContentHandler.prototype = {
       throw NS_ERROR_WONT_HANDLE_CONTENT;
 
     aRequest.cancel(Cr.NS_BINDING_ABORTED);
-    window.location = url.replace('%s', targetUrl);
+    aRequest.cancel(Cr.NS_BINDING_ABORTED);
+    window.location = url.replace('%s', encodeURIComponent(targetUrl));
   },
 
   classID: Components.ID('{2278dfd0-b75c-11e0-8257-1ba3d93c9f1a}'),

From 2d8b0f767752f70568d35afa30c4f3d1b0205030 Mon Sep 17 00:00:00 2001
From: gigaherz <gigaherz@gmail.com>
Date: Mon, 31 Oct 2011 21:18:41 +0100
Subject: [PATCH 22/25] Properly fix the previous commit.

---
 extensions/firefox/components/pdfContentHandler.js | 1 -
 1 file changed, 1 deletion(-)

diff --git a/extensions/firefox/components/pdfContentHandler.js b/extensions/firefox/components/pdfContentHandler.js
index 5f659bd9c..444db1c1f 100644
--- a/extensions/firefox/components/pdfContentHandler.js
+++ b/extensions/firefox/components/pdfContentHandler.js
@@ -55,7 +55,6 @@ pdfContentHandler.prototype = {
     if (targetUrl.indexOf('?pdfjs.action=download') >= 0)
       throw NS_ERROR_WONT_HANDLE_CONTENT;
 
-    aRequest.cancel(Cr.NS_BINDING_ABORTED);
     aRequest.cancel(Cr.NS_BINDING_ABORTED);
     window.location = url.replace('%s', encodeURIComponent(targetUrl));
   },

From 1f80b0b26692617a72eae44fcd42f007dd964fa8 Mon Sep 17 00:00:00 2001
From: Artur Adib <arturadib@gmail.com>
Date: Tue, 1 Nov 2011 08:46:39 -0400
Subject: [PATCH 23/25] Replace andreasgal/pdf.js --> mozilla/pdf.js

---
 Makefile                       |  2 +-
 README.md                      | 10 +++++-----
 extensions/firefox/install.rdf |  2 +-
 web/index.html.template        | 18 +++++++++---------
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/Makefile b/Makefile
index 80003bdf6..3484ab414 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-REPO = git@github.com:andreasgal/pdf.js.git
+REPO = git@github.com:mozilla/pdf.js.git
 BUILD_DIR := build
 BUILD_TARGET := $(BUILD_DIR)/pdf.js
 DEFAULT_BROWSERS := resources/browser_manifests/browser_manifest.json
diff --git a/README.md b/README.md
index 42669da28..d6d2d886d 100644
--- a/README.md
+++ b/README.md
@@ -39,7 +39,7 @@ However, note that the extension might not reflect the latest source in our mast
 
 To get a local copy of the current code, clone it using git:
 
-    $ git clone git://github.com/andreasgal/pdf.js.git pdfjs
+    $ git clone git://github.com/mozilla/pdf.js.git pdfjs
     $ cd pdfjs
 
 Next, you need to start a local web server as some browsers don't allow opening
@@ -73,7 +73,7 @@ Additional resources are available in a separate section below.
 
 For a "hello world" example, take a look at:
 
-+ [examples/helloworld/hello.js](https://github.com/andreasgal/pdf.js/blob/master/examples/helloworld/hello.js)
++ [examples/helloworld/hello.js](https://github.com/mozilla/pdf.js/blob/master/examples/helloworld/hello.js)
 
 This example illustrates the bare minimum ingredients for integrating pdf.js
 in a custom project.
@@ -92,10 +92,10 @@ workings of PDF and pdf.js:
 
 pdf.js is a community-driven project, so contributors are always welcome. 
 Simply fork our repo and contribute away. A great place to start is our
-[open issues](https://github.com/andreasgal/pdf.js/issues). For better consistency and 
+[open issues](https://github.com/mozilla/pdf.js/issues). For better consistency and 
 long-term stability, please do look around the code and try to follow our conventions.
 More information about the contributor process can be found on the 
-[contributor wiki page](https://github.com/andreasgal/pdf.js/wiki/Contributing).
+[contributor wiki page](https://github.com/mozilla/pdf.js/wiki/Contributing).
 
 If you don't want to hack on the project or have little spare time, __you still
 can help!__ Just open PDFs in the 
@@ -104,7 +104,7 @@ any breakage in rendering.
 
 Our Github contributors so far:
 
-+ https://github.com/andreasgal/pdf.js/contributors
++ https://github.com/mozilla/pdf.js/contributors
 
 You can add your name to it! :)
 
diff --git a/extensions/firefox/install.rdf b/extensions/firefox/install.rdf
index 0dfd6bf57..26b2192b6 100644
--- a/extensions/firefox/install.rdf
+++ b/extensions/firefox/install.rdf
@@ -19,6 +19,6 @@
     <em:unpack>true</em:unpack>
     <em:creator>Vivien Nicolas</em:creator>
     <em:description>pdf.js uri loader</em:description>
-    <em:homepageURL>https://github.com/andreasgal/pdf.js/</em:homepageURL>
+    <em:homepageURL>https://github.com/mozilla/pdf.js/</em:homepageURL>
   </Description>
 </RDF>
diff --git a/web/index.html.template b/web/index.html.template
index 12e606371..44e9a0cbe 100644
--- a/web/index.html.template
+++ b/web/index.html.template
@@ -3,7 +3,7 @@
 <head>
   <meta charset='utf-8'>
 
-  <title>andreasgal/pdf.js @ GitHub</title>
+  <title>mozilla/pdf.js @ GitHub</title>
 
   <style type="text/css">
     body {
@@ -31,18 +31,18 @@
 </head>
 
 <body>
-  <a href="http://github.com/andreasgal/pdf.js"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" /></a>
+  <a href="http://github.com/mozilla/pdf.js"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" /></a>
 
   <div id="container">
 
     <div class="download">
-      <a href="http://github.com/andreasgal/pdf.js/zipball/master">
+      <a href="http://github.com/mozilla/pdf.js/zipball/master">
         <img border="0" width="90" src="http://github.com/images/modules/download/zip.png"></a>
-      <a href="http://github.com/andreasgal/pdf.js/tarball/master">
+      <a href="http://github.com/mozilla/pdf.js/tarball/master">
         <img border="0" width="90" src="http://github.com/images/modules/download/tar.png"></a>
     </div>
 
-    <h1><a href="http://github.com/andreasgal/pdf.js">pdf.js</a>
+    <h1><a href="http://github.com/mozilla/pdf.js">pdf.js</a>
       <span class="small">by <a href="http://github.com/andreasgal">andreasgal</a></span></h1>
 
     <div class="description">
@@ -69,16 +69,16 @@
     <h2>Download</h2>
     <p>
       You can download this project in either
-      <a href="http://github.com/andreasgal/pdf.js/zipball/master">zip</a> or
-      <a href="http://github.com/andreasgal/pdf.js/tarball/master">tar</a> formats.
+      <a href="http://github.com/mozilla/pdf.js/zipball/master">zip</a> or
+      <a href="http://github.com/mozilla/pdf.js/tarball/master">tar</a> formats.
     </p>
     <p>You can also clone the project with <a href="http://git-scm.com">Git</a>
       by running:
-      <pre>$ git clone git://github.com/andreasgal/pdf.js</pre>
+      <pre>$ git clone git://github.com/mozilla/pdf.js</pre>
     </p>
 
     <div class="footer">
-      get the source code on GitHub : <a href="http://github.com/andreasgal/pdf.js">andreasgal/pdf.js</a>
+      get the source code on GitHub : <a href="http://github.com/mozilla/pdf.js">mozilla/pdf.js</a>
     </div>
 
   </div>

From 75bac7d97cb5c18767d484fe5310394008722f0f Mon Sep 17 00:00:00 2001
From: Artur Adib <arturadib@gmail.com>
Date: Tue, 1 Nov 2011 08:49:47 -0400
Subject: [PATCH 24/25] andreasgal.github --> mozilla.github

---
 README.md | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index d6d2d886d..f57d63805 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ successful.
 
 For an online demo, visit:
 
-+ http://andreasgal.github.com/pdf.js/web/viewer.html
++ http://mozilla.github.com/pdf.js/web/viewer.html
 
 This demo provides an interactive interface for displaying and browsing PDFs
 using the pdf.js API.
@@ -31,7 +31,7 @@ using the pdf.js API.
 
 A Firefox extension is also available:
 
-+ http://andreasgal.github.com/pdf.js/extensions/firefox/pdf.js.xpi
++ http://mozilla.github.com/pdf.js/extensions/firefox/pdf.js.xpi
 
 However, note that the extension might not reflect the latest source in our master branch.
 
@@ -99,7 +99,7 @@ More information about the contributor process can be found on the
 
 If you don't want to hack on the project or have little spare time, __you still
 can help!__ Just open PDFs in the 
-[online demo](http://andreasgal.github.com/pdf.js/web/viewer.html) and report 
+[online demo](http://mozilla.github.com/pdf.js/web/viewer.html) and report 
 any breakage in rendering.
 
 Our Github contributors so far:
@@ -150,7 +150,7 @@ See the bot repo for details:
 
 Our demo site is here:
 
-+ http://andreasgal.github.com/pdf.js/web/viewer.html
++ http://mozilla.github.com/pdf.js/web/viewer.html
 
 You can read more about pdf.js here:
 

From 112115c0132c369fb53528d98f5b600b88c555ef Mon Sep 17 00:00:00 2001
From: Artur Adib <arturadib@gmail.com>
Date: Tue, 1 Nov 2011 14:27:02 -0300
Subject: [PATCH 25/25] Update README.md

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index f57d63805..8414ad2a9 100644
--- a/README.md
+++ b/README.md
@@ -143,7 +143,7 @@ against reference images before merging pull requests.
 
 See the bot repo for details:
 
-+ https://github.com/arturadib/pdf.js-bot
++ https://github.com/mozilla/pdf.js-bot
 
 
 ## Additional resources