]> git.parisson.com Git - pdf.js.git/commitdiff
Chromium throw an error on calling defineProperty on a getter only
authorVivien Nicolas <21@vingtetun.org>
Wed, 31 Aug 2011 12:41:21 +0000 (14:41 +0200)
committerVivien Nicolas <21@vingtetun.org>
Wed, 31 Aug 2011 12:41:21 +0000 (14:41 +0200)
pdf.js

diff --git a/pdf.js b/pdf.js
index 46f946c40561ea5ad9dbfcf0e11ef4effe64f5f6..1a586e48afbc29e172019802ed52ca5f850a0ee3 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -55,11 +55,17 @@ function backtrace() {
 }
 
 function shadow(obj, prop, value) {
-  Object.defineProperty(obj, prop, { value: value,
-                                     enumerable: true,
-                                     configurable: true,
-                                     writable: false });
-    return value;
+  try {
+    Object.defineProperty(obj, prop, { value: value,
+                                       enumerable: true,
+                                       configurable: true,
+                                       writable: false });
+  } catch(e) {
+    obj.__defineGetter__(prop, function() {
+      return value;
+    });
+  }
+  return value;
 }
 
 function bytesToString(bytes) {
@@ -4275,6 +4281,10 @@ var PartialEvaluator = (function() {
             case 'Type1':
               baseEncoding = Encodings.StandardEncoding.slice();
               break;
+            case 'Type3':
+              // There is no baseEncoding for a Type3 font, the 'Encoding'
+              // entry is required and should provide a complete encoding
+              break;
             default:
               warn('Unknown type of font: ' + fontType);
               break;
@@ -4298,6 +4308,10 @@ var PartialEvaluator = (function() {
             glyphsMap[glyph] = encodingMap[i] = GlyphsUnicode[glyph] || i;
         }
 
+        
+        if (fontType == 'Type3')
+        log(glyphsMap);
+
         if (fontType == 'TrueType' && fontDict.has('ToUnicode') && differences) {
           var cmapObj = xref.fetchIfRef(fontDict.get('ToUnicode'));
           if (IsName(cmapObj)) {