mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-11-30 16:37:18 +01:00
Add a Content-Security-Policy to pdf.js' viewer.html (bug 1960363)
This commit is contained in:
@@ -26,6 +26,20 @@ See https://github.com/adobe-type-tools/cmap-resources
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
||||
<title>PDF.js viewer</title>
|
||||
|
||||
<!--
|
||||
The print service injects an inline <style>@page { size: … }</style>
|
||||
at print time (web/pdf_print_service.js, web/firefox_print_service.js)
|
||||
to match the PDF's page dimensions. Since the size varies per PDF the
|
||||
content can't be pre-hashed, so style-src-elem allows 'unsafe-inline'.
|
||||
Inline style="…" attributes stay blocked via style-src (no fallback).
|
||||
-->
|
||||
<!--#if MOZCENTRAL-->
|
||||
<!--<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'none'; script-src resource: 'wasm-unsafe-eval'; worker-src resource:; style-src resource:; style-src-elem resource: 'unsafe-inline'; img-src resource: blob: data:; font-src resource:; connect-src resource:; base-uri 'none'; form-action 'none';"
|
||||
/>-->
|
||||
<!--#endif-->
|
||||
|
||||
<!--#if MOZCENTRAL-->
|
||||
<!--#include viewer-snippet-firefox-extension.html-->
|
||||
<!--#endif-->
|
||||
|
||||
@@ -4,19 +4,7 @@
|
||||
users with recognizing which checkbox they have to click when they
|
||||
visit chrome://extensions.
|
||||
-->
|
||||
<p
|
||||
id="chrome-pdfjs-logo-bg"
|
||||
style="
|
||||
display: block;
|
||||
padding-left: 60px;
|
||||
min-height: 48px;
|
||||
background-size: 48px;
|
||||
background-repeat: no-repeat;
|
||||
font-size: 14px;
|
||||
line-height: 1.8em;
|
||||
word-break: break-all;
|
||||
"
|
||||
>
|
||||
<p id="chrome-pdfjs-logo-bg">
|
||||
Click on "<span id="chrome-file-access-label">Allow access to file URLs</span>" at
|
||||
<a id="chrome-link-to-extensions-page">chrome://extensions</a>
|
||||
<br />
|
||||
|
||||
@@ -713,6 +713,25 @@ dialog :link {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
/*#if !MOZCENTRAL*/
|
||||
#printServiceDialog {
|
||||
min-width: 200px;
|
||||
}
|
||||
/*#endif*/
|
||||
|
||||
/*#if CHROME*/
|
||||
#chrome-pdfjs-logo-bg {
|
||||
display: block;
|
||||
padding-left: 60px;
|
||||
min-height: 48px;
|
||||
background-size: 48px;
|
||||
background-repeat: no-repeat;
|
||||
font-size: 14px;
|
||||
line-height: 1.8em;
|
||||
word-break: break-all;
|
||||
}
|
||||
/*#endif*/
|
||||
|
||||
.grab-to-pan-grab {
|
||||
cursor: grab !important;
|
||||
}
|
||||
|
||||
+30
-1
@@ -29,6 +29,35 @@ See https://github.com/adobe-type-tools/cmap-resources
|
||||
<!--#endif-->
|
||||
<title>PDF.js viewer</title>
|
||||
|
||||
<!--
|
||||
The print service injects an inline <style>@page { size: … }</style>
|
||||
at print time (web/pdf_print_service.js, web/firefox_print_service.js)
|
||||
to match the PDF's page dimensions. Since the size varies per PDF the
|
||||
content can't be pre-hashed, so style-src-elem allows 'unsafe-inline'.
|
||||
Inline style="…" attributes stay blocked via style-src (no fallback).
|
||||
-->
|
||||
<!--#if MOZCENTRAL-->
|
||||
<!--<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'none'; script-src resource: 'wasm-unsafe-eval'; worker-src resource:; style-src resource:; style-src-elem resource: 'unsafe-inline'; img-src resource: blob: data:; font-src resource:; connect-src resource:; base-uri 'none'; form-action 'none';"
|
||||
/>-->
|
||||
<!--#elif TESTING-->
|
||||
<!--<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'none'; script-src 'self' 'wasm-unsafe-eval' 'unsafe-eval'; worker-src 'self' blob:; style-src 'self'; style-src-elem 'self' 'unsafe-inline'; img-src 'self' blob: data:; font-src 'self' data:; connect-src * blob: data:; base-uri 'self'; form-action 'none';"
|
||||
/>-->
|
||||
<!--#elif CHROME-->
|
||||
<!--<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'none'; script-src 'self' 'wasm-unsafe-eval'; worker-src 'self' blob:; style-src 'self'; style-src-elem 'self' 'unsafe-inline'; img-src 'self' blob: data:; font-src 'self' data:; connect-src * blob: data:; base-uri 'self'; form-action 'none';"
|
||||
/>-->
|
||||
<!--#else-->
|
||||
<!--<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'none'; script-src 'self' 'wasm-unsafe-eval'; worker-src 'self' blob:; style-src 'self'; style-src-elem 'self' 'unsafe-inline'; img-src 'self' blob: data:; font-src 'self' data:; connect-src * blob: data:; base-uri 'none'; form-action 'none';"
|
||||
/>-->
|
||||
<!--#endif-->
|
||||
|
||||
<!--#if MOZCENTRAL-->
|
||||
<!--#include viewer-snippet-firefox-extension.html-->
|
||||
<!--#elif CHROME-->
|
||||
@@ -1237,7 +1266,7 @@ See https://github.com/adobe-type-tools/cmap-resources
|
||||
</dialog>
|
||||
|
||||
<!--#if !MOZCENTRAL-->
|
||||
<dialog id="printServiceDialog" style="min-width: 200px">
|
||||
<dialog id="printServiceDialog">
|
||||
<div class="row">
|
||||
<span data-l10n-id="pdfjs-print-progress-message"></span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user