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

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

Issue 1217503012: Avoid cross-origin iframe issues when loading PDF in print preview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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/pdf_scripting_api.js
diff --git a/chrome/browser/resources/pdf/pdf_scripting_api.js b/chrome/browser/resources/pdf/pdf_scripting_api.js
index 4a08195c83c5777d1b51c17883e9bde18ed3a017..63fd0480f6c91fb00137f24757b19f4b63074045 100644
--- a/chrome/browser/resources/pdf/pdf_scripting_api.js
+++ b/chrome/browser/resources/pdf/pdf_scripting_api.js
@@ -56,7 +56,8 @@ function PDFScriptingAPI(window, plugin) {
this.setPlugin(plugin);
window.addEventListener('message', function(event) {
- if (event.origin != 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai') {
+ if (event.origin != 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai' &&
+ event.origin != 'chrome://print') {
console.error('Received message that was not from the extension: ' +
event);
return;
@@ -270,9 +271,7 @@ PDFScriptingAPI.prototype = {
*/
function PDFCreateOutOfProcessPlugin(src) {
var iframe = window.document.createElement('iframe');
- iframe.setAttribute(
- 'src',
- 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html?' + src);
+ iframe.setAttribute('src', 'pdf_preview.html?' + src);
// Prevent the frame from being tab-focusable.
iframe.setAttribute('tabindex', '-1');
var client = new PDFScriptingAPI(window);

Powered by Google App Engine
This is Rietveld 408576698