Bug 1385817 - Enable brace-style and no-else-return ESLint rules for accessible/ r=yzen

MozReview-Commit-ID: DeVusjK4kt0

--HG--
extra : rebase_source : 67dfeb6c82792ad453dfe72e74dbc8f430877649
This commit is contained in:
Dan Banner 2017-08-01 19:08:02 +01:00
Родитель 1ce5193a91
Коммит 3e7397ae81
233 изменённых файлов: 1482 добавлений и 2932 удалений

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

@ -8,10 +8,8 @@ module.exports = {
// XXX These are rules that are enabled in the recommended configuration, but
// disabled here due to failures when initially implemented. They should be
// removed (and hence enabled) at some stage.
"brace-style": "off",
"consistent-return": "off",
"object-shorthand": "off",
"no-else-return": "off",
"no-unexpected-multiline": "off",
"no-unsafe-finally": "off",
"no-useless-call": "off",

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

@ -773,9 +773,9 @@ var Input = {
// Don't move forward if caret is not at end of entry.
// XXX: Fix for rtl
return;
} else {
target.blur();
}
target.blur();
}
this.moveCursor(aEvent.shiftKey ?
"moveLast" : "moveNext", "Simple", "keyboard");
@ -786,9 +786,9 @@ var Input = {
// Don't move backward if caret is not at start of entry.
// XXX: Fix for rtl
return;
} else {
target.blur();
}
target.blur();
}
this.moveCursor(aEvent.shiftKey ?
"moveFirst" : "movePrevious", "Simple", "keyboard");
@ -798,9 +798,9 @@ var Input = {
if (!this.editState.atStart) {
// Don't blur content if caret is not at start of text area.
return;
} else {
target.blur();
}
target.blur();
}
if (Utils.MozBuildApp == "mobile/android") {

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

@ -671,8 +671,7 @@ this.UtteranceGenerator = { // jshint ignore:line
if (itemno.value == 1) {
// Start of list
utterance.push({string: "listStart"});
}
else if (itemno.value == itemof.value) {
} else if (itemno.value == itemof.value) {
// last item
utterance.push({string: "listEnd"});
}

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

@ -47,8 +47,7 @@ BaseTraversalRule.prototype = {
return aRoles.value.length;
},
match: function BaseTraversalRule_match(aAccessible)
{
match: function BaseTraversalRule_match(aAccessible) {
let role = aAccessible.role;
if (role == Roles.INTERNAL_FRAME) {
return (Utils.getMessageManager(aAccessible.DOMNode)) ?
@ -194,14 +193,13 @@ this.TraversalRules = { // jshint ignore:line
Anchor: new BaseTraversalRule(
[Roles.LINK],
function Anchor_match(aAccessible)
{
function Anchor_match(aAccessible) {
// We want to ignore links, only focus named anchors.
if (Utils.getState(aAccessible).contains(States.LINKED)) {
return Filters.IGNORE;
} else {
return Filters.MATCH;
}
return Filters.MATCH;
}),
Button: new BaseTraversalRule(
@ -284,14 +282,13 @@ this.TraversalRules = { // jshint ignore:line
Link: new BaseTraversalRule(
[Roles.LINK],
function Link_match(aAccessible)
{
function Link_match(aAccessible) {
// We want to ignore anchors, only focus real links.
if (Utils.getState(aAccessible).contains(States.LINKED)) {
return Filters.MATCH;
} else {
return Filters.IGNORE;
}
return Filters.IGNORE;
}),
/* For TalkBack's "Control" granularity. Form conrols and links */
@ -314,8 +311,7 @@ this.TraversalRules = { // jshint ignore:line
Roles.SWITCH,
Roles.LINK,
Roles.MENUITEM],
function Control_match(aAccessible)
{
function Control_match(aAccessible) {
// We want to ignore anchors, only focus real links.
if (aAccessible.role == Roles.LINK &&
!Utils.getState(aAccessible).contains(States.LINKED)) {
@ -409,9 +405,9 @@ this.TraversalHelper = {
}
return moved;
} else {
return aVirtualCursor[aMethod](rule);
}
return aVirtualCursor[aMethod](rule);
}
};

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

@ -264,12 +264,12 @@ this.Utils = { // jshint ignore:line
return new State(
aAccessibleOrEvent.isExtraState ? 0 : aAccessibleOrEvent.state,
aAccessibleOrEvent.isExtraState ? aAccessibleOrEvent.state : 0);
} else {
}
let state = {};
let extState = {};
aAccessibleOrEvent.getState(state, extState);
return new State(state.value, extState.value);
}
},
getAttributes: function getAttributes(aAccessible) {

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

@ -47,8 +47,7 @@ const XUL_EVENTS = CLICK_EVENTS | COMMAND_EVENT;
*
* @param aArray [in] an array of action cheker objects
*/
function testActions(aArray)
{
function testActions(aArray) {
gActionsQueue = new eventQueue();
for (var idx = 0; idx < aArray.length; idx++) {
@ -94,8 +93,7 @@ function testActions(aArray)
/**
* Test action names and descriptions.
*/
function testActionNames(aID, aActions)
{
function testActionNames(aID, aActions) {
var actions = (typeof aActions == "string") ?
[ aActions ] : (aActions || []);
@ -113,10 +111,8 @@ function testActionNames(aID, aActions)
var gActionsQueue = null;
function actionInvoker(aAccOrElmOrId, aActionIndex, aActionName, aEventSeq)
{
this.invoke = function actionInvoker_invoke()
{
function actionInvoker(aAccOrElmOrId, aActionIndex, aActionName, aEventSeq) {
this.invoke = function actionInvoker_invoke() {
var acc = getAccessible(aAccOrElmOrId);
if (!acc)
return INVOKER_ACTION_FAILED;
@ -133,8 +129,7 @@ function actionInvoker(aAccOrElmOrId, aActionIndex, aActionName, aEventSeq)
try {
acc.doAction(aActionIndex);
}
catch (e) {
} catch (e) {
ok(false, "doAction(" + aActionIndex + ") failed with: " + e.name);
return INVOKER_ACTION_FAILED;
}
@ -142,28 +137,24 @@ function actionInvoker(aAccOrElmOrId, aActionIndex, aActionName, aEventSeq)
this.eventSeq = aEventSeq;
this.getID = function actionInvoker_getID()
{
this.getID = function actionInvoker_getID() {
return "invoke an action " + aActionName + " at index " + aActionIndex +
" on " + prettyName(aAccOrElmOrId);
}
}
function checkerOfActionInvoker(aType, aTarget, aActionObj)
{
function checkerOfActionInvoker(aType, aTarget, aActionObj) {
this.type = aType;
this.target = aTarget;
this.phase = false;
this.getID = function getID()
{
this.getID = function getID() {
return aType + " event handling";
}
this.check = function check(aEvent)
{
this.check = function check(aEvent) {
if (aActionObj && "checkOnClickEvent" in aActionObj)
aActionObj.checkOnClickEvent(aEvent);
}

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

@ -21,12 +21,10 @@
// //////////////////////////////////////////////////////////////////////////
// Event checkers
function scrollingChecker(aAcc)
{
function scrollingChecker(aAcc) {
this.type = EVENT_SCROLLING_START;
this.target = aAcc;
this.getID = function scrollingChecker_getID()
{
this.getID = function scrollingChecker_getID() {
return "scrolling start handling for " + prettyName(aAcc);
}
}
@ -37,8 +35,7 @@
// gA11yEventDumpID = "debug"; // debug stuff
// gA11yEventDumpToConsole = true; // debug stuff
function doTest()
{
function doTest() {
var actionsArray = [
{
ID: "anchor1",

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

@ -17,8 +17,7 @@
src="../actions.js"></script>
<script type="application/javascript">
function doTest()
{
function doTest() {
var actionsArray = [
{
ID: "clickable",

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

@ -21,8 +21,7 @@
src="../actions.js"></script>
<script type="application/javascript">
function doTest()
{
function doTest() {
var actionsArray = [
{
ID: "button",

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

@ -17,8 +17,7 @@
src="../actions.js"></script>
<script type="application/javascript">
function doTest()
{
function doTest() {
var actionsArray = [
{
ID: "li_clickable1",

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

@ -13,8 +13,7 @@
src="../common.js"></script>
<script type="application/javascript">
function testAcessKey(aAccOrElmOrID, aKey)
{
function testAcessKey(aAccOrElmOrID, aKey) {
var acc = getAccessible(aAccOrElmOrID);
if (!acc)
return;
@ -23,8 +22,7 @@
"Wrong keyboard shortcut on " + prettyName(aAccOrElmOrID));
}
function doTest()
{
function doTest() {
testAcessKey("input1", "");
testAcessKey("input2", MAC ? "⌃⌥b" : "Alt+Shift+b");
testAcessKey("link", MAC ? "⌃⌥l" : "Alt+Shift+l");

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

@ -17,8 +17,7 @@
src="../actions.js"></script>
<script type="application/javascript">
function getAnchorTargetDocumentAcc()
{
function getAnchorTargetDocumentAcc() {
var thisTabDocAcc = getTabDocAccessible();
var thisDocTabPanelAcc = thisTabDocAcc.parent.parent;
var tabPanelsAcc = thisDocTabPanelAcc.parent;
@ -35,21 +34,18 @@
return newDocTabPanelAcc.firstChild.firstChild;
}
function linkChecker(aID)
{
function linkChecker(aID) {
this.type = EVENT_DOCUMENT_LOAD_COMPLETE;
this.__defineGetter__("target", getAnchorTargetDocumentAcc);
this.check = function linkChecker_check()
{
this.check = function linkChecker_check() {
var anchorTargetWindow =
getAccessible(getAnchorTargetDocumentAcc(), [nsIAccessibleDocument]).
window;
anchorTargetWindow.close();
}
this.getID = function linkChecker_getID()
{
this.getID = function linkChecker_getID() {
return "link '" + aID + "' states check ";
}
}
@ -57,8 +53,7 @@
// gA11yEventDumpToConsole = true;
// enableLogging("tree,eventTree,verbose");
function doTest()
{
function doTest() {
var actionsArray = [
{
ID: "link1",

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

@ -26,37 +26,30 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
// gA11yEventDumpID = "eventDump";
// gA11yEventDumpToConsole = true; // debug stuff
function focusChecker(aAcc)
{
function focusChecker(aAcc) {
this.type = EVENT_FOCUS;
this.target = aAcc;
this.getID = function focusChecker_getID()
{
this.getID = function focusChecker_getID() {
return "focus handling";
}
this.check = function focusChecker_check(aEvent)
{
this.check = function focusChecker_check(aEvent) {
testStates(this.target, STATE_FOCUSED);
}
}
function nameChecker(aAcc, aName)
{
function nameChecker(aAcc, aName) {
this.type = EVENT_NAME_CHANGE;
this.target = aAcc;
this.getID = function nameChecker_getID()
{
this.getID = function nameChecker_getID() {
return "name change handling";
},
this.check = function nameChecker_check(aEvent)
{
this.check = function nameChecker_check(aEvent) {
is(aEvent.accessible.name, aName,
"Wrong name of " + prettyName(aEvent.accessible) + " on focus");
}
}
function doTest()
{
function doTest() {
// ////////////////////////////////////////////////////////////////////////
// test actions of audio controls

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

@ -22,8 +22,7 @@
<script type="application/javascript">
// gA11yEventDumpToConsole = true; // debugging
function doTest()
{
function doTest() {
var actionsArray = [
{
ID: "lb_apple",

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

@ -10,8 +10,7 @@
* @param aSkipUnexpectedAttrs [in] points this function doesn't fail if
* unexpected attribute is encountered
*/
function testAttrs(aAccOrElmOrID, aAttrs, aSkipUnexpectedAttrs)
{
function testAttrs(aAccOrElmOrID, aAttrs, aSkipUnexpectedAttrs) {
testAttrsInternal(aAccOrElmOrID, aAttrs, aSkipUnexpectedAttrs);
}
@ -22,16 +21,14 @@ function testAttrs(aAccOrElmOrID, aAttrs, aSkipUnexpectedAttrs)
* @param aAbsentAttrs [in] map of attributes that should not be
* present (name/value pairs)
*/
function testAbsentAttrs(aAccOrElmOrID, aAbsentAttrs)
{
function testAbsentAttrs(aAccOrElmOrID, aAbsentAttrs) {
testAttrsInternal(aAccOrElmOrID, {}, true, aAbsentAttrs);
}
/**
* Test CSS based object attributes.
*/
function testCSSAttrs(aID)
{
function testCSSAttrs(aID) {
var node = document.getElementById(aID);
var computedStyle = document.defaultView.getComputedStyle(node);
@ -50,8 +47,7 @@ function testCSSAttrs(aID)
/**
* Test the accessible that it doesn't have CSS-based object attributes.
*/
function testAbsentCSSAttrs(aID)
{
function testAbsentCSSAttrs(aID) {
var attrs = {
"display": "",
"text-align": "",
@ -73,8 +69,7 @@ function testAbsentCSSAttrs(aID)
* @param aSetSize [in] the value of 'setsize' attribute
* @param aLevel [in, optional] the value of 'level' attribute
*/
function testGroupAttrs(aAccOrElmOrID, aPosInSet, aSetSize, aLevel)
{
function testGroupAttrs(aAccOrElmOrID, aPosInSet, aSetSize, aLevel) {
var acc = getAccessible(aAccOrElmOrID);
var levelObj = {}, posInSetObj = {}, setSizeObj = {};
acc.groupPosition(levelObj, setSizeObj, posInSetObj);
@ -124,8 +119,7 @@ function testGroupAttrs(aAccOrElmOrID, aPosInSet, aSetSize, aLevel)
* unexpected attribute is encountered
*/
function testTextAttrs(aID, aOffset, aAttrs, aDefAttrs,
aStartOffset, aEndOffset, aSkipUnexpectedAttrs)
{
aStartOffset, aEndOffset, aSkipUnexpectedAttrs) {
var accessible = getAccessible(aID, [nsIAccessibleText]);
if (!accessible)
return;
@ -176,8 +170,7 @@ function testTextAttrs(aID, aOffset, aAttrs, aDefAttrs,
* @param aSkipUnexpectedAttrs [in] points the function doesn't fail if
* unexpected attribute is encountered
*/
function testDefaultTextAttrs(aID, aDefAttrs, aSkipUnexpectedAttrs)
{
function testDefaultTextAttrs(aID, aDefAttrs, aSkipUnexpectedAttrs) {
var accessible = getAccessible(aID, [nsIAccessibleText]);
if (!accessible)
return;
@ -200,8 +193,7 @@ function testDefaultTextAttrs(aID, aDefAttrs, aSkipUnexpectedAttrs)
/**
* Test text attributes for wrong offset.
*/
function testTextAttrsWrongOffset(aID, aOffset)
{
function testTextAttrsWrongOffset(aID, aOffset) {
var res = false;
try {
var s = {}, e = {};
@ -242,8 +234,7 @@ const kCursiveFontFamily = LINUX ? "DejaVu Serif" : "Comic Sans MS";
/**
* Return used font from the given computed style.
*/
function fontFamily(aComputedStyle)
{
function fontFamily(aComputedStyle) {
var name = aComputedStyle.fontFamily;
switch (name) {
case "monospace":
@ -265,8 +256,7 @@ function fontFamily(aComputedStyle)
* @param aFontWeight [in, optional] kBoldFontWeight or kNormalFontWeight,
* default value is kNormalFontWeight
*/
function buildDefaultTextAttrs(aID, aFontSize, aFontWeight, aFontFamily)
{
function buildDefaultTextAttrs(aID, aFontSize, aFontWeight, aFontFamily) {
var elm = getNode(aID);
var computedStyle = document.defaultView.getComputedStyle(elm);
var bgColor = computedStyle.backgroundColor == "rgba(0, 0, 0, 0)" ?
@ -289,8 +279,7 @@ function buildDefaultTextAttrs(aID, aFontSize, aFontWeight, aFontFamily)
// Private.
function getTextAttributes(aID, aAccessible, aIncludeDefAttrs, aOffset,
aStartOffset, aEndOffset)
{
aStartOffset, aEndOffset) {
// This function expects the passed in accessible to already be queried for
// nsIAccessibleText.
var attrs = null;
@ -308,8 +297,7 @@ function getTextAttributes(aID, aAccessible, aIncludeDefAttrs, aOffset,
}
function testAttrsInternal(aAccOrElmOrID, aAttrs, aSkipUnexpectedAttrs,
aAbsentAttrs)
{
aAbsentAttrs) {
var accessible = getAccessible(aAccOrElmOrID);
if (!accessible)
return;
@ -329,8 +317,7 @@ function testAttrsInternal(aAccOrElmOrID, aAttrs, aSkipUnexpectedAttrs,
}
function compareAttrs(aErrorMsg, aAttrs, aExpectedAttrs, aSkipUnexpectedAttrs,
aAbsentAttrs)
{
aAbsentAttrs) {
// Check if all obtained attributes are expected and have expected value.
var enumerate = aAttrs.enumerate();
while (enumerate.hasMoreElements()) {

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

@ -17,8 +17,7 @@
<script type="application/javascript">
function doTest()
{
function doTest() {
// DPub ARIA roles should be exposed via the xml-roles object attribute.
let dpub_attrs = [
"doc-abstract",

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

@ -19,8 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
src="../attributes.js"></script>
<script type="application/javascript">
function doTest()
{
function doTest() {
// aria
testAttrs("atomic", {"atomic": "true", "container-atomic": "true"}, true);
testAttrs(getNode("atomic").firstChild, {"container-atomic": "true"}, true);

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

@ -17,8 +17,7 @@
<script type="application/javascript">
var gQueue = null;
function removeElm(aID)
{
function removeElm(aID) {
this.node = getNode(aID);
this.accessible = getAccessible(aID);
@ -26,24 +25,20 @@
new invokerChecker(EVENT_HIDE, this.accessible)
];
this.invoke = function removeElm_invoke()
{
this.invoke = function removeElm_invoke() {
this.node.remove();
}
this.check = function removeElm_check()
{
this.check = function removeElm_check() {
testAbsentCSSAttrs(this.accessible);
}
this.getID = function removeElm_getID()
{
this.getID = function removeElm_getID() {
return "test CSS-based attributes on removed accessible";
}
}
function doTest()
{
function doTest() {
// CSS display
testCSSAttrs("display_block");
testCSSAttrs("display_inline");

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

@ -16,8 +16,7 @@
src="../events.js"></script>
<script type="application/javascript">
function doTest()
{
function doTest() {
// ////////////////////////////////////////////////////////////////////////
// HTML select with no size attribute.
testGroupAttrs("opt1-nosize", 1, 4);

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

@ -17,8 +17,7 @@
<script type="application/javascript">
function doTest()
{
function doTest() {
// And some AT may look for this
testAttrs("nav", {"tag": "nav"}, true);
testAttrs("header", {"tag": "header"}, true);

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

@ -17,8 +17,7 @@
<script type="application/javascript">
function doTest()
{
function doTest() {
// Some AT may look for this
testAttrs("nav", {"xml-roles": "navigation"}, true);
testAttrs("header", {"xml-roles": "banner"}, true);

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

@ -14,8 +14,7 @@ var gDefaultAutoCompleteSearch = null;
* @param aValues [in] set of possible results values
* @param aComments [in] set of possible results descriptions
*/
function initAutoComplete(aValues, aComments)
{
function initAutoComplete(aValues, aComments) {
var allResults = new ResultsHeap(aValues, aComments);
gDefaultAutoCompleteSearch =
new AutoCompleteSearch("test-a11y-search", allResults);
@ -26,8 +25,7 @@ function initAutoComplete(aValues, aComments)
/**
* Unregister 'test-a11y-search' AutoCompleteSearch.
*/
function shutdownAutoComplete()
{
function shutdownAutoComplete() {
unregisterAutoCompleteSearch(gDefaultAutoCompleteSearch);
gDefaultAutoCompleteSearch.cid = null;
gDefaultAutoCompleteSearch = null;
@ -40,8 +38,7 @@ function shutdownAutoComplete()
* @param aSearch [in] AutoCompleteSearch object
* @param aDescription [in] description of the search object
*/
function registerAutoCompleteSearch(aSearch, aDescription)
{
function registerAutoCompleteSearch(aSearch, aDescription) {
var name = "@mozilla.org/autocomplete/search;1?name=" + aSearch.name;
var uuidGenerator = Components.classes["@mozilla.org/uuid-generator;1"].
@ -58,8 +55,7 @@ function registerAutoCompleteSearch(aSearch, aDescription)
/**
* Unregister the given AutoCompleteSearch.
*/
function unregisterAutoCompleteSearch(aSearch)
{
function unregisterAutoCompleteSearch(aSearch) {
var componentManager = Components.manager.QueryInterface(nsIComponentRegistrar);
componentManager.unregisterFactory(aSearch.cid, aSearch);
}
@ -68,8 +64,7 @@ function unregisterAutoCompleteSearch(aSearch)
/**
* A container to keep all possible results of autocomplete search.
*/
function ResultsHeap(aValues, aComments)
{
function ResultsHeap(aValues, aComments) {
this.values = aValues;
this.comments = aComments;
}
@ -81,8 +76,7 @@ ResultsHeap.prototype =
/**
* Return AutoCompleteResult for the given search string.
*/
getAutoCompleteResultFor: function(aSearchString)
{
getAutoCompleteResultFor: function(aSearchString) {
var values = [], comments = [];
for (var idx = 0; idx < this.values.length; idx++) {
if (this.values[idx].indexOf(aSearchString) != -1) {
@ -101,8 +95,7 @@ ResultsHeap.prototype =
* @param aName [in] the name of autocomplete search
* @param aAllResults [in] ResultsHeap object
*/
function AutoCompleteSearch(aName, aAllResults)
{
function AutoCompleteSearch(aName, aAllResults) {
this.name = aName;
this.allResults = aAllResults;
}
@ -113,8 +106,7 @@ AutoCompleteSearch.prototype =
// nsIAutoCompleteSearch implementation
startSearch: function(aSearchString, aSearchParam, aPreviousResult,
aListener)
{
aListener) {
var result = this.allResults.getAutoCompleteResultFor(aSearchString);
aListener.onSearchResult(this, result);
},
@ -122,8 +114,7 @@ AutoCompleteSearch.prototype =
stopSearch: function() {},
// nsISupports implementation
QueryInterface: function(iid)
{
QueryInterface: function(iid) {
if (iid.equals(nsISupports) ||
iid.equals(nsIFactory) ||
iid.equals(nsIAutoCompleteSearch))
@ -133,8 +124,7 @@ AutoCompleteSearch.prototype =
},
// nsIFactory implementation
createInstance: function(outer, iid)
{
createInstance: function(outer, iid) {
return this.QueryInterface(iid);
},
@ -149,8 +139,7 @@ AutoCompleteSearch.prototype =
/**
* nsIAutoCompleteResult implementation.
*/
function AutoCompleteResult(aValues, aComments)
{
function AutoCompleteResult(aValues, aComments) {
this.values = aValues;
this.comments = aComments;
@ -169,38 +158,31 @@ AutoCompleteResult.prototype =
defaultIndex: 0,
get matchCount()
{
get matchCount() {
return this.values.length;
},
getValueAt: function(aIndex)
{
getValueAt: function(aIndex) {
return this.values[aIndex];
},
getLabelAt: function(aIndex)
{
getLabelAt: function(aIndex) {
return this.getValueAt(aIndex);
},
getCommentAt: function(aIndex)
{
getCommentAt: function(aIndex) {
return this.comments[aIndex];
},
getStyleAt: function(aIndex)
{
getStyleAt: function(aIndex) {
return null;
},
getImageAt: function(aIndex)
{
getImageAt: function(aIndex) {
return "";
},
getFinalCompleteValueAt: function(aIndex)
{
getFinalCompleteValueAt: function(aIndex) {
return this.getValueAt(aIndex);
},

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

@ -18,8 +18,7 @@
src="../layout.js"></script>
<script type="application/javascript">
function doTest()
{
function doTest() {
// Inside list
var li = getAccessible("insidelist_item");
testBounds(li);

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

@ -20,8 +20,7 @@
src="../events.js"></script>
<script type="application/javascript">
function openComboboxNCheckBounds(aID)
{
function openComboboxNCheckBounds(aID) {
this.combobox = getAccessible(aID);
this.comboboxList = this.combobox.firstChild;
this.comboboxOption = this.comboboxList.firstChild;
@ -30,19 +29,16 @@
new invokerChecker(EVENT_FOCUS, this.comboboxOption)
];
this.invoke = function openComboboxNCheckBounds_invoke()
{
this.invoke = function openComboboxNCheckBounds_invoke() {
getNode(aID).focus();
synthesizeKey("VK_DOWN", { altKey: true });
}
this.finalCheck = function openComboboxNCheckBounds_invoke()
{
this.finalCheck = function openComboboxNCheckBounds_invoke() {
testBounds(this.comboboxOption);
}
this.getID = function openComboboxNCheckBounds_getID()
{
this.getID = function openComboboxNCheckBounds_getID() {
return "open combobox and test boundaries";
}
}
@ -51,8 +47,7 @@
var gQueue = null;
function doTest()
{
function doTest() {
// Combobox
testBounds("combobox");

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

@ -1,8 +1,7 @@
/**
* Load the browser with the given url and then invokes the given function.
*/
function openBrowserWindow(aFunc, aURL, aRect)
{
function openBrowserWindow(aFunc, aURL, aRect) {
gBrowserContext.testFunc = aFunc;
gBrowserContext.startURL = aURL;
gBrowserContext.browserRect = aRect;
@ -13,88 +12,77 @@ function openBrowserWindow(aFunc, aURL, aRect)
/**
* Close the browser window.
*/
function closeBrowserWindow()
{
function closeBrowserWindow() {
gBrowserContext.browserWnd.close();
}
/**
* Return the browser window object.
*/
function browserWindow()
{
function browserWindow() {
return gBrowserContext.browserWnd;
}
/**
* Return the document of the browser window.
*/
function browserDocument()
{
function browserDocument() {
return browserWindow().document;
}
/**
* Return tab browser object.
*/
function tabBrowser()
{
function tabBrowser() {
return browserWindow().gBrowser;
}
/**
* Return browser element of the current tab.
*/
function currentBrowser()
{
function currentBrowser() {
return tabBrowser().selectedBrowser;
}
/**
* Return DOM document of the current tab.
*/
function currentTabDocument()
{
function currentTabDocument() {
return currentBrowser().contentDocument;
}
/**
* Return window of the current tab.
*/
function currentTabWindow()
{
function currentTabWindow() {
return currentTabDocument().defaultView;
}
/**
* Return browser element of the tab at the given index.
*/
function browserAt(aIndex)
{
function browserAt(aIndex) {
return tabBrowser().getBrowserAtIndex(aIndex);
}
/**
* Return DOM document of the tab at the given index.
*/
function tabDocumentAt(aIndex)
{
function tabDocumentAt(aIndex) {
return browserAt(aIndex).contentDocument;
}
/**
* Return input element of address bar.
*/
function urlbarInput()
{
function urlbarInput() {
return browserWindow().document.getElementById("urlbar").inputField;
}
/**
* Return reload button.
*/
function reloadButton()
{
function reloadButton() {
return browserWindow().document.getElementById("urlbar-reload-button");
}
@ -110,8 +98,7 @@ var gBrowserContext =
startURL: ""
};
function openBrowserWindowIntl()
{
function openBrowserWindowIntl() {
var params = "chrome,all,dialog=no";
var rect = gBrowserContext.browserRect;
if (rect) {
@ -135,8 +122,7 @@ function openBrowserWindowIntl()
});
}
function startBrowserTests()
{
function startBrowserTests() {
if (gBrowserContext.startURL) // wait for load
addA11yLoadEvent(gBrowserContext.testFunc, currentBrowser().contentWindow);
else

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

@ -102,26 +102,21 @@ var gAccService = Components.classes["@mozilla.org/accessibilityService;1"].
/**
* Enable/disable logging.
*/
function enableLogging(aModules)
{
function enableLogging(aModules) {
gAccService.setLogging(aModules);
}
function disableLogging()
{
function disableLogging() {
gAccService.setLogging("");
}
function isLogged(aModule)
{
function isLogged(aModule) {
return gAccService.isLogged(aModule);
}
/**
* Dumps the accessible tree into console.
*/
function dumpTree(aId, aMsg)
{
function dumpTreeIntl(acc, indent)
{
function dumpTree(aId, aMsg) {
function dumpTreeIntl(acc, indent) {
dump(indent + prettyName(acc) + "\n");
var children = acc.children;
@ -131,8 +126,7 @@ function dumpTree(aId, aMsg)
}
}
function dumpDOMTreeIntl(node, indent)
{
function dumpDOMTreeIntl(node, indent) {
dump(indent + prettyName(node) + "\n");
var children = node.childNodes;
@ -157,13 +151,10 @@ function dumpTree(aId, aMsg)
*
* @param aFunc the function to invoke
*/
function addA11yLoadEvent(aFunc, aWindow)
{
function waitForDocLoad()
{
function addA11yLoadEvent(aFunc, aWindow) {
function waitForDocLoad() {
window.setTimeout(
function()
{
function() {
var targetDocument = aWindow ? aWindow.document : document;
var accDoc = getAccessible(targetDocument);
var state = {};
@ -183,8 +174,7 @@ function addA11yLoadEvent(aFunc, aWindow)
/**
* Analogy of SimpleTest.is function used to compare objects.
*/
function isObject(aObj, aExpectedObj, aMsg)
{
function isObject(aObj, aExpectedObj, aMsg) {
if (aObj == aExpectedObj) {
ok(true, aMsg);
return;
@ -201,8 +191,7 @@ function isObject(aObj, aExpectedObj, aMsg)
/**
* Return the DOM node by identifier (may be accessible, DOM node or ID).
*/
function getNode(aAccOrNodeOrID, aDocument)
{
function getNode(aAccOrNodeOrID, aDocument) {
if (!aAccOrNodeOrID)
return null;
@ -245,8 +234,7 @@ const DONOTFAIL_IF_NO_INTERFACE = 2;
* @param aDoNotFailIf [in, optional] no error for special cases (see
* constants above)
*/
function getAccessible(aAccOrElmOrID, aInterfaces, aElmObj, aDoNotFailIf)
{
function getAccessible(aAccOrElmOrID, aInterfaces, aElmObj, aDoNotFailIf) {
if (!aAccOrElmOrID)
return null;
@ -311,8 +299,7 @@ function getAccessible(aAccOrElmOrID, aInterfaces, aElmObj, aDoNotFailIf)
* Return true if the given identifier has an accessible, or exposes the wanted
* interfaces.
*/
function isAccessible(aAccOrElmOrID, aInterfaces)
{
function isAccessible(aAccOrElmOrID, aInterfaces) {
return !!getAccessible(aAccOrElmOrID, aInterfaces, null,
DONOTFAIL_IF_NO_ACC | DONOTFAIL_IF_NO_INTERFACE);
}
@ -320,8 +307,7 @@ function isAccessible(aAccOrElmOrID, aInterfaces)
/**
* Return an accessible that contains the DOM node for the given identifier.
*/
function getContainerAccessible(aAccOrElmOrID)
{
function getContainerAccessible(aAccOrElmOrID) {
var node = getNode(aAccOrElmOrID);
if (!node)
return null;
@ -333,8 +319,7 @@ function getContainerAccessible(aAccOrElmOrID)
/**
* Return root accessible for the given identifier.
*/
function getRootAccessible(aAccOrElmOrID)
{
function getRootAccessible(aAccOrElmOrID) {
var acc = getAccessible(aAccOrElmOrID ? aAccOrElmOrID : document);
return acc ? acc.rootDocument.QueryInterface(nsIAccessible) : null;
}
@ -342,8 +327,7 @@ function getRootAccessible(aAccOrElmOrID)
/**
* Return tab document accessible the given accessible is contained by.
*/
function getTabDocAccessible(aAccOrElmOrID)
{
function getTabDocAccessible(aAccOrElmOrID) {
var acc = getAccessible(aAccOrElmOrID ? aAccOrElmOrID : document);
var docAcc = acc.document.QueryInterface(nsIAccessible);
@ -360,8 +344,7 @@ function getTabDocAccessible(aAccOrElmOrID)
/**
* Return application accessible.
*/
function getApplicationAccessible()
{
function getApplicationAccessible() {
return gAccService.getApplicationAccessible().
QueryInterface(nsIAccessibleApplication);
}
@ -369,8 +352,7 @@ function getApplicationAccessible()
/**
* A version of accessible tree testing, doesn't fail if tree is not complete.
*/
function testElm(aID, aTreeObj)
{
function testElm(aID, aTreeObj) {
testAccessibleTree(aID, aTreeObj, kSkipTreeFullCheck);
}
@ -392,8 +374,7 @@ const kSkipTreeFullCheck = 1;
* fields
* @param aFlags [in, optional] flags, see constants above
*/
function testAccessibleTree(aAccOrElmOrID, aAccTree, aFlags)
{
function testAccessibleTree(aAccOrElmOrID, aAccTree, aFlags) {
var acc = getAccessible(aAccOrElmOrID);
if (!acc)
return;
@ -580,8 +561,7 @@ function testAccessibleTree(aAccOrElmOrID, aAccTree, aFlags)
/**
* Return true if accessible for the given node is in cache.
*/
function isAccessibleInCache(aNodeOrId)
{
function isAccessibleInCache(aNodeOrId) {
var node = getNode(aNodeOrId);
return !!gAccService.getAccessibleFromCache(node);
}
@ -592,8 +572,7 @@ function isAccessibleInCache(aNodeOrId)
* @param aAcc [in] the defunct accessible
* @param aNodeOrId [in] the DOM node identifier for the defunct accessible
*/
function testDefunctAccessible(aAcc, aNodeOrId)
{
function testDefunctAccessible(aAcc, aNodeOrId) {
if (aNodeOrId)
ok(!isAccessible(aNodeOrId),
"Accessible for " + aNodeOrId + " wasn't properly shut down!");
@ -668,16 +647,14 @@ function testDefunctAccessible(aAcc, aNodeOrId)
/**
* Convert role to human readable string.
*/
function roleToString(aRole)
{
function roleToString(aRole) {
return gAccService.getStringRole(aRole);
}
/**
* Convert states to human readable string.
*/
function statesToString(aStates, aExtraStates)
{
function statesToString(aStates, aExtraStates) {
var list = gAccService.getStringStates(aStates, aExtraStates);
var str = "";
@ -693,16 +670,14 @@ function statesToString(aStates, aExtraStates)
/**
* Convert event type to human readable string.
*/
function eventTypeToString(aEventType)
{
function eventTypeToString(aEventType) {
return gAccService.getStringEventType(aEventType);
}
/**
* Convert relation type to human readable string.
*/
function relationTypeToString(aRelationType)
{
function relationTypeToString(aRelationType) {
return gAccService.getStringRelationType(aRelationType);
}
@ -716,8 +691,7 @@ function getLoadContext() {
/**
* Return text from clipboard.
*/
function getTextFromClipboard()
{
function getTextFromClipboard() {
var clip = Components.classes["@mozilla.org/widget/clipboard;1"].
getService(Components.interfaces.nsIClipboard);
if (!clip)
@ -772,8 +746,7 @@ function getAccessibleDOMNodeID(accessible) {
/**
* Return pretty name for identifier, it may be ID, DOM node or accessible.
*/
function prettyName(aIdentifier)
{
function prettyName(aIdentifier) {
if (aIdentifier instanceof Array) {
var msg = "";
for (var idx = 0; idx < aIdentifier.length; idx++) {
@ -843,8 +816,7 @@ function prettyName(aIdentifier)
* @param aString the string to shorten.
* @returns the shortened string.
*/
function shortenString(aString, aMaxLength)
{
function shortenString(aString, aMaxLength) {
if (aString.length <= MAX_TRIM_LENGTH)
return aString;
@ -860,8 +832,7 @@ function shortenString(aString, aMaxLength)
/**
* Return main chrome window (crosses chrome boundary)
*/
function getMainChromeWindow(aWindow)
{
function getMainChromeWindow(aWindow) {
return aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
@ -876,8 +847,7 @@ function getMainChromeWindow(aWindow)
* @param aNewEnabledState [in] the enabled state, e.g. SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED
* @param aPluginName [in, optional] The name of the plugin, defaults to "Test Plug-in"
*/
function setTestPluginEnabledState(aNewEnabledState, aPluginName)
{
function setTestPluginEnabledState(aNewEnabledState, aPluginName) {
var plugin = getTestPluginTag(aPluginName);
var oldEnabledState = plugin.enabledState;
plugin.enabledState = aNewEnabledState;
@ -893,8 +863,7 @@ function setTestPluginEnabledState(aNewEnabledState, aPluginName)
// //////////////////////////////////////////////////////////////////////////////
// Accessible general
function getNodePrettyName(aNode)
{
function getNodePrettyName(aNode) {
try {
var tag = "";
if (aNode.nodeType == nsIDOMNode.DOCUMENT_NODE) {
@ -911,8 +880,7 @@ function getNodePrettyName(aNode)
}
}
function getObjAddress(aObj)
{
function getObjAddress(aObj) {
var exp = /native\s*@\s*(0x[a-f0-9]+)/g;
var match = exp.exec(aObj.toString());
if (match)
@ -921,8 +889,7 @@ function getObjAddress(aObj)
return aObj.toString();
}
function getTestPluginTag(aPluginName)
{
function getTestPluginTag(aPluginName) {
var ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"]
.getService(SpecialPowers.Ci.nsIPluginHost);
var tags = ph.getPluginTags();
@ -937,8 +904,7 @@ function getTestPluginTag(aPluginName)
return null;
}
function normalizeAccTreeObj(aObj)
{
function normalizeAccTreeObj(aObj) {
var key = Object.keys(aObj)[0];
var roleName = "ROLE_" + key;
if (roleName in nsIAccessibleRole) {

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

@ -1,23 +1,19 @@
/**
* Perform all editable text tests.
*/
function editableTextTestRun()
{
this.add = function add(aTest)
{
function editableTextTestRun() {
this.add = function add(aTest) {
this.seq.push(aTest);
}
this.run = function run()
{
this.run = function run() {
this.iterate();
}
this.index = 0;
this.seq = [];
this.iterate = function iterate()
{
this.iterate = function iterate() {
if (this.index < this.seq.length) {
this.seq[this.index++].startTest(this);
return;
@ -31,14 +27,12 @@ function editableTextTestRun()
/**
* Used to test nsIEditableTextAccessible methods.
*/
function editableTextTest(aID)
{
function editableTextTest(aID) {
/**
* Schedule a test, the given function with its arguments will be executed
* when preceding test is complete.
*/
this.scheduleTest = function scheduleTest(aFunc)
{
this.scheduleTest = function scheduleTest(aFunc) {
// A data container acts like a dummy invoker, it's never invoked but
// it's used to generate real invoker when previous invoker was handled.
var dataContainer = {
@ -56,12 +50,10 @@ function editableTextTest(aID)
/**
* setTextContents test.
*/
this.setTextContents = function setTextContents(aValue, aSkipStartOffset)
{
this.setTextContents = function setTextContents(aValue, aSkipStartOffset) {
var testID = "setTextContents '" + aValue + "' for " + prettyName(aID);
function setTextContentsInvoke()
{
function setTextContentsInvoke() {
dump(`\nsetTextContents '${aValue}'\n`);
var acc = getAccessible(aID, nsIAccessibleEditableText);
acc.setTextContents(aValue);
@ -81,13 +73,11 @@ function editableTextTest(aID)
/**
* insertText test.
*/
this.insertText = function insertText(aStr, aPos, aResStr, aResPos)
{
this.insertText = function insertText(aStr, aPos, aResStr, aResPos) {
var testID = "insertText '" + aStr + "' at " + aPos + " for " +
prettyName(aID);
function insertTextInvoke()
{
function insertTextInvoke() {
dump(`\ninsertText '${aStr}' at ${aPos} pos\n`);
var acc = getAccessible(aID, nsIAccessibleEditableText);
acc.insertText(aStr, aPos);
@ -101,13 +91,11 @@ function editableTextTest(aID)
/**
* copyText test.
*/
this.copyText = function copyText(aStartPos, aEndPos, aClipboardStr)
{
this.copyText = function copyText(aStartPos, aEndPos, aClipboardStr) {
var testID = "copyText from " + aStartPos + " to " + aEndPos + " for " +
prettyName(aID);
function copyTextInvoke()
{
function copyTextInvoke() {
var acc = getAccessible(aID, nsIAccessibleEditableText);
acc.copyText(aStartPos, aEndPos);
}
@ -120,13 +108,11 @@ function editableTextTest(aID)
* copyText and pasteText test.
*/
this.copyNPasteText = function copyNPasteText(aStartPos, aEndPos,
aPos, aResStr)
{
aPos, aResStr) {
var testID = "copyText from " + aStartPos + " to " + aEndPos +
"and pasteText at " + aPos + " for " + prettyName(aID);
function copyNPasteTextInvoke()
{
function copyNPasteTextInvoke() {
var acc = getAccessible(aID, nsIAccessibleEditableText);
acc.copyText(aStartPos, aEndPos);
acc.pasteText(aPos);
@ -140,13 +126,11 @@ function editableTextTest(aID)
* cutText test.
*/
this.cutText = function cutText(aStartPos, aEndPos, aResStr,
aResStartPos, aResEndPos)
{
aResStartPos, aResEndPos) {
var testID = "cutText from " + aStartPos + " to " + aEndPos + " for " +
prettyName(aID);
function cutTextInvoke()
{
function cutTextInvoke() {
var acc = getAccessible(aID, nsIAccessibleEditableText);
acc.cutText(aStartPos, aEndPos);
}
@ -161,13 +145,11 @@ function editableTextTest(aID)
* cutText and pasteText test.
*/
this.cutNPasteText = function copyNPasteText(aStartPos, aEndPos,
aPos, aResStr)
{
aPos, aResStr) {
var testID = "cutText from " + aStartPos + " to " + aEndPos +
" and pasteText at " + aPos + " for " + prettyName(aID);
function cutNPasteTextInvoke()
{
function cutNPasteTextInvoke() {
var acc = getAccessible(aID, nsIAccessibleEditableText);
acc.cutText(aStartPos, aEndPos);
acc.pasteText(aPos);
@ -182,12 +164,10 @@ function editableTextTest(aID)
/**
* pasteText test.
*/
this.pasteText = function pasteText(aPos, aResStr)
{
this.pasteText = function pasteText(aPos, aResStr) {
var testID = "pasteText at " + aPos + " for " + prettyName(aID);
function pasteTextInvoke()
{
function pasteTextInvoke() {
var acc = getAccessible(aID, nsIAccessibleEditableText);
acc.pasteText(aPos);
}
@ -199,16 +179,14 @@ function editableTextTest(aID)
/**
* deleteText test.
*/
this.deleteText = function deleteText(aStartPos, aEndPos, aResStr)
{
this.deleteText = function deleteText(aStartPos, aEndPos, aResStr) {
var testID = "deleteText from " + aStartPos + " to " + aEndPos +
" for " + prettyName(aID);
var oldValue = getValue(aID).substring(aStartPos, aEndPos);
var removeTripple = oldValue ? [aStartPos, aEndPos, oldValue] : null;
function deleteTextInvoke()
{
function deleteTextInvoke() {
var acc = getAccessible(aID, [nsIAccessibleEditableText]);
acc.deleteText(aStartPos, aEndPos);
}
@ -220,8 +198,7 @@ function editableTextTest(aID)
// ////////////////////////////////////////////////////////////////////////////
// Implementation details.
function getValue(aID)
{
function getValue(aID) {
var elm = getNode(aID);
if (elm instanceof Components.interfaces.nsIDOMNSEditableElement)
return elm.value;
@ -235,22 +212,18 @@ function editableTextTest(aID)
/**
* Common checkers.
*/
function getValueChecker(aID, aValue)
{
function getValueChecker(aID, aValue) {
var checker = {
check: function valueChecker_check()
{
check: function valueChecker_check() {
is(getValue(aID), aValue, "Wrong value " + aValue);
}
};
return checker;
}
function getClipboardChecker(aID, aText)
{
function getClipboardChecker(aID, aText) {
var checker = {
check: function clipboardChecker_check()
{
check: function clipboardChecker_check() {
is(getTextFromClipboard(), aText, "Wrong text in clipboard.");
}
};
@ -260,8 +233,7 @@ function editableTextTest(aID)
/**
* Process next scheduled test.
*/
this.unwrapNextTest = function unwrapNextTest()
{
this.unwrapNextTest = function unwrapNextTest() {
var data = this.mEventQueue.mInvokers[this.mEventQueue.mIndex + 1];
if (data)
data.func.apply(this, data.funcArgs);
@ -271,15 +243,13 @@ function editableTextTest(aID)
* Used to generate an invoker object for the sheduled test.
*/
this.generateTest = function generateTest(aID, aRemoveTriple, aInsertTriple,
aInvokeFunc, aChecker, aInvokerID)
{
aInvokeFunc, aChecker, aInvokerID) {
var et = this;
var invoker = {
eventSeq: [],
invoke: aInvokeFunc,
finalCheck: function finalCheck()
{
finalCheck: function finalCheck() {
// dumpTree(aID, `'${aID}' tree:`);
aChecker.check();
@ -312,12 +282,10 @@ function editableTextTest(aID)
/**
* Run the tests.
*/
this.startTest = function startTest(aTestRun)
{
this.startTest = function startTest(aTestRun) {
var testRunObj = aTestRun;
var thisObj = this;
this.mEventQueue.onFinish = function finishCallback()
{
this.mEventQueue.onFinish = function finishCallback() {
// Notify textRun object that all tests were finished.
testRunObj.iterate();

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

@ -22,8 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452161
// gA11yEventDumpToConsole = true;
// enableLogging("tree,verbose"); // debug
function addTestEditable(aID, aTestRun, aBeforeContent, aAfterContent)
{
function addTestEditable(aID, aTestRun, aBeforeContent, aAfterContent) {
var et = new editableTextTest(aID);
var startOffset = aBeforeContent ? aBeforeContent.length : 0;
// XXX afterContent currently is not used
@ -69,8 +68,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452161
// gA11yEventDumpToConsole = true; // debug stuff
function runTest()
{
function runTest() {
var testRun = new editableTextTestRun();
addTestEditable("input", testRun);
@ -83,8 +81,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452161
testRun.run(); // Will call SimpleTest.finish();
}
function doTest()
{
function doTest() {
// Prepare tested elements.
// Design mode on/off triggers an editable state change event on

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

@ -16,8 +16,7 @@
src="editabletext.js"></script>
<script type="application/javascript">
function doTest()
{
function doTest() {
var et = new editableTextTest("input");
// 'ee' insertion/removal at 1 or 2 offset of 'hello'/'heeello' string

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

@ -24,8 +24,7 @@
src="../name.js"></script>
<script type="application/javascript">
function doTest()
{
function doTest() {
// ////////////////////////////////////////////////////////////////////////
// HTML:a@href

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

@ -24,8 +24,7 @@
src="../name.js"></script>
<script type="application/javascript">
function doTest()
{
function doTest() {
// ////////////////////////////////////////////////////////////////////////
// math

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

@ -19,8 +19,7 @@
<script type="application/javascript">
var kX = 10, kY = 10, kWidth = 150, kHeight = 100;
function doTest()
{
function doTest() {
var canv = document.getElementById("c");
var context = canv.getContext("2d");
var element = document.getElementById("showA");

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

@ -21,8 +21,7 @@
<script type="application/javascript">
function doTest()
{
function doTest() {
testRole("figure", ROLE_FIGURE);
testRole("figcaption", ROLE_CAPTION);

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

@ -13,8 +13,7 @@
src="../role.js"></script>
<script type="application/javascript">
function doTest()
{
function doTest() {
var accessible = getApplicationAccessible();
if (!accessible) {
SimpleTest.finish();

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

@ -17,8 +17,7 @@
<script type="application/javascript">
function doTest()
{
function doTest() {
if (!WIN) {
ok(true,
"It's Windows specific test. Feel free to extend the test.");

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

@ -14,8 +14,7 @@
src="../role.js"></script>
<script type="application/javascript">
function doTest()
{
function doTest() {
testElm("component", {
role: ROLE_GROUPING,
children: [

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -5,8 +5,7 @@
const STATE_BUSY = Components.interfaces.nsIAccessibleStates.STATE_BUSY;
var gService = null;
function waitForDocLoad()
{
function waitForDocLoad() {
if (!gService) {
gService = Components.classes["@mozilla.org/accessibilityService;1"].
getService(Components.interfaces.nsIAccessibilityService);
@ -24,8 +23,7 @@
hideIFrame();
}
function hideIFrame()
{
function hideIFrame() {
var iframe = document.getElementById("iframe");
gService.getAccessibleFor(iframe.contentDocument);
iframe.style.display = "none";

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

@ -19,12 +19,10 @@
src="../events.js"></script>
<script type="application/javascript">
function showAlert(aID)
{
function showAlert(aID) {
this.DOMNode = document.createElement("div");
this.invoke = function showAlert_invoke()
{
this.invoke = function showAlert_invoke() {
this.DOMNode.setAttribute("role", "alert");
this.DOMNode.setAttribute("id", aID);
var text = document.createTextNode("alert");
@ -32,23 +30,19 @@
document.body.appendChild(this.DOMNode);
};
this.getID = function showAlert_getID()
{
this.getID = function showAlert_getID() {
return "Show ARIA alert " + aID;
};
}
function changeAlert(aID)
{
function changeAlert(aID) {
this.__defineGetter__("DOMNode", function() { return getNode(aID) });
this.invoke = function changeAlert_invoke()
{
this.invoke = function changeAlert_invoke() {
this.DOMNode.textContent = "new alert";
}
this.getID = function showAlert_getID()
{
this.getID = function showAlert_getID() {
return "Change ARIA alert " + aID;
}
}
@ -60,8 +54,7 @@
// enableLogging("tree,events,verbose");
var gQueue = null;
function doTests()
{
function doTests() {
gQueue = new eventQueue(nsIAccessibleEvent.EVENT_ALERT);
gQueue.push(new showAlert("alert"));

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

@ -24,8 +24,7 @@
const kViaDisplayStyle = 0;
const kViaVisibilityStyle = 1;
function focusMenu(aMenuBarID, aMenuID, aActiveMenuBarID)
{
function focusMenu(aMenuBarID, aMenuID, aActiveMenuBarID) {
this.eventSeq = [];
if (aActiveMenuBarID) {
@ -36,19 +35,16 @@
this.eventSeq.push(new invokerChecker(EVENT_MENU_START, getNode(aMenuBarID)));
this.eventSeq.push(new invokerChecker(EVENT_FOCUS, getNode(aMenuID)));
this.invoke = function focusMenu_invoke()
{
this.invoke = function focusMenu_invoke() {
getNode(aMenuID).focus();
}
this.getID = function focusMenu_getID()
{
this.getID = function focusMenu_getID() {
return "focus menu '" + aMenuID + "'";
}
}
function showMenu(aMenuID, aParentMenuID, aHow)
{
function showMenu(aMenuID, aParentMenuID, aHow) {
this.menuNode = getNode(aMenuID);
// Because of aria-owns processing we may have menupopup start fired before
@ -59,24 +55,21 @@
new invokerChecker(EVENT_MENUPOPUP_START, this.menuNode)
];
this.invoke = function showMenu_invoke()
{
this.invoke = function showMenu_invoke() {
if (aHow == kViaDisplayStyle)
this.menuNode.style.display = "block";
else
this.menuNode.style.visibility = "visible";
};
this.getID = function showMenu_getID()
{
this.getID = function showMenu_getID() {
return "Show ARIA menu '" + aMenuID + "' by " +
(aHow == kViaDisplayStyle ? "display" : "visibility") +
" style tricks";
};
}
function closeMenu(aMenuID, aParentMenuID, aHow)
{
function closeMenu(aMenuID, aParentMenuID, aHow) {
this.menuNode = getNode(aMenuID);
this.menu = null;
@ -86,8 +79,7 @@
new invokerChecker(EVENT_REORDER, getNode(aParentMenuID))
];
this.invoke = function closeMenu_invoke()
{
this.invoke = function closeMenu_invoke() {
// Store menu accessible reference while menu is still open.
this.menu = getAccessible(this.menuNode);
@ -98,21 +90,18 @@
this.menuNode.style.visibility = "hidden";
}
this.getID = function closeMenu_getID()
{
this.getID = function closeMenu_getID() {
return "Close ARIA menu " + aMenuID + " by " +
(aHow == kViaDisplayStyle ? "display" : "visibility") +
" style tricks";
}
function getMenu(aThisObj)
{
function getMenu(aThisObj) {
return aThisObj.menu;
}
}
function focusInsideMenu(aMenuID, aMenuBarID)
{
function focusInsideMenu(aMenuID, aMenuBarID) {
this.eventSeq = [
new invokerChecker(EVENT_FOCUS, getNode(aMenuID))
];
@ -121,19 +110,16 @@
new invokerChecker(EVENT_MENU_END, getNode(aMenuBarID))
];
this.invoke = function focusInsideMenu_invoke()
{
this.invoke = function focusInsideMenu_invoke() {
getNode(aMenuID).focus();
}
this.getID = function focusInsideMenu_getID()
{
this.getID = function focusInsideMenu_getID() {
return "focus menu '" + aMenuID + "'";
}
}
function blurMenu(aMenuBarID)
{
function blurMenu(aMenuBarID) {
var eventSeq = [
new invokerChecker(EVENT_MENU_END, getNode(aMenuBarID)),
new invokerChecker(EVENT_FOCUS, getNode("outsidemenu"))
@ -141,8 +127,7 @@
this.__proto__ = new synthClick("outsidemenu", eventSeq);
this.getID = function blurMenu_getID()
{
this.getID = function blurMenu_getID() {
return "blur menu";
}
}
@ -154,8 +139,7 @@
// enableLogging("tree,events,verbose");
var gQueue = null;
function doTests()
{
function doTests() {
gQueue = new eventQueue();
gQueue.push(new focusMenu("menubar2", "menu-help"));

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

@ -22,8 +22,7 @@
* Do tests.
*/
var gQueue = null;
function updateAttribute(aID, aAttr, aValue)
{
function updateAttribute(aID, aAttr, aValue) {
this.node = getNode(aID);
this.accessible = getAccessible(this.node);
@ -31,24 +30,20 @@
new objAttrChangedChecker(aID, aAttr),
];
this.invoke = function updateAttribute_invoke()
{
this.invoke = function updateAttribute_invoke() {
this.node.setAttribute(aAttr, aValue);
};
this.getID = function updateAttribute_getID()
{
this.getID = function updateAttribute_getID() {
return aAttr + " for " + aID + " " + aValue;
};
}
function updateARIAHidden(aID, aIsDefined, aChildId)
{
function updateARIAHidden(aID, aIsDefined, aChildId) {
this.__proto__ = new updateAttribute(aID, "aria-hidden",
aIsDefined ? "true" : "false");
this.finalCheck = function updateARIAHidden()
{
this.finalCheck = function updateARIAHidden() {
if (aIsDefined) {
testAttrs(aID, {"hidden": "true"}, true);
testAttrs(aChildId, {"hidden": "true"}, true);
@ -63,8 +58,7 @@
// gA11yEventDumpID = "eventdump";
// gA11yEventDumpToConsole = true;
function doTests()
{
function doTests() {
gQueue = new eventQueue();
gQueue.push(new updateARIAHidden("hideable", true, "hideable_child"));

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

@ -33,8 +33,7 @@
* <div id="t1_fc" aria-owns="t1_owns"></div>
* <span id="t1_owns"></div>
*/
function testAriaOwns()
{
function testAriaOwns() {
this.parent = getNode("t1");
this.fc = document.createElement("div");
this.fc.setAttribute("id", "t1_fc");
@ -46,8 +45,7 @@
new unexpectedInvokerChecker(EVENT_SHOW, this.owns)
];
this.invoke = function testAriaOwns_invoke()
{
this.invoke = function testAriaOwns_invoke() {
getNode("t1").appendChild(this.fc);
getNode("t1").appendChild(this.owns);
getNode("t1_fc").setAttribute("aria-owns", "t1_owns");
@ -66,8 +64,7 @@
* <div id="t2_sc" aria-labelledby="t2_owns"></div>
* <span id="t2_owns"></div>
*/
function testAriaOwnsAndLabelledBy()
{
function testAriaOwnsAndLabelledBy() {
this.parent = getNode("t2");
this.fc = document.createElement("div");
this.fc.setAttribute("id", "t2_fc");
@ -82,8 +79,7 @@
new unexpectedInvokerChecker(EVENT_SHOW, this.owns)
];
this.invoke = function testAriaOwns_invoke()
{
this.invoke = function testAriaOwns_invoke() {
getNode("t2").appendChild(this.fc);
getNode("t2").appendChild(this.sc);
getNode("t2").appendChild(this.owns);
@ -97,8 +93,7 @@
}
var gQueue = null;
function doTests()
{
function doTests() {
gQueue = new eventQueue();
gQueue.push(new testAriaOwns());
gQueue.push(new testAriaOwnsAndLabelledBy());

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

@ -29,66 +29,56 @@
// gA11yEventDumpID = "eventdump"; // debugging
// gA11yEventDumpToConsole = true; // debugging
function expandNode(aID, aIsExpanded)
{
function expandNode(aID, aIsExpanded) {
this.DOMNode = getNode(aID);
this.eventSeq = [
new expandedStateChecker(aIsExpanded, this.DOMNode)
];
this.invoke = function expandNode_invoke()
{
this.invoke = function expandNode_invoke() {
this.DOMNode.setAttribute("aria-expanded",
(aIsExpanded ? "true" : "false"));
};
this.getID = function expandNode_getID()
{
this.getID = function expandNode_getID() {
return prettyName(aID) + " aria-expanded changed to '" + aIsExpanded + "'";
};
}
function busyify(aID, aIsBusy)
{
function busyify(aID, aIsBusy) {
this.DOMNode = getNode(aID);
this.eventSeq = [
new stateChangeChecker(STATE_BUSY, kOrdinalState, aIsBusy, this.DOMNode)
];
this.invoke = function busyify_invoke()
{
this.invoke = function busyify_invoke() {
this.DOMNode.setAttribute("aria-busy", (aIsBusy ? "true" : "false"));
};
this.getID = function busyify_getID()
{
this.getID = function busyify_getID() {
return prettyName(aID) + " aria-busy changed to '" + aIsBusy + "'";
};
}
function makeCurrent(aID, aIsCurrent, aValue)
{
function makeCurrent(aID, aIsCurrent, aValue) {
this.DOMNode = getNode(aID);
this.eventSeq = [
new stateChangeChecker(EXT_STATE_CURRENT, true, aIsCurrent, this.DOMNode)
];
this.invoke = function makeCurrent_invoke()
{
this.invoke = function makeCurrent_invoke() {
this.DOMNode.setAttribute("aria-current", aValue);
};
this.getID = function makeCurrent_getID()
{
this.getID = function makeCurrent_getID() {
return prettyName(aID) + " aria-current changed to " + aValue;
};
}
function setAttrOfMixedType(aID, aAttr, aState, aValue)
{
function setAttrOfMixedType(aID, aAttr, aState, aValue) {
this.DOMNode = getNode(aID);
this.eventSeq = [
@ -103,31 +93,26 @@
);
}
this.invoke = function setAttrOfMixedType_invoke()
{
this.invoke = function setAttrOfMixedType_invoke() {
this.DOMNode.setAttribute(aAttr, aValue);
};
this.getID = function setAttrOfMixedType_getID()
{
this.getID = function setAttrOfMixedType_getID() {
return prettyName(aID) + " " + aAttr + " changed to '" + aValue + "'";
};
}
function setPressed(aID, aValue)
{
function setPressed(aID, aValue) {
this.__proto__ =
new setAttrOfMixedType(aID, "aria-pressed", STATE_PRESSED, aValue);
}
function setChecked(aID, aValue)
{
function setChecked(aID, aValue) {
this.__proto__ =
new setAttrOfMixedType(aID, "aria-checked", STATE_CHECKED, aValue);
}
function buildQueueForAttr(aList, aQueue, aID, aInvokerFunc)
{
function buildQueueForAttr(aList, aQueue, aID, aInvokerFunc) {
for (var i = 0; i < aList.length; i++) {
for (var j = i + 1; j < aList.length; j++) {
// XXX: changes from/to "undefined"/"" shouldn't fire state change
@ -138,20 +123,17 @@
}
}
function buildQueueForAttrOfMixedType(aQueue, aID, aInvokerFunc)
{
function buildQueueForAttrOfMixedType(aQueue, aID, aInvokerFunc) {
var list = [ "", "undefined", "false", "true", "mixed" ];
buildQueueForAttr(list, aQueue, aID, aInvokerFunc);
}
function buildQueueForAttrOfBoolType(aQueue, aID, aInvokerFunc)
{
function buildQueueForAttrOfBoolType(aQueue, aID, aInvokerFunc) {
var list = [ "", "undefined", "false", "true" ];
buildQueueForAttr(list, aQueue, aID, aInvokerFunc);
}
function doTests()
{
function doTests() {
gQueue = new eventQueue();
gQueue.push(new expandNode("section", true));

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

@ -23,15 +23,13 @@
/**
* Test "event-from-input" object attribute.
*/
function eventFromInputChecker(aEventType, aID, aValue, aNoTargetID)
{
function eventFromInputChecker(aEventType, aID, aValue, aNoTargetID) {
this.type = aEventType;
this.target = getAccessible(aID);
this.noTarget = getNode(aNoTargetID);
this.check = function checker_check(aEvent)
{
this.check = function checker_check(aEvent) {
testAttrs(aEvent.accessible, { "event-from-input": aValue }, true);
var accessible = getAccessible(this.noTarget);
@ -47,8 +45,7 @@
// gA11yEventDumpID = "eventdump"; // debug stuff
// gA11yEventDumpToConsole = true; // debug stuff
function doTests()
{
function doTests() {
gQueue = new eventQueue();
var id = "textbox", noTargetId = "textarea";

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

@ -17,8 +17,7 @@
src="../events.js"></script>
<script type="application/javascript">
function changeMultipleElements()
{
function changeMultipleElements() {
this.node1 = getNode("span1");
this.node2 = getNode("span2");
@ -30,14 +29,12 @@
new textChangeChecker("container", 7, 8, "b", true, undefined, true)
];
this.invoke = function changeMultipleElements_invoke()
{
this.invoke = function changeMultipleElements_invoke() {
this.node1.textContent = "a";
this.node2.textContent = "b";
}
this.getID = function changeMultipleElements_invoke_getID()
{
this.getID = function changeMultipleElements_invoke_getID() {
return "Change the text content of multiple sibling divs";
}
}
@ -47,8 +44,7 @@
// gA11yEventDumpToConsole = true; // debugging
var gQueue = null;
function doTests()
{
function doTests() {
gQueue = new eventQueue();
gQueue.push(new changeMultipleElements());

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

@ -17,8 +17,7 @@
src="../events.js"></script>
<script type="application/javascript">
function changeMultipleElements()
{
function changeMultipleElements() {
this.node1 = getNode("div1");
this.node2 = getNode("div2");
@ -30,14 +29,12 @@
new textChangeChecker("div2", 0, 1, "b", true, undefined, true)
];
this.invoke = function changeMultipleElements_invoke()
{
this.invoke = function changeMultipleElements_invoke() {
this.node1.textContent = "a";
this.node2.textContent = "b";
}
this.getID = function changeMultipleElements_invoke_getID()
{
this.getID = function changeMultipleElements_invoke_getID() {
return "Change the text content of multiple sibling divs";
}
}
@ -47,8 +44,7 @@
// gA11yEventDumpToConsole = true; // debugging
var gQueue = null;
function doTests()
{
function doTests() {
gQueue = new eventQueue();
gQueue.push(new changeMultipleElements());

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

@ -20,14 +20,12 @@
/**
* Click checker.
*/
function clickChecker(aCaretOffset, aID, aExtraNodeOrID, aExtraCaretOffset)
{
function clickChecker(aCaretOffset, aID, aExtraNodeOrID, aExtraCaretOffset) {
this.__proto__ = new caretMoveChecker(aCaretOffset, aID);
this.extraNode = getNode(aExtraNodeOrID);
this.check = function clickChecker_check(aEvent)
{
this.check = function clickChecker_check(aEvent) {
this.__proto__.check(aEvent);
if (this.extraNode) {
@ -46,8 +44,7 @@
// gA11yEventDumpID = "eventdump"; // debug stuff
// gA11yEventDumpToConsole = true;
function doTests()
{
function doTests() {
// test caret move events and caret offsets
gQueue = new eventQueue();

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

@ -32,12 +32,10 @@
* Base class to test of mutation events coalescence.
*/
function coalescenceBase(aChildAction, aParentAction,
aPerformActionOnChildInTheFirstPlace)
{
aPerformActionOnChildInTheFirstPlace) {
// Invoker interface
this.invoke = function coalescenceBase_invoke()
{
this.invoke = function coalescenceBase_invoke() {
if (aPerformActionOnChildInTheFirstPlace) {
this.invokeAction(this.childNode, aChildAction);
this.invokeAction(this.parentNode, aParentAction);
@ -47,8 +45,7 @@
}
}
this.getID = function coalescenceBase_getID()
{
this.getID = function coalescenceBase_getID() {
var childAction = this.getActionName(aChildAction) + " child";
var parentAction = this.getActionName(aParentAction) + " parent";
@ -58,8 +55,7 @@
return parentAction + " and then " + childAction;
}
this.finalCheck = function coalescenceBase_check()
{
this.finalCheck = function coalescenceBase_check() {
if (this.getEventType(aChildAction) == EVENT_HIDE) {
testIsDefunct(this.child);
}
@ -70,8 +66,7 @@
// Implementation details
this.invokeAction = function coalescenceBase_invokeAction(aNode, aAction)
{
this.invokeAction = function coalescenceBase_invokeAction(aNode, aAction) {
switch (aAction) {
case kRemoveElm:
aNode.remove();
@ -97,8 +92,7 @@
}
}
this.getEventType = function coalescenceBase_getEventType(aAction)
{
this.getEventType = function coalescenceBase_getEventType(aAction) {
switch (aAction) {
case kRemoveElm: case kHideElm:
return EVENT_HIDE;
@ -107,8 +101,7 @@
}
}
this.getActionName = function coalescenceBase_getActionName(aAction)
{
this.getActionName = function coalescenceBase_getActionName(aAction) {
switch (aAction) {
case kRemoveElm:
return "remove";
@ -123,8 +116,7 @@
}
}
this.initSequence = function coalescenceBase_initSequence()
{
this.initSequence = function coalescenceBase_initSequence() {
// expected events
var eventType = this.getEventType(aParentAction);
this.eventSeq = [
@ -145,13 +137,11 @@
*/
function removeOrHideCoalescenceBase(aChildID, aParentID,
aChildAction, aParentAction,
aPerformActionOnChildInTheFirstPlace)
{
aPerformActionOnChildInTheFirstPlace) {
this.__proto__ = new coalescenceBase(aChildAction, aParentAction,
aPerformActionOnChildInTheFirstPlace);
this.init = function removeOrHideCoalescenceBase_init()
{
this.init = function removeOrHideCoalescenceBase_init() {
this.childNode = getNode(aChildID);
this.parentNode = getNode(aParentID);
this.child = getAccessible(this.childNode);
@ -171,8 +161,7 @@
/**
* Remove child node and then its parent node from DOM tree.
*/
function removeChildNParent(aChildID, aParentID)
{
function removeChildNParent(aChildID, aParentID) {
this.__proto__ = new removeOrHideCoalescenceBase(aChildID, aParentID,
kRemoveElm, kRemoveElm,
true);
@ -181,8 +170,7 @@
/**
* Remove parent node and then its child node from DOM tree.
*/
function removeParentNChild(aChildID, aParentID)
{
function removeParentNChild(aChildID, aParentID) {
this.__proto__ = new removeOrHideCoalescenceBase(aChildID, aParentID,
kRemoveElm, kRemoveElm,
false);
@ -191,8 +179,7 @@
/**
* Hide child node and then its parent node.
*/
function hideChildNParent(aChildID, aParentID)
{
function hideChildNParent(aChildID, aParentID) {
this.__proto__ = new removeOrHideCoalescenceBase(aChildID, aParentID,
kHideElm, kHideElm,
true);
@ -201,8 +188,7 @@
/**
* Hide parent node and then its child node.
*/
function hideParentNChild(aChildID, aParentID)
{
function hideParentNChild(aChildID, aParentID) {
this.__proto__ = new removeOrHideCoalescenceBase(aChildID, aParentID,
kHideElm, kHideElm,
false);
@ -211,8 +197,7 @@
/**
* Hide child node and then remove its parent node.
*/
function hideChildNRemoveParent(aChildID, aParentID)
{
function hideChildNRemoveParent(aChildID, aParentID) {
this.__proto__ = new removeOrHideCoalescenceBase(aChildID, aParentID,
kHideElm, kRemoveElm,
true);
@ -221,8 +206,7 @@
/**
* Hide parent node and then remove its child node.
*/
function hideParentNRemoveChild(aChildID, aParentID)
{
function hideParentNRemoveChild(aChildID, aParentID) {
this.__proto__ = new removeOrHideCoalescenceBase(aChildID, aParentID,
kRemoveElm, kHideElm,
false);
@ -231,8 +215,7 @@
/**
* Remove child node and then hide its parent node.
*/
function removeChildNHideParent(aChildID, aParentID)
{
function removeChildNHideParent(aChildID, aParentID) {
this.__proto__ = new removeOrHideCoalescenceBase(aChildID, aParentID,
kRemoveElm, kHideElm,
true);
@ -241,8 +224,7 @@
/**
* Remove parent node and then hide its child node.
*/
function removeParentNHideChild(aChildID, aParentID)
{
function removeParentNHideChild(aChildID, aParentID) {
this.__proto__ = new removeOrHideCoalescenceBase(aChildID, aParentID,
kHideElm, kRemoveElm,
false);
@ -251,10 +233,8 @@
/**
* Create and append parent node and create and append child node to it.
*/
function addParentNChild(aHostID, aPerformActionOnChildInTheFirstPlace)
{
this.init = function addParentNChild_init()
{
function addParentNChild(aHostID, aPerformActionOnChildInTheFirstPlace) {
this.init = function addParentNChild_init() {
this.hostNode = getNode(aHostID);
this.parentNode = document.createElement("select");
this.childNode = document.createElement("option");
@ -272,10 +252,8 @@
* Show parent node and show child node to it.
*/
function showParentNChild(aParentID, aChildID,
aPerformActionOnChildInTheFirstPlace)
{
this.init = function showParentNChild_init()
{
aPerformActionOnChildInTheFirstPlace) {
this.init = function showParentNChild_init() {
this.parentNode = getNode(aParentID);
this.hostNode = this.parentNode.parentNode;
this.childNode = getNode(aChildID);
@ -292,10 +270,8 @@
* Create and append child node to the DOM and then show parent node.
*/
function showParentNAddChild(aParentID,
aPerformActionOnChildInTheFirstPlace)
{
this.init = function showParentNAddChild_init()
{
aPerformActionOnChildInTheFirstPlace) {
this.init = function showParentNAddChild_init() {
this.parentNode = getNode(aParentID);
this.hostNode = this.parentNode.parentNode;
this.childNode = document.createElement("option");
@ -312,8 +288,7 @@
/**
* Remove children and parent
*/
function removeGrandChildrenNHideParent(aChild1Id, aChild2Id, aParentId)
{
function removeGrandChildrenNHideParent(aChild1Id, aChild2Id, aParentId) {
this.child1 = getNode(aChild1Id);
this.child2 = getNode(aChild2Id);
this.parent = getNode(aParentId);
@ -326,8 +301,7 @@
new unexpectedInvokerChecker(EVENT_REORDER, getAccessible(aParentId))
];
this.invoke = function removeGrandChildrenNHideParent_invoke()
{
this.invoke = function removeGrandChildrenNHideParent_invoke() {
this.child1.remove();
this.child2.remove();
this.parent.hidden = true;
@ -341,8 +315,7 @@
/**
* Remove a child, and then its parent.
*/
function test3()
{
function test3() {
this.o = getAccessible("t3_o");
this.ofc = getAccessible("t3_o").firstChild;
@ -353,14 +326,12 @@
new unexpectedInvokerChecker(EVENT_REORDER, this.o)
];
this.invoke = function test3_invoke()
{
this.invoke = function test3_invoke() {
getNode("t3_o").textContent = "";
getNode("t3_lb").removeChild(getNode("t3_o"));
}
this.finalCheck = function test3_finalCheck()
{
this.finalCheck = function test3_finalCheck() {
testIsDefunct(this.o);
testIsDefunct(this.ofc);
}
@ -373,8 +344,7 @@
/**
* Remove children, and then a parent of 2nd child.
*/
function test4()
{
function test4() {
this.o1 = getAccessible("t4_o1");
this.o1fc = this.o1.firstChild;
this.o2 = getAccessible("t4_o2");
@ -389,15 +359,13 @@
new unexpectedInvokerChecker(EVENT_REORDER, this.o2)
];
this.invoke = function test4_invoke()
{
this.invoke = function test4_invoke() {
getNode("t4_o1").textContent = "";
getNode("t4_o2").textContent = "";
getNode("t4_lb").removeChild(getNode("t4_o2"));
}
this.finalCheck = function test4_finalCheck()
{
this.finalCheck = function test4_finalCheck() {
testIsDefunct(this.o1fc);
testIsDefunct(this.o2);
testIsDefunct(this.o2fc);
@ -411,8 +379,7 @@
/**
* Remove a child, remove a parent sibling, remove the parent
*/
function test5()
{
function test5() {
this.o = getAccessible("t5_o");
this.ofc = this.o.firstChild;
this.b = getAccessible("t5_b");
@ -427,15 +394,13 @@
new unexpectedInvokerChecker(EVENT_REORDER, this.lb)
];
this.invoke = function test5_invoke()
{
this.invoke = function test5_invoke() {
getNode("t5_o").textContent = "";
getNode("t5").removeChild(getNode("t5_b"));
getNode("t5_lb").removeChild(getNode("t5_o"));
}
this.finalCheck = function test5_finalCheck()
{
this.finalCheck = function test5_finalCheck() {
testIsDefunct(this.ofc);
testIsDefunct(this.o);
testIsDefunct(this.b);
@ -454,8 +419,7 @@
* </div>
* <div id="t6_sc" aria-owns="t6_owns"></div>
*/
function test6()
{
function test6() {
this.parent = getNode("t6");
this.fc = document.createElement("div");
this.fc.setAttribute("id", "t6_fc");
@ -474,8 +438,7 @@
new unexpectedInvokerChecker(EVENT_SHOW, this.owns)
];
this.invoke = function test6_invoke()
{
this.invoke = function test6_invoke() {
getNode("t6").appendChild(this.fc);
getNode("t6_fc").appendChild(this.owns);
getNode("t6").appendChild(this.sc);
@ -498,8 +461,7 @@
* <div><div id="t7_c_grandchild">ha</div></div>
* </div>
*/
function test7()
{
function test7() {
this.eventSeq = [
new invokerChecker(EVENT_HIDE, getNode("t7_c")),
new invokerChecker(EVENT_SHOW, getNode("t7_c")),
@ -510,8 +472,7 @@
new unexpectedInvokerChecker(EVENT_SHOW, () => getNode("t7_c_grandchild").firstChild)
];
this.invoke = function test7_invoke()
{
this.invoke = function test7_invoke() {
getNode("t7_c_directchild").textContent = "ha";
getNode("t7_c_grandchild").textContent = "ha";
getNode("t7_moveplace").setAttribute("aria-owns", "t7_c");
@ -533,8 +494,7 @@
*
* The hide event should be delivered before the paired show event.
*/
function test8()
{
function test8() {
this.eventSeq = [
new invokerChecker(EVENT_HIDE, getNode("t8_c1_child")),
new invokerChecker(EVENT_HIDE, "t8_c2_moved"),
@ -543,8 +503,7 @@
new invokerChecker(EVENT_REORDER, "t8_c1"),
];
this.invoke = function test8_invoke()
{
this.invoke = function test8_invoke() {
// Remove a node from 't8_c1' container to give the event tree a
// desired structure (the 't8_c1' container node goes first in the event
// tree)
@ -574,8 +533,7 @@
* The hide events for 't9_c2_moved' and 't9_c3_moved' should be delivered
* before the show event for 't9_c2_moved'.
*/
function test9()
{
function test9() {
this.eventSeq = [
new invokerChecker(EVENT_HIDE, getNode("t9_c1_child")),
new invokerChecker(EVENT_HIDE, getNode("t9_c2_child")),
@ -588,8 +546,7 @@
new unexpectedInvokerChecker(EVENT_SHOW, "t9_c3_moved")
];
this.invoke = function test9_invoke()
{
this.invoke = function test9_invoke() {
// Remove child nodes from 't9_c1' and 't9_c2' containers to give
// the event tree a needed structure ('t9_c1' and 't9_c2' nodes go
// first in the event tree),
@ -620,8 +577,7 @@
* The hide events for 't10_c2_moved' and 't10_c3_moved' should be delivered
* before the show event for 't10_c2_moved'.
*/
function test10()
{
function test10() {
this.eventSeq = [
new invokerChecker(EVENT_HIDE, getNode("t10_c1_child")),
new invokerChecker(EVENT_HIDE, getNode("t10_c2_child")),
@ -633,8 +589,7 @@
new invokerChecker(EVENT_REORDER, "t10_c3")
];
this.invoke = function test10_invoke()
{
this.invoke = function test10_invoke() {
// Remove child nodes from 't10_c1' and 't10_c2' containers to give
// the event tree a needed structure ('t10_c1' and 't10_c2' nodes go first
// in the event tree),
@ -655,8 +610,7 @@
* move its parent too by aria-owns. No hide event should be fired for
* original node.
*/
function test11()
{
function test11() {
this.eventSeq = [
new invokerChecker(EVENT_HIDE, getNode("t11_c1_child")),
new invokerChecker(EVENT_HIDE, getNode("t11_c2")),
@ -671,8 +625,7 @@
new unexpectedInvokerChecker(EVENT_REORDER, "t11_c3")
];
this.invoke = function test11_invoke()
{
this.invoke = function test11_invoke() {
// Remove a node from 't11_c1' container to give the event tree a
// desired structure (the 't11_c1' container node goes first in
// the event tree),
@ -695,8 +648,7 @@
// enableLogging("eventTree");
var gQueue = null;
function doTests()
{
function doTests() {
gQueue = new eventQueue();
gQueue.push(new removeChildNParent("option1", "select1"));

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

@ -24,68 +24,57 @@
// //////////////////////////////////////////////////////////////////////////
// Invokers
function showContextMenu(aID)
{
function showContextMenu(aID) {
this.DOMNode = getNode(aID);
this.eventSeq = [
new invokerChecker(EVENT_MENUPOPUP_START, getContextMenuNode()),
];
this.invoke = function showContextMenu_invoke()
{
this.invoke = function showContextMenu_invoke() {
synthesizeMouse(this.DOMNode, 4, 4, { type: "contextmenu", button: 2 });
}
this.getID = function showContextMenu_getID()
{
this.getID = function showContextMenu_getID() {
return "show context menu";
}
}
function selectMenuItem()
{
function selectMenuItem() {
this.eventSeq = [
new invokerChecker(EVENT_FOCUS, getFocusedMenuItem)
];
this.invoke = function selectMenuItem_invoke()
{
this.invoke = function selectMenuItem_invoke() {
synthesizeKey("VK_DOWN", { });
}
this.getID = function selectMenuItem_getID()
{
this.getID = function selectMenuItem_getID() {
return "select first menuitem";
}
}
function closeContextMenu(aID)
{
function closeContextMenu(aID) {
this.eventSeq = [
new invokerChecker(EVENT_MENUPOPUP_END,
getAccessible(getContextMenuNode()))
];
this.invoke = function closeContextMenu_invoke()
{
this.invoke = function closeContextMenu_invoke() {
synthesizeKey("VK_ESCAPE", { });
}
this.getID = function closeContextMenu_getID()
{
this.getID = function closeContextMenu_getID() {
return "close context menu";
}
}
function getContextMenuNode()
{
function getContextMenuNode() {
return getRootAccessible().DOMDocument.
getElementById("contentAreaContextMenu");
}
function getFocusedMenuItem()
{
function getFocusedMenuItem() {
var menu = getAccessible(getAccessible(getContextMenuNode()));
for (var idx = 0; idx < menu.childCount; idx++) {
var item = menu.getChildAt(idx);
@ -103,8 +92,7 @@
// gA11yEventDumpID = "eventdump"; // debug stuff
// gA11yEventDumpToConsole = true;
function doTests()
{
function doTests() {
gQueue = new eventQueue();
gQueue.push(new showContextMenu("input"));

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

@ -24,16 +24,13 @@
// //////////////////////////////////////////////////////////////////////////
// Invokers
function setAttr(aID, aAttr, aValue, aChecker)
{
function setAttr(aID, aAttr, aValue, aChecker) {
this.eventSeq = [ aChecker ];
this.invoke = function setAttr_invoke()
{
this.invoke = function setAttr_invoke() {
getNode(aID).setAttribute(aAttr, aValue);
}
this.getID = function setAttr_getID()
{
this.getID = function setAttr_getID() {
return "set attr '" + aAttr + "', value '" + aValue + "'";
}
}
@ -44,8 +41,7 @@
// gA11yEventDumpToConsole = true; // debuggin
var gQueue = null;
function doTests()
{
function doTests() {
gQueue = new eventQueue();
gQueue.push(new setAttr("tst1", "aria-describedby", "display",

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

@ -41,8 +41,7 @@
// //////////////////////////////////////////////////////////////////////////
// Invokers
function changeIframeSrc(aIdentifier, aURL)
{
function changeIframeSrc(aIdentifier, aURL) {
this.DOMNode = getNode(aIdentifier);
this.eventSeq = [
@ -50,13 +49,11 @@
new asyncInvokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, getIframeDoc)
];
this.invoke = function changeIframeSrc_invoke()
{
this.invoke = function changeIframeSrc_invoke() {
this.DOMNode.src = aURL;
}
this.finalCheck = function changeIframeSrc_finalCheck()
{
this.finalCheck = function changeIframeSrc_finalCheck() {
var accTree = {
role: ROLE_INTERNAL_FRAME,
children: [
@ -70,13 +67,11 @@
testAccessibleTree(this.DOMNode, accTree);
}
this.getID = function changeIframeSrc_getID()
{
this.getID = function changeIframeSrc_getID() {
return "change iframe src on " + aURL;
}
function getIframeDoc()
{
function getIframeDoc() {
return getAccessible(getNode(aIdentifier).contentDocument);
}
}
@ -84,8 +79,7 @@
const kHide = 1;
const kShow = 2;
const kRemove = 3;
function morphIFrame(aIdentifier, aAction)
{
function morphIFrame(aIdentifier, aAction) {
this.DOMNode = getNode(aIdentifier);
this.IFrameContainerDOMNode = this.DOMNode.parentNode;
@ -102,8 +96,7 @@
new invokerChecker(EVENT_REORDER, this.IFrameContainerDOMNode);
this.eventSeq.push(reorderChecker);
this.invoke = function morphIFrame_invoke()
{
this.invoke = function morphIFrame_invoke() {
if (aAction == kHide) {
this.DOMNode.style.display = "none";
} else if (aAction == kShow) {
@ -113,8 +106,7 @@
}
}
this.finalCheck = function morphIFrame_finalCheck()
{
this.finalCheck = function morphIFrame_finalCheck() {
var accTree = {
role: ROLE_SECTION,
children: (aAction == kHide || aAction == kRemove) ? [ ] :
@ -131,8 +123,7 @@
testAccessibleTree(this.IFrameContainerDOMNode, accTree);
}
this.getID = function morphIFrame_getID()
{
this.getID = function morphIFrame_getID() {
if (aAction == kRemove)
return "remove iframe";
@ -141,27 +132,23 @@
}
}
function makeIFrameVisible(aID)
{
function makeIFrameVisible(aID) {
this.DOMNode = getNode(aID);
this.eventSeq = [
new invokerChecker(EVENT_REORDER, this.DOMNode.parentNode)
];
this.invoke = function makeIFrameVisible_invoke()
{
this.invoke = function makeIFrameVisible_invoke() {
this.DOMNode.style.visibility = "visible";
}
this.getID = function makeIFrameVisible_getID()
{
this.getID = function makeIFrameVisible_getID() {
return "The accessible for DOM document loaded before it's shown shouldn't have busy state.";
}
}
function openDialogWnd(aURL)
{
function openDialogWnd(aURL) {
// Get application root accessible.
var docAcc = getAccessible(document);
while (docAcc) {
@ -178,18 +165,15 @@
new invokerChecker(EVENT_REORDER, this.mRootAcc)
];
this.invoke = function openDialogWnd_invoke()
{
this.invoke = function openDialogWnd_invoke() {
this.mDialog = window.openDialog(aURL);
}
this.finalCheck = function openDialogWnd_finalCheck()
{
this.finalCheck = function openDialogWnd_finalCheck() {
this.finalCheckImpl();
}
this.finalCheckImpl = function openDialogWnd_finalCheckImpl()
{
this.finalCheckImpl = function openDialogWnd_finalCheckImpl() {
var accTree = {
role: ROLE_APP_ROOT,
children: [
@ -223,28 +207,24 @@
});
}
this.getID = function openDialogWnd_getID()
{
this.getID = function openDialogWnd_getID() {
return "open dialog '" + aURL + "'";
}
}
function openWndShutdownDoc()
{
function openWndShutdownDoc() {
this.__proto__ =
new openDialogWnd("../events/docload_wnd.html");
var thisObj = this;
var docChecker = {
type: EVENT_HIDE,
get target()
{
get target() {
var iframe = this.invoker.mDialog.document.getElementById("iframe");
this.invoker.iframeDoc = iframe.contentDocument;
return iframe;
},
get targetDescr()
{
get targetDescr() {
return "inner iframe of docload_wnd.html document";
},
invoker: thisObj
@ -252,8 +232,7 @@
this.eventSeq.push(docChecker);
this.finalCheck = function openWndShutdownDoc_finalCheck()
{
this.finalCheck = function openWndShutdownDoc_finalCheck() {
// After timeout after event hide for iframe was handled the document
// accessible for iframe's document is in cache still.
ok(!isAccessibleInCache(this.iframeDoc),
@ -277,8 +256,7 @@
// gA11yEventDumpID = "eventdump";
// gA11yEventDumpToConsole = true;
function doTests()
{
function doTests() {
gQueue = new eventQueue();
gQueue.push(new changeIframeSrc("iframe", "about:"));
@ -295,8 +273,7 @@
gQueue.invoke(); // Will call SimpleTest.finish();
}
function doLastCallTests()
{
function doLastCallTests() {
// ////////////////////////////////////////////////////////////////////////
// makeIFrameVisible() test, part2

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

@ -22,21 +22,18 @@
// //////////////////////////////////////////////////////////////////////////
// Invokers
function showARIADialog(aID)
{
function showARIADialog(aID) {
this.dialogNode = getNode(aID);
this.eventSeq = [
new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, this.dialogNode)
];
this.invoke = function showARIADialog_invoke()
{
this.invoke = function showARIADialog_invoke() {
this.dialogNode.style.display = "block";
}
this.getID = function showARIADialog_getID()
{
this.getID = function showARIADialog_getID() {
return "show ARIA dialog";
}
}
@ -49,8 +46,7 @@
// Debug stuff.
// gA11yEventDumpToConsole = true;
function doTests()
{
function doTests() {
gQueue = new eventQueue();
gQueue.push(new showARIADialog("dialog"));

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

@ -25,8 +25,7 @@
var gQueue = null;
// aria grabbed invoker
function changeGrabbed(aNodeOrID, aGrabValue)
{
function changeGrabbed(aNodeOrID, aGrabValue) {
this.DOMNode = getNode(aNodeOrID);
this.invoke = function changeGrabbed_invoke() {
@ -45,8 +44,7 @@
}
// aria dropeffect invoker
function changeDropeffect(aNodeOrID, aDropeffectValue)
{
function changeDropeffect(aNodeOrID, aDropeffectValue) {
this.DOMNode = getNode(aNodeOrID);
this.invoke = function changeDropeffect_invoke() {
@ -64,8 +62,7 @@
}
}
function doTests()
{
function doTests() {
// Test aria attribute mutation events
gQueue = new eventQueue(nsIAccessibleEvent.EVENT_OBJECT_ATTRIBUTE_CHANGED);

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

@ -46,8 +46,7 @@
count: 0
};
function doTests()
{
function doTests() {
registerA11yEventListener(EVENT_FOCUS, gFocusHandler);
getAccessible("input1").takeFocus();

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

@ -22,32 +22,27 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=429547
<script type="application/javascript">
// gA11yEventDumpToConsole = true; // debugging
function changeARIAActiveDescendant(aID, aItemID)
{
function changeARIAActiveDescendant(aID, aItemID) {
this.eventSeq = [
new focusChecker(aItemID)
];
this.invoke = function changeARIAActiveDescendant_invoke()
{
this.invoke = function changeARIAActiveDescendant_invoke() {
getNode(aID).setAttribute("aria-activedescendant", aItemID);
}
this.getID = function changeARIAActiveDescendant_getID()
{
this.getID = function changeARIAActiveDescendant_getID() {
return "change aria-activedescendant on " + aItemID;
}
}
function insertItemNFocus(aID, aNewItemID)
{
function insertItemNFocus(aID, aNewItemID) {
this.eventSeq = [
new invokerChecker(EVENT_SHOW, aNewItemID),
new focusChecker(aNewItemID)
];
this.invoke = function insertItemNFocus_invoke()
{
this.invoke = function insertItemNFocus_invoke() {
var container = getNode(aID);
var itemNode = document.createElement("div");
itemNode.setAttribute("id", aNewItemID);
@ -57,15 +52,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=429547
container.setAttribute("aria-activedescendant", aNewItemID);
}
this.getID = function insertItemNFocus_getID()
{
this.getID = function insertItemNFocus_getID() {
return "insert new node and focus it with ID: " + aNewItemID;
}
}
var gQueue = null;
function doTest()
{
function doTest() {
gQueue = new eventQueue();
gQueue.push(new synthFocus("listbox", new focusChecker("item1")));

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

@ -24,8 +24,7 @@
// gA11yEventDumpToConsole = true;
var gQueue = null;
function doTests()
{
function doTests() {
gQueue = new eventQueue();
gQueue.push(new synthFocus("button"));

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

@ -24,8 +24,7 @@
// gA11yEventDumpToConsole = true;
var gQueue = null;
function doTests()
{
function doTests() {
gQueue = new eventQueue(EVENT_FOCUS);
gQueue.push(new synthFocus("textbox"));

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

@ -26,8 +26,7 @@
// var gA11yEventDumpID = "eventdump";
// gA11yEventDumpToConsole = true;
function doTests()
{
function doTests() {
// setup
var frameDoc = document.getElementById("iframe").contentDocument;
frameDoc.designMode = "on";

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

@ -21,12 +21,10 @@
src="../states.js"></script>
<script type="application/javascript">
function focusElmWhileSubdocIsFocused(aID)
{
function focusElmWhileSubdocIsFocused(aID) {
this.DOMNode = getNode(aID);
this.invoke = function focusElmWhileSubdocIsFocused_invoke()
{
this.invoke = function focusElmWhileSubdocIsFocused_invoke() {
this.DOMNode.focus();
}
@ -38,46 +36,37 @@
new invokerChecker(EVENT_FOCUS, this.DOMNode.ownerDocument)
];
this.getID = function focusElmWhileSubdocIsFocused_getID()
{
this.getID = function focusElmWhileSubdocIsFocused_getID() {
return "Focus element while subdocument is focused " + prettyName(aID);
}
}
function imageMapChecker(aID)
{
function imageMapChecker(aID) {
var node = getNode(aID);
this.type = EVENT_FOCUS;
this.match = function imageMapChecker_match(aEvent)
{
this.match = function imageMapChecker_match(aEvent) {
return aEvent.DOMNode == node;
}
}
function topMenuChecker()
{
function topMenuChecker() {
this.type = EVENT_FOCUS;
this.match = function topMenuChecker_match(aEvent)
{
this.match = function topMenuChecker_match(aEvent) {
return aEvent.accessible.role == ROLE_PARENT_MENUITEM;
}
}
function contextMenuChecker()
{
function contextMenuChecker() {
this.type = EVENT_MENUPOPUP_START;
this.match = function contextMenuChecker_match(aEvent)
{
this.match = function contextMenuChecker_match(aEvent) {
return aEvent.accessible.role == ROLE_MENUPOPUP;
}
}
function focusContextMenuItemChecker()
{
function focusContextMenuItemChecker() {
this.__proto__ = new focusChecker();
this.match = function focusContextMenuItemChecker_match(aEvent)
{
this.match = function focusContextMenuItemChecker_match(aEvent) {
return aEvent.accessible.role == ROLE_MENUITEM;
}
}
@ -91,8 +80,7 @@
var gQueue = null;
function doTests()
{
function doTests() {
var frameDoc = document.getElementById("iframe").contentDocument;
var editableDoc = document.getElementById("editabledoc").contentDocument;

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

@ -20,12 +20,10 @@
/**
* Checker for invokers.
*/
function actionChecker(aID, aDescription)
{
function actionChecker(aID, aDescription) {
this.__proto__ = new invokerChecker(EVENT_FOCUS, aID);
this.check = function actionChecker_check(aEvent)
{
this.check = function actionChecker_check(aEvent) {
var target = aEvent.accessible;
is(target.description, aDescription,
"Wrong description for " + prettyName(target));
@ -67,8 +65,7 @@
var gTextboxElm = null;
var gTooltipElm = null;
function doTests()
{
function doTests() {
gButtonElm = getNode("button");
gTextboxElm = getNode("textbox");
gTooltipElm = getNode("tooltip");
@ -81,8 +78,7 @@
// The aria-describedby is changed on DOM focus. Accessible description
// should be updated when a11y focus is fired.
gQueue = new eventQueue(nsIAccessibleEvent.EVENT_FOCUS);
gQueue.onFinish = function()
{
gQueue.onFinish = function() {
gButtonElm.removeEventListener("focus", gFocusHandler);
gButtonElm.removeEventListener("blur", gBlurHandler);
gTextboxElm.removeEventListener("focus", gFocusHandler);

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

@ -26,8 +26,7 @@
var gQueue = null;
function doTests()
{
function doTests() {
// Bug 746534 - File causes crash or hang on OS X
if (MAC) {
todo(false, "Bug 746534 - test file causes crash or hang on OS X");

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

@ -21,24 +21,21 @@
/**
* Remove text data from HTML input.
*/
function removeTextFromInput(aID, aStart, aEnd, aText, aFromUser)
{
function removeTextFromInput(aID, aStart, aEnd, aText, aFromUser) {
this.DOMNode = getNode(aID);
this.eventSeq = [
new textChangeChecker(aID, aStart, aEnd, aText, false, aFromUser)
];
this.invoke = function removeTextFromInput_invoke()
{
this.invoke = function removeTextFromInput_invoke() {
this.DOMNode.focus();
this.DOMNode.setSelectionRange(aStart, aEnd);
synthesizeKey("VK_DELETE", {});
}
this.getID = function removeTextFromInput_getID()
{
this.getID = function removeTextFromInput_getID() {
return "Remove text from " + aStart + " to " + aEnd + " for " +
prettyName(aID);
}
@ -47,16 +44,14 @@
/**
* Remove text data from text node.
*/
function removeTextFromContentEditable(aID, aStart, aEnd, aText, aFromUser)
{
function removeTextFromContentEditable(aID, aStart, aEnd, aText, aFromUser) {
this.DOMNode = getNode(aID);
this.eventSeq = [
new textChangeChecker(aID, aStart, aEnd, aText, false, aFromUser)
];
this.invoke = function removeTextFromContentEditable_invoke()
{
this.invoke = function removeTextFromContentEditable_invoke() {
this.DOMNode.focus();
this.textNode = getNode(aID).firstChild;
var selection = window.getSelection();
@ -68,8 +63,7 @@
synthesizeKey("VK_DELETE", {});
}
this.getID = function removeTextFromContentEditable_getID()
{
this.getID = function removeTextFromContentEditable_getID() {
return "Remove text from " + aStart + " to " + aEnd + " for " +
prettyName(aID);
}
@ -81,8 +75,7 @@
var gQueue = null;
function doTests()
{
function doTests() {
gQueue = new eventQueue();
// Focused editable text node

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

@ -41,8 +41,7 @@
* @param aEventTypes [in] events to register (see constants above)
* @param aDoNotExpectEvents [in] boolean indicates if events are expected
*/
function mutateA11yTree(aNodeOrID, aEventTypes, aDoNotExpectEvents)
{
function mutateA11yTree(aNodeOrID, aEventTypes, aDoNotExpectEvents) {
// Interface
this.DOMNode = getNode(aNodeOrID);
this.doNotExpectEvents = aDoNotExpectEvents;
@ -52,8 +51,7 @@
/**
* Change default target (aNodeOrID) registered for the given event type.
*/
this.setTarget = function mutateA11yTree_setTarget(aEventType, aTarget)
{
this.setTarget = function mutateA11yTree_setTarget(aEventType, aTarget) {
var type = this.getA11yEventType(aEventType);
for (var idx = 0; idx < this.getEventSeq().length; idx++) {
if (this.getEventSeq()[idx].type == type) {
@ -79,8 +77,7 @@
}
// Implementation
this.getA11yEventType = function mutateA11yTree_getA11yEventType(aEventType)
{
this.getA11yEventType = function mutateA11yTree_getA11yEventType(aEventType) {
if (aEventType == kReorderEvent)
return nsIAccessibleEvent.EVENT_REORDER;
@ -91,8 +88,7 @@
return nsIAccessibleEvent.EVENT_SHOW;
}
this.getEventSeq = function mutateA11yTree_getEventSeq()
{
this.getEventSeq = function mutateA11yTree_getEventSeq() {
return this.doNotExpectEvents ? this.unexpectedEventSeq : this.eventSeq;
}
@ -118,17 +114,14 @@
/**
* Change CSS style for the given node.
*/
function changeStyle(aNodeOrID, aProp, aValue, aEventTypes)
{
function changeStyle(aNodeOrID, aProp, aValue, aEventTypes) {
this.__proto__ = new mutateA11yTree(aNodeOrID, aEventTypes, false);
this.invoke = function changeStyle_invoke()
{
this.invoke = function changeStyle_invoke() {
this.DOMNode.style[aProp] = aValue;
}
this.getID = function changeStyle_getID()
{
this.getID = function changeStyle_getID() {
return aNodeOrID + " change style " + aProp + " on value " + aValue;
}
}
@ -136,17 +129,14 @@
/**
* Change class name for the given node.
*/
function changeClass(aParentNodeOrID, aNodeOrID, aClassName, aEventTypes)
{
function changeClass(aParentNodeOrID, aNodeOrID, aClassName, aEventTypes) {
this.__proto__ = new mutateA11yTree(aNodeOrID, aEventTypes, false);
this.invoke = function changeClass_invoke()
{
this.invoke = function changeClass_invoke() {
this.parentDOMNode.className = aClassName;
}
this.getID = function changeClass_getID()
{
this.getID = function changeClass_getID() {
return aNodeOrID + " change class " + aClassName;
}
@ -157,16 +147,14 @@
* Clone the node and append it to its parent.
*/
function cloneAndAppendToDOM(aNodeOrID, aEventTypes,
aTargetsFunc, aReorderTargetFunc)
{
aTargetsFunc, aReorderTargetFunc) {
var eventTypes = aEventTypes || kShowEvents;
var doNotExpectEvents = (aEventTypes == kNoEvents);
this.__proto__ = new mutateA11yTree(aNodeOrID, eventTypes,
doNotExpectEvents);
this.invoke = function cloneAndAppendToDOM_invoke()
{
this.invoke = function cloneAndAppendToDOM_invoke() {
var newElm = this.DOMNode.cloneNode(true);
newElm.removeAttribute("id");
@ -182,8 +170,7 @@
this.DOMNode.parentNode.appendChild(newElm);
}
this.getID = function cloneAndAppendToDOM_getID()
{
this.getID = function cloneAndAppendToDOM_getID() {
return aNodeOrID + " clone and append to DOM.";
}
}
@ -192,21 +179,18 @@
* Removes the node from DOM.
*/
function removeFromDOM(aNodeOrID, aEventTypes,
aTargetsFunc, aReorderTargetFunc)
{
aTargetsFunc, aReorderTargetFunc) {
var eventTypes = aEventTypes || kHideEvents;
var doNotExpectEvents = (aEventTypes == kNoEvents);
this.__proto__ = new mutateA11yTree(aNodeOrID, eventTypes,
doNotExpectEvents);
this.invoke = function removeFromDOM_invoke()
{
this.invoke = function removeFromDOM_invoke() {
this.DOMNode.remove();
}
this.getID = function removeFromDOM_getID()
{
this.getID = function removeFromDOM_getID() {
return prettyName(aNodeOrID) + " remove from DOM.";
}
@ -221,18 +205,15 @@
/**
* Clone the node and replace the original node by cloned one.
*/
function cloneAndReplaceInDOM(aNodeOrID)
{
function cloneAndReplaceInDOM(aNodeOrID) {
this.__proto__ = new mutateA11yTree(aNodeOrID, kHideAndShowEvents,
false);
this.invoke = function cloneAndReplaceInDOM_invoke()
{
this.invoke = function cloneAndReplaceInDOM_invoke() {
this.DOMNode.parentNode.replaceChild(this.newElm, this.DOMNode);
}
this.getID = function cloneAndReplaceInDOM_getID()
{
this.getID = function cloneAndReplaceInDOM_getID() {
return aNodeOrID + " clone and replace in DOM.";
}
@ -245,8 +226,7 @@
* Trigger content insertion (flush layout), removal and insertion of
* the same element for the same parent.
*/
function test1(aContainerID)
{
function test1(aContainerID) {
this.divNode = document.createElement("div");
this.divNode.setAttribute("id", "div-test1");
this.containerNode = getNode(aContainerID);
@ -256,16 +236,14 @@
new invokerChecker(EVENT_REORDER, this.containerNode)
];
this.invoke = function test1_invoke()
{
this.invoke = function test1_invoke() {
this.containerNode.appendChild(this.divNode);
getComputedStyle(this.divNode, "").color;
this.containerNode.removeChild(this.divNode);
this.containerNode.appendChild(this.divNode);
}
this.getID = function test1_getID()
{
this.getID = function test1_getID() {
return "fuzzy test #1: content insertion (flush layout), removal and" +
"reinsertion";
}
@ -275,8 +253,7 @@
* Trigger content insertion (flush layout), removal and insertion of
* the same element for the different parents.
*/
function test2(aContainerID, aTmpContainerID)
{
function test2(aContainerID, aTmpContainerID) {
this.divNode = document.createElement("div");
this.divNode.setAttribute("id", "div-test2");
this.containerNode = getNode(aContainerID);
@ -293,16 +270,14 @@
new invokerChecker(EVENT_REORDER, this.tmpContainerNode)
];
this.invoke = function test2_invoke()
{
this.invoke = function test2_invoke() {
this.tmpContainerNode.appendChild(this.divNode);
getComputedStyle(this.divNode, "").color;
this.tmpContainerNode.removeChild(this.divNode);
this.containerNode.appendChild(this.divNode);
}
this.getID = function test2_getID()
{
this.getID = function test2_getID() {
return "fuzzy test #2: content insertion (flush layout), removal and" +
"reinsertion under another container";
}
@ -311,8 +286,7 @@
/**
* Content insertion (flush layout) and then removal (nothing was changed).
*/
function test3(aContainerID)
{
function test3(aContainerID) {
this.divNode = document.createElement("div");
this.divNode.setAttribute("id", "div-test3");
this.containerNode = getNode(aContainerID);
@ -323,21 +297,18 @@
new invokerChecker(EVENT_REORDER, this.containerNode)
];
this.invoke = function test3_invoke()
{
this.invoke = function test3_invoke() {
this.containerNode.appendChild(this.divNode);
getComputedStyle(this.divNode, "").color;
this.containerNode.removeChild(this.divNode);
}
this.getID = function test3_getID()
{
this.getID = function test3_getID() {
return "fuzzy test #3: content insertion (flush layout) and removal";
}
}
function insertReferredElm(aContainerID)
{
function insertReferredElm(aContainerID) {
this.containerNode = getNode(aContainerID);
this.eventSeq = [
@ -346,70 +317,59 @@
new invokerChecker(EVENT_REORDER, this.containerNode)
];
this.invoke = function insertReferredElm_invoke()
{
this.invoke = function insertReferredElm_invoke() {
this.containerNode.innerHTML =
"<span id='insertReferredElms_span'></span><input aria-labelledby='insertReferredElms_span'>";
}
this.getID = function insertReferredElm_getID()
{
this.getID = function insertReferredElm_getID() {
return "insert inaccessible element and then insert referring element to make it accessible";
}
}
function showHiddenParentOfVisibleChild()
{
function showHiddenParentOfVisibleChild() {
this.eventSeq = [
new invokerChecker(EVENT_HIDE, getNode("c4_child")),
new invokerChecker(EVENT_SHOW, getNode("c4_middle")),
new invokerChecker(EVENT_REORDER, getNode("c4"))
];
this.invoke = function showHiddenParentOfVisibleChild_invoke()
{
this.invoke = function showHiddenParentOfVisibleChild_invoke() {
getNode("c4_middle").style.visibility = "visible";
}
this.getID = function showHiddenParentOfVisibleChild_getID()
{
this.getID = function showHiddenParentOfVisibleChild_getID() {
return "show hidden parent of visible child";
}
}
function hideNDestroyDoc()
{
function hideNDestroyDoc() {
this.txt = null;
this.eventSeq = [
new invokerChecker(EVENT_HIDE, () => { return this.txt; })
];
this.invoke = function hideNDestroyDoc_invoke()
{
this.invoke = function hideNDestroyDoc_invoke() {
this.txt = getAccessible("c5").firstChild.firstChild;
this.txt.DOMNode.remove();
}
this.check = function hideNDestroyDoc_check()
{
this.check = function hideNDestroyDoc_check() {
getNode("c5").remove();
}
this.getID = function hideNDestroyDoc_getID()
{
this.getID = function hideNDestroyDoc_getID() {
return "remove text node and destroy a document on hide event";
}
}
function hideHideNDestroyDoc()
{
function hideHideNDestroyDoc() {
this.target = null;
this.eventSeq = [
new invokerChecker(EVENT_HIDE, () => { return this.target; })
];
this.invoke = function hideHideNDestroyDoc_invoke()
{
this.invoke = function hideHideNDestroyDoc_invoke() {
var doc = getAccessible("c6").firstChild;
var l1 = doc.firstChild;
this.target = l1.firstChild;
@ -418,13 +378,11 @@
l2.DOMNode.firstChild.remove();
}
this.check = function hideHideNDestroyDoc_check()
{
this.check = function hideHideNDestroyDoc_check() {
getNode("c6").remove();
}
this.getID = function hideHideNDestroyDoc_getID()
{
this.getID = function hideHideNDestroyDoc_getID() {
return "remove text nodes (2 events in the queue) and destroy a document on first hide event";
}
}
@ -432,24 +390,20 @@
/**
* Target getters.
*/
function getFirstChild(aNode)
{
function getFirstChild(aNode) {
return [aNode.firstChild];
}
function getLastChild(aNode)
{
function getLastChild(aNode) {
return [aNode.lastChild];
}
function getNEnsureFirstChild(aNode)
{
function getNEnsureFirstChild(aNode) {
var node = aNode.firstChild;
getAccessible(node);
return [node];
}
function getNEnsureChildren(aNode)
{
function getNEnsureChildren(aNode) {
var children = [];
var node = aNode.firstChild;
do {
@ -461,8 +415,7 @@
return children;
}
function getParent(aNode)
{
function getParent(aNode) {
return aNode.parentNode;
}
@ -474,8 +427,7 @@
*/
var gQueue = null;
function doTests()
{
function doTests() {
gQueue = new eventQueue();
// Show/hide events by changing of display style of accessible DOM node

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

@ -30,14 +30,11 @@
* Insert a not accessible bound element containing an accessible element
* in anonymous content.
*/
function insertBinding(aContainerID)
{
function insertBinding(aContainerID) {
this.containerNode = getNode(aContainerID);
function getButtonFromBinding(aNode)
{
try { return document.getAnonymousNodes(aNode.firstChild)[0]; }
catch (e) { return null; }
function getButtonFromBinding(aNode) {
try { return document.getAnonymousNodes(aNode.firstChild)[0]; } catch (e) { return null; }
}
this.eventSeq = [
@ -45,15 +42,13 @@
new invokerChecker(EVENT_REORDER, this.containerNode)
];
this.invoke = function insertBinding_invoke()
{
this.invoke = function insertBinding_invoke() {
var span = document.createElement("span");
span.setAttribute("style", "-moz-binding:url(#button)");
this.containerNode.appendChild(span);
}
this.getID = function insertBinding_getID()
{
this.getID = function insertBinding_getID() {
return "insert button binding";
}
}
@ -65,8 +60,7 @@
// gA11yEventDumpID = "eventdump"; // debug stuff
// gA11yEventDumpToConsole = true;
function doTests()
{
function doTests() {
gQueue = new eventQueue();
gQueue.push(new insertBinding("testContainer"));

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

@ -24,16 +24,13 @@
// //////////////////////////////////////////////////////////////////////////
// Invokers
function setAttr(aID, aAttr, aValue, aChecker)
{
function setAttr(aID, aAttr, aValue, aChecker) {
this.eventSeq = [ aChecker ];
this.invoke = function setAttr_invoke()
{
this.invoke = function setAttr_invoke() {
getNode(aID).setAttribute(aAttr, aValue);
}
this.getID = function setAttr_getID()
{
this.getID = function setAttr_getID() {
return "set attr '" + aAttr + "', value '" + aValue + "'";
}
}
@ -41,20 +38,17 @@
/**
* No name change on an accessible, because the accessible is recreated.
*/
function setAttr_recreate(aID, aAttr, aValue)
{
function setAttr_recreate(aID, aAttr, aValue) {
this.eventSeq = [
new invokerChecker(EVENT_HIDE, getAccessible(aID)),
new invokerChecker(EVENT_SHOW, aID)
];
this.invoke = function setAttr_recreate_invoke()
{
this.invoke = function setAttr_recreate_invoke() {
todo(false, "No accessible recreation should happen, just name change event");
getNode(aID).setAttribute(aAttr, aValue);
}
this.getID = function setAttr_recreate_getID()
{
this.getID = function setAttr_recreate_getID() {
return "set attr '" + aAttr + "', value '" + aValue + "'";
}
}
@ -65,8 +59,7 @@
// gA11yEventDumpToConsole = true; // debuggin
var gQueue = null;
function doTests()
{
function doTests() {
gQueue = new eventQueue();
gQueue.push(new setAttr("tst1", "aria-label", "hi",

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

@ -30,8 +30,7 @@
// gA11yEventDumpToConsole = true; // debuggin
var gQueue = null;
function doTests()
{
function doTests() {
gQueue = new eventQueue();
// open combobox

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

@ -24,8 +24,7 @@
// //////////////////////////////////////////////////////////////////////////
// Invokers
function selectItem(aSelectID, aItemID)
{
function selectItem(aSelectID, aItemID) {
this.selectNode = getNode(aSelectID);
this.itemNode = getNode(aItemID);
@ -41,8 +40,7 @@
this.itemNode.setAttribute("aria-selected", "true");
}
this.getID = function selectItem_getID()
{
this.getID = function selectItem_getID() {
return "select item " + prettyName(aItemID);
}
}
@ -54,8 +52,7 @@
// gA11yEventDumpToConsole = true; // debug stuff
function doTests()
{
function doTests() {
gQueue = new eventQueue();
gQueue.push(new selectItem("tablist", "tab1"));

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

@ -22,8 +22,7 @@
// //////////////////////////////////////////////////////////////////////////
// Invokers
function makeEditableDoc(aDocNode, aIsEnabled)
{
function makeEditableDoc(aDocNode, aIsEnabled) {
this.DOMNode = aDocNode;
this.invoke = function editabledoc_invoke() {
@ -54,8 +53,7 @@
};
}
function invalidInput(aNodeOrID)
{
function invalidInput(aNodeOrID) {
this.DOMNode = getNode(aNodeOrID);
this.invoke = function invalidInput_invoke() {
@ -72,36 +70,31 @@
};
}
function changeCheckInput(aID, aIsChecked)
{
function changeCheckInput(aID, aIsChecked) {
this.DOMNode = getNode(aID);
this.eventSeq = [
new stateChangeChecker(STATE_CHECKED, false, aIsChecked, this.DOMNode)
];
this.invoke = function changeCheckInput_invoke()
{
this.invoke = function changeCheckInput_invoke() {
this.DOMNode.checked = aIsChecked;
}
this.getID = function changeCheckInput_getID()
{
this.getID = function changeCheckInput_getID() {
return "change checked state to '" + aIsChecked + "' for " +
prettyName(aID);
}
}
function stateChangeOnFileInput(aID, aAttr, aValue,
aState, aIsExtraState, aIsEnabled)
{
aState, aIsExtraState, aIsEnabled) {
this.fileControlNode = getNode(aID);
this.fileControl = getAccessible(this.fileControlNode);
this.browseButton = this.fileControl.firstChild;
// No state change events on the label.
this.invoke = function stateChangeOnFileInput_invoke()
{
this.invoke = function stateChangeOnFileInput_invoke() {
this.fileControlNode.setAttribute(aAttr, aValue);
}
@ -110,47 +103,40 @@
new stateChangeChecker(aState, aIsExtraState, aIsEnabled, this.browseButton)
];
this.getID = function stateChangeOnFileInput_getID()
{
this.getID = function stateChangeOnFileInput_getID() {
return "inherited state change on file input on attribute '" + aAttr + "' change";
}
}
function dupeStateChange(aID, aAttr, aValue,
aState, aIsExtraState, aIsEnabled)
{
aState, aIsExtraState, aIsEnabled) {
this.eventSeq = [
new stateChangeChecker(aState, aIsExtraState, aIsEnabled, getNode(aID))
];
this.invoke = function dupeStateChange_invoke()
{
this.invoke = function dupeStateChange_invoke() {
getNode(aID).setAttribute(aAttr, aValue);
getNode(aID).setAttribute(aAttr, aValue);
}
this.getID = function dupeStateChange_getID()
{
this.getID = function dupeStateChange_getID() {
return "duped state change events";
}
}
function oppositeStateChange(aID, aAttr, aState, aIsExtraState)
{
function oppositeStateChange(aID, aAttr, aState, aIsExtraState) {
this.eventSeq = [ ];
this.unexpectedEventSeq = [
new stateChangeChecker(aState, aIsExtraState, false, getNode(aID)),
new stateChangeChecker(aState, aIsExtraState, true, getNode(aID))
];
this.invoke = function oppositeStateChange_invoke()
{
this.invoke = function oppositeStateChange_invoke() {
getNode(aID).setAttribute(aAttr, "false");
getNode(aID).setAttribute(aAttr, "true");
}
this.getID = function oppositeStateChange_getID()
{
this.getID = function oppositeStateChange_getID() {
return "opposite state change events";
}
}
@ -159,14 +145,12 @@
* Change concomitant ARIA and native attribute at once.
*/
function echoingStateChange(aID, aARIAAttr, aAttr, aValue,
aState, aIsExtraState, aIsEnabled)
{
aState, aIsExtraState, aIsEnabled) {
this.eventSeq = [
new stateChangeChecker(aState, aIsExtraState, aIsEnabled, getNode(aID))
];
this.invoke = function echoingStateChange_invoke()
{
this.invoke = function echoingStateChange_invoke() {
if (aValue == null) {
getNode(aID).removeAttribute(aARIAAttr);
getNode(aID).removeAttribute(aAttr);
@ -177,8 +161,7 @@
}
}
this.getID = function echoingStateChange_getID()
{
this.getID = function echoingStateChange_getID() {
return "enchoing ARIA and native attributes change";
}
}
@ -191,8 +174,7 @@
// var gA11yEventDumpID = "eventdump"; // debug stuff
// gA11yEventDumpToConsole = true; // debug stuff
function doTests()
{
function doTests() {
gQueue = new eventQueue(nsIAccessibleEvent.EVENT_STATE_CHANGE);
// Test delayed editable state change

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

@ -23,8 +23,7 @@
/**
* Base text remove invoker and checker.
*/
function textRemoveInvoker(aID, aStart, aEnd, aText)
{
function textRemoveInvoker(aID, aStart, aEnd, aText) {
this.DOMNode = getNode(aID);
this.eventSeq = [
@ -32,8 +31,7 @@
];
}
function textInsertInvoker(aID, aStart, aEnd, aText)
{
function textInsertInvoker(aID, aStart, aEnd, aText) {
this.DOMNode = getNode(aID);
this.eventSeq = [
@ -44,18 +42,15 @@
/**
* Remove inaccessible child node containing accessibles.
*/
function removeChildSpan(aID)
{
function removeChildSpan(aID) {
this.__proto__ = new textRemoveInvoker(aID, 0, 5, "33322");
this.invoke = function removeChildSpan_invoke()
{
this.invoke = function removeChildSpan_invoke() {
// remove HTML span, a first child of the node
this.DOMNode.firstChild.remove();
}
this.getID = function removeChildSpan_getID()
{
this.getID = function removeChildSpan_getID() {
return "Remove inaccessible span containing accessible nodes" + prettyName(aID);
}
}
@ -63,12 +58,10 @@
/**
* Insert inaccessible child node containing accessibles.
*/
function insertChildSpan(aID, aInsertAllTogether)
{
function insertChildSpan(aID, aInsertAllTogether) {
this.__proto__ = new textInsertInvoker(aID, 0, 5, "33322");
this.invoke = function insertChildSpan_invoke()
{
this.invoke = function insertChildSpan_invoke() {
// <span><span>333</span><span>22</span></span>
if (aInsertAllTogether) {
var topSpan = document.createElement("span");
@ -95,8 +88,7 @@
}
}
this.getID = function insertChildSpan_getID()
{
this.getID = function insertChildSpan_getID() {
return "Insert inaccessible span containing accessibles" +
prettyName(aID);
}
@ -105,12 +97,10 @@
/**
* Remove child embedded accessible.
*/
function removeChildDiv(aID)
{
function removeChildDiv(aID) {
this.__proto__ = new textRemoveInvoker(aID, 5, 6, kEmbedChar);
this.invoke = function removeChildDiv_invoke()
{
this.invoke = function removeChildDiv_invoke() {
var childDiv = this.DOMNode.childNodes[1];
// Ensure accessible is created to get text remove event when it's
@ -120,8 +110,7 @@
this.DOMNode.removeChild(childDiv);
}
this.getID = function removeChildDiv_getID()
{
this.getID = function removeChildDiv_getID() {
return "Remove accessible div from the middle of text accessible " +
prettyName(aID);
}
@ -130,18 +119,15 @@
/**
* Insert child embedded accessible.
*/
function insertChildDiv(aID)
{
function insertChildDiv(aID) {
this.__proto__ = new textInsertInvoker(aID, 5, 6, kEmbedChar);
this.invoke = function insertChildDiv_invoke()
{
this.invoke = function insertChildDiv_invoke() {
var childDiv = document.createElement("div");
this.DOMNode.insertBefore(childDiv, this.DOMNode.childNodes[1]);
}
this.getID = function insertChildDiv_getID()
{
this.getID = function insertChildDiv_getID() {
return "Insert accessible div into the middle of text accessible " +
prettyName(aID);
}
@ -151,12 +137,10 @@
* Remove children from text container from first to last child or vice
* versa.
*/
function removeChildren(aID, aLastToFirst, aStart, aEnd, aText)
{
function removeChildren(aID, aLastToFirst, aStart, aEnd, aText) {
this.__proto__ = new textRemoveInvoker(aID, aStart, aEnd, aText);
this.invoke = function removeChildren_invoke()
{
this.invoke = function removeChildren_invoke() {
if (aLastToFirst) {
while (this.DOMNode.firstChild)
this.DOMNode.removeChild(this.DOMNode.lastChild);
@ -166,8 +150,7 @@
}
}
this.getID = function removeChildren_getID()
{
this.getID = function removeChildren_getID() {
return "remove children of " + prettyName(aID) +
(aLastToFirst ? " from last to first" : " from first to last");
}
@ -176,23 +159,20 @@
/**
* Remove text from HTML input.
*/
function removeTextFromInput(aID, aStart, aEnd, aText)
{
function removeTextFromInput(aID, aStart, aEnd, aText) {
this.__proto__ = new textRemoveInvoker(aID, aStart, aEnd, aText);
this.eventSeq.push(new invokerChecker(EVENT_TEXT_VALUE_CHANGE,
this.DOMNode));
this.invoke = function removeTextFromInput_invoke()
{
this.invoke = function removeTextFromInput_invoke() {
this.DOMNode.focus();
this.DOMNode.setSelectionRange(aStart, aEnd);
synthesizeKey("VK_DELETE", {});
}
this.getID = function removeTextFromInput_getID()
{
this.getID = function removeTextFromInput_getID() {
return "Remove text from " + aStart + " to " + aEnd + " for " +
prettyName(aID);
}
@ -201,21 +181,18 @@
/**
* Add text into HTML input.
*/
function insertTextIntoInput(aID, aStart, aEnd, aText)
{
function insertTextIntoInput(aID, aStart, aEnd, aText) {
this.__proto__ = new textInsertInvoker(aID, aStart, aEnd, aText);
this.eventSeq.push(new invokerChecker(EVENT_TEXT_VALUE_CHANGE,
this.DOMNode));
this.invoke = function insertTextIntoInput_invoke()
{
this.invoke = function insertTextIntoInput_invoke() {
this.DOMNode.focus();
synthesizeKey("a", {});
}
this.getID = function insertTextIntoInput_getID()
{
this.getID = function insertTextIntoInput_getID() {
return "Insert text to " + aStart + " for " + prettyName(aID);
}
}
@ -223,12 +200,10 @@
/**
* Remove text data from text node of editable area.
*/
function removeTextFromEditable(aID, aStart, aEnd, aText, aTextNode)
{
function removeTextFromEditable(aID, aStart, aEnd, aText, aTextNode) {
this.__proto__ = new textRemoveInvoker(aID, aStart, aEnd, aText);
this.invoke = function removeTextFromEditable_invoke()
{
this.invoke = function removeTextFromEditable_invoke() {
this.DOMNode.focus();
var selection = window.getSelection();
@ -240,8 +215,7 @@
synthesizeKey("VK_DELETE", {});
}
this.getID = function removeTextFromEditable_getID()
{
this.getID = function removeTextFromEditable_getID() {
return "Remove text from " + aStart + " to " + aEnd + " for " +
prettyName(aID);
}
@ -254,8 +228,7 @@
gA11yEventDumpToConsole = true; // debugging
var gQueue = null;
function doTests()
{
function doTests() {
gQueue = new eventQueue();
// Text remove event on inaccessible child HTML span removal containing

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

@ -24,8 +24,7 @@
const kInsertion = true;
const kUnexpected = true;
function changeText(aContainerID, aValue, aEventList)
{
function changeText(aContainerID, aValue, aEventList) {
this.containerNode = getNode(aContainerID);
this.textNode = this.containerNode.firstChild;
this.textData = this.textNode.data;
@ -49,21 +48,18 @@
this.eventSeq.push(checker);
}
this.invoke = function changeText_invoke()
{
this.invoke = function changeText_invoke() {
this.textNode.data = aValue;
}
this.getID = function changeText_getID()
{
this.getID = function changeText_getID() {
return "change text '" + shortenString(this.textData) + "' -> '" +
shortenString(this.textNode.data) + "' for " +
prettyName(this.containerNode);
}
}
function expStr(x, doublings)
{
function expStr(x, doublings) {
for (var i = 0; i < doublings; ++i)
x = x + x;
return x;
@ -76,8 +72,7 @@
// gA11yEventDumpToConsole = true;
var gQueue = null;
function doTests()
{
function doTests() {
gQueue = new eventQueue();
// ////////////////////////////////////////////////////////////////////////

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

@ -29,16 +29,14 @@
Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm");
function spelledTextInvoker(aID)
{
function spelledTextInvoker(aID) {
this.DOMNode = getNode(aID);
this.eventSeq = [
new invokerChecker(EVENT_TEXT_ATTRIBUTE_CHANGED, this.DOMNode)
];
this.invoke = function spelledTextInvoker_invoke()
{
this.invoke = function spelledTextInvoker_invoke() {
var editor = this.DOMNode.QueryInterface(nsIDOMNSEditableElement).editor;
var spellChecker = new InlineSpellChecker(editor);
spellChecker.enabled = true;
@ -49,8 +47,7 @@
this.DOMNode.value = "valid text inalid tixt";
}
this.finalCheck = function spelledTextInvoker_finalCheck()
{
this.finalCheck = function spelledTextInvoker_finalCheck() {
var defAttrs = buildDefaultTextAttrs(this.DOMNode, kInputFontSize,
kNormalFontWeight,
kInputFontFamily);
@ -67,8 +64,7 @@
testTextAttrs(aID, 18, misspelledAttrs, defAttrs, 18, 22);
}
this.getID = function spelledTextInvoker_getID()
{
this.getID = function spelledTextInvoker_getID() {
return "text attribute change for misspelled text";
}
}
@ -80,8 +76,7 @@
// gA11yEventDumpToConsole = true;
var gQueue = null;
function doTests()
{
function doTests() {
// Synth focus before spellchecking turning on to make sure editor
// gets a time for initialization.

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

@ -24,16 +24,14 @@
// gA11yEventDumpID = "eventdump"; // debug stuff
// gA11yEventDumpToConsole = true;
function getOnclickSeq(aID)
{
function getOnclickSeq(aID) {
return [
new caretMoveChecker(0, aID),
new unexpectedInvokerChecker(EVENT_TEXT_SELECTION_CHANGED, aID)
];
}
function doTests()
{
function doTests() {
// test caret move events and caret offsets
gQueue = new eventQueue();

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

@ -26,8 +26,7 @@
var gQueue = null;
// Value change invoker
function changeARIAValue(aNodeOrID, aValuenow, aValuetext)
{
function changeARIAValue(aNodeOrID, aValuenow, aValuetext) {
this.DOMNode = getNode(aNodeOrID);
this.eventSeq = [ new invokerChecker(aValuetext ?
EVENT_TEXT_VALUE_CHANGE :
@ -62,100 +61,83 @@
}
}
function changeValue(aID, aValue)
{
function changeValue(aID, aValue) {
this.DOMNode = getNode(aID);
this.eventSeq = [new invokerChecker(EVENT_TEXT_VALUE_CHANGE,
this.DOMNode)
];
this.invoke = function changeValue_invoke()
{
this.invoke = function changeValue_invoke() {
this.DOMNode.value = aValue;
}
this.check = function changeValue_check()
{
this.check = function changeValue_check() {
var acc = getAccessible(this.DOMNode);
is(acc.value, aValue, "Wrong value for " + prettyName(aID));
}
this.getID = function changeValue_getID()
{
this.getID = function changeValue_getID() {
return prettyName(aID) + " value changed";
}
}
function changeProgressValue(aID, aValue)
{
function changeProgressValue(aID, aValue) {
this.DOMNode = getNode(aID);
this.eventSeq = [new invokerChecker(EVENT_VALUE_CHANGE, this.DOMNode)];
this.invoke = function changeProgressValue_invoke()
{
this.invoke = function changeProgressValue_invoke() {
this.DOMNode.value = aValue;
}
this.check = function changeProgressValue_check()
{
this.check = function changeProgressValue_check() {
var acc = getAccessible(this.DOMNode);
is(acc.value, aValue + "%", "Wrong value for " + prettyName(aID));
}
this.getID = function changeProgressValue_getID()
{
this.getID = function changeProgressValue_getID() {
return prettyName(aID) + " value changed";
}
}
function changeRangeValue(aID)
{
function changeRangeValue(aID) {
this.DOMNode = getNode(aID);
this.eventSeq = [new invokerChecker(EVENT_VALUE_CHANGE, this.DOMNode)];
this.invoke = function changeRangeValue_invoke()
{
this.invoke = function changeRangeValue_invoke() {
synthesizeMouse(getNode(aID), 5, 5, { });
}
this.finalCheck = function changeRangeValue_finalCheck()
{
this.finalCheck = function changeRangeValue_finalCheck() {
var acc = getAccessible(this.DOMNode);
is(acc.value, "0", "Wrong value for " + prettyName(aID));
}
this.getID = function changeRangeValue_getID()
{
this.getID = function changeRangeValue_getID() {
return prettyName(aID) + " range value changed";
}
}
function changeSelectValue(aID, aKey, aValue)
{
function changeSelectValue(aID, aKey, aValue) {
this.eventSeq =
[ new invokerChecker(EVENT_TEXT_VALUE_CHANGE, getAccessible(aID)) ];
this.invoke = function changeSelectValue_invoke()
{
this.invoke = function changeSelectValue_invoke() {
getNode(aID).focus();
synthesizeKey(aKey, {}, window);
}
this.finalCheck = function changeSelectValue_finalCheck()
{
this.finalCheck = function changeSelectValue_finalCheck() {
is(getAccessible(aID).value, aValue, "Wrong value for " + prettyName(aID));
}
this.getID = function changeSelectValue_getID()
{
this.getID = function changeSelectValue_getID() {
return `${prettyName(aID)} closed select value change on '${aKey}'' key press`;
}
}
// enableLogging("DOMEvents");
// gA11yEventDumpToConsole = true;
function doTests()
{
function doTests() {
// Test initial values
testValue("slider_vn", "5", 5, 0, 1000, 0);
testValue("slider_vnvt", "plain", 0, 0, 5, 0);

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

@ -19,21 +19,18 @@
src="../events.js"></script>
<script type="application/javascript">
function openWnd()
{
function openWnd() {
this.eventSeq = [ new invokerChecker(EVENT_FOCUS,
getDialogAccessible,
this) ];
this.invoke = function openWnd_invoke()
{
this.invoke = function openWnd_invoke() {
this.dialog = window.openDialog("about:mozilla",
"AboutMozilla",
"chrome,width=600,height=600");
}
this.finalCheck = function openWnd_finalCheck()
{
this.finalCheck = function openWnd_finalCheck() {
var app = getApplicationAccessible();
is(app.focusedChild, getDialogAccessible(this),
"Wrong focused child");
@ -41,13 +38,11 @@
this.dialog.close();
}
this.getID = function openWnd_getID()
{
this.getID = function openWnd_getID() {
return "focusedChild for application accessible";
}
function getDialogAccessible(aInvoker)
{
function getDialogAccessible(aInvoker) {
return getAccessible(aInvoker.dialog.document);
}
}
@ -55,8 +50,7 @@
gA11yEventDumpToConsole = true;
var gQueue = null;
function doTest()
{
function doTest() {
enableLogging("focus,doclifecycle");
gQueue = new eventQueue();

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

@ -22,19 +22,16 @@
// //////////////////////////////////////////////////////////////////////////
// Invokers
function takeFocusInvoker(aID)
{
function takeFocusInvoker(aID) {
this.accessible = getAccessible(aID);
this.eventSeq = [ new focusChecker(this.accessible) ];
this.invoke = function takeFocusInvoker_invoke()
{
this.invoke = function takeFocusInvoker_invoke() {
this.accessible.takeFocus();
}
this.getID = function takeFocusInvoker_getID()
{
this.getID = function takeFocusInvoker_getID() {
return "takeFocus for " + prettyName(aID);
}
}
@ -45,8 +42,7 @@
// gA11yEventDumpToConsole = true; // debug stuff
var gQueue = null;
function doTest()
{
function doTest() {
disableLogging(); // from test_focusedChild
gQueue = new eventQueue();
@ -65,8 +61,7 @@
gQueue.invoke(); // Will call SimpleTest.finish();
}
function waitForPlugin()
{
function waitForPlugin() {
window.setTimeout((isAccessible("plugin") ? doTest : waitForPlugin), 0);
}

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

@ -3,29 +3,23 @@ const nsIDOMKeyEvent = Components.interfaces.nsIDOMKeyEvent;
/**
* Create grid object based on HTML table.
*/
function grid(aTableIdentifier)
{
this.getRowCount = function getRowCount()
{
function grid(aTableIdentifier) {
this.getRowCount = function getRowCount() {
return this.table.rows.length - (this.table.tHead ? 1 : 0);
}
this.getColsCount = function getColsCount()
{
this.getColsCount = function getColsCount() {
return this.table.rows[0].cells.length;
}
this.getRowAtIndex = function getRowAtIndex(aIndex)
{
this.getRowAtIndex = function getRowAtIndex(aIndex) {
return this.table.rows[this.table.tHead ? aIndex + 1 : aIndex];
}
this.getMaxIndex = function getMaxIndex()
{
this.getMaxIndex = function getMaxIndex() {
return this.getRowCount() * this.getColsCount() - 1;
}
this.getCellAtIndex = function getCellAtIndex(aIndex)
{
this.getCellAtIndex = function getCellAtIndex(aIndex) {
var colsCount = this.getColsCount();
var rowIdx = Math.floor(aIndex / colsCount);
@ -35,8 +29,7 @@ function grid(aTableIdentifier)
return row.cells[colIdx];
}
this.getIndexByCell = function getIndexByCell(aCell)
{
this.getIndexByCell = function getIndexByCell(aCell) {
var colIdx = aCell.cellIndex;
var rowIdx = aCell.parentNode.rowIndex;
@ -47,8 +40,7 @@ function grid(aTableIdentifier)
return rowIdx * colsCount + colIdx;
}
this.getCurrentCell = function getCurrentCell()
{
this.getCurrentCell = function getCurrentCell() {
var rowCount = this.table.rows.length;
var colsCount = this.getColsCount();
for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
@ -61,22 +53,19 @@ function grid(aTableIdentifier)
return null;
}
this.initGrid = function initGrid()
{
this.initGrid = function initGrid() {
this.table.addEventListener("keypress", this);
this.table.addEventListener("click", this);
}
this.handleEvent = function handleEvent(aEvent)
{
this.handleEvent = function handleEvent(aEvent) {
if (aEvent instanceof nsIDOMKeyEvent)
this.handleKeyEvent(aEvent);
else
this.handleClickEvent(aEvent);
}
this.handleKeyEvent = function handleKeyEvent(aEvent)
{
this.handleKeyEvent = function handleKeyEvent(aEvent) {
if (aEvent.target.localName != "td")
return;
@ -128,8 +117,7 @@ function grid(aTableIdentifier)
}
}
this.handleClickEvent = function handleClickEvent(aEvent)
{
this.handleClickEvent = function handleClickEvent(aEvent) {
if (aEvent.target.localName != "td")
return;

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

@ -13,8 +13,7 @@
src="../layout.js"></script>
<script type="application/javascript">
function doTest()
{
function doTest() {
// Hit testing. See bug #726097
getNode("hittest").scrollIntoView(true);

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

@ -13,8 +13,7 @@
src="../layout.js"></script>
<script type="application/javascript">
function redrawCheckbox(context, element, x, y)
{
function redrawCheckbox(context, element, x, y) {
context.save();
context.font = "10px sans-serif";
context.textAlign = "left";
@ -39,8 +38,7 @@
context.restore();
}
function doTest()
{
function doTest() {
var offsetX = 20, offsetY = 40;
getNode("hitcanvas").scrollIntoView(true);

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

@ -17,13 +17,11 @@
src="../events.js"></script>
<script type="application/javascript">
function doPreTest()
{
function doPreTest() {
waitForImageMap("imgmap", doTest);
}
function doTest()
{
function doTest() {
// Not specific case, child and deepchild testing.
var list = getAccessible("list");
var listitem = getAccessible("listitem");

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

@ -14,8 +14,7 @@
src="../layout.js"></script>
<script type="application/javascript">
function doTest()
{
function doTest() {
var componentAcc = getAccessible("component1");
testChildAtPoint(componentAcc, 1, 1, componentAcc.firstChild,
componentAcc.firstChild);

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

@ -18,8 +18,7 @@
src="../browser.js"></script>
<script type="application/javascript">
function doTest()
{
function doTest() {
if (!MAC) {
var tabDocument = currentTabDocument();
var p1 = tabDocument.body.firstElementChild;

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

@ -16,8 +16,7 @@
src="../layout.js"></script>
<script type="application/javascript">
function doTest()
{
function doTest() {
var hyperText = getNode("paragraph");
var textNode = hyperText.firstChild;
var [x, y, width, height] = getBounds(textNode);

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

@ -5,8 +5,7 @@
* @param aSelectedAfter [in] specifies if hyperlink is selected/focused after
* the focus
*/
function focusLink(aID, aSelectedAfter)
{
function focusLink(aID, aSelectedAfter) {
this.node = getNode(aID);
this.accessible = getAccessible(this.node);
@ -19,8 +18,7 @@ function focusLink(aID, aSelectedAfter)
else
this.unexpectedEventSeq.push(checker);
this.invoke = function focusLink_invoke()
{
this.invoke = function focusLink_invoke() {
var expectedStates = (aSelectedAfter ? STATE_FOCUSABLE : 0);
var unexpectedStates = (!aSelectedAfter ? STATE_FOCUSABLE : 0) | STATE_FOCUSED;
testStates(aID, expectedStates, 0, unexpectedStates, 0);
@ -28,15 +26,13 @@ function focusLink(aID, aSelectedAfter)
this.node.focus();
}
this.finalCheck = function focusLink_finalCheck()
{
this.finalCheck = function focusLink_finalCheck() {
var expectedStates = (aSelectedAfter ? STATE_FOCUSABLE | STATE_FOCUSED : 0);
var unexpectedStates = (!aSelectedAfter ? STATE_FOCUSABLE | STATE_FOCUSED : 0);
testStates(aID, expectedStates, 0, unexpectedStates, 0);
}
this.getID = function focusLink_getID()
{
this.getID = function focusLink_getID() {
return "focus hyperlink " + prettyName(aID);
}
}

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

@ -26,8 +26,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
<script type="application/javascript">
function testThis(aID, aAcc, aRole, aAnchors, aName, aValid, aStartIndex,
aEndIndex)
{
aEndIndex) {
testRole(aAcc, aRole);
is(aAcc.anchorCount, aAnchors, "Wrong number of anchors for ID "
+ aID + "!");
@ -41,8 +40,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
+ aID + "!");
}
function testAction(aId, aAcc, aActionName)
{
function testAction(aId, aAcc, aActionName) {
var actionCount = aActionName ? 1 : 0;
is(aAcc.actionCount, actionCount,
"Wrong actions number for ID " + aId);
@ -58,14 +56,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
}
// gA11yEventDumpToConsole = true; // debug stuff
function doPreTest()
{
function doPreTest() {
waitForImageMap("imgmap", doTest);
}
var gQueue = null;
function doTest()
{
function doTest() {
// ////////////////////////////////////////////////////////////////////////
// normal hyperlink
var normalHyperlinkAcc = getAccessible("NormalHyperlink",

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

@ -20,15 +20,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=428248
<script type="application/javascript">
var gParagraphAcc;
function testLinkIndexAtOffset(aID, aOffset, aIndex)
{
function testLinkIndexAtOffset(aID, aOffset, aIndex) {
var htAcc = getAccessible(aID, [nsIAccessibleHyperText]);
is(htAcc.getLinkIndexAtOffset(aOffset), aIndex,
"Wrong link index at offset " + aOffset + " for ID " + aID + "!");
}
function testThis(aID, aCharIndex, aExpectedLinkIndex, aName)
{
function testThis(aID, aCharIndex, aExpectedLinkIndex, aName) {
testLinkIndexAtOffset(gParagraphAcc, aCharIndex, aExpectedLinkIndex);
var linkAcc = gParagraphAcc.getLinkAt(aExpectedLinkIndex);
@ -42,13 +40,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=428248
}
// gA11yEventDumpToConsole = true;
function doPreTest()
{
function doPreTest() {
waitForImageMap("imgmap", doTest);
}
function doTest()
{
function doTest() {
// Test link count
gParagraphAcc = getAccessible("testParagraph", [nsIAccessibleHyperText]);
is(gParagraphAcc.linkCount, 7, "Wrong link count for paragraph!");

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

@ -15,16 +15,14 @@
<script type="application/javascript">
const kLinksCount = 128;
function addLinks(aContainerID)
{
function addLinks(aContainerID) {
this.containerNode = getNode(aContainerID);
this.eventSeq = [
new invokerChecker(EVENT_REORDER, this.containerNode)
];
this.invoke = function addLinks_invoke()
{
this.invoke = function addLinks_invoke() {
for (var jdx = 0; jdx < kLinksCount; jdx++) {
var a = document.createElement("a");
a.setAttribute("href", "mozilla.org");
@ -37,8 +35,7 @@
}
}
this.finalCheck = function addLinks_finalCheck()
{
this.finalCheck = function addLinks_finalCheck() {
// getLinkAt and getLinkIndex.
var htAcc = getAccessible(this.containerNode, [nsIAccessibleHyperText]);
for (var jdx = 0; jdx < kLinksCount; jdx++) {
@ -50,14 +47,12 @@
}
}
this.getID = function addLinks_getID()
{
this.getID = function addLinks_getID() {
return "Add links for '" + aContainerID + "'";
}
}
function updateText(aContainerID)
{
function updateText(aContainerID) {
this.containerNode = getNode(aContainerID);
this.container = getAccessible(this.containerNode, nsIAccessibleHyperText);
this.text = this.container.firstChild;
@ -68,22 +63,19 @@
new invokerChecker(EVENT_TEXT_INSERTED, this.containerNode)
];
this.invoke = function updateText_invoke()
{
this.invoke = function updateText_invoke() {
is(this.container.getLinkIndexAtOffset(this.textLen), 0,
"Wrong intial text offsets!");
this.text.DOMNode.appendData(" my");
}
this.finalCheck = function updateText_finalCheck()
{
this.finalCheck = function updateText_finalCheck() {
is(this.container.getLinkIndexAtOffset(this.textLen), -1,
"Text offsets weren't updated!");
}
this.getID = function updateText_getID()
{
this.getID = function updateText_getID() {
return "update text for '" + aContainerID + "'";
}
}
@ -91,8 +83,7 @@
/**
* Text offsets must be updated when hypertext child is removed.
*/
function removeChild(aContainerID, aChildID, aInitialText, aFinalText)
{
function removeChild(aContainerID, aChildID, aInitialText, aFinalText) {
this.containerNode = getNode(aContainerID);
this.container = getAccessible(this.containerNode, nsIAccessibleText);
this.childNode = getNode(aChildID);
@ -105,68 +96,58 @@
new invokerChecker(EVENT_REORDER, this.containerNode)
];
this.invoke = function removeChild_invoke()
{
this.invoke = function removeChild_invoke() {
this.containerNode.removeChild(this.childNode);
}
this.finalCheck = function removeChild_finalCheck()
{
this.finalCheck = function removeChild_finalCheck() {
is(this.container.getText(0, -1), aFinalText,
"Wrong text after child removal");
is(this.container.characterCount, aFinalText.length,
"Wrong text after child removal");
}
this.getID = function removeChild_getID()
{
this.getID = function removeChild_getID() {
return "check text after removing child from '" + aContainerID + "'";
}
}
function removeFirstChild(aContainer)
{
function removeFirstChild(aContainer) {
this.ht = getAccessible(aContainer, [ nsIAccessibleHyperText ]);
this.eventSeq = [
new invokerChecker(EVENT_REORDER, aContainer)
];
this.invoke = function removeFirstChild_invoke()
{
this.invoke = function removeFirstChild_invoke() {
is(this.ht.linkCount, 2, "Wrong embedded objects count before removal");
getNode(aContainer).removeChild(getNode(aContainer).firstElementChild);
}
this.finalCheck = function removeFirstChild_finalCheck()
{
this.finalCheck = function removeFirstChild_finalCheck() {
// check list index before link count
is(this.ht.getLinkIndex(this.ht.firstChild), 0, "Wrong child index");
is(this.ht.linkCount, 1, "Wrong embedded objects count after removal");
}
this.getID = function removeFirstChild_getID()
{
this.getID = function removeFirstChild_getID() {
return "Remove first child and check embedded object indeces";
}
}
function removeLastChild(aContainer)
{
function removeLastChild(aContainer) {
this.ht = getAccessible(aContainer, [ nsIAccessibleHyperText ]);
this.eventSeq = [
new invokerChecker(EVENT_REORDER, aContainer)
];
this.invoke = function removeLastChild_invoke()
{
this.invoke = function removeLastChild_invoke() {
is(this.ht.linkCount, 1, "Wrong embedded objects count before removal");
getNode(aContainer).removeChild(getNode(aContainer).lastElementChild);
}
this.finalCheck = function removeLastChild_finalCheck()
{
this.finalCheck = function removeLastChild_finalCheck() {
is(this.ht.linkCount, 0, "Wrong embedded objects count after removal");
var link = null;
@ -176,8 +157,7 @@
ok(!link, "No embedded object is expected");
}
this.getID = function removeLastChild_getID()
{
this.getID = function removeLastChild_getID() {
return "Remove last child and try its embedded object";
}
}
@ -185,8 +165,7 @@
// gA11yEventDumpToConsole = true; // debug stuff
var gQueue = null;
function doTest()
{
function doTest() {
gQueue = new eventQueue();
gQueue.push(new addLinks("p1"));
gQueue.push(new updateText("p2"));

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

@ -325,7 +325,8 @@
["dom.mozBrowserFramesEnabled", true],
["browser.pagethumbnails.capturing_disabled", true]
]
}, doTest) },
}, doTest)
},
getRootDirectory(window.location.href) + "doc_content_integration.html");
});
</script>

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

@ -25,15 +25,13 @@
var gBrowserWnd = null;
var gQueue = null;
function doTest()
{
function doTest() {
var doc = currentTabDocument();
var docAcc = getAccessible(doc, [nsIAccessibleDocument]);
gQueue = new eventQueue();
gQueue.onFinish = function onFinish()
{
gQueue.onFinish = function onFinish() {
closeBrowserWindow();
}

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

@ -71,8 +71,7 @@
}
function doTest()
{
function doTest() {
var doc = currentTabDocument();
var docAcc = getAccessible(doc, [nsIAccessibleDocument]);
vc = docAcc.virtualCursor;

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

@ -8,8 +8,7 @@
* @param aChildID [in] expected child accessible
* @param aGrandChildID [in] expected child accessible
*/
function testChildAtPoint(aID, aX, aY, aChildID, aGrandChildID)
{
function testChildAtPoint(aID, aX, aY, aChildID, aGrandChildID) {
var child = getChildAtPoint(aID, aX, aY, false);
var expectedChild = getAccessible(aChildID);
@ -29,8 +28,7 @@ function testChildAtPoint(aID, aX, aY, aChildID, aGrandChildID)
* Test if getChildAtPoint returns the given child and grand child accessibles
* at coordinates of child accessible (direct and deep hit test).
*/
function hitTest(aContainerID, aChildID, aGrandChildID)
{
function hitTest(aContainerID, aChildID, aGrandChildID) {
var container = getAccessible(aContainerID);
var child = getAccessible(aChildID);
var grandChild = getAccessible(aGrandChildID);
@ -49,8 +47,7 @@ function hitTest(aContainerID, aChildID, aGrandChildID)
/**
* Test if getOffsetAtPoint returns the given text offset at given coordinates.
*/
function testOffsetAtPoint(aHyperTextID, aX, aY, aCoordType, aExpectedOffset)
{
function testOffsetAtPoint(aHyperTextID, aX, aY, aCoordType, aExpectedOffset) {
var hyperText = getAccessible(aHyperTextID, [nsIAccessibleText]);
var offset = hyperText.getOffsetAtPoint(aX, aY, aCoordType);
is(offset, aExpectedOffset,
@ -61,8 +58,7 @@ function testOffsetAtPoint(aHyperTextID, aX, aY, aCoordType, aExpectedOffset)
/**
* Zoom the given document.
*/
function zoomDocument(aDocument, aZoom)
{
function zoomDocument(aDocument, aZoom) {
var docShell = aDocument.defaultView.
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIWebNavigation).
@ -82,8 +78,7 @@ function zoomDocument(aDocument, aZoom)
* be returned
* @return the child accessible at the given point
*/
function getChildAtPoint(aIdentifier, aX, aY, aFindDeepestChild)
{
function getChildAtPoint(aIdentifier, aX, aY, aFindDeepestChild) {
var acc = getAccessible(aIdentifier);
if (!acc)
return;
@ -105,8 +100,7 @@ function getChildAtPoint(aIdentifier, aX, aY, aFindDeepestChild)
/**
* Test the accessible position.
*/
function testPos(aID, aPoint)
{
function testPos(aID, aPoint) {
var [expectedX, expectedY] =
(aPoint != undefined) ? aPoint : getBoundsForDOMElm(aID);
@ -118,8 +112,7 @@ function testPos(aID, aPoint)
/**
* Test the accessible boundaries.
*/
function testBounds(aID, aRect)
{
function testBounds(aID, aRect) {
var [expectedX, expectedY, expectedWidth, expectedHeight] =
(aRect != undefined) ? aRect : getBoundsForDOMElm(aID);
@ -133,8 +126,7 @@ function testBounds(aID, aRect)
/**
* Test text position at the given offset.
*/
function testTextPos(aID, aOffset, aPoint, aCoordOrigin)
{
function testTextPos(aID, aOffset, aPoint, aCoordOrigin) {
var [expectedX, expectedY] = aPoint;
var xObj = {}, yObj = {};
@ -151,8 +143,7 @@ function testTextPos(aID, aOffset, aPoint, aCoordOrigin)
/**
* Test text bounds that is enclosed betwene the given offsets.
*/
function testTextBounds(aID, aStartOffset, aEndOffset, aRect, aCoordOrigin)
{
function testTextBounds(aID, aStartOffset, aEndOffset, aRect, aCoordOrigin) {
var [expectedX, expectedY, expectedWidth, expectedHeight] = aRect;
var xObj = {}, yObj = {}, widthObj = {}, heightObj = {};
@ -181,8 +172,7 @@ function testTextBounds(aID, aStartOffset, aEndOffset, aRect, aCoordOrigin)
/**
* Return the accessible coordinates relative to the screen in device pixels.
*/
function getPos(aID)
{
function getPos(aID) {
var accessible = getAccessible(aID);
var x = {}, y = {};
accessible.getBounds(x, y, {}, {});
@ -193,8 +183,7 @@ function getPos(aID)
* Return the accessible coordinates and size relative to the screen in device
* pixels.
*/
function getBounds(aID)
{
function getBounds(aID) {
var accessible = getAccessible(aID);
var x = {}, y = {}, width = {}, height = {};
accessible.getBounds(x, y, width, height);
@ -205,8 +194,7 @@ function getBounds(aID)
* Return DOM node coordinates relative the screen and its size in device
* pixels.
*/
function getBoundsForDOMElm(aID)
{
function getBoundsForDOMElm(aID) {
var x = 0, y = 0, width = 0, height = 0;
var elm = getNode(aID);
@ -226,8 +214,7 @@ function getBoundsForDOMElm(aID)
y = rect.top + areaY;
width = areaWidth;
height = areaHeight;
}
else {
} else {
var rect = elm.getBoundingClientRect();
x = rect.left;
y = rect.top;
@ -243,8 +230,7 @@ function getBoundsForDOMElm(aID)
height);
}
function CSSToDevicePixels(aWindow, aX, aY, aWidth, aHeight)
{
function CSSToDevicePixels(aWindow, aX, aY, aWidth, aHeight) {
var winUtil = aWindow.
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);

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

@ -1,8 +1,7 @@
/**
* Test accessible name for the given accessible identifier.
*/
function testName(aAccOrElmOrID, aName, aMsg, aTodo)
{
function testName(aAccOrElmOrID, aName, aMsg, aTodo) {
var msg = aMsg ? aMsg : "";
var acc = getAccessible(aAccOrElmOrID);
@ -22,8 +21,7 @@ function testName(aAccOrElmOrID, aName, aMsg, aTodo)
/**
* Test accessible description for the given accessible.
*/
function testDescr(aAccOrElmOrID, aDescr)
{
function testDescr(aAccOrElmOrID, aDescr) {
var acc = getAccessible(aAccOrElmOrID);
if (!acc)
return;

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

@ -12,8 +12,7 @@ var gDumpToConsole = false;
* Start name tests. Run through markup elements and test names for test
* element (see namerules.xml for details).
*/
function testNames()
{
function testNames() {
// enableLogging("tree,stack"); // debugging
var request = new XMLHttpRequest();
@ -34,8 +33,7 @@ function testNames()
*/
var gTestIterator =
{
iterateMarkups: function gTestIterator_iterateMarkups(aMarkupElms)
{
iterateMarkups: function gTestIterator_iterateMarkups(aMarkupElms) {
this.markupElms = aMarkupElms;
this.iterateNext();
@ -43,8 +41,7 @@ var gTestIterator =
iterateRules: function gTestIterator_iterateRules(aElm, aContainer,
aRuleSetElm, aRuleElms,
aTestID)
{
aTestID) {
this.ruleSetElm = aRuleSetElm;
this.ruleElms = aRuleElms;
this.elm = aElm;
@ -54,8 +51,7 @@ var gTestIterator =
this.iterateNext();
},
iterateNext: function gTestIterator_iterateNext()
{
iterateNext: function gTestIterator_iterateNext() {
if (this.markupIdx == -1) {
this.markupIdx++;
testNamesForMarkup(this.markupElms[this.markupIdx]);
@ -108,8 +104,7 @@ var gTestIterator =
* Process every 'markup' element and test names for it. Used by testNames
* function.
*/
function testNamesForMarkup(aMarkupElm)
{
function testNamesForMarkup(aMarkupElm) {
if (gDumpToConsole)
dump("\nProcessing markup '" + aMarkupElm.getAttribute("id") + "'\n");
@ -133,8 +128,7 @@ function testNamesForMarkup(aMarkupElm)
document.body.appendChild(div);
}
function testNamesForMarkupRules(aMarkupElm, aContainer)
{
function testNamesForMarkupRules(aMarkupElm, aContainer) {
var testID = aMarkupElm.getAttribute("id");
if (gDumpToConsole)
dump("\nProcessing markup rules '" + testID + "'\n");
@ -164,8 +158,7 @@ function testNamesForMarkupRules(aMarkupElm, aContainer)
* Test name for current rule and current 'markup' element. Used by
* testNamesForMarkup function.
*/
function testNameForRule(aElm, aRuleElm)
{
function testNameForRule(aElm, aRuleElm) {
if (aRuleElm.hasAttribute("attr")) {
if (gDumpToConsole) {
dump("\nProcessing rule { attr: " + aRuleElm.getAttribute("attr") + " }\n");
@ -191,8 +184,7 @@ function testNameForRule(aElm, aRuleElm)
}
}
function testNameForAttrRule(aElm, aRule)
{
function testNameForAttrRule(aElm, aRule) {
var name = "";
var attr = aRule.getAttribute("attr");
@ -245,16 +237,14 @@ function testNameForAttrRule(aElm, aRule)
}
}
function testNameForElmRule(aElm, aRule)
{
function testNameForElmRule(aElm, aRule) {
var labelElm;
var tagname = aRule.getAttribute("elm");
var attrname = aRule.getAttribute("elmattr");
if (attrname) {
var filter = {
acceptNode: function filter_acceptNode(aNode)
{
acceptNode: function filter_acceptNode(aNode) {
if (aNode.localName == this.mLocalName &&
aNode.getAttribute(this.mAttrName) == this.mAttrValue)
return NodeFilter.FILTER_ACCEPT;
@ -301,8 +291,7 @@ function testNameForElmRule(aElm, aRule)
parentNode.removeChild(labelElm);
}
function testNameForSubtreeRule(aElm, aRule)
{
function testNameForSubtreeRule(aElm, aRule) {
var msg = "From subtree test (" + gTestIterator.testID + ").";
testName(aElm, aElm.getAttribute("textequiv"), msg);
testAbsentAttrs(aElm, {"explicit-name": "true"});
@ -321,15 +310,13 @@ function testNameForSubtreeRule(aElm, aRule)
* Return array of 'rule' elements. Used in conjunction with
* getRuleElmsFromRulesetElm() function.
*/
function getRuleElmsByRulesetId(aRulesetId)
{
function getRuleElmsByRulesetId(aRulesetId) {
var expr = "//rules/ruledfn/ruleset[@id='" + aRulesetId + "']";
var rulesetElm = evaluateXPath(gRuleDoc, expr);
return getRuleElmsFromRulesetElm(rulesetElm[0]);
}
function getRuleElmsFromRulesetElm(aRulesetElm)
{
function getRuleElmsFromRulesetElm(aRulesetElm) {
var rulesetId = aRulesetElm.getAttribute("ref");
if (rulesetId)
return getRuleElmsByRulesetId(rulesetId);
@ -352,8 +339,7 @@ function getRuleElmsFromRulesetElm(aRulesetElm)
/**
* Helper method to evaluate xpath expression.
*/
function evaluateXPath(aNode, aExpr, aResolver)
{
function evaluateXPath(aNode, aExpr, aResolver) {
var xpe = new XPathEvaluator();
var resolver = aResolver;

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

@ -78,10 +78,8 @@
<script type="application/javascript">
function doTest()
{
function testRule(aRule, aNames, aTodo)
{
function doTest() {
function testRule(aRule, aNames, aTodo) {
testName(aRule + "-1", aNames[0], null, aTodo);
testName(aRule + "-7", aNames[1], null, aTodo);
testName(aRule + "-29", aNames[2], null, aTodo);

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

@ -15,8 +15,7 @@
<script type="application/javascript">
function doTest()
{
function doTest() {
// aria-label
// Simple label provided via ARIA

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

@ -15,8 +15,7 @@
src="../name.js"></script>
<script type="application/javascript">
function doTest()
{
function doTest() {
// aria-label
testName("aria_label", "anchor label");

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

@ -19,14 +19,12 @@
/**
* Alter list item numbering and change list style type.
*/
function bulletUpdate()
{
function bulletUpdate() {
this.eventSeq = [
new invokerChecker(EVENT_REORDER, getNode("list"))
];
this.invoke = function bulletUpdate_invoke()
{
this.invoke = function bulletUpdate_invoke() {
testName("li_end", "1. list end");
var li = document.createElement("li");
@ -35,8 +33,7 @@
getNode("list").insertBefore(li, getNode("li_end"));
}
this.finalCheck = function bulletUpdate_finalCheck()
{
this.finalCheck = function bulletUpdate_finalCheck() {
testName("li_start", "1. list start");
testName("li_end", "2. list end");
@ -49,15 +46,13 @@
testName("li_end", kDiscBulletText + "list end");
}
this.getID = function bulletUpdate_getID()
{
this.getID = function bulletUpdate_getID() {
return "Update bullet of list items";
}
}
var gQueue = null;
function doTest()
{
function doTest() {
gQueue = new eventQueue();
gQueue.push(new bulletUpdate());
gQueue.invoke(); // SimpleTest.finish();

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

@ -15,8 +15,7 @@
<script type="application/javascript">
function doTest()
{
function doTest() {
testName("svg1", "A name");
testDescr("svg1", "A description");
testName("svg2", "A tooltip");

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

@ -23,16 +23,14 @@ const NS_ERROR_INVALID_ARG = 0x80070057;
*/
var HeadersTraversalRule =
{
getMatchRoles: function(aRules)
{
getMatchRoles: function(aRules) {
aRules.value = [ROLE_HEADING];
return aRules.value.length;
},
preFilter: PREFILTER_INVISIBLE,
match: function(aAccessible)
{
match: function(aAccessible) {
return FILTER_MATCH;
},
@ -44,16 +42,14 @@ var HeadersTraversalRule =
*/
var ObjectTraversalRule =
{
getMatchRoles: function(aRules)
{
getMatchRoles: function(aRules) {
aRules.value = [];
return 0;
},
preFilter: PREFILTER_INVISIBLE | PREFILTER_ARIA_HIDDEN | PREFILTER_TRANSPARENT,
match: function(aAccessible)
{
match: function(aAccessible) {
var rv = FILTER_IGNORE;
var role = aAccessible.role;
if (hasState(aAccessible, STATE_FOCUSABLE) &&
@ -76,12 +72,10 @@ var ObjectTraversalRule =
* A checker for virtual cursor changed events.
*/
function VCChangedChecker(aDocAcc, aIdOrNameOrAcc, aTextOffsets, aPivotMoveMethod,
aIsFromUserInput)
{
aIsFromUserInput) {
this.__proto__ = new invokerChecker(EVENT_VIRTUALCURSOR_CHANGED, aDocAcc);
this.match = function VCChangedChecker_match(aEvent)
{
this.match = function VCChangedChecker_match(aEvent) {
var event = null;
try {
event = aEvent.QueryInterface(nsIAccessibleVirtualCursorChangeEvent);
@ -95,8 +89,7 @@ function VCChangedChecker(aDocAcc, aIdOrNameOrAcc, aTextOffsets, aPivotMoveMetho
return event.reason == expectedReason;
};
this.check = function VCChangedChecker_check(aEvent)
{
this.check = function VCChangedChecker_check(aEvent) {
SimpleTest.info("VCChangedChecker_check");
var event = null;
@ -142,8 +135,7 @@ function VCChangedChecker(aDocAcc, aIdOrNameOrAcc, aTextOffsets, aPivotMoveMetho
VCChangedChecker.prevPosAndOffset = {};
VCChangedChecker.storePreviousPosAndOffset =
function storePreviousPosAndOffset(aPivot)
{
function storePreviousPosAndOffset(aPivot) {
VCChangedChecker.prevPosAndOffset[aPivot] =
{position: aPivot.position,
startOffset: aPivot.startOffset,
@ -151,8 +143,7 @@ VCChangedChecker.storePreviousPosAndOffset =
};
VCChangedChecker.getPreviousPosAndOffset =
function getPreviousPosAndOffset(aPivot)
{
function getPreviousPosAndOffset(aPivot) {
return VCChangedChecker.prevPosAndOffset[aPivot];
};
@ -175,10 +166,8 @@ VCChangedChecker.methodReasonMap = {
* @param aTextOffsets [in] start and end offsets of text range to set in
* virtual cursor.
*/
function setVCRangeInvoker(aDocAcc, aTextAccessible, aTextOffsets)
{
this.invoke = function virtualCursorChangedInvoker_invoke()
{
function setVCRangeInvoker(aDocAcc, aTextAccessible, aTextOffsets) {
this.invoke = function virtualCursorChangedInvoker_invoke() {
VCChangedChecker.
storePreviousPosAndOffset(aDocAcc.virtualCursor);
SimpleTest.info(prettyName(aTextAccessible) + " " + aTextOffsets);
@ -187,8 +176,7 @@ function setVCRangeInvoker(aDocAcc, aTextAccessible, aTextOffsets)
aTextOffsets[1]);
};
this.getID = function setVCRangeInvoker_getID()
{
this.getID = function setVCRangeInvoker_getID() {
return "Set offset in " + prettyName(aTextAccessible) +
" to (" + aTextOffsets[0] + ", " + aTextOffsets[1] + ")";
};
@ -211,11 +199,9 @@ function setVCRangeInvoker(aDocAcc, aTextAccessible, aTextOffsets)
* expect it in the event.
*/
function setVCPosInvoker(aDocAcc, aPivotMoveMethod, aRule, aIdOrNameOrAcc,
aIsFromUserInput)
{
aIsFromUserInput) {
var expectMove = (aIdOrNameOrAcc != false);
this.invoke = function virtualCursorChangedInvoker_invoke()
{
this.invoke = function virtualCursorChangedInvoker_invoke() {
VCChangedChecker.
storePreviousPosAndOffset(aDocAcc.virtualCursor);
if (aPivotMoveMethod && aRule) {
@ -241,8 +227,7 @@ function setVCPosInvoker(aDocAcc, aPivotMoveMethod, aRule, aIdOrNameOrAcc,
}
};
this.getID = function setVCPosInvoker_getID()
{
this.getID = function setVCPosInvoker_getID() {
return "Do " + (expectMove ? "" : "no-op ") + aPivotMoveMethod;
};
@ -274,11 +259,9 @@ function setVCPosInvoker(aDocAcc, aPivotMoveMethod, aRule, aIdOrNameOrAcc,
* expect it in the event.
*/
function setVCTextInvoker(aDocAcc, aPivotMoveMethod, aBoundary, aTextOffsets,
aIdOrNameOrAcc, aIsFromUserInput)
{
aIdOrNameOrAcc, aIsFromUserInput) {
var expectMove = (aIdOrNameOrAcc != false);
this.invoke = function virtualCursorChangedInvoker_invoke()
{
this.invoke = function virtualCursorChangedInvoker_invoke() {
VCChangedChecker.storePreviousPosAndOffset(aDocAcc.virtualCursor);
SimpleTest.info(aDocAcc.virtualCursor.position);
var moved = aDocAcc.virtualCursor[aPivotMoveMethod](aBoundary,
@ -288,8 +271,7 @@ function setVCTextInvoker(aDocAcc, aPivotMoveMethod, aBoundary, aTextOffsets,
" to " + aIdOrNameOrAcc);
};
this.getID = function setVCPosInvoker_getID()
{
this.getID = function setVCPosInvoker_getID() {
return "Do " + (expectMove ? "" : "no-op ") + aPivotMoveMethod + " in " +
prettyName(aIdOrNameOrAcc) + ", " + boundaryToString(aBoundary) +
", [" + aTextOffsets + "]";
@ -323,11 +305,9 @@ function setVCTextInvoker(aDocAcc, aPivotMoveMethod, aBoundary, aTextOffsets,
* false if no move is expected.
*/
function moveVCCoordInvoker(aDocAcc, aX, aY, aIgnoreNoMatch,
aRule, aIdOrNameOrAcc)
{
aRule, aIdOrNameOrAcc) {
var expectMove = (aIdOrNameOrAcc != false);
this.invoke = function virtualCursorChangedInvoker_invoke()
{
this.invoke = function virtualCursorChangedInvoker_invoke() {
VCChangedChecker.
storePreviousPosAndOffset(aDocAcc.virtualCursor);
var moved = aDocAcc.virtualCursor.moveToPoint(aRule, aX, aY,
@ -336,8 +316,7 @@ function moveVCCoordInvoker(aDocAcc, aX, aY, aIgnoreNoMatch,
"moved pivot");
};
this.getID = function setVCPosInvoker_getID()
{
this.getID = function setVCPosInvoker_getID() {
return "Do " + (expectMove ? "" : "no-op ") + "moveToPoint " + aIdOrNameOrAcc;
};
@ -360,10 +339,8 @@ function moveVCCoordInvoker(aDocAcc, aX, aY, aIgnoreNoMatch,
* @param aModalRootAcc [in] accessible of the modal root, or null
* @param aExpectedResult [in] error result expected. 0 if expecting success
*/
function setModalRootInvoker(aDocAcc, aModalRootAcc, aExpectedResult)
{
this.invoke = function setModalRootInvoker_invoke()
{
function setModalRootInvoker(aDocAcc, aModalRootAcc, aExpectedResult) {
this.invoke = function setModalRootInvoker_invoke() {
var errorResult = 0;
try {
aDocAcc.virtualCursor.modalRoot = aModalRootAcc;
@ -377,8 +354,7 @@ function setModalRootInvoker(aDocAcc, aModalRootAcc, aExpectedResult)
"Did not get expected result when changing modalRoot");
};
this.getID = function setModalRootInvoker_getID()
{
this.getID = function setModalRootInvoker_getID() {
return "Set modalRoot to " + prettyName(aModalRootAcc);
};
@ -400,8 +376,7 @@ function setModalRootInvoker(aDocAcc, aModalRootAcc, aExpectedResult)
* @param aSequence [in] a sequence of accessible names or element ids to expect
* with the given rule in the given document
*/
function queueTraversalSequence(aQueue, aDocAcc, aRule, aModalRoot, aSequence)
{
function queueTraversalSequence(aQueue, aDocAcc, aRule, aModalRoot, aSequence) {
aDocAcc.virtualCursor.position = null;
// Add modal root (if any)
@ -446,8 +421,7 @@ function queueTraversalSequence(aQueue, aDocAcc, aRule, aModalRoot, aSequence)
/**
* A checker for removing an accessible while the virtual cursor is on it.
*/
function removeVCPositionChecker(aDocAcc, aHiddenParentAcc)
{
function removeVCPositionChecker(aDocAcc, aHiddenParentAcc) {
this.__proto__ = new invokerChecker(EVENT_REORDER, aHiddenParentAcc);
this.check = function removeVCPositionChecker_check(aEvent) {
@ -470,17 +444,14 @@ function removeVCPositionChecker(aDocAcc, aHiddenParentAcc)
* @param aPosNode [in] DOM node to hide after virtual cursor's position is
* set to it.
*/
function removeVCPositionInvoker(aDocAcc, aPosNode)
{
function removeVCPositionInvoker(aDocAcc, aPosNode) {
this.accessible = getAccessible(aPosNode);
this.invoke = function removeVCPositionInvoker_invoke()
{
this.invoke = function removeVCPositionInvoker_invoke() {
aDocAcc.virtualCursor.position = this.accessible;
aPosNode.remove();
};
this.getID = function removeVCPositionInvoker_getID()
{
this.getID = function removeVCPositionInvoker_getID() {
return "Bring virtual cursor to accessible, and remove its DOM node.";
};
@ -493,8 +464,7 @@ function removeVCPositionInvoker(aDocAcc, aPosNode)
* A checker for removing the pivot root and then calling moveFirst, and
* checking that an exception is thrown.
*/
function removeVCRootChecker(aPivot)
{
function removeVCRootChecker(aPivot) {
this.__proto__ = new invokerChecker(EVENT_REORDER, aPivot.root.parent);
this.check = function removeVCRootChecker_check(aEvent) {
@ -517,17 +487,14 @@ function removeVCRootChecker(aPivot)
* @param aRootNode [in] DOM node of which accessible will be the root of the
* pivot. Should have more than one child.
*/
function removeVCRootInvoker(aRootNode)
{
function removeVCRootInvoker(aRootNode) {
this.pivot = gAccService.createAccessiblePivot(getAccessible(aRootNode));
this.invoke = function removeVCRootInvoker_invoke()
{
this.invoke = function removeVCRootInvoker_invoke() {
this.pivot.position = this.pivot.root.firstChild;
aRootNode.remove();
};
this.getID = function removeVCRootInvoker_getID()
{
this.getID = function removeVCRootInvoker_getID() {
return "Remove root of pivot from tree.";
};
@ -539,8 +506,7 @@ function removeVCRootInvoker(aRootNode)
/**
* A debug utility for writing proper sequences for queueTraversalSequence.
*/
function dumpTraversalSequence(aPivot, aRule)
{
function dumpTraversalSequence(aPivot, aRule) {
var sequence = [];
if (aPivot.moveFirst(aRule)) {
do {

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

@ -24,8 +24,7 @@
var gBrowserWnd = null;
var gQueue = null;
function doTest()
{
function doTest() {
var rootAcc = getAccessible(browserDocument(), [nsIAccessibleDocument]);
ok(rootAcc.virtualCursor,
"root document does not have virtualCursor");
@ -40,8 +39,7 @@
gQueue = new eventQueue();
gQueue.onFinish = function onFinish()
{
gQueue.onFinish = function onFinish() {
closeBrowserWindow();
}

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

@ -25,15 +25,13 @@
var gBrowserWnd = null;
var gQueue = null;
function doTest()
{
function doTest() {
var doc = currentTabDocument();
var docAcc = getAccessible(doc, [nsIAccessibleDocument]);
gQueue = new eventQueue();
gQueue.onFinish = function onFinish()
{
gQueue.onFinish = function onFinish() {
closeBrowserWindow();
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше