Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #4267: prototype-diff.txt

File prototype-diff.txt, 1.5 kB (added by blair, 3 years ago)

First pass at a patch

Line 
1 Index: public/javascripts/prototype.js
2 ===================================================================
3 --- public/javascripts/prototype.js     (revision 103805)
4 +++ public/javascripts/prototype.js     (working copy)
5 @@ -609,9 +609,16 @@
6    },
7  
8    responseIsSuccess: function() {
9 -    return this.transport.status == undefined
10 -        || this.transport.status == 0
11 -        || (this.transport.status >= 200 && this.transport.status < 300);
12 +    /* Firefox does not have a transport.status member variable when
13 +     * there is no server listening on the port the AJAX call was
14 +     * made to. */
15 +    try {
16 +      return this.transport.status == undefined
17 +          || this.transport.status == 0
18 +          || (this.transport.status >= 200 && this.transport.status < 300);
19 +    } catch (e) {
20 +      return 0;
21 +    }
22    },
23  
24    responseIsFailure: function() {
25 @@ -714,8 +721,16 @@
26      var transport = this.transport, json = this.evalJSON();
27  
28      if (event == 'Complete') {
29 +      /* Firefox does not have a transport.status member variable when
30 +       * there is no server listening on the port the AJAX call was
31 +       * made to. */
32 +      var status = 'Failure';
33        try {
34 -        (this.options['on' + this.transport.status]
35 +        status = this.transport.status;
36 +      } catch (e) {}
37 +
38 +      try {
39 +        (this.options['on' + status]
40           || this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')]
41           || Prototype.emptyFunction)(transport, json);
42        } catch (e) {