Bug 976122 - Fix HomePanels:Get handling in Home.jsm (r=margaret)
authorLucas Rocha <lucasr@mozilla.com>
Tue, 25 Feb 2014 11:28:58 +0000
changeset 170456 989f56e2fca980b0518bf136a0a07ed63ab1ad02
parent 170455 6c895af7ccf169ab9bc3cea07618a59b9ee4c1cb
child 170457 70f928fe9ecf274d026b25946dcea07acbc281cf
push id26288
push userryanvm@gmail.com
push dateTue, 25 Feb 2014 20:20:43 +0000
treeherdermozilla-central@22650589a724 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs976122
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 976122 - Fix HomePanels:Get handling in Home.jsm (r=margaret)
mobile/android/modules/Home.jsm
--- a/mobile/android/modules/Home.jsm
+++ b/mobile/android/modules/Home.jsm
@@ -165,33 +165,37 @@ function Panel(options) {
 
   if ("layout" in options)
     this.layout = options.layout;
 
   if ("views" in options)
     this.views = options.views;
 }
 
+// We need this function to have access to the HomePanels
+// private members without leaking it outside Home.jsm.
+let handlePanelsGet;
+
 let HomePanels = (function () {
   // Holds the current set of registered panels that can be
   // installed, updated, uninstalled, or unregistered. This
   // is also used to retrieve the list of available panels
   // in the system (see HomePanels:Get handler).
   let _registeredPanels = {};
 
   let _panelToJSON = function(panel) {
     return {
       id: panel.id,
       title: panel.title,
       layout: panel.layout,
       views: panel.views
     };
   };
 
-  let _handleGet = function(data) {
+  handlePanelsGet = function(data) {
     let requestId = data.requestId;
     let ids = data.ids || null;
 
     let panels = [];
     for (let id in _registeredPanels) {
       let panel = _registeredPanels[id];
 
       // Null ids means we want to fetch all available panels
@@ -334,13 +338,13 @@ let HomePanels = (function () {
 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));
+        handlePanelsGet(JSON.parse(data));
         break;
     }
   }
 });