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

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

Issue 2407683002: PDF: Check the loaded URL in sendScriptingMessage_(). (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | pdf/document_loader.h » ('j') | pdf/document_loader.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/pdf/pdf.js
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js
index 9805660b562c34e82cae189e4670abaace68eb8e..0a24f7e346e3f8c8866c6b54aa6a58a0e12920c0 100644
--- a/chrome/browser/resources/pdf/pdf.js
+++ b/chrome/browser/resources/pdf/pdf.js
@@ -94,6 +94,7 @@ PDFViewer.DARK_BACKGROUND_COLOR = '0xFF525659';
function PDFViewer(browserApi) {
this.browserApi_ = browserApi;
this.originalUrl_ = this.browserApi_.getStreamInfo().originalUrl;
+ this.actualUrl_ = null;
this.loadState_ = LoadState.LOADING;
this.parentWindow_ = null;
this.parentOrigin_ = null;
@@ -602,6 +603,9 @@ PDFViewer.prototype = {
case 'goToPage':
this.viewport_.goToPage(message.data.page);
break;
+ case 'gotActualURL':
+ this.actualUrl_ = message.data.actualURL;
+ break;
case 'loadProgress':
this.updateProgress_(message.data.progress);
break;
@@ -842,6 +846,8 @@ PDFViewer.prototype = {
targetOrigin = this.parentOrigin_;
else if (message.type == 'documentLoaded')
targetOrigin = '*';
+ else if (this.actualUrl_)
+ targetOrigin = this.actualUrl_;
else
targetOrigin = this.originalUrl_;
this.parentWindow_.postMessage(message, targetOrigin);
« no previous file with comments | « no previous file | pdf/document_loader.h » ('j') | pdf/document_loader.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698