Skip to content
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

Merged
merged 1 commit into from
Sep 29, 2015
Merged

Remove Parser_fetchIfRef since it's obsolete #6411

merged 1 commit into from
Sep 29, 2015

Conversation

Snuffleupagus
Copy link
Collaborator

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.

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
Copy link
Collaborator Author

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);

@Snuffleupagus
Copy link
Collaborator Author

Note that if this PR is accepted, then #6045 becomes obsolete.

@timvandermeij
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://107.21.233.14:8877/0cc258882004aff/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://107.22.172.223:8877/5d0392485d5a9a5/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/5d0392485d5a9a5/output.txt

Total script time: 18.43 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/0cc258882004aff/output.txt

Total script time: 19.43 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

timvandermeij added a commit that referenced this pull request Sep 29, 2015
Remove `Parser_fetchIfRef` since it's obsolete
@timvandermeij timvandermeij merged commit 1bdfc47 into mozilla:master Sep 29, 2015
@timvandermeij
Copy link
Contributor

Nice find, thank you!

@Snuffleupagus Snuffleupagus deleted the remove-Parser_fetchIfRef branch September 30, 2015 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants