diff --git a/accessible/.eslintrc.js b/accessible/.eslintrc.js index dfff532c7f7f..a0b80b2281d6 100644 --- a/accessible/.eslintrc.js +++ b/accessible/.eslintrc.js @@ -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", diff --git a/accessible/jsat/AccessFu.jsm b/accessible/jsat/AccessFu.jsm index 447a6506bba2..3d2e5eba8176 100644 --- a/accessible/jsat/AccessFu.jsm +++ b/accessible/jsat/AccessFu.jsm @@ -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") { diff --git a/accessible/jsat/OutputGenerator.jsm b/accessible/jsat/OutputGenerator.jsm index 682d221e0b76..37443f85532a 100644 --- a/accessible/jsat/OutputGenerator.jsm +++ b/accessible/jsat/OutputGenerator.jsm @@ -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"}); } diff --git a/accessible/jsat/Traversal.jsm b/accessible/jsat/Traversal.jsm index abc17a737a97..3adb3eb31024 100644 --- a/accessible/jsat/Traversal.jsm +++ b/accessible/jsat/Traversal.jsm @@ -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); + } }; diff --git a/accessible/jsat/Utils.jsm b/accessible/jsat/Utils.jsm index 3920fa690d20..02f1b2bf53fa 100644 --- a/accessible/jsat/Utils.jsm +++ b/accessible/jsat/Utils.jsm @@ -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) { diff --git a/accessible/tests/mochitest/actions.js b/accessible/tests/mochitest/actions.js index 6e9ad56abe55..77792ab85667 100644 --- a/accessible/tests/mochitest/actions.js +++ b/accessible/tests/mochitest/actions.js @@ -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); } diff --git a/accessible/tests/mochitest/actions/test_anchors.html b/accessible/tests/mochitest/actions/test_anchors.html index 4667cf0b29d6..559166eef1ed 100644 --- a/accessible/tests/mochitest/actions/test_anchors.html +++ b/accessible/tests/mochitest/actions/test_anchors.html @@ -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", diff --git a/accessible/tests/mochitest/actions/test_aria.html b/accessible/tests/mochitest/actions/test_aria.html index c4eae812dac2..c0f4d939ff7e 100644 --- a/accessible/tests/mochitest/actions/test_aria.html +++ b/accessible/tests/mochitest/actions/test_aria.html @@ -17,8 +17,7 @@ src="../actions.js"> diff --git a/accessible/tests/mochitest/jsat/test_traversal.html b/accessible/tests/mochitest/jsat/test_traversal.html index 9ea132b20252..a423308dec2a 100644 --- a/accessible/tests/mochitest/jsat/test_traversal.html +++ b/accessible/tests/mochitest/jsat/test_traversal.html @@ -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(); } diff --git a/accessible/tests/mochitest/jsat/test_traversal_helper.html b/accessible/tests/mochitest/jsat/test_traversal_helper.html index 1c1bd230dfa8..a035ec983ac7 100644 --- a/accessible/tests/mochitest/jsat/test_traversal_helper.html +++ b/accessible/tests/mochitest/jsat/test_traversal_helper.html @@ -71,8 +71,7 @@ } - function doTest() - { + function doTest() { var doc = currentTabDocument(); var docAcc = getAccessible(doc, [nsIAccessibleDocument]); vc = docAcc.virtualCursor; diff --git a/accessible/tests/mochitest/layout.js b/accessible/tests/mochitest/layout.js index 6d2cbef5bec1..a8274cd6aa9b 100644 --- a/accessible/tests/mochitest/layout.js +++ b/accessible/tests/mochitest/layout.js @@ -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); diff --git a/accessible/tests/mochitest/name.js b/accessible/tests/mochitest/name.js index 8d82909058a5..8167ab027e6b 100644 --- a/accessible/tests/mochitest/name.js +++ b/accessible/tests/mochitest/name.js @@ -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; diff --git a/accessible/tests/mochitest/name/markup.js b/accessible/tests/mochitest/name/markup.js index ba5e9512c934..0d797f848854 100644 --- a/accessible/tests/mochitest/name/markup.js +++ b/accessible/tests/mochitest/name/markup.js @@ -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; diff --git a/accessible/tests/mochitest/name/test_counterstyle.html b/accessible/tests/mochitest/name/test_counterstyle.html index 04c608f92386..3dec293bb793 100644 --- a/accessible/tests/mochitest/name/test_counterstyle.html +++ b/accessible/tests/mochitest/name/test_counterstyle.html @@ -78,10 +78,8 @@