Chromium throw an error on calling defineProperty on a getter only

This commit is contained in:
Vivien Nicolas 2011-08-31 14:41:21 +02:00
parent 763bd7059a
commit c7195a4450

24
pdf.js
View File

@ -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)) {