From 078afbe3a526eb4ab422a352a107cc5206cc68f3 Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Thu, 29 Sep 2011 12:06:36 -0400 Subject: [PATCH] Bug 687332: Fix toolkit/. r=rs --- toolkit/components/url-classifier/content/xml-fetcher.js | 5 ++--- toolkit/mozapps/extensions/AddonRepository.jsm | 8 +++++--- toolkit/mozapps/extensions/AddonUpdateChecker.jsm | 4 ++-- toolkit/mozapps/extensions/LightweightThemeManager.jsm | 4 ++-- toolkit/mozapps/extensions/nsBlocklistService.js | 4 ++-- toolkit/mozapps/update/nsUpdateService.js | 6 +++--- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/toolkit/components/url-classifier/content/xml-fetcher.js b/toolkit/components/url-classifier/content/xml-fetcher.js index 6e52e5a0cbe..1edad3470af 100644 --- a/toolkit/components/url-classifier/content/xml-fetcher.js +++ b/toolkit/components/url-classifier/content/xml-fetcher.js @@ -103,15 +103,14 @@ PROT_XMLFetcher.prototype = { // Create a closure var self = this; - this._request.onreadystatechange = function() { + this._request.addEventListener("readystatechange", function() { self.readyStateChange(self); - } + }, false); this._request.send(null); }, cancel: function() { - this._request.onreadystatechange = null; this._request.abort(); this._request = null; }, diff --git a/toolkit/mozapps/extensions/AddonRepository.jsm b/toolkit/mozapps/extensions/AddonRepository.jsm index 7ebea12f42d..36a7cf92f95 100644 --- a/toolkit/mozapps/extensions/AddonRepository.jsm +++ b/toolkit/mozapps/extensions/AddonRepository.jsm @@ -1176,8 +1176,10 @@ var AddonRepository = { this._request.overrideMimeType("text/xml"); let self = this; - this._request.onerror = function(aEvent) { self._reportFailure(); }; - this._request.onload = function(aEvent) { + this._request.addEventListener("error", function(aEvent) { + self._reportFailure(); + }, false); + this._request.addEventListener("load", function(aEvent) { let request = aEvent.target; let responseXML = request.responseXML; @@ -1196,7 +1198,7 @@ var AddonRepository = { totalResults = parsedTotalResults; aHandleResults(elements, totalResults); - }; + }, false); this._request.send(null); }, diff --git a/toolkit/mozapps/extensions/AddonUpdateChecker.jsm b/toolkit/mozapps/extensions/AddonUpdateChecker.jsm index 7aa1bb2539f..163b279dc8f 100644 --- a/toolkit/mozapps/extensions/AddonUpdateChecker.jsm +++ b/toolkit/mozapps/extensions/AddonUpdateChecker.jsm @@ -451,8 +451,8 @@ function UpdateParser(aId, aType, aUpdateKey, aUrl, aObserver) { this.request.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE; this.request.overrideMimeType("text/xml"); var self = this; - this.request.onload = function(event) { self.onLoad() }; - this.request.onerror = function(event) { self.onError() }; + this.request.addEventListener("load", function(event) { self.onLoad() }, false); + this.request.addEventListener("error", function(event) { self.onError() }, false); this.request.send(null); } catch (e) { diff --git a/toolkit/mozapps/extensions/LightweightThemeManager.jsm b/toolkit/mozapps/extensions/LightweightThemeManager.jsm index e9d0a2cfcce..63ac4db2363 100644 --- a/toolkit/mozapps/extensions/LightweightThemeManager.jsm +++ b/toolkit/mozapps/extensions/LightweightThemeManager.jsm @@ -227,7 +227,7 @@ var LightweightThemeManager = { req.open("GET", theme.updateURL, true); var self = this; - req.onload = function () { + req.addEventListener("load", function () { if (req.status != 200) return; @@ -240,7 +240,7 @@ var LightweightThemeManager = { var currentTheme = self.currentTheme; if (currentTheme && currentTheme.id == theme.id) self.currentTheme = newData; - }; + }, false); req.send(null); }, diff --git a/toolkit/mozapps/extensions/nsBlocklistService.js b/toolkit/mozapps/extensions/nsBlocklistService.js index 7efc0ee8ad1..23cd11a75a5 100644 --- a/toolkit/mozapps/extensions/nsBlocklistService.js +++ b/toolkit/mozapps/extensions/nsBlocklistService.js @@ -546,8 +546,8 @@ Blocklist.prototype = { request.QueryInterface(Components.interfaces.nsIJSXMLHttpRequest); var self = this; - request.onerror = function(event) { self.onXMLError(event); }; - request.onload = function(event) { self.onXMLLoad(event); }; + request.addEventListener("error", function(event) { self.onXMLError(event); }, false); + request.addEventListener("load", function(event) { self.onXMLLoad(event); }, false); request.send(null); // When the blocklist loads we need to compare it to the current copy so diff --git a/toolkit/mozapps/update/nsUpdateService.js b/toolkit/mozapps/update/nsUpdateService.js index b856c81f33b..8f365e56df1 100644 --- a/toolkit/mozapps/update/nsUpdateService.js +++ b/toolkit/mozapps/update/nsUpdateService.js @@ -2155,9 +2155,9 @@ Checker.prototype = { this._request.setRequestHeader("Cache-Control", "no-cache"); var self = this; - this._request.onerror = function(event) { self.onError(event); }; - this._request.onload = function(event) { self.onLoad(event); }; - this._request.onprogress = function(event) { self.onProgress(event); }; + this._request.addEventListener("error", function(event) { self.onError(event); } ,false); + this._request.addEventListener("load", function(event) { self.onLoad(event); }, false); + this._request.addEventListener("progress", function(event) { self.onProgress(event); }, false); LOG("Checker:checkForUpdates - sending request to: " + url); this._request.send(null);