Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10284)

Unified Diff: chrome/browser/resources/pdf/browser_api.js

Issue 2407713002: Limit PDF helper extension to print preview only (Closed)
Patch Set: Nits + fix compilation failure on macOS Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/pdf/browser_api.js
diff --git a/chrome/browser/resources/pdf/browser_api.js b/chrome/browser/resources/pdf/browser_api.js
index 90033b84085322370cabe103d2970fd738817a56..051a5aff5bcf490d7bb44f3e0111705a001c140e 100644
--- a/chrome/browser/resources/pdf/browser_api.js
+++ b/chrome/browser/resources/pdf/browser_api.js
@@ -206,8 +206,12 @@ function createBrowserApiForStandaloneExtension() {
* current environment.
*/
function createBrowserApi() {
- if (window.location.search)
+ if (location.search) {
+ if (location.ancestorOrigins[0] !== 'chrome://print') {
raymes 2016/10/12 02:08:52 I think it could be good to rework these 2 checks.
robwu 2016/10/12 11:33:28 Are you sure about the claim that this snippet run
raymes 2016/10/13 00:43:22 Yes I'm fairly sure. PDFCreateOutOfProcessPlugin l
robwu 2016/10/13 23:29:30 Done.
+ throw new Error('Refused to load the standalone extension.');
+ }
return createBrowserApiForStandaloneExtension();
+ }
return createBrowserApiForMimeHandlerView();
}

Powered by Google App Engine
This is Rietveld 408576698