Index: chrome/browser/resources/pdf/pdf.js |
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js |
index 3fb61482a5e994149ec83f6ad9d9a90705b18a9a..61dd1600f01b3e8c82e191763bc4fe2d7dc240d8 100644 |
--- a/chrome/browser/resources/pdf/pdf.js |
+++ b/chrome/browser/resources/pdf/pdf.js |
@@ -35,7 +35,12 @@ function getFilenameFromURL(url) { |
* @param {string} url The url to be opened in the current tab. |
*/ |
function onNavigateInCurrentTab(url) { |
- window.location.href = url; |
+ // Prefer the tabs API because it can navigate from one file:// URL to |
+ // another. |
+ if (chrome.tabs) |
+ chrome.tabs.update({url: url}); |
+ else |
+ window.location.href = url; |
} |
/** |
@@ -46,7 +51,7 @@ function onNavigateInNewTab(url) { |
// Prefer the tabs API because it guarantees we can just open a new tab. |
// window.open doesn't have this guarantee. |
if (chrome.tabs) |
- chrome.tabs.create({ url: url}); |
+ chrome.tabs.create({url: url}); |
else |
window.open(url); |
} |