]> git.parisson.com Git - pdf.js.git/commitdiff
shadow in the direct object, no defineProperty needed
authorAndreas Gal <andreas.gal@gmail.com>
Tue, 3 May 2011 01:26:18 +0000 (18:26 -0700)
committerAndreas Gal <andreas.gal@gmail.com>
Tue, 3 May 2011 01:26:18 +0000 (18:26 -0700)
pdf.js

diff --git a/pdf.js b/pdf.js
index 0437816dc60cf6c973ea2dd717d3a7686e982669..62317e64effa250168d2e0aa46cc8011e00ecf89 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -558,15 +558,6 @@ var PDFDoc = (function () {
         this.setup(arrayBuffer);
     }
 
-    function ShadowGetter(obj, name, value) {
-        Object.defineProperty(obj, name, {
-            value: value,
-            configurable: false,
-            writable: false,
-            enumerable: true
-        });
-    }
-
     constructor.prototype = {
         get linearization() {
             var length = this.stream.length;
@@ -576,8 +567,8 @@ var PDFDoc = (function () {
                 if (linearization.length != length)
                     linearization = false;
             }
-            ShadowGetter(this, "linearization", linearization);
-            return linearization;
+            // shadow the prototype getter
+            return this.linearization = linearization;
         },
         get startXRef() {
             var startXRef;
@@ -587,8 +578,8 @@ var PDFDoc = (function () {
             } else {
                 // TODO
             }
-            ShadowGetter(this, "startXRef", startXRef);
-            return startXRef;
+            // shadow the prototype getter
+            return this.startXRef = startXRef;
         },
         // Find the header, remove leading garbage and setup the stream
         // starting from the header.