Bug 838407 - aria-hidden false value shouldn't be exposed via object attributes, r=tbsaunde

This commit is contained in:
Alexander Surkov 2013-02-11 09:54:14 +09:00
parent 6c7ff5b5b9
commit 65db8c80b8
3 changed files with 17 additions and 3 deletions

View File

@ -679,7 +679,7 @@ nsAttributeCharacteristics nsARIAMap::gWAIUnivAttrMap[] = {
{&nsGkAtoms::aria_flowto, ATTR_BYPASSOBJ | ATTR_GLOBAL },
{&nsGkAtoms::aria_grabbed, ATTR_VALTOKEN | ATTR_GLOBAL },
{&nsGkAtoms::aria_haspopup, ATTR_BYPASSOBJ | ATTR_VALTOKEN | ATTR_GLOBAL },
{&nsGkAtoms::aria_hidden, ATTR_VALTOKEN | ATTR_GLOBAL },/* always expose obj attr */
{&nsGkAtoms::aria_hidden, ATTR_BYPASSOBJ_IF_FALSE | ATTR_VALTOKEN | ATTR_GLOBAL },
{&nsGkAtoms::aria_invalid, ATTR_BYPASSOBJ | ATTR_VALTOKEN | ATTR_GLOBAL },
{&nsGkAtoms::aria_label, ATTR_BYPASSOBJ | ATTR_GLOBAL },
{&nsGkAtoms::aria_labelledby, ATTR_BYPASSOBJ | ATTR_GLOBAL },
@ -776,6 +776,12 @@ AttrIterator::Next(nsAString& aAttrName, nsAString& aAttrValue)
!nsAccUtils::HasDefinedARIAToken(mContent, attrAtom))
continue; // only expose token based attributes if they are defined
if ((attrFlags & ATTR_BYPASSOBJ_IF_FALSE) &&
mContent->AttrValueIs(kNameSpaceID_None, attrAtom,
nsGkAtoms::_false, eCaseMatters)) {
continue; // only expose token based attribute if value is not 'false'.
}
nsAutoString value;
if (mContent->GetAttr(kNameSpaceID_None, attrAtom, value)) {
aAttrName.Assign(Substring(attrStr, 5));

View File

@ -98,18 +98,19 @@ const bool kUseNativeRole = false;
* that it should, but is already handled in other code.
*/
const uint8_t ATTR_BYPASSOBJ = 0x1 << 0;
const uint8_t ATTR_BYPASSOBJ_IF_FALSE = 0x1 << 1;
/**
* This mask indicates the attribute is expected to have an NMTOKEN or bool value.
* (See for example usage in Accessible::Attributes())
*/
const uint8_t ATTR_VALTOKEN = 0x1 << 1;
const uint8_t ATTR_VALTOKEN = 0x1 << 2;
/**
* Indicate the attribute is global state or property (refer to
* http://www.w3.org/TR/wai-aria/states_and_properties#global_states).
*/
const uint8_t ATTR_GLOBAL = 0x1 << 2;
const uint8_t ATTR_GLOBAL = 0x1 << 3;
/**
* Small footprint storage of persistent aria attribute characteristics.

View File

@ -33,6 +33,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
testAttrs("dropeffect", {"dropeffect" : "copy"}, true);
testAttrs("grabbed", {"grabbed" : "true"}, true);
testAttrs("hidden", {"hidden" : "true"}, true);
testAbsentAttrs("hidden_false", { "hidden": "false" });
testAttrs("sortAscending", {"sort" : "ascending"}, true);
testAttrs("sortDescending", {"sort" : "descending"}, true);
testAttrs("sortNone", {"sort" : "none"}, true);
@ -162,6 +163,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
title="crash in nsTextEquivUtils::AppendTextEquivFromTextContent">
Mozilla Bug 819303
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=838407"
title="aria-hidden false value shouldn't be exposed via object attributes">
Mozilla Bug 838407
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
@ -179,6 +185,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
<div id="dropeffect" aria-dropeffect="copy"></div>
<div id="grabbed" aria-grabbed="true"></div>
<div id="hidden" aria-hidden="true"></div>
<div id="hidden_false" aria-hidden="false"></div>
<div id="sortAscending" role="columnheader" aria-sort="ascending"></div>
<div id="sortDescending" role="columnheader" aria-sort="descending"></div>
<div id="sortNone" role="columnheader" aria-sort="none"></div>