зеркало из https://github.com/mozilla/pjs.git
Bug 456121 - nsApplicationAccessible::GetName does not return a default value when brand.properties does not exist, patch=arno renevier, r=me, marcoz
This commit is contained in:
Родитель
f367656b73
Коммит
5ade623a65
|
@ -114,16 +114,16 @@ nsApplicationAccessible::GetName(nsAString& aName)
|
|||
NS_ENSURE_STATE(bundleService);
|
||||
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
bundleService->CreateBundle("chrome://branding/locale/brand.properties",
|
||||
getter_AddRefs(bundle));
|
||||
nsresult rv = bundleService->CreateBundle("chrome://branding/locale/brand.properties",
|
||||
getter_AddRefs(bundle));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsXPIDLString appName;
|
||||
if (bundle) {
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
|
||||
getter_Copies(appName));
|
||||
} else {
|
||||
NS_WARNING("brand.properties not present, using default app name");
|
||||
appName.AssignLiteral("Mozilla");
|
||||
rv = bundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
|
||||
getter_Copies(appName));
|
||||
if (NS_FAILED(rv) || appName.IsEmpty()) {
|
||||
NS_WARNING("brandShortName not found, using default app name");
|
||||
appName.AssignLiteral("Gecko based application");
|
||||
}
|
||||
|
||||
aName.Assign(appName);
|
||||
|
|
|
@ -66,6 +66,7 @@ _TEST_FILES =\
|
|||
$(warning test_table_indexes.html temporarily disabled) \
|
||||
test_nsIAccessible_actions.html \
|
||||
test_nsIAccessible_actions.xul \
|
||||
test_nsIAccessible_applicationAccessible.html \
|
||||
test_nsIAccessible_editablebody.html \
|
||||
test_nsIAccessible_editabledoc.html \
|
||||
test_nsIAccessible_name.html \
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>application accessible name</title>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js" ></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
{
|
||||
var accessible = getAccessible(document);
|
||||
while (accessible && accessible.parent) {
|
||||
accessible = accessible.parent;
|
||||
}
|
||||
|
||||
if (!accessible) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
var bundleServ = Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Components.interfaces.nsIStringBundleService);
|
||||
var bundle = bundleServ.createBundle("chrome://branding/locale/brand.properties");
|
||||
|
||||
var applicationName = "";
|
||||
|
||||
try {
|
||||
applicationName = bundle.GetStringFromName("brandShortName");
|
||||
} catch(e) {
|
||||
}
|
||||
|
||||
if (applicationName == "")
|
||||
applicationName = "Gecko based application";
|
||||
|
||||
is (accessible.name, applicationName, "wrong application accessible name");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=456121"
|
||||
title="nsApplicationAccessible::GetName does not return a default value when brand.properties does not exist">
|
||||
Mozilla Bug 454211
|
||||
</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче