From 32313b9149b0849731ce4501551cd68cdea91c96 Mon Sep 17 00:00:00 2001 From: Rob Wu Date: Thu, 5 Dec 2013 11:16:14 +0100 Subject: [PATCH] Insert dummy content script at every location. This is needed for propagating the extension's permissions to the extension's iframe, in the rare event that the PDF is loaded in a sub frame, and the extension does not have access to the top frame. For instance, when a http:-PDF file is embedded in a local file, while "Allow access to local URLs" is disabled. Note: Propagating permissions by inserting content scripts is an undocumented feature (http://crbug.com/302548). Whenever it breaks, the issue (cross-domain permissions for XHR) can be solved by using a content script that gets the blob using the XMLHttpRequest API, followed by `postMessage` (via transferables) to efficiently pass the arraybuffer back to the PDF Viewer. --- extensions/chromium/manifest.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/extensions/chromium/manifest.json b/extensions/chromium/manifest.json index f19986246..48802ed97 100644 --- a/extensions/chromium/manifest.json +++ b/extensions/chromium/manifest.json @@ -22,7 +22,12 @@ */ "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4zyYTii0VTKI7W2U6fDeAvs3YCVZeAt7C62IC64IDCMHvWy7SKMpOPjfg5v1PgYkFm+fGsCsVLN8NaF7fzYMVtjLc5bqhqPAi56Qidrqh1HxPAAYhwFQd5BVGhZmh1fySHXFPE8VI2tIHwRrASOtx67jbSEk4nBAcJz6n+eGq8QIDAQAB", "content_scripts": [{ - "matches": ["file://*/*"], + "matches": [ + "http://*/*", + "https://*/*", + "ftp://*/*", + "file://*/*" + ], "js": ["nothing.js"] }], "mime_types": [