2011-07-31 12:43:54 -07:00
|
|
|
|
<!DOCTYPE HTML>
|
|
|
|
|
<html>
|
|
|
|
|
<!--
|
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=583533
|
|
|
|
|
-->
|
|
|
|
|
<head>
|
|
|
|
|
<title>Test for Bug 583514</title>
|
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=583533">Mozilla Bug 583533</a>
|
|
|
|
|
<p id="display"></p>
|
|
|
|
|
<div id="content">
|
|
|
|
|
<div id="e" accesskey="a">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<pre id="test">
|
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
|
|
|
|
/** Test for Bug 583533 **/
|
|
|
|
|
|
2013-04-15 10:50:45 -07:00
|
|
|
|
var sbs = SpecialPowers.Cc['@mozilla.org/intl/stringbundle;1'].
|
|
|
|
|
getService(SpecialPowers.Ci.nsIStringBundleService);
|
2011-07-31 12:43:54 -07:00
|
|
|
|
var bundle = sbs.createBundle("chrome://global-platform/locale/platformKeys.properties");
|
|
|
|
|
|
|
|
|
|
var shiftText = bundle.GetStringFromName("VK_SHIFT");
|
|
|
|
|
var altText = bundle.GetStringFromName("VK_ALT");
|
|
|
|
|
var controlText = bundle.GetStringFromName("VK_CONTROL");
|
|
|
|
|
var metaText = bundle.GetStringFromName("VK_META");
|
|
|
|
|
var separatorText = bundle.GetStringFromName("MODIFIER_SEPARATOR");
|
|
|
|
|
|
2013-04-15 10:50:45 -07:00
|
|
|
|
var modifier = SpecialPowers.getIntPref("ui.key.contentAccess");
|
2012-02-26 19:02:35 -08:00
|
|
|
|
|
2011-07-31 12:43:54 -07:00
|
|
|
|
var isShift;
|
|
|
|
|
var isAlt;
|
|
|
|
|
var isControl;
|
|
|
|
|
var isMeta;
|
|
|
|
|
|
|
|
|
|
is(modifier < 16 && modifier >= 0, true, "Modifier in range");
|
|
|
|
|
|
2012-02-26 19:02:35 -08:00
|
|
|
|
// There are no consts for the mask of this prefs.
|
|
|
|
|
if (modifier & 8) {
|
2011-07-31 12:43:54 -07:00
|
|
|
|
isMeta = true;
|
2012-02-26 19:02:35 -08:00
|
|
|
|
}
|
|
|
|
|
if (modifier & 1) {
|
2011-07-31 12:43:54 -07:00
|
|
|
|
isShift = true;
|
2012-02-26 19:02:35 -08:00
|
|
|
|
}
|
|
|
|
|
if (modifier & 2) {
|
2011-07-31 12:43:54 -07:00
|
|
|
|
isControl = true;
|
2012-02-26 19:02:35 -08:00
|
|
|
|
}
|
|
|
|
|
if (modifier & 4) {
|
2011-07-31 12:43:54 -07:00
|
|
|
|
isAlt = true;
|
2012-02-26 19:02:35 -08:00
|
|
|
|
}
|
2011-07-31 12:43:54 -07:00
|
|
|
|
|
|
|
|
|
var label = "";
|
|
|
|
|
|
|
|
|
|
if (isControl)
|
|
|
|
|
label += controlText + separatorText;
|
|
|
|
|
if (isMeta)
|
|
|
|
|
label += metaText + separatorText;
|
|
|
|
|
if (isAlt)
|
|
|
|
|
label += altText + separatorText;
|
|
|
|
|
if (isShift)
|
|
|
|
|
label += shiftText + separatorText;
|
|
|
|
|
|
|
|
|
|
label += document.getElementById("e").accessKey;
|
|
|
|
|
|
|
|
|
|
is(label, document.getElementById("e").accessKeyLabel, "JS and C++ agree on accessKeyLabel");
|
|
|
|
|
|
2012-11-07 10:47:34 -08:00
|
|
|
|
/** Test for Bug 808964 **/
|
|
|
|
|
|
|
|
|
|
var div = document.createElement("div");
|
|
|
|
|
document.body.appendChild(div);
|
|
|
|
|
|
|
|
|
|
is(div.accessKeyLabel, "", "accessKeyLabel should be empty string");
|
|
|
|
|
|
2011-07-31 12:43:54 -07:00
|
|
|
|
</script>
|
|
|
|
|
</pre>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|