Fix for bug 740467 (Make test_XHR_timeout.js use addEventListener(..., obj, ...) instead of on* = obj). r=khuey.
authorPeter Van der Beken <peterv@propagandism.org>
Thu, 29 Mar 2012 11:16:31 -0700
changeset 93956 5561efcb19f226576e474fa8a1f57ef68c111b70
parent 93955 8ecff1c072e66279ef70659f30c2bc0d0a9aa5c7
child 93957 612fd2e764fdae8e76a5144e9659fe9939387833
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs740467
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Fix for bug 740467 (Make test_XHR_timeout.js use addEventListener(..., obj, ...) instead of on* = obj). r=khuey.
content/base/test/test_XHR_timeout.js
--- a/content/base/test/test_XHR_timeout.js
+++ b/content/base/test/test_XHR_timeout.js
@@ -65,20 +65,22 @@ function RequestTracker(async, id, timeL
 RequestTracker.prototype = {
   /**
    * Start the XMLHttpRequest!
    */
   startXHR: function() {
     var req = new XMLHttpRequest();
     this.request = req;
     req.open("GET", "file_XHR_timeout.sjs", this.async);
-    req.onerror   = this;
-    req.onload    = this;
-    req.onabort   = this;
-    req.ontimeout = this;
+    var me = this;
+    function handleEvent(e) { return me.handleEvent(e); };
+    req.onerror = handleEvent;
+    req.onload = handleEvent;
+    req.onabort = handleEvent;
+    req.ontimeout = handleEvent;
 
     req.timeout = this.timeLimit;
     
     if (this.mustReset) {
       var resetTo = this.resetTo;
       self.setTimeout(function() {
         req.timeout = resetTo;
       }, this.resetAfter);
@@ -146,20 +148,22 @@ function AbortedRequest(shouldAbort, abo
 AbortedRequest.prototype = {
   /**
    * Start the XMLHttpRequest!
    */
   startXHR: function() {
     var req = new XMLHttpRequest();
     this.request = req;
     req.open("GET", "file_XHR_timeout.sjs");
-    req.onerror   = this;
-    req.onload    = this;
-    req.onabort   = this;
-    req.ontimeout = this;
+    var me = this;
+    function handleEvent(e) { return me.handleEvent(e); };
+    req.onerror = handleEvent;
+    req.onload = handleEvent;
+    req.onabort = handleEvent;
+    req.ontimeout = handleEvent;
 
     req.timeout = 2000;
     var _this = this;
 
     function abortReq() {
       req.abort();
     }