Bug 965023 - Use Object.freeze on exports of Home.jsm. r=mcomella
authorPeiyong Lin <pylaurent1314@gmail.com>
Sat, 08 Feb 2014 21:02:27 -0500
changeset 184934 42e3d236bebb43becddf70c42b44af58d351669e
parent 184933 cd69b4b6d5443b537815cd745184e3e703cc96ef
child 184935 28b58d3d089f137443af8a1e6f8a60f0ed7bb0ef
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella
bugs965023
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 965023 - Use Object.freeze on exports of Home.jsm. r=mcomella
mobile/android/modules/Home.jsm
--- a/mobile/android/modules/Home.jsm
+++ b/mobile/android/modules/Home.jsm
@@ -43,17 +43,17 @@ function BannerMessage(options) {
 
   if ("onshown" in options && typeof options.onshown === "function")
     this.onshown = options.onshown;
 
   if ("onclick" in options && typeof options.onclick === "function")
     this.onclick = options.onclick;
 }
 
-let HomeBanner = {
+let HomeBanner = Object.freeze({
   // Holds the messages that will rotate through the banner.
   _messages: {},
 
   // A queue used to keep track of which message to show next.
   _queue: [],
 
   observe: function(subject, topic, data) {
     switch(topic) {
@@ -130,43 +130,43 @@ let HomeBanner = {
     this._queue.splice(index, 1);
 
     // If there are no more messages, remove the observers.
     if (Object.keys(this._messages).length == 0) {
       Services.obs.removeObserver(this, "HomeBanner:Get");
       Services.obs.removeObserver(this, "HomeBanner:Click");
     }
   }
-};
+});
 
 function Panel(options) {
   if ("id" in options)
     this.id = options.id;
 
   if ("title" in options)
     this.title = options.title;
 
   if ("layout" in options)
     this.layout = options.layout;
 
   if ("views" in options)
     this.views = options.views;
 }
 
-let HomePanels = {
+let HomePanels = Object.freeze({
   // Valid layouts for a panel.
-  Layout: {
+  Layout: Object.freeze({
     FRAME: "frame"
-  },
+  }),
 
   // Valid types of views for a dataset.
-  View: {
+  View: Object.freeze({
     LIST: "list",
     GRID: "grid"
-  },
+  }),
 
   // Holds the currrent set of registered panels.
   _panels: {},
 
   _panelToJSON : function(panel) {
     return {
       id: panel.id,
       title: panel.title,
@@ -249,24 +249,24 @@ let HomePanels = {
   _valueExists: function(obj, value) {
     for (let key in obj) {
       if (obj[key] == value) {
         return true;
       }
     }
     return false;
   }
-};
+});
 
 // Public API
-this.Home = {
+this.Home = Object.freeze({
   banner: HomeBanner,
   panels: HomePanels,
 
   // Lazy notification observer registered in browser.js
   observe: function(subject, topic, data) {
     switch(topic) {
       case "HomePanels:Get":
         HomePanels._handleGet(JSON.parse(data));
         break;
     }
   }
-}
+});