From d7990b0e0354bf054eb88e248ca21bb3ac608add Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 9 Aug 2006 06:32:16 +0000 Subject: [PATCH] Updated Scholar.Files.linkFromURL() to take title and mime type as parameters, to prevent loading huge external PDFs just to get the content type when the ingester already knows it (though that will hopefully be alleviated by #173 and #174 later) --- .../content/scholar/xpcom/data_access.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/chrome/chromeFiles/content/scholar/xpcom/data_access.js b/chrome/chromeFiles/content/scholar/xpcom/data_access.js index 7ccc3d1262..ce5c58b6f4 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/data_access.js +++ b/chrome/chromeFiles/content/scholar/xpcom/data_access.js @@ -1962,7 +1962,19 @@ Scholar.Files = new function(){ } - function linkFromURL(url, sourceItemID){ + function linkFromURL(url, sourceItemID, title, mimeType){ + // If we're given the title and mime type, don't bother fetching the page + if (title && mimeType){ + _addToDB(null, url, title, this.LINK_MODE_LINKED_URL, mimeType, null, sourceItemID); + return; + } + + // TODO: try to get title and content type without fetching the whole page + // - https://chnm.gmu.edu/trac/scholar/ticket/173 + // (or, failing that, at least check the file size and don't load huge files) + // + // DEBUG: don't load images and other attached files + // - https://chnm.gmu.edu/trac/scholar/ticket/174 var browser = Scholar.Browser.createHiddenBrowser(); browser.addEventListener("pageshow", function(){ Scholar.Files.linkFromDocument(browser.contentDocument, sourceItemID);