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

Unified Diff: lib/utils.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.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/io.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/utils.js
===================================================================
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -50,17 +50,17 @@ let Utils = exports.Utils =
/**
* Returns whether we are running in Fennec, for Fennec-specific hacks
* @type Boolean
*/
get isFennec()
{
let {application} = require("info");
let result = (application == "fennec" || application == "fennec2");
- Utils.__defineGetter__("isFennec", () => result);
+ Object.defineProperty(this, "isFennec", {value: result});
return result;
},
/**
* Returns the user interface locale selected for adblockplus chrome package.
*/
get appLocale()
{
@@ -68,28 +68,28 @@ let Utils = exports.Utils =
try
{
locale = Utils.chromeRegistry.getSelectedLocale("adblockplus");
}
catch (e)
{
Cu.reportError(e);
}
- Utils.__defineGetter__("appLocale", () => locale);
- return Utils.appLocale;
+ Object.defineProperty(this, "appLocale", {value: locale});
+ return locale;
},
/**
* Returns version of the Gecko platform
*/
get platformVersion()
{
let platformVersion = Services.appinfo.platformVersion;
- Utils.__defineGetter__("platformVersion", () => platformVersion);
- return Utils.platformVersion;
+ Object.defineProperty(this, "platformVersion", {value: platformVersion});
+ return platformVersion;
},
/**
* Retrieves a string from global.properties string bundle, will throw if string isn't found.
*
* @param {String} name string name
* @return {String}
*/
« no previous file with comments | « lib/io.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld