shadow in the direct object, no defineProperty needed

This commit is contained in:
Andreas Gal 2011-05-02 18:26:18 -07:00
parent 21c54da9d1
commit a6b123016b

17
pdf.js
View File

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