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: I am generally not a big fan of iterating over property names. It seems like for most objects here … Created June 26, 2014, 8:33 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/filterStorage.js ('k') | lib/utils.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(this, "lineBreak", {value: lineBreak});
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
« no previous file with comments | « lib/filterStorage.js ('k') | lib/utils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld