-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow local PDF files to be viewed in local frames
The Chrome extension enforces that local files cannot be embedded in non-local web pages. The previous check was too strict (because the origin of a file:-URL is "null"), and prevented local PDF from being viewed in local files). This patch fixes that problem, by querying the actual tab URL via the background page. Steps to verify: 1. Create a HTML file: `<iframe src=test.pdf width=100% height=100%>` 2. Build and load the extension. 3. Allow file access to the extension at `chrome://extensions` 4. Open the HTML file from a file:// URL. 5. VERIFY: The extension should attempt to load the PDF file. 6. Now open the following (replace ID with the extension ID, which you can find at `chrome://extensions`): `data:text/html,<iframe src="chrome-extension://ID/file:///test.pdf">` 7. VERIFY: The next error should be displayed: "Refused to load a local file in a non-local page for security reasons."
- Loading branch information
Showing
2 changed files
with
58 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters