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) |