pdf.js/web
Jonas Jenwald 108258a8f8 [Firefox] Allow PDF attachments to, once again, be opened directly in the browser (bug 1632644)
Apparently the old link format used in MOZCENTRAL-builds, with the blob URL separated from the filename with a `?` character violates the specification; see https://bugzilla.mozilla.org/show_bug.cgi?id=1632644#c5

Obviously just removing the `?`-part of the URL would have worked, but that would also have meant that we'd no longer be able to provide the correct filename when the user attempts to download the opened PDF attachment.
To fix this we'll instead append the filename in the hash-part of the URL, which however required using a *custom* hash-parameter to avoid triggering the fallback "named destination" code-paths in the viewer.

Note that only changing the `web/pdf_attachment_viewer.js` file wasn't sufficient to fix the bug, and we also need to tweak the `webViewerInitialized` function in `web/app.js` since MOZCENTRAL-builds used to ignore *everything* in the URL hash.
This particular code is very old, but changing it *should* be completely safe given that the `PDFViewerApplication.setTitleUsingUrl` method since some time now stores both the original URL (in `this.url`) as well as one without the hash (in `this.baseUrl`). The latter one is already used everywhere where it matters, so this change seem fine to me.

This patch thus restores the original behaviour for PDF attachments in the MOZCENTRAL-build, by once again allowing them to be opened *directly* in the browser without downloading. (The fallback added in PR 11845 is obviously kept, since it seems generally useful to have.)
2020-05-20 12:08:59 +02:00
..
images Replace the RTL images with CSS transforms of the standard images (issue 11766) 2020-03-30 22:47:49 +02:00
.eslintrc Enable the ESLint prefer-const rule globally (PR 11450 follow-up) 2020-01-25 00:20:22 +01:00
.gitignore Remove obselete file from .gitignore 2015-01-26 16:44:45 +01:00
annotation_layer_builder.css Convert all six-digit HEX colors to RGBA colors 2020-01-01 14:52:37 +01:00
annotation_layer_builder.js Ensure that all import and require statements, in the entire code-base, have a .js file extension 2020-01-04 13:01:43 +01:00
app_options.js Avoid reading the "disablePreferences"/"locale" options, when initializing the viewer, in extension builds 2020-04-20 13:09:33 +02:00
app.js [Firefox] Allow PDF attachments to, once again, be opened directly in the browser (bug 1632644) 2020-05-20 12:08:59 +02:00
base_viewer.js Enable the dot-notation ESLint rule 2020-04-17 12:24:46 +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 Update Prettier to version 2.0 2020-04-14 12:28:14 +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 Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
download_manager.js Enable the ESLint prefer-const rule in the web/ directory 2019-12-27 01:03:58 +01:00
firefox_print_service.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
firefoxcom.js Use the native URL.createObjectURL method more in web/firefoxcom.js 2020-04-24 11:29:33 +02:00
genericcom.js Re-factor the various ExternalServices, used in the default viewer, to classes with static methods 2020-01-15 14:26:47 +01:00
genericl10n.js Enable import/extensions of ESlint plugin to enforce all import have a .js file extension. 2020-01-18 10:53:01 +09:00
grab_to_pan.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
interfaces.js [api-minor] Deprecate getGlobalEventBus and update the "viewer components" examples accordingly 2020-02-27 14:44:48 +01:00
overlay_manager.js Fix the linting errors, from the Prettier auto-formatting, that ESLint --fix couldn't handle 2019-12-26 12:35:12 +01:00
password_prompt.js Ensure that all import and require statements, in the entire code-base, have a .js file extension 2020-01-04 13:01:43 +01:00
pdf_attachment_viewer.js [Firefox] Allow PDF attachments to, once again, be opened directly in the browser (bug 1632644) 2020-05-20 12:08:59 +02:00
pdf_cursor_tools.js Re-factor the EventBus to allow servicing of "external" event listeners *after* the viewer components have updated 2020-02-27 19:38:13 +01:00
pdf_document_properties.js Enable the dot-notation ESLint rule 2020-04-17 12:24:46 +02:00
pdf_find_bar.js [api-minor] Remove the getGlobalEventBus viewer functionality (PR 11631 follow-up) 2020-03-29 12:20:23 +02:00
pdf_find_controller.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
pdf_find_utils.js Enable auto-formatting of the entire code-base using Prettier (issue 11444) 2019-12-26 12:34:24 +01:00
pdf_history.js Attempt to respect the "zoom" hash parameter, even when the "nameddest" parameter is present (issue 11875) 2020-05-07 13:53:07 +02:00
pdf_link_service.js Attempt to respect the "zoom" hash parameter, even when the "nameddest" parameter is present (issue 11875) 2020-05-07 13:53:07 +02:00
pdf_outline_viewer.js Re-factor the EventBus to allow servicing of "external" event listeners *after* the viewer components have updated 2020-02-27 19:38:13 +01:00
pdf_page_view.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
pdf_presentation_mode.js Add passive: false when removing wheel listeners 2020-03-25 22:42:27 +08:00
pdf_print_service.js Enable the dot-notation ESLint rule 2020-04-17 12:24:46 +02:00
pdf_rendering_queue.js Prevent circular references in the /Pages tree 2020-02-19 01:49:39 +01:00
pdf_sidebar_resizer.js Re-factor the EventBus to allow servicing of "external" event listeners *after* the viewer components have updated 2020-02-27 19:38:13 +01:00
pdf_sidebar.js Remove variable shadowing from the JavaScript files in the web/ folder 2020-03-13 12:59:58 +01:00
pdf_single_page_viewer.js Rename BaseViewer._setDocumentViewerElement to BaseViewer._viewerElement 2020-03-24 16:54:37 +01:00
pdf_thumbnail_view.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
pdf_thumbnail_viewer.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
pdf_viewer.component.js [api-minor] Deprecate getGlobalEventBus and update the "viewer components" examples accordingly 2020-02-27 14:44:48 +01:00
pdf_viewer.css Convert all named colors to RGBA colors 2020-01-01 14:48:56 +01:00
pdf_viewer.js Rename BaseViewer._setDocumentViewerElement to BaseViewer._viewerElement 2020-03-24 16:54:37 +01:00
pdfjs.js Enable auto-formatting of the entire code-base using Prettier (issue 11444) 2019-12-26 12:34:24 +01:00
preferences.js Remove the SystemJS dependency from the web/preferences.js file 2020-05-16 16:22:15 +02:00
secondary_toolbar.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
text_layer_builder.css Convert all RGB colors to RGBA colors 2020-01-01 14:48:55 +01:00
text_layer_builder.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
toolbar.js Update Prettier to version 2.0 2020-04-14 12:28:14 +02:00
ui_utils.js [Firefox] Allow PDF attachments to, once again, be opened directly in the browser (bug 1632644) 2020-05-20 12:08:59 +02:00
view_history.js Add a bit more validation in the ViewHistory constructor 2020-03-21 13:55:06 +01:00
viewer_compatibility.js Reduce the usage of require statements in code-paths not protected by pre-processor and/or run-time checks 2020-05-14 15:57:49 +02:00
viewer-snippet-chrome-extension.html Wraps mozL10n to async calls; splits firefox and generic l10n libs. 2017-05-31 09:22:25 -05:00
viewer-snippet-chrome-overlays.html [CRX] Add file chooser as fallback (fixes #9411) 2018-03-21 18:21:46 +01:00
viewer-snippet-firefox-extension.html Stop bundling the ReadableStream polyfill in MOZCENTRAL builds (PR 10470 follow-up) 2019-01-23 20:33:20 +01:00
viewer-snippet-minified.html Remove XHTML leftovers from the viewer HTML files 2016-02-14 13:23:34 +01:00
viewer-snippet.html Wraps mozL10n to async calls; splits firefox and generic l10n libs. 2017-05-31 09:22:25 -05:00
viewer.css Add a new pdfjs.enablePermissions preference, off by default, to allow the PDF documents to disable copying in the viewer (bug 792816) 2020-04-08 18:20:47 +02:00
viewer.html Suppress browser autofill on page number 2020-04-16 09:49:17 +01:00
viewer.js Always attempt to dispatch the "webviewerloaded" event at the embedding document (PR 10318 follow-up, issue 11829) 2020-04-22 22:52:20 +02:00