b354682dd6
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 |
||
---|---|---|
.. | ||
images | ||
.gitignore | ||
annotation_layer_builder.css | ||
annotation_layer_builder.js | ||
app.js | ||
chrome-i18n-allow-access-to-file-urls.json | ||
chromecom.js | ||
compatibility.js | ||
compressed.tracemonkey-pldi-09.pdf | ||
debugger.js | ||
default_preferences.js | ||
default_preferences.json | ||
dom_events.js | ||
download_manager.js | ||
firefoxcom.js | ||
grab_to_pan.js | ||
hand_tool.js | ||
interfaces.js | ||
mozPrintCallback_polyfill.js | ||
overlay_manager.js | ||
password_prompt.js | ||
pdf_attachment_viewer.js | ||
pdf_document_properties.js | ||
pdf_find_bar.js | ||
pdf_find_controller.js | ||
pdf_history.js | ||
pdf_link_service.js | ||
pdf_outline_viewer.js | ||
pdf_page_view.js | ||
pdf_presentation_mode.js | ||
pdf_rendering_queue.js | ||
pdf_sidebar.js | ||
pdf_thumbnail_view.js | ||
pdf_thumbnail_viewer.js | ||
pdf_viewer.component.js | ||
pdf_viewer.css | ||
pdf_viewer.js | ||
pdfjs.js | ||
preferences.js | ||
secondary_toolbar.js | ||
text_layer_builder.css | ||
text_layer_builder.js | ||
ui_utils.js | ||
view_history.js | ||
viewer-snippet-chrome-extension.html | ||
viewer-snippet-chrome-overlays.html | ||
viewer-snippet-firefox-extension.html | ||
viewer-snippet-minified.html | ||
viewer-snippet-mozPrintCallback-polyfill.html | ||
viewer-snippet.html | ||
viewer.css | ||
viewer.html | ||
viewer.js |