Skip to content

Commit

Permalink
Merge pull request mozilla#7749 from Snuffleupagus/PDFLinkService_set…
Browse files Browse the repository at this point in the history
…Hash-dest-fallback

Avoid accidentally rejecting a named destination that looks like a decimal number or a boolean (PR 7341 follow-up)
  • Loading branch information
timvandermeij authored Oct 27, 2016
2 parents 47a1c77 + 901a2d4 commit e94c294
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions web/pdf_link_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ var PDFLinkService = (function PDFLinkServiceClosure() {
dest = unescape(hash);
try {
dest = JSON.parse(dest);

if (!(dest instanceof Array)) {
// Avoid incorrectly rejecting a valid named destination, such as
// e.g. "4.3" or "true", because `JSON.parse` converted its type.
dest = dest.toString();
}
} catch (ex) {}

if (typeof dest === 'string' || isValidExplicitDestination(dest)) {
Expand Down

0 comments on commit e94c294

Please sign in to comment.