Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: lib/io.js

Issue 29340852: Issue 3993 - Implement Utils.yield() in a better way (ABP/Firefox part) (Closed)
Left Patch Set: Created April 26, 2016, 6:50 p.m.
Right Patch Set: Finalized revisions and added comment Created April 28, 2016, 12:16 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « dependencies ('k') | lib/utils.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 let onSuccess = function() 124 let onSuccess = function()
125 { 125 {
126 if (processing) 126 if (processing)
127 { 127 {
128 // Still processing data, delay processing this event. 128 // Still processing data, delay processing this event.
129 loaded = true; 129 loaded = true;
130 return; 130 return;
131 } 131 }
132 132
133 // We are ignoring return value of listener.process() here because
134 // turning this callback into a generator would be complicated, and
135 // delaying isn't really necessary for the last two calls.
133 if (buffer !== "") 136 if (buffer !== "")
134 listener.process(buffer); 137 listener.process(buffer);
135 listener.process(null); 138 listener.process(null);
Wladimir Palant 2016/04/26 18:52:56 Note that return value is ignored here - turning o
Erik 2016/04/28 00:51:48 worth adding a comment for I think, which says wha
Wladimir Palant 2016/04/28 12:18:34 Done.
136 139
137 callback(null); 140 callback(null);
138 }; 141 };
139 142
140 let onError = function(e) 143 let onError = function(e)
141 { 144 {
142 if (processing) 145 if (processing)
143 { 146 {
144 // Still processing data, delay processing this event. 147 // Still processing data, delay processing this event.
145 error = e; 148 error = e;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 } 262 }
260 }, 263 },
261 264
262 /** 265 /**
263 * Renames a file within the same directory, will call callback when done. 266 * Renames a file within the same directory, will call callback when done.
264 */ 267 */
265 renameFile: function(/**nsIFile*/ fromFile, /**String*/ newName, /**Function*/ callback) 268 renameFile: function(/**nsIFile*/ fromFile, /**String*/ newName, /**Function*/ callback)
266 { 269 {
267 try 270 try
268 { 271 {
269 toFile = fromFile.clone(); 272 let toFile = fromFile.clone();
270 toFile.leafName = newName; 273 toFile.leafName = newName;
271 let promise = OS.File.move(fromFile.path, toFile.path); 274 let promise = OS.File.move(fromFile.path, toFile.path);
272 promise.then(callback.bind(null, null), callback); 275 promise.then(callback.bind(null, null), callback);
273 } 276 }
274 catch(e) 277 catch(e)
275 { 278 {
276 callback(e); 279 callback(e);
277 } 280 }
278 }, 281 },
279 282
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 else 326 else
324 callback(e); 327 callback(e);
325 }); 328 });
326 } 329 }
327 catch(e) 330 catch(e)
328 { 331 {
329 callback(e); 332 callback(e);
330 } 333 }
331 } 334 }
332 } 335 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld