-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Parser_fetchIfRef
since it's obsolete
#6411
Remove Parser_fetchIfRef
since it's obsolete
#6411
Conversation
This code was added in PR 1214, but was made obsolete by PRs 1488/1493. Prior to the latter ones, `Dict_get` retured the raw objects. However, afterwards (and currently) `Dict_get` now resolves indirect objects, which makes `Parser_fetchIfRef` redundant. *Potential risks with this patch:* This patch passes all tests locally, but there's a *small* possibility that it could break some weird PDF files. In the current code, wrapping `Dict_get` inside `Parser_fetchIfRef` will potentially mean two back-to-back call of `XRef_fetch`, if a reference points directly to another reference. I'm not sure if this can actually happen in practice, and I'd think that if that were the case we'd already have run into it elsewhere in the code-base, given that `Parser` is the only place where we try to "double" resolve references.
@@ -416,10 +416,6 @@ var Parser = (function ParserClosure() { | |||
|
|||
return imageStream; | |||
}, | |||
fetchIfRef: function Parser_fetchIfRef(obj) { | |||
// not relying on the xref.fetchIfRef -- xref might not be set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, note how this comment doesn't actually agree entirely with the code. Reading it, I'd expect the next line to read e.g. like this instead:
return (this.xref && isRef(obj) ? this.xref.fetch(obj) : obj);
Note that if this PR is accepted, then #6045 becomes obsolete. |
/botio test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/0cc258882004aff/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://107.22.172.223:8877/5d0392485d5a9a5/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/5d0392485d5a9a5/output.txt Total script time: 18.43 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/0cc258882004aff/output.txt Total script time: 19.43 mins
|
Remove `Parser_fetchIfRef` since it's obsolete
Nice find, thank you! |
This code was added in PR #1214, but was made obsolete by PRs #1488/#1493. Prior to the latter ones,
Dict_get
retured the raw objects. However, afterwards (and currently)Dict_get
now resolves indirect objects, which makesParser_fetchIfRef
redundant.Potential risks with this patch:
This patch passes all tests locally, but there's a small possibility that it could break some weird PDF files.
In the current code, wrapping
Dict_get
insideParser_fetchIfRef
will potentially mean two back-to-back call ofXRef_fetch
, if a reference points directly to another reference. I'm not sure if this can actually happen in practice, and I'd think that if that were the case we'd already have run into it elsewhere in the code-base, given thatParser
is the only place where we try to "double" resolve references.