Bug 1225563 - Log error in JS that Doorhangers only support one positive and one negative button if invalid buttons are provided. r=nalexander
authordlim <daniel9618@gmail.com>
Tue, 23 Feb 2016 13:45:36 -0800
changeset 285308 e38a16b7d37e848ace544aa45c8ccebb3d0411c5
parent 285307 e0cc363043ade8f69a600bfd68edaf88b35b7c96
child 285309 0ed2152fd50bd4655adf35c77e26ab64c15181a1
push id17788
push usercbook@mozilla.com
push dateWed, 24 Feb 2016 14:55:28 +0000
treeherderfx-team@0ed2152fd50b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1225563
milestone47.0a1
Bug 1225563 - Log error in JS that Doorhangers only support one positive and one negative button if invalid buttons are provided. r=nalexander
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -2278,16 +2278,21 @@ var NativeWindow = {
    * @param aCategory
    *        Doorhanger type to display (e.g., LOGIN)
    */
     show: function(aMessage, aValue, aButtons, aTabID, aOptions, aCategory) {
       if (aButtons == null) {
         aButtons = [];
       }
 
+      if (aButtons.length > 2) {
+        console.log("Doorhanger can have a maximum of two buttons!");
+        aButtons.length = 2;
+      }
+
       aButtons.forEach((function(aButton) {
         this._callbacks[this._callbacksId] = { cb: aButton.callback, prompt: this._promptId };
         aButton.callback = this._callbacksId;
         this._callbacksId++;
       }).bind(this));
 
       this._promptId++;
       let json = {