Bug 214707: Don't allow creation of nameless toolbars. p=gavin.sharp@gmail.com, r=bsmedberg

This commit is contained in:
steffen.wilberg%web.de 2005-03-05 01:22:30 +00:00
Родитель 6ae35f8b2a
Коммит 65e2af214e
2 изменённых файлов: 18 добавлений и 7 удалений

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

@ -527,28 +527,38 @@ function addNewToolbar()
var stringBundle = document.getElementById("stringBundle");
var message = stringBundle.getString("enterToolbarName");
var title = stringBundle.getString("enterToolbarTitle");
var name = {};
while (true) {
if (!promptService.prompt(window, title, message, name, null, {}))
return;
if (!name.value) {
message = stringBundle.getFormattedString("enterToolbarBlank", [name.value]);
continue;
}
var dupeFound = false;
// Check for an existing toolbar with the same display name
for (i = 0; i < gToolbox.childNodes.length; ++i) {
var toolbar = gToolbox.childNodes[i];
var toolbarName = toolbar.getAttribute("toolbarname");
if (toolbarName == name.value && toolbar.getAttribute("type") != "menubar") {
if (toolbarName == name.value &&
toolbar.getAttribute("type") != "menubar" &&
toolbar.nodeName == 'toolbar') {
dupeFound = true;
break;
}
}
}
if (!dupeFound)
break;
message = stringBundle.getFormattedString("enterToolbarDup", [name.value]);
message = stringBundle.getFormattedString("enterToolbarDup", [name.value]);
}
gToolbox.appendCustomToolbar(name.value, "");

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

@ -1,6 +1,7 @@
enterToolbarTitle=New Toolbar
enterToolbarName=Enter a name for this toolbar:
enterToolbarDup=There is already a toolbar with the name "%S". Please enter a different name.
enterToolbarBlank=You must enter a name to create a new toolbar.
separatorTitle=Separator
springTitle=Flexible Space
spacerTitle=Space