Bug 558202 - enter/escape keys don't work correctly in confirmEx in Fennec [r=mfinkle]

This commit is contained in:
Matt Brubeck 2010-04-09 00:59:23 -04:00
Родитель 807c92159d
Коммит 93ac1a676d
2 изменённых файлов: 16 добавлений и 4 удалений

Просмотреть файл

@ -35,7 +35,11 @@ var PromptHelper = {
closeDialog : function(confirm, id) {
let dialog = document.getElementById(id);
dialog.arguments.result = confirm;
if (typeof confirm == "boolean" && dialog.arguments && "defaultButton" in dialog.arguments)
// confirmEx always returns 1 when dismissed with "escape" (bug 345067).
dialog.arguments.result = confirm ? dialog.arguments.defaultButton : 1;
else
dialog.arguments.result = confirm;
dialog.close();
},

Просмотреть файл

@ -231,10 +231,18 @@ promptService.prototype = {
let numButtons = 0;
let titles = [aButton0, aButton1, aButton2];
let defaultButton = 0;
if (aButtonFlags & Ci.nsIPromptService.BUTTON_POS_1_DEFAULT)
defaultButton = 1;
if (aButtonFlags & Ci.nsIPromptService.BUTTON_POS_2_DEFAULT)
defaultButton = 2;
var params = new Object();
params.result = false;
params.checkbox = aCheckState;
var params = {
result: false,
checkbox: aCheckState,
defaultButton: defaultButton
}
let dialog = this.openDialog(aParent, "chrome://browser/content/prompt/confirm.xul", params);
doc.getElementById("prompt-confirm-title").value = aTitle;