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 321645 e38a16b7d37e848ace544aa45c8ccebb3d0411c5
parent 321644 e0cc363043ade8f69a600bfd68edaf88b35b7c96
child 321646 0ed2152fd50bd4655adf35c77e26ab64c15181a1
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1225563
milestone47.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 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 = {