pdf.js/web
Jonas Jenwald b354682dd6 [api-minor] Let LinkAnnotation/PDFLinkService_getDestinationHash return a stringified version of the destination array for explicit destinations
Currently for explicit destinations, compared to named destinations, we manually try to build a hash that often times is a quite poor representation of the *actual* destination. (Currently this only, kind of, works for `\XYZ` destinations.)
For PDF files using explicit destinations, this can make it difficult/impossible to obtain a link to a specific section of the document through the URL.

Note that in practice most PDF files, especially newer ones, use named destinations and these are thus unnaffected by this patch.
This patch also fixes an existing issue in `PDFLinkService_getDestinationHash`, where a named destination consisting of only a number would not be handled correctly.

With the added, and already existing, type checks in place for destinations, I really don't think that this patch exposes any "sensitive" internal destination code not already accessible through normal hash parameters.

*Please note:* Just trying to improve the algorithm that generates the hash is unfortunately not possible in general, since there are a number of cases where it will simply never work well.

 - First of all, note that `getDestinationHash` currently relies on the `_pagesRefCache`, hence it's possible that the hash returned is empty during e.g. ranged/streamed loading of a PDF file.

 - Second of all, the currently computed hash is actually dependent on the document rotation. With named destinations, the fetched internal destination array is rotational invariant (as it should be), but this will not hold in general for the hash. We can easily avoid this issue by using a stringified destination array.

 - Third of all, note that according to the PDF specification[1], `GoToR` destinations may actually contain explicit destination arrays. Since we cannot really construct a hash in `annotation.js`, we currently have no good way to support those. Even though this case seems *very* rare in practice (I've not actually seen such a PDF file), it's in the specification, and this patch allows us to support that for "free".

---
[1] http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#G11.1951685
2016-05-21 14:14:07 +02:00
..
images Add mirrored triangle (TOC item icon) 2015-09-06 15:35:58 +02:00
.gitignore Remove obselete file from .gitignore 2015-01-26 16:44:45 +01:00
annotation_layer_builder.css Implement support for FileAttachment annotations 2016-02-23 22:49:53 +01:00
annotation_layer_builder.js Export the DefaultAnnotationLayerFactory to prevent the viewer components from breaking (PR 7172 followup) 2016-04-13 17:42:04 +02:00
app.js [api-minor] Let LinkAnnotation/PDFLinkService_getDestinationHash return a stringified version of the destination array for explicit destinations 2016-05-21 14:14:07 +02:00
chrome-i18n-allow-access-to-file-urls.json Add translations of "Allow access to file URLs" 2015-08-14 18:59:55 +02:00
chromecom.js Moves DEFAULT_PREFENCES into JSON format. 2016-05-11 17:58:17 -05:00
compatibility.js Added context to compatibility.js to have 'use strict' directive in our context only 2016-05-12 10:04:51 +02:00
compressed.tracemonkey-pldi-09.pdf Add Makefile. Move some files around to make building the website easier. 2011-07-05 10:53:57 -07:00
debugger.js Enables debugger only when needed. 2016-05-09 18:18:43 -05:00
default_preferences.js Moves DEFAULT_PREFENCES into JSON format. 2016-05-11 17:58:17 -05:00
default_preferences.json Moves DEFAULT_PREFENCES into JSON format. 2016-05-11 17:58:17 -05:00
dom_events.js Disable pagechange event if page is not changing. 2016-05-04 11:06:07 -05:00
download_manager.js Replace pdfjsLib with module that represents pdf.js. 2016-04-13 10:11:34 -05:00
firefoxcom.js Refactors PDFFindBar and FirefoxCom find events. 2016-04-28 07:11:40 -05:00
grab_to_pan.js Update grab_to_pan.js 2016-05-07 23:46:56 +02:00
hand_tool.js Removes circular dependency of secondary toolbar on app.js. 2016-04-28 15:04:09 -05:00
interfaces.js Remove a superfluous "s" in AnnotationsLayerBuilder from files in web/ 2015-12-18 19:55:54 +01:00
mozPrintCallback_polyfill.js Introduces UMD headers to the web/ folder. 2016-04-13 10:09:48 -05:00
overlay_manager.js Moves all document.getElementById lookups into viewer.js 2016-04-21 11:39:11 -05:00
password_prompt.js Moves all document.getElementById lookups into viewer.js 2016-04-21 11:39:11 -05:00
pdf_attachment_viewer.js Adds EventBus. 2016-04-28 06:57:24 -05:00
pdf_document_properties.js Moves all document.getElementById lookups into viewer.js 2016-04-21 11:39:11 -05:00
pdf_find_bar.js Adds EventBus. 2016-04-28 06:57:24 -05:00
pdf_find_controller.js Remove unused variables 2016-05-11 16:11:13 +02:00
pdf_history.js Fixes some static analysis warnings and recommendations 2016-05-02 17:34:58 -05:00
pdf_link_service.js [api-minor] Let LinkAnnotation/PDFLinkService_getDestinationHash return a stringified version of the destination array for explicit destinations 2016-05-21 14:14:07 +02:00
pdf_outline_viewer.js Fixes some static analysis warnings and recommendations 2016-05-02 17:34:58 -05:00
pdf_page_view.js Remove unused variables 2016-05-11 16:11:13 +02:00
pdf_presentation_mode.js Removes circular dependency of secondary toolbar on app.js. 2016-04-28 15:04:09 -05:00
pdf_rendering_queue.js Introduces UMD headers to the web/ folder. 2016-04-13 10:09:48 -05:00
pdf_sidebar.js Adds EventBus. 2016-04-28 06:57:24 -05:00
pdf_thumbnail_view.js Introduces UMD headers to the web/ folder. 2016-04-13 10:09:48 -05:00
pdf_thumbnail_viewer.js Fixes some static analysis warnings and recommendations 2016-05-02 17:34:58 -05:00
pdf_viewer.component.js Fixes AMD name in the web/pdf_viewer.js. 2016-05-16 12:01:29 -05:00
pdf_viewer.css Better components examples. 2016-04-28 13:30:03 -05:00
pdf_viewer.js [api-minor] Let LinkAnnotation/PDFLinkService_getDestinationHash return a stringified version of the destination array for explicit destinations 2016-05-21 14:14:07 +02:00
pdfjs.js Replace pdfjsLib with module that represents pdf.js. 2016-04-13 10:11:34 -05:00
preferences.js Moves DEFAULT_PREFENCES into JSON format. 2016-05-11 17:58:17 -05:00
secondary_toolbar.js Convert the secondary toolbar to a class 2016-05-11 20:53:39 +02:00
text_layer_builder.css Use default line height for the text layer 2015-12-02 23:00:12 +01:00
text_layer_builder.js Remove unused variables 2016-05-11 16:11:13 +02:00
ui_utils.js Adds EventBus. 2016-04-28 06:57:24 -05:00
view_history.js Introduces UMD headers to the web/ folder. 2016-04-13 10:09:48 -05:00
viewer-snippet-chrome-extension.html Remove type="text/javascript" from script tags. 2014-05-13 02:41:01 +02:00
viewer-snippet-chrome-overlays.html Add translations of "Allow access to file URLs" 2015-08-14 18:59:55 +02:00
viewer-snippet-firefox-extension.html Remove XHTML leftovers from the viewer HTML files 2016-02-14 13:23:34 +01:00
viewer-snippet-minified.html Remove XHTML leftovers from the viewer HTML files 2016-02-14 13:23:34 +01:00
viewer-snippet-mozPrintCallback-polyfill.html Revert PR 5510, except in WebKit browsers, for breaking print preview in Firefox 2015-03-07 00:16:55 +01:00
viewer-snippet.html Remove XHTML leftovers from the viewer HTML files 2016-02-14 13:23:34 +01:00
viewer.css Fix insertion of blank pages during printing due to non-matching page sizes 2016-03-21 14:21:07 -07:00
viewer.html Enables debugger only when needed. 2016-05-09 18:18:43 -05:00
viewer.js Convert the secondary toolbar to a class 2016-05-11 20:53:39 +02:00