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

Side by Side Diff: lib/io.js

Issue 5055554716172288: Issue 653 -Object.defineProperty instead of defineGetter / defineSetter (Closed)
Patch Set: Created June 9, 2014, 9:29 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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 21 matching lines...) Expand all
32 const BUFFER_SIZE = 0x8000; // 32kB 32 const BUFFER_SIZE = 0x8000; // 32kB
33 33
34 let IO = exports.IO = 34 let IO = exports.IO =
35 { 35 {
36 /** 36 /**
37 * Retrieves the platform-dependent line break string. 37 * Retrieves the platform-dependent line break string.
38 */ 38 */
39 get lineBreak() 39 get lineBreak()
40 { 40 {
41 let lineBreak = (Services.appinfo.OS == "WINNT" ? "\r\n" : "\n"); 41 let lineBreak = (Services.appinfo.OS == "WINNT" ? "\r\n" : "\n");
42 delete IO.lineBreak; 42 Object.defineProperty(IO, "lineBreak", {value: lineBreak});
Wladimir Palant 2014/06/23 11:12:41 Use this rather than IO here?
43 IO.__defineGetter__("lineBreak", () => lineBreak); 43 return lineBreak;
44 return IO.lineBreak;
45 }, 44 },
46 45
47 /** 46 /**
48 * Tries to interpret a file path as an absolute path or a path relative to 47 * Tries to interpret a file path as an absolute path or a path relative to
49 * user's profile. Returns a file or null on failure. 48 * user's profile. Returns a file or null on failure.
50 */ 49 */
51 resolveFilePath: function(/**String*/ path) /**nsIFile*/ 50 resolveFilePath: function(/**String*/ path) /**nsIFile*/
52 { 51 {
53 if (!path) 52 if (!path)
54 return null; 53 return null;
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 else 355 else
357 callback(e); 356 callback(e);
358 }); 357 });
359 } 358 }
360 catch(e) 359 catch(e)
361 { 360 {
362 callback(e); 361 callback(e);
363 } 362 }
364 } 363 }
365 } 364 }
OLDNEW

Powered by Google App Engine
This is Rietveld