Bug 1016348 - Treat prompt service boolean returns as real booleans. r=margaret
authorWes Johnston <wjohnston@mozilla.com>
Tue, 27 May 2014 14:43:43 -0700
changeset 185191 80bb6e3621fcf3dd4a387fbd900cfc814527ffda
parent 185190 643749739862a3d3f111388f0c9f52b8d5bad0c3
child 185192 d38acfe08ecda41a419ae7c07b9c8d88a4c4c06a
push id6998
push userwjohnston@mozilla.com
push dateTue, 27 May 2014 21:44:08 +0000
treeherderfx-team@80bb6e3621fc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1016348
milestone32.0a1
Bug 1016348 - Treat prompt service boolean returns as real booleans. r=margaret
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) {