LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 155 |
156 if (timeLineID) | 156 if (timeLineID) |
157 { | 157 { |
158 TimeLine.asyncEnd(timeLineID); | 158 TimeLine.asyncEnd(timeLineID); |
159 TimeLine.asyncDone(timeLineID); | 159 TimeLine.asyncDone(timeLineID); |
160 } | 160 } |
161 | 161 |
162 callback(null); | 162 callback(null); |
163 }; | 163 }; |
164 | 164 |
165 let onError = function(result) | 165 let onError = function(status) |
166 { | 166 { |
167 if (processing) | 167 if (processing) |
168 { | 168 { |
169 // Still processing data, delay processing this event. | 169 // Still processing data, delay processing this event. |
170 error = result; | 170 error = status; |
171 return; | 171 return; |
172 } | 172 } |
173 | 173 |
174 let e = Cc["@mozilla.org/js/xpc/Exception;1"].createInstance(Ci.nsIXPCEx
ception); | 174 let e = Cc["@mozilla.org/js/xpc/Exception;1"].createInstance(Ci.nsIXPCEx
ception); |
175 e.initialize("File read operation failed", result, null, Components.stac
k, file, null); | 175 e.initialize("File read operation failed", status, null, Components.stac
k, file, null); |
176 callback(e); | 176 callback(e); |
177 | 177 |
178 if (timeLineID) | 178 if (timeLineID) |
179 { | 179 { |
180 TimeLine.asyncDone(timeLineID); | 180 TimeLine.asyncDone(timeLineID); |
181 } | 181 } |
182 }; | 182 }; |
183 | 183 |
184 request.addEventListener("progress", function(event) | 184 request.addEventListener("progress", function(event) |
185 { | 185 { |
186 Utils.runAsync(onProgress.bind(this, event.target.response)); | 186 Utils.runAsync(onProgress.bind(this, event.target.response)); |
187 }, false); | 187 }, false); |
188 request.addEventListener("load", function(event) | 188 request.addEventListener("load", function(event) |
189 { | 189 { |
190 Utils.runAsync(onLoad.bind(this)); | 190 Utils.runAsync(onLoad.bind(this)); |
191 }, false); | 191 }, false); |
192 request.addEventListener("error", function(event) | 192 request.addEventListener("error", function(event) |
193 { | 193 { |
194 Utils.runAsync(onError.bind(this, event.result)); | 194 Utils.runAsync(onError.bind(this, event.target.channel.status)); |
195 }, false); | 195 }, false); |
196 | 196 |
197 request.send(null); | 197 request.send(null); |
198 } | 198 } |
199 catch (e) | 199 catch (e) |
200 { | 200 { |
201 callback(e); | 201 callback(e); |
202 } | 202 } |
203 }, | 203 }, |
204 /** | 204 /** |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 isFile: exists && file.isFile(), | 385 isFile: exists && file.isFile(), |
386 lastModified: exists ? file.lastModifiedTime : 0 | 386 lastModified: exists ? file.lastModifiedTime : 0 |
387 }); | 387 }); |
388 } | 388 } |
389 catch(e) | 389 catch(e) |
390 { | 390 { |
391 callback(e); | 391 callback(e); |
392 } | 392 } |
393 } | 393 } |
394 } | 394 } |
LEFT | RIGHT |