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

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

Issue 2402873002: Add check for file:-navigations from PDFs (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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/pdf/navigator.js
diff --git a/chrome/browser/resources/pdf/navigator.js b/chrome/browser/resources/pdf/navigator.js
index 1e9a13c6b25e366f3f663e714387d9c66f9771a3..812299790ad6f16b285ccdccd2576fa7fb844461 100644
--- a/chrome/browser/resources/pdf/navigator.js
+++ b/chrome/browser/resources/pdf/navigator.js
@@ -54,6 +54,9 @@ NavigatorDelegate.prototype = {
* @param {boolean} active Indicates if the new tab should be the active tab.
*/
navigateInNewTab: function(url, active) {
+ if (!this.isSourceFileUrl_ && /^file:/i.test(url))
+ return;
+
// Prefer the tabs API because it guarantees we can just open a new tab.
// window.open doesn't have this guarantee.
if (chrome.tabs)
@@ -68,6 +71,9 @@ NavigatorDelegate.prototype = {
* @param {string} url The url to be opened in the new window.
*/
navigateInNewWindow: function(url) {
+ if (!this.isSourceFileUrl_ && /^file:/i.test(url))
Lei Zhang 2016/10/10 21:07:04 Can we write a helper function and call it from mu
raymes 2016/10/11 06:37:42 +1 Could you also please add a test to this to na
robwu 2016/10/12 22:08:01 Done.
+ return;
+
// Prefer the windows API because it guarantees we can just open a new
// window. window.open with '_blank' argument doesn't have this guarantee.
if (chrome.windows)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698