Bug 1016348 - Treat prompt service boolean returns as real booleans. r=margaret, a=lsblakk
authorWes Johnston <wjohnston@mozilla.com>
Tue, 27 May 2014 14:43:43 -0700
changeset 199351 c241763e5e37a4a303fec32a124c187b99cd9eb4
parent 199350 f4bd705a54a2bacd40b9e41d3028ffd1cf054aee
child 199352 4c2feb08ebbe613438dccf1b403b1cb11a6604b9
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret, lsblakk
bugs1016348
milestone31.0a2
Bug 1016348 - Treat prompt service boolean returns as real booleans. r=margaret, a=lsblakk
mobile/android/components/PromptService.js
--- a/mobile/android/components/PromptService.js
+++ b/mobile/android/components/PromptService.js
@@ -229,33 +229,33 @@ InternalPrompt.prototype = {
     this.showPrompt(p);
   },
 
   alertCheck: function alertCheck(aTitle, aText, aCheckMsg, aCheckState) {
     let p = this._getPrompt(aTitle, aText, [ PromptUtils.getLocaleString("OK") ]);
     this.addCheckbox(p, aCheckMsg, aCheckState);
     let data = this.showPrompt(p);
     if (aCheckState && data.button > -1)
-      aCheckState.value = data.checkbox0 == "true";
+      aCheckState.value = data.checkbox0;
   },
 
   confirm: function confirm(aTitle, aText) {
     let p = this._getPrompt(aTitle, aText);
     p.setHint("confirm");
     let data = this.showPrompt(p);
     return (data.button == 0);
   },
 
   confirmCheck: function confirmCheck(aTitle, aText, aCheckMsg, aCheckState) {
     let p = this._getPrompt(aTitle, aText, null);
     this.addCheckbox(p, aCheckMsg, aCheckState);
     let data = this.showPrompt(p);
     let ok = data.button == 0;
     if (aCheckState && data.button > -1)
-      aCheckState.value = data.checkbox0 == "true";
+      aCheckState.value = data.checkbox0;
     return ok;
   },
 
   confirmEx: function confirmEx(aTitle, aText, aButtonFlags, aButton0,
                       aButton1, aButton2, aCheckMsg, aCheckState) {
     let buttons = [];
     let titles = [aButton0, aButton1, aButton2];
     for (let i = 0; i < 3; i++) {
@@ -292,61 +292,62 @@ InternalPrompt.prototype = {
 
       aButtonFlags >>= 8;
     }
 
     let p = this._getPrompt(aTitle, aText, buttons);
     this.addCheckbox(p, aCheckMsg, aCheckState);
     let data = this.showPrompt(p);
     if (aCheckState && data.button > -1)
-      aCheckState.value = data.checkbox0 == "true";
+      aCheckState.value = data.checkbox0;
     return data.button;
   },
 
   nsIPrompt_prompt: function nsIPrompt_prompt(aTitle, aText, aValue, aCheckMsg, aCheckState) {
     let p = this._getPrompt(aTitle, aText, null, aCheckMsg, aCheckState);
     p.setHint("prompt");
     this.addTextbox(p, aValue.value, true);
     this.addCheckbox(p, aCheckMsg, aCheckState);
     let data = this.showPrompt(p);
 
     let ok = data.button == 0;
     if (aCheckState && data.button > -1)
-      aCheckState.value = data.checkbox0 == "true";
+      aCheckState.value = data.checkbox0;
     if (ok)
       aValue.value = data.textbox0;
     return ok;
   },
 
   nsIPrompt_promptPassword: function nsIPrompt_promptPassword(
       aTitle, aText, aPassword, aCheckMsg, aCheckState) {
     let p = this._getPrompt(aTitle, aText, null);
     this.addPassword(p, aPassword.value, true, PromptUtils.getLocaleString("password", "passwdmgr"));
     this.addCheckbox(p, aCheckMsg, aCheckState);
     let data = this.showPrompt(p);
 
     let ok = data.button == 0;
     if (aCheckState && data.button > -1)
-      aCheckState.value = data.checkbox0 == "true";
+      aCheckState.value = data.checkbox0;
     if (ok)
       aPassword.value = data.password0;
     return ok;
   },
 
   nsIPrompt_promptUsernameAndPassword: function nsIPrompt_promptUsernameAndPassword(
       aTitle, aText, aUsername, aPassword, aCheckMsg, aCheckState) {
     let p = this._getPrompt(aTitle, aText, null);
     this.addTextbox(p, aUsername.value, true, PromptUtils.getLocaleString("username", "passwdmgr"));
     this.addPassword(p, aPassword.value, false, PromptUtils.getLocaleString("password", "passwdmgr"));
     this.addCheckbox(p, aCheckMsg, aCheckState);
     let data = this.showPrompt(p);
 
     let ok = data.button == 0;
     if (aCheckState && data.button > -1)
-      aCheckState.value = data.checkbox0 == "true";
+      aCheckState.value = data.checkbox0;
+
     if (ok) {
       aUsername.value = data.textbox0;
       aPassword.value = data.password0;
     }
     return ok;
   },
 
   select: function select(aTitle, aText, aCount, aSelectList, aOutSelection) {