Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 | 1 |
2 XMLHttpRequest = function() | 2 XMLHttpRequest = function() |
3 { | 3 { |
4 this.headers = {}; | 4 this.headers = {}; |
5 this.responseHeaders = {}; | 5 this.responseHeaders = {}; |
6 }; | 6 }; |
7 | 7 |
8 XMLHttpRequest.UNSENT = 0; | 8 XMLHttpRequest.UNSENT = 0; |
9 XMLHttpRequest.OPEN = 1; | 9 XMLHttpRequest.OPEN = 1; |
10 XMLHttpRequest.HEADERS_RECEIVED = 2; | 10 XMLHttpRequest.HEADERS_RECEIVED = 2; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 }, | 70 }, |
71 onreadystatechange: function(){}, | 71 onreadystatechange: function(){}, |
72 getResponseHeader: function(header) | 72 getResponseHeader: function(header) |
73 { | 73 { |
74 if (this.readyState < XMLHttpRequest.LOADING) | 74 if (this.readyState < XMLHttpRequest.LOADING) |
75 throw new Error("INVALID_STATE_ERR"); | 75 throw new Error("INVALID_STATE_ERR"); |
76 else | 76 else |
77 { | 77 { |
78 var lcHeader = header.toLowerCase(); | 78 var lcHeader = header.toLowerCase(); |
79 var returnedHeaders = []; | 79 var returnedHeaders = []; |
80 for (var rHeader in this.responseHeaders) | 80 for (var rHeader in this.responseHeaders) |
Felix Dahlke
2012/11/13 07:53:14
You might want to make sure that you're not iterat
Andrey Novikov
2012/11/13 09:44:54
Done.
| |
81 { | 81 { |
82 if (rHeader.toLowerCase() == lcHeader) | 82 if (this.responseHeaders.hasOwnProperty(rHeader) && rHeader.toLowerCase( ) == lcHeader) |
83 returnedHeaders.push(this.responseHeaders[rHeader]); | 83 returnedHeaders.push(this.responseHeaders[rHeader]); |
84 } | 84 } |
85 | 85 |
86 if (returnedHeaders.length) | 86 if (returnedHeaders.length) |
87 return returnedHeaders.join(", "); | 87 return returnedHeaders.join(", "); |
88 } | 88 } |
89 | 89 |
90 return null; | 90 return null; |
91 }, | 91 }, |
92 getAllResponseHeaders: function(header) | 92 getAllResponseHeaders: function(header) |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 status: -1, | 161 status: -1, |
162 notificationCallbacks: {}, | 162 notificationCallbacks: {}, |
163 loadFlags: 0, | 163 loadFlags: 0, |
164 INHIBIT_CACHING: 0, | 164 INHIBIT_CACHING: 0, |
165 VALIDATE_ALWAYS: 0, | 165 VALIDATE_ALWAYS: 0, |
166 QueryInterface: function() | 166 QueryInterface: function() |
167 { | 167 { |
168 return this; | 168 return this; |
169 } | 169 } |
170 }; | 170 }; |
LEFT | RIGHT |