From b0e18a07036c49f16584a5c5773ce5490a1ea152 Mon Sep 17 00:00:00 2001 From: Rob Wu Date: Sat, 25 Jan 2014 21:44:58 +0100 Subject: [PATCH] [CRX] Remove redundant location.origin check The PDF Viewer will always be rendered directly from the extension, so checking "origin == chrome-extension:/.." is not needed any more. ( since edd4bae903c36048b7d4d4bed393e4408d0198ba ) --- web/viewer.js | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/web/viewer.js b/web/viewer.js index 9021ec02f..4cd233be5 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -1564,18 +1564,14 @@ var DocumentOutlineView = function documentOutlineView(outline) { //(function rewriteUrlClosure() { // // Run this code outside DOMContentLoaded to make sure that the URL // // is rewritten as soon as possible. -// if (location.origin + '/' !== chrome.extension.getURL('/')) { -// DEFAULT_URL = window.location.href.split('#')[0]; -// } else { -// var params = PDFView.parseQueryString(document.location.search.slice(1)); -// DEFAULT_URL = params.file || DEFAULT_URL; +// var params = PDFView.parseQueryString(document.location.search.slice(1)); +// DEFAULT_URL = params.file || DEFAULT_URL; // -// // Example: chrome-extension://.../http://example.com/file.pdf -// var humanReadableUrl = '/' + DEFAULT_URL + location.hash; -// history.replaceState(history.state, '', humanReadableUrl); -// if (top === window) { -// chrome.runtime.sendMessage('showPageAction'); -// } +// // Example: chrome-extension://.../http://example.com/file.pdf +// var humanReadableUrl = '/' + DEFAULT_URL + location.hash; +// history.replaceState(history.state, '', humanReadableUrl); +// if (top === window) { +// chrome.runtime.sendMessage('showPageAction'); // } //})(); //#endif @@ -1594,12 +1590,6 @@ document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) { //var file = DEFAULT_URL; //#endif -//#if CHROME -//if (location.protocol !== 'chrome-extension:') { -// file = location.href.split('#')[0]; -//} -//#endif - //#if !(FIREFOX || MOZCENTRAL || CHROME || B2G) var fileInput = document.createElement('input'); fileInput.id = 'fileInput';