Bug 877467 - List API for prompt.jsm should take a flat list. r=mfinkle
☠☠ backed out by b11bffd58de9 ☠ ☠
authorWes Johnston <wjohnston@mozilla.com>
Mon, 03 Jun 2013 09:20:43 -0700
changeset 133814 1797dc46e8622a12ce5e3a1c2f12ea335650e415
parent 133813 ce3ac61c379c81e42797a3d302a5826954975ef7
child 133815 4fd2ae88da98cfedf769694222509952956c2b91
push id28907
push userwjohnston@mozilla.com
push dateMon, 03 Jun 2013 16:22:12 +0000
treeherdermozilla-inbound@8904d2bf5da0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs877467
milestone24.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 877467 - List API for prompt.jsm should take a flat list. r=mfinkle
mobile/android/modules/Prompt.jsm
--- a/mobile/android/modules/Prompt.jsm
+++ b/mobile/android/modules/Prompt.jsm
@@ -107,53 +107,47 @@ Prompt.prototype = {
       return;
 
     Services.obs.removeObserver(this, "Prompt:Reply", false);
 
     if (this.callback)
       this.callback(data);
   },
 
-  _setListItems: function(aItems, aInGroup) {
+  _setListItems: function(aItems) {
     let hasSelected = false;
-    if (!aInGroup)
-      this.msg.listitems = [];
+    this.msg.listitems = [];
 
     aItems.forEach(function(item) {
       let obj = { id: item.id };
 
-      if (aInGroup !== undefined)
-        obj.inGroup = aInGroup;
-
       obj.label = item.label;
 
       if (item.disabled)
         obj.disabled = true;
 
       if (item.selected || hasSelected || this.msg.multiple) {
         if (!this.msg.selected) {
           this.msg.selected = new Array(this.msg.listitems.length);
           hasSelected = true;
         }
         this.msg.selected[this.msg.listitems.length] = item.selected;
       }
 
-      if (item.children) {
+      if (item.header)
         obj.isGroup = true;
-      } else if (item.submenu) {
-        obj.isParent = true;
-      }
 
-      // Order matters in the java message, so make sure we add the obj
-      // to the list before we add its children
+      if (item.menu)
+        obj.isParent = true;
+
+      if (item.child)
+        obj.inGroup = true;
+
       this.msg.listitems.push(obj);
 
-      if (item.children)
-        this._setListItems(item.children, true);
-
     }, this);
     return this;
   },
 
   setSingleChoiceItems: function(aItems) {
     return this._setListItems(aItems);
   },