Don't directly access the private map
in setGState
, and ensure that we avoid indirect objects
*This patch is based on something I noticed while debugging some of the PDF files in issue 6931.* In a number of the cases in `setGState`, we're implicitly assuming that we're not dealing with indirect objects (i.e. `Ref`s). See e.g. the 'Font' case, or the various cases where we simply do `gStateObj.push([key, value]);` (since the code in `canvas.js` won't be able to deal with a `Ref` for those cases). The reason that I didn't use `Dict_forEach` instead, is that it would re-introduce the unncessary closures that PR 5205 removed.
This commit is contained in:
parent
2d4a1aa0af
commit
a1fe2cb443
@ -468,11 +468,12 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
xref, stateManager) {
|
||||
// This array holds the converted/processed state data.
|
||||
var gStateObj = [];
|
||||
var gStateMap = gState.map;
|
||||
var gStateKeys = gState.getKeys();
|
||||
var self = this;
|
||||
var promise = Promise.resolve();
|
||||
for (var key in gStateMap) {
|
||||
var value = gStateMap[key];
|
||||
for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
|
||||
var key = gStateKeys[i];
|
||||
var value = gState.get(key);
|
||||
switch (key) {
|
||||
case 'Type':
|
||||
break;
|
||||
@ -505,12 +506,11 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
gStateObj.push([key, false]);
|
||||
break;
|
||||
}
|
||||
var dict = xref.fetchIfRef(value);
|
||||
if (isDict(dict)) {
|
||||
promise = promise.then(function () {
|
||||
if (isDict(value)) {
|
||||
promise = promise.then(function (dict) {
|
||||
return self.handleSMask(dict, resources, operatorList,
|
||||
task, stateManager);
|
||||
});
|
||||
}.bind(this, value));
|
||||
gStateObj.push([key, true]);
|
||||
} else {
|
||||
warn('Unsupported SMask type');
|
||||
|
Loading…
Reference in New Issue
Block a user