From cb8f961639820203f319d118d8dacb7dd6811070 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 27 Jun 2006 23:24:02 +0000 Subject: [PATCH] Removed Scholar.HTTP, now that its functionality has been incorporated back into Scholar.Utilities.HTTP --- .../content/scholar/xpcom/schema.js | 2 +- .../content/scholar/xpcom/scholar.js | 108 ------------------ 2 files changed, 1 insertion(+), 109 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/xpcom/schema.js b/chrome/chromeFiles/content/scholar/xpcom/schema.js index 3bdbde23f4..c9b90336ff 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/schema.js +++ b/chrome/chromeFiles/content/scholar/xpcom/schema.js @@ -80,7 +80,7 @@ Scholar.Schema = new function(){ + 'version=' + Scholar.version; Scholar.debug('Checking repository for updates (' + url + ')'); - var get = Scholar.HTTP.doGet(url, _updateScrapersRemoteCallback); + var get = Scholar.Utilities.HTTP.doGet(url, _updateScrapersRemoteCallback); // TODO: instead, add an observer to start and stop timer on online state change if (!get){ diff --git a/chrome/chromeFiles/content/scholar/xpcom/scholar.js b/chrome/chromeFiles/content/scholar/xpcom/scholar.js index 5fe45fe8cf..5f4102c6ae 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/scholar.js +++ b/chrome/chromeFiles/content/scholar/xpcom/scholar.js @@ -461,114 +461,6 @@ Scholar.Hash.prototype.has = function(in_key){ -Scholar.HTTP = new function(){ - - this.doGet = doGet; - this.doPost = doPost; - this.browserIsOffline = browserIsOffline; - - /** - * Send an HTTP GET request via XMLHTTPRequest - * - * Returns false if browser is offline - **/ - function doGet(url, onDone){ - if (this.browserIsOffline()){ - return false; - } - - var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"] - .createInstance(); - - var test = xmlhttp.open('GET', url, true); - - xmlhttp.onreadystatechange = function(){ - _stateChange(xmlhttp, onDone); - }; - - xmlhttp.send(null); - - return true; - } - - - /** - * Send an HTTP POST request via XMLHTTPRequest - * - * Returns false if browser is offline - **/ - function doPost(url, body, onDone){ - if (this.browserIsOffline()){ - return false; - } - - var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"] - .createInstance(); - - xmlhttp.open('POST', url, true); - - xmlhttp.onreadystatechange = function(){ - _stateChange(xmlhttp, onDone); - }; - - xmlhttp.send(body); - - return true; - } - - - function browserIsOffline(){ - return Components.classes["@mozilla.org/network/io-service;1"] - .getService(Components.interfaces.nsIIOService).offline; - } - - - function _stateChange(xmlhttp, onDone){ - switch (xmlhttp.readyState){ - // Request not yet made - case 1: - break; - - // Contact established with server but nothing downloaded yet - case 2: - // Accessing status will throw an exception if no network connection - try { - xmlhttp.status; - } - catch (e){ - Scholar.debug('No network connection'); - xmlhttp.noNetwork = true; - return false; - } - - // Check for HTTP status 200 - if (xmlhttp.status != 200){ - Scholar.debug('XMLHTTPRequest received HTTP response code ' - + xmlhttp.status); - } - break; - - // Called multiple while downloading in progress - case 3: - break; - - // Download complete - case 4: - try { - if (onDone){ - onDone(xmlhttp); - } - } - catch (e){ - Scholar.debug(e, 2); - } - break; - } - } -} - - - Scholar.Date = new function(){ this.sqlToDate = sqlToDate;