Commit Graph

4 Commits

Author SHA1 Message Date
Jonas Jenwald
f0aa08b464 Convert the existing overlays to use <dialog> elements (issue 14698)
This replaces our *custom* overlays with standard `<dialog>` DOM elements, see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog, thus simplifying the related CSS, HTML, and JavaScript code.

With these changes, some of the functionality of the `OverlayManager` class is now handled natively (e.g. `Esc` to close the dialog). However, since we still need to be able to prevent dialogs from overlaying one another, it still makes sense to keep this functionality (as far as I'm concerned).
2022-03-28 11:36:29 +02:00
Rob Wu
29c370af27 [CRX] Add file chooser as fallback (fixes #9411)
Test case to exercise the different encodings:
1. Create a file "some file#@%M<br>%25 .pdf"
2. Build the extension with `gulp chromium` and load it in Chrome.
3. Go to `chrome://extensions/` and ensure that the
   "Allow access to file URLs" is disabled.
4. Try to open the file from step 1 in Chrome (maybe reload once).
5. PDF.js should be showing a file chooser button.
6. Click on that button and select a different file.

   Test: Check that a confirmation dialog pops up that warns about
   a different file name. Cancel the dialog.

7. Click on the button again and select the original file.

   Test: Check that the file opens as expected.
2018-03-21 18:21:46 +01:00
Rob Wu
cf1d398bd2 Add translations of "Allow access to file URLs"
The JSON file is generated as follows.

1. Go to the src/chrome/app/resources directory of Chromium's source.

2. Find the translation ID of the "Allow access to file URLs" string:

grep 'Allow access to file URLs' generated_resources_en-GB.xtb

3. With the ID that you've found, locate the other translations.

grep 3341703758641437857 generated_resources_*.xtb

4. If the result looks OK, serialize the result as JSON and save it.

> path/to/pdf.js/web/chrome-i18n-allow-access-to-file-urls.json \
python -c "import json;print(json.dumps({ \
$(grep 3341703758641437857 generated_resources_*.xtb | \
 sed "s@generated_resources_\([^.]\+\)\.xtb:<translation[^>]\+>\(.\+\)</translation>@'\1':'''\2''',@" \
)}, sort_keys=True, indent=2))"

(Strings are taken from Chromium 45.0.2448.0 (ccrev.com/337313).
2015-08-14 18:59:55 +02:00
Rob Wu
775d4e69cf Teach users how to enable access to local files. 2015-08-14 18:59:30 +02:00