Backed out 7 changesets (bug 872147, bug 872143, bug 877467, bug 877200, bug 870063, bug 872149) for robocop-2 failures on a CLOSED TREE.
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 03 Jun 2013 15:04:51 -0400
changeset 145339 b11bffd58de933310089ff6e61d59c52763c9cac
parent 145338 a2de97d3a53fd1dcef9a23d5a325c295d4fe9aac
child 145340 65c09310a0b3771dc5626fa14c19bae77d008961
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs872147, 872143, 877467, 877200, 870063, 872149
milestone24.0a1
backs out3a1e8e7ac07eb823272cad73620e659f8ca1092a
8904d2bf5da0db6c4dddb632ae85291ffa6e6cc3
80455a25276b4eed1fbe9067c901860ae08c1a3d
c3b5567f1271c88ebc991c6155a35e3db5121d34
d3106edd4a5a31029afad97c1c3fa4bf13eb2fd6
4fd2ae88da98cfedf769694222509952956c2b91
1797dc46e8622a12ce5e3a1c2f12ea335650e415
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
Backed out 7 changesets (bug 872147, bug 872143, bug 877467, bug 877200, bug 870063, bug 872149) for robocop-2 failures on a CLOSED TREE. Backed out changeset 3a1e8e7ac07e (bug 870063) Backed out changeset 8904d2bf5da0 (bug 877200) Backed out changeset 80455a25276b (bug 872149) Backed out changeset c3b5567f1271 (bug 872147) Backed out changeset d3106edd4a5a (bug 872143) Backed out changeset 4fd2ae88da98 (bug 870063) Backed out changeset 1797dc46e862 (bug 877467)
mobile/android/chrome/content/FeedHandler.js
mobile/android/chrome/content/InputWidgetHelper.js
mobile/android/chrome/content/browser.js
mobile/android/components/PaymentsUI.js
mobile/android/modules/Prompt.jsm
--- a/mobile/android/chrome/content/FeedHandler.js
+++ b/mobile/android/chrome/content/FeedHandler.js
@@ -67,53 +67,74 @@ var FeedHandler = {
       let browser = tab.browser;
       let feeds = browser.feeds;
       if (feeds == null)
         return;
 
       // First, let's decide on which feed to subscribe
       let feedIndex = -1;
       if (feeds.length > 1) {
-        let p = new Prompt({
-          window: browser.contentWindow,
-        }).setSingleChoiceItems(feeds.map(function(feed) {
-          return { label: feed.title || feed.href }
-        })).show((function(data) {
-          feedIndex = data.button;
-          if (feedIndex == -1)
-            return;
+        // JSON for Prompt
+        let feedResult = {
+          type: "Prompt:Show",
+          multiple: false,
+          selected: [],
+          listitems: []
+        };
 
-          this.loadFeed(feeds[feedIndex], browser);
-        }).bind(this));
-        return;
+        // Build the list of feeds
+        for (let i = 0; i < feeds.length; i++) {
+          let item = {
+            label: feeds[i].title || feeds[i].href,
+            isGroup: false,
+            inGroup: false,
+            disabled: false,
+            id: i
+          };
+          feedResult.listitems.push(item);
+        }
+        feedIndex = JSON.parse(sendMessageToJava(feedResult)).button;
+      } else {
+        // Only a single feed on the page
+        feedIndex = 0;
       }
 
-      this.loadFeed(feeds[0], browser);
-    }
-  },
-
-  loadFeed: function fh_loadFeed(aFeed, aBrowser) {
-      let feedURL = aFeed.href;
+      if (feedIndex == -1)
+        return;
+      let feedURL = feeds[feedIndex].href;
 
       // Next, we decide on which service to send the feed
       let handlers = this.getContentHandlers(this.TYPE_MAYBE_FEED);
       if (handlers.length == 0)
         return;
 
       // JSON for Prompt
-      let p = new Prompt({
-        window: aBrowser.contentWindow
-      }).setSingleChoiceItems(handlers.map(function(handler) {
-        return { label: handler.name };
-      })).show(function(data) {
-        if (data.button == -1)
-          return;
+      let handlerResult = {
+        type: "Prompt:Show",
+        multiple: false,
+        selected: [],
+        listitems: []
+      };
 
-        // Merge the handler URL and the feed URL
-        let readerURL = handlers[data.button].uri;
-        readerURL = readerURL.replace(/%s/gi, encodeURIComponent(feedURL));
+      // Build the list of handlers
+      for (let i = 0; i < handlers.length; ++i) {
+        let item = {
+          label: handlers[i].name,
+          isGroup: false,
+          inGroup: false,
+          disabled: false,
+          id: i
+        };
+        handlerResult.listitems.push(item);
+      }
+      let handlerIndex = JSON.parse(sendMessageToJava(handlerResult)).button;
+      if (handlerIndex == -1)
+        return;
 
-        // Open the resultant URL in a new tab
-        BrowserApp.addTab(readerURL, { parentId: BrowserApp.selectedTab.id });
-      });
+      // Merge the handler URL and the feed URL
+      let readerURL = handlers[handlerIndex].uri;
+      readerURL = readerURL.replace(/%s/gi, encodeURIComponent(feedURL));
 
+      // Open the resultant URL in a new tab
+      BrowserApp.addTab(readerURL, { parentId: BrowserApp.selectedTab.id });
+    }
   }
 };
--- a/mobile/android/chrome/content/InputWidgetHelper.js
+++ b/mobile/android/chrome/content/InputWidgetHelper.js
@@ -18,51 +18,54 @@ var InputWidgetHelper = {
 
     this._uiBusy = true;
     this.show(aTarget);
     this._uiBusy = false;
   },
 
   show: function(aElement) {
     let type = aElement.getAttribute('type');
-    let p = new Prompt({
-      window: aElement.ownerDocument.defaultView,
+    let msg = {
+      type: "Prompt:Show",
       title: Strings.browser.GetStringFromName("inputWidgetHelper." + aElement.getAttribute('type')),
       buttons: [
         Strings.browser.GetStringFromName("inputWidgetHelper.set"),
         Strings.browser.GetStringFromName("inputWidgetHelper.clear"),
         Strings.browser.GetStringFromName("inputWidgetHelper.cancel")
       ],
-    }).addDatePicker({
-      value: aElement.value,
-      type: type,
-    }).show((function(data) {
-      let changed = false;
-      if (data.button == -1) {
-        // This type is not supported with this android version.
-        return;
+      inputs: [
+        { type: type, value: aElement.value }
+      ]
+    };
+
+    let data = JSON.parse(sendMessageToJava(msg));
+
+    let changed = false;
+    if (data.button == -1) {
+      // This type is not supported with this android version.
+      return;
+    }
+    if (data.button == 1) {
+      // The user cleared the value.
+      if (aElement.value != "") {
+        aElement.value = "";
+        changed = true;
       }
-      if (data.button == 1) {
-        // The user cleared the value.
-        if (aElement.value != "") {
-          aElement.value = "";
-          changed = true;
-        }
-      } else if (data.button == 0) {
-        // Commit the new value.
-        if (aElement.value != data[type]) {
-          aElement.value = data[type + "0"];
-          changed = true;
-        }
+    } else if (data.button == 0) {
+      // Commit the new value.
+      if (aElement.value != data[type]) {
+        aElement.value = data[type];
+        changed = true;
       }
-      // Else the user canceled the input.
+    }
+    // Else the user canceled the input.
 
-      if (changed)
-        this.fireOnChange(aElement);
-    }).bind(this));
+    if (changed)
+      this.fireOnChange(aElement);
+
   },
 
   _isValidInput: function(aElement) {
     if (!aElement instanceof HTMLInputElement)
       return false;
 
     let type = aElement.getAttribute('type');
     if (type == "date" || type == "datetime" || type == "datetime-local" ||
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -244,16 +244,17 @@ var Strings = {};
     return Services.strings.createBundle(bundle);
   });
 });
 
 var BrowserApp = {
   _tabs: [],
   _selectedTab: null,
   _prefObservers: [],
+  _promptHandlers: {},
 
   get isTablet() {
     let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
     delete this.isTablet;
     return this.isTablet = sysInfo.get("tablet");
   },
 
   get isOnLowMemoryPlatform() {
@@ -293,16 +294,17 @@ var BrowserApp = {
     Services.obs.addObserver(this, "FullScreen:Exit", false);
     Services.obs.addObserver(this, "Viewport:Change", false);
     Services.obs.addObserver(this, "Viewport:Flush", false);
     Services.obs.addObserver(this, "Viewport:FixedMarginsChanged", false);
     Services.obs.addObserver(this, "Passwords:Init", false);
     Services.obs.addObserver(this, "FormHistory:Init", false);
     Services.obs.addObserver(this, "gather-telemetry", false);
     Services.obs.addObserver(this, "keyword-search", false);
+    Services.obs.addObserver(this, "Prompt:Reply", false);
 
     Services.obs.addObserver(this, "sessionstore-state-purge-complete", false);
 
     function showFullScreenWarning() {
       NativeWindow.toast.show(Strings.browser.GetStringFromName("alertFullScreenToast"), "short");
     }
 
     window.addEventListener("fullscreen", function() {
@@ -1421,16 +1423,28 @@ var BrowserApp = {
       case "Sanitize:ClearData":
         this.sanitize(aData);
         break;
 
       case "FullScreen:Exit":
         browser.contentDocument.mozCancelFullScreen();
         break;
 
+      case "Prompt:Reply":
+        {
+            let data = JSON.parse(aData);
+            let guid = data.guid;
+            let handler = this._promptHandlers[guid];
+            if (!handler)
+              break;
+            this._promptHandlers[guid];
+            handler(data);
+        }
+        break;
+
       case "Viewport:Change":
         if (this.isBrowserContentDocumentDisplayed())
           this.selectedTab.setViewport(JSON.parse(aData));
         break;
 
       case "Viewport:Flush":
         this.contentDocumentChanged();
         break;
@@ -1485,36 +1499,45 @@ var BrowserApp = {
   getBrowserTab: function(tabId) {
     return this.getTabForId(tabId);
   },
 
   // This method will print a list from fromIndex to toIndex, optionally
   // selecting selIndex(if fromIndex<=selIndex<=toIndex)
   showHistory: function(fromIndex, toIndex, selIndex) {
     let browser = this.selectedBrowser;
+    let guid = uuidgen.generateUUID().toString();
+    let result = {
+      type: "Prompt:Show",
+      multiple: false,
+      async: true,
+      guid: guid,
+      selected: [],
+      listitems: []
+    };
     let hist = browser.sessionHistory;
-    let listitems = [];
     for (let i = toIndex; i >= fromIndex; i--) {
       let entry = hist.getEntryAtIndex(i, false);
       let item = {
         label: entry.title || entry.URI.spec,
-        selected: (i == selIndex)
+        isGroup: false,
+        inGroup: false,
+        disabled: false,
+        id: i
       };
-      listitems.push(item);
-    }
-
-    let p = new Prompt({
-      window: browser.contentWindow
-    }).setSingleChoiceItems(listitems).show(function(data) {
+      result.listitems.push(item);
+      result.selected.push(i == selIndex);
+    }
+    this._promptHandlers[guid] = function (data) {
         let selected = data.button;
         if (selected == -1)
           return;
-
         browser.gotoIndex(toIndex-selected);
-    });
+    };
+    sendMessageToJava(result);
   },
 };
 
 var NativeWindow = {
   init: function() {
     Services.obs.addObserver(this, "Menu:Clicked", false);
     Services.obs.addObserver(this, "Doorhanger:Reply", false);
     this.contextmenus.init();
@@ -1884,18 +1907,20 @@ var NativeWindow = {
           getValue: function(aElt) {
             if (item.hasAttribute("hidden"))
               return null;
 
             return {
               icon: item.icon,
               label: item.label,
               id: id,
+              isGroup: false,
+              inGroup: false,
               disabled: item.disabled,
-              parent: item instanceof Ci.nsIDOMHTMLMenuElement
+              isParent: item instanceof Ci.nsIDOMHTMLMenuElement
             }
           }
         };
 
         this.menuitems.splice(this._nativeItemsSeparator, 0, menuitem);
         this._nativeItemsSeparator++;
       }
     },
@@ -2010,46 +2035,46 @@ var NativeWindow = {
         // hidden menu items will return null from getValue
         if (val)
           itemArray.push(val);
       }
 
       if (itemArray.length == 0)
         return;
 
-      let prompt = new Prompt({
-        window: aTarget.ownerDocument.defaultView,
-        title: title
-      }).setSingleChoiceItems(itemArray)
-      .show(function(data) {
-        if (data.button == -1) {
-          // prompt was cancelled
-          return;
+      let msg = {
+        type: "Prompt:Show",
+        title: title,
+        listitems: itemArray
+      };
+      let data = JSON.parse(sendMessageToJava(msg));
+      if (data.button == -1) {
+        // prompt was cancelled
+        return;
+      }
+
+      let selectedId = itemArray[data.button].id;
+      let selectedItem = this._getMenuItemForId(selectedId);
+
+      this.menuitems = null;
+      if (selectedItem && selectedItem.callback) {
+        if (selectedItem.matches) {
+          // for menuitems added using the native UI, pass the dom element that matched that item to the callback
+          while (aTarget) {
+            if (selectedItem.matches(aTarget, aX, aY)) {
+              selectedItem.callback.call(selectedItem, aTarget, aX, aY);
+              break;
+            }
+            aTarget = aTarget.parentNode;
+          }
+        } else {
+          // if this was added using the html5 context menu api, just click on the context menu item
+          selectedItem.callback.call(selectedItem, aTarget, aX, aY);
         }
-
-        let selectedId = itemArray[data.button].id;
-        let selectedItem = this._getMenuItemForId(selectedId);
-
-        this.menuitems = null;
-        if (selectedItem && selectedItem.callback) {
-          if (selectedItem.matches) {
-            // for menuitems added using the native UI, pass the dom element that matched that item to the callback
-            while (aTarget) {
-              if (selectedItem.matches(aTarget, aX, aY)) {
-                selectedItem.callback.call(selectedItem, aTarget, aX, aY);
-                break;
-              }
-              aTarget = aTarget.parentNode;
-            }
-          } else {
-            // if this was added using the html5 context menu api, just click on the context menu item
-            selectedItem.callback.call(selectedItem, aTarget, aX, aY);
-          }
-        }
-      });
+      }
     },
 
     handleEvent: function(aEvent) {
       BrowserEventHandler._cancelTapHighlight();
       aEvent.target.ownerDocument.defaultView.removeEventListener("contextmenu", this, false);
       this._show(aEvent);
     },
 
--- a/mobile/android/components/PaymentsUI.js
+++ b/mobile/android/components/PaymentsUI.js
@@ -77,29 +77,38 @@ PaymentUI.prototype = {
     // Otherwise, let the user select a payment provider from a list.
     for (let i = 0; i < aRequests.length; i++) {
       let request = aRequests[i].wrappedJSObject;
       let requestText = request.providerName;
       if (request.productPrice) {
         requestText += " (" + request.productPrice[0].amount + " " +
                               request.productPrice[0].currency + ")";
       }
-      listItems.push({ label: requestText });
+      listItems.push({
+        label: requestText,
+        isGroup: false,
+        inGroup: false,
+        disabled: false,
+        id: i
+      });
     }
 
-    let p = new Prompt({
-      window: null,
+    let result = this.sendMessageToJava({
+      type: "Prompt:Show",
       title: this.bundle.GetStringFromName("payments.providerdialog.title"),
-    }).setSingleChoiceItems(listItems).show(function(data) {
-      if (data.button > -1 && aSuccessCb) {
-        aSuccessCb.onresult(aRequestId, aRequests[data.button].wrappedJSObject.type);
-      } else {
-        _error(aRequestId, "USER_CANCELED");
-      }
+      multiple: false,
+      selected: [],
+      listItems: listItems,
     });
+
+    if (result.button > -1 && aSuccessCb) {
+      aSuccessCb.onresult(aRequestId, aRequests[result.button].wrappedJSObject.type);
+    } else {
+      _error(aRequestId, "USER_CANCELED");
+    }
   },
 
   _error: function(aCallback) {
     return function _error(id, msg) {
       if (aCallback) {
         aCallback.onresult(id, msg);
       }
     };
--- a/mobile/android/modules/Prompt.jsm
+++ b/mobile/android/modules/Prompt.jsm
@@ -43,18 +43,16 @@ Prompt.prototype = {
   _addInput: function(aOptions) {
     let obj = aOptions;
     if (this[aOptions.type + "_count"] === undefined)
       this[aOptions.type + "_count"] = 0;
 
     obj.id = aOptions.id || (aOptions.type + this[aOptions.type + "_count"]);
     this[aOptions.type + "_count"]++;
 
-    if (!this.msg.inputs)
-      this.msg.inputs = [];
     this.msg.inputs.push(obj);
     return this;
   },
 
   addCheckbox: function(aOptions) {
     return this._addInput({
       type: "checkbox",
       label: aOptions.label,
@@ -78,23 +76,16 @@ Prompt.prototype = {
       type: "password",
       value: aOptions.value,
       hint: aOptions.hint,
       autofocus: aOptions.autofocus,
       id : aOptions.id
     });
   },
 
-  addDatePicker: function(aOptions) {
-    return this._addInput({
-      type: aOptions.type || "date",
-      value: aOptions.value,
-    });
-  },
-
   addMenulist: function(aOptions) {
     return this._addInput({
       type: "menulist",
       values: aOptions.values,
       id: aOptions.id
     });
   },
 
@@ -116,46 +107,52 @@ Prompt.prototype = {
       return;
 
     Services.obs.removeObserver(this, "Prompt:Reply", false);
 
     if (this.callback)
       this.callback(data);
   },
 
-  _setListItems: function(aItems) {
+  _setListItems: function(aItems, aInGroup) {
     let hasSelected = false;
-    this.msg.listitems = [];
+    if (!aInGroup)
+      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.header)
+      if (item.children) {
         obj.isGroup = true;
-
-      if (item.menu)
+      } else if (item.submenu) {
         obj.isParent = true;
+      }
 
-      if (item.child)
-        obj.inGroup = true;
+      // Order matters in the java message, so make sure we add the obj
+      // to the list before we add its children
+      this.msg.listitems.push(obj);
 
-      this.msg.listitems.push(obj);
+      if (item.children)
+        this._setListItems(item.children, true);
 
     }, this);
     return this;
   },
 
   setSingleChoiceItems: function(aItems) {
     return this._setListItems(aItems);
   },