Bug 687332: Fix OpenWebApps. r=fabrice
authorKyle Huey <khuey@kylehuey.com>
Thu, 29 Sep 2011 12:06:36 -0400
changeset 77822 1aa8a58760580670006a871de77bd1db3c924053
parent 77821 69e1b5167409a00a1b201963c5e7415e37b869fb
child 77824 60e86b84775943c1a8b473f0138c5fc062d51427
child 77863 8417548adf12704b5cb198504253efd429e4f860
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersfabrice
bugs687332
milestone10.0a1
Bug 687332: Fix OpenWebApps. r=fabrice
toolkit/mozapps/webapps/OpenWebapps.js
--- a/toolkit/mozapps/webapps/OpenWebapps.js
+++ b/toolkit/mozapps/webapps/OpenWebapps.js
@@ -161,17 +161,17 @@ OpenWebapps.prototype = {
   // nsIOpenWebapps implementation
   
   install: function(aURL, aInstallData, aSuccess, aError) {
     let self = this;
 
     let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
     xhr.open("GET", aURL, true);
 
-    xhr.onload = function() {
+    xhr.addEventListener("load", function() {
       if (xhr.status == 200) {
         try {
           let manifest = JSON.parse(xhr.responseText);
           if (!self.checkManifest(manifest)) {
             if (aError)
               aError.handle({ code: "invalidManifest", message: "Invalid manifest" });
           } else {
             self.mm.sendAsyncMessage("OpenWebapps:Install", { storeURI: self._window.location.href, manifestURI: aURL, manifest: xhr.responseText,
@@ -180,22 +180,22 @@ OpenWebapps.prototype = {
         } catch(e) {
           if (aError)
             aError.handle({ code: "manifestParseError", message: "Unable to parse the manifest" });
         }
       }
       else if (aError) {
         aError.handle({ code: "networkError", message: "Unable to retrieve manifest" });
       }      
-    }
+    }, false);
 
-    xhr.onerror = function() {
+    xhr.addEventListener("error", function() {
       if (aError)
         aError.handle({ code: "networkError", message: "Unable to retrieve manifest" });
-    }
+    }, false);
 
     xhr.send(null);
   },
   
   amInstalled: function(aSuccess, aError) {
     this.mm.sendAsyncMessage("OpenWebapps:AmInstalled", { appURI: this._window.location.href, callbackID:  this.getCallbackId({ success: aSuccess, error: aError }) });
   },