зеркало из https://github.com/mozilla/pjs.git
Bug 214707: Don't allow creation of nameless toolbars. p=gavin.sharp@gmail.com, r=bsmedberg
This commit is contained in:
Родитель
541ae4d7ec
Коммит
91938ec760
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче