Bug 559458 - document.getElementById(prompt-confirm-dialog) can be null in confirm.xul [r=mfinkle]

This commit is contained in:
Vivien Nicolas 2010-04-15 10:40:43 -04:00
parent 5e1a31e5a8
commit 7b96f05622
2 changed files with 8 additions and 3 deletions

View File

@ -2,7 +2,7 @@
<!DOCTYPE vbox SYSTEM "chrome://browser/locale/prompt.dtd">
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="prompt-confirm-dialog"
onload="document.getElementById('prompt-confirm-button-ok').focus()"
onload="document.getElementsByAttribute('command', 'cmd_ok')[0].focus()"
onclose="this.PromptHelper.onCloseConfirm(this)"
script="chrome://browser/content/prompt/prompt.js">
<keyset>

View File

@ -295,8 +295,13 @@ promptService.prototype = {
let button = doc.createElement("button");
this.setLabelForNode(button, bTitle);
button.setAttribute("class", "button-dark");
button.setAttribute("oncommand",
"document.getElementById('prompt-confirm-dialog').PromptHelper.closeConfirm(" + i + ")");
if (i == defaultButton) {
button.setAttribute("command", "cmd_ok");
}
else {
button.setAttribute("oncommand",
"document.getElementById('prompt-confirm-dialog').PromptHelper.closeConfirm(" + i + ")");
}
bbox.appendChild(button);
}