Merge m-c to inbound, a=merge CLOSED TREE

MozReview-Commit-ID: AHCROxMdKPB
This commit is contained in:
Wes Kocher 2017-08-03 18:13:23 -07:00
Родитель 8e8d3afeee 2196b718d3
Коммит e371c2bbf3
593 изменённых файлов: 7826 добавлений и 9868 удалений

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

@ -138,8 +138,9 @@ devtools/shared/qrcode/tests/mochitest/test_decode.html
devtools/shared/tests/mochitest/*.html
devtools/shared/webconsole/test/test_*.html
# Ignore devtools pre-processed files
# Ignore devtools preferences files
devtools/client/preferences/**
devtools/shim/devtools-startup-prefs.js
# Ignore devtools third-party libs
devtools/shared/jsbeautify/*
@ -339,7 +340,6 @@ toolkit/components/workerloader/tests/moduleF-syntax-error.js
toolkit/modules/tests/xpcshell/test_task.js
# Not yet updated
toolkit/components/osfile/**
toolkit/components/url-classifier/**
# External code:
@ -351,6 +351,7 @@ toolkit/components/reader/JSDOMParser.js
# Uses preprocessing
toolkit/content/widgets/wizard.xml
toolkit/components/jsdownloads/src/DownloadIntegration.jsm
toolkit/components/osfile/osfile.jsm
toolkit/components/urlformatter/nsURLFormatter.js
toolkit/modules/AppConstants.jsm
toolkit/mozapps/downloads/nsHelperAppDlg.js

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

@ -8,17 +8,10 @@ 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",
"quotes": "off",
"object-shorthand": "off",
"space-before-function-paren": "off",
"space-infix-ops": "off",
"no-else-return": "off",
"no-multi-spaces": "off",
"no-unexpected-multiline": "off",
"no-unsafe-finally": "off",
"no-useless-call": "off",
"spaced-comment": "off",
}
};

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

@ -4,26 +4,26 @@
/* exported AccessFu */
'use strict';
"use strict";
const {utils: Cu, interfaces: Ci} = Components;
this.EXPORTED_SYMBOLS = ['AccessFu']; // jshint ignore:line
this.EXPORTED_SYMBOLS = ["AccessFu"]; // jshint ignore:line
Cu.import('resource://gre/modules/Services.jsm');
Cu.import('resource://gre/modules/accessibility/Utils.jsm');
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/accessibility/Utils.jsm");
if (Utils.MozBuildApp === 'mobile/android') {
Cu.import('resource://gre/modules/Messaging.jsm');
if (Utils.MozBuildApp === "mobile/android") {
Cu.import("resource://gre/modules/Messaging.jsm");
}
const ACCESSFU_DISABLE = 0; // jshint ignore:line
const ACCESSFU_ENABLE = 1;
const ACCESSFU_AUTO = 2;
const SCREENREADER_SETTING = 'accessibility.screenreader';
const QUICKNAV_MODES_PREF = 'accessibility.accessfu.quicknav_modes';
const QUICKNAV_INDEX_PREF = 'accessibility.accessfu.quicknav_index';
const SCREENREADER_SETTING = "accessibility.screenreader";
const QUICKNAV_MODES_PREF = "accessibility.accessfu.quicknav_modes";
const QUICKNAV_INDEX_PREF = "accessibility.accessfu.quicknav_index";
this.AccessFu = { // jshint ignore:line
/**
@ -34,13 +34,13 @@ this.AccessFu = { // jshint ignore:line
attach: function attach(aWindow) {
Utils.init(aWindow);
if (Utils.MozBuildApp === 'mobile/android') {
EventDispatcher.instance.dispatch('Accessibility:Ready');
EventDispatcher.instance.registerListener(this, 'Accessibility:Settings');
if (Utils.MozBuildApp === "mobile/android") {
EventDispatcher.instance.dispatch("Accessibility:Ready");
EventDispatcher.instance.registerListener(this, "Accessibility:Settings");
}
this._activatePref = new PrefCache(
'accessibility.accessfu.activate', this._enableOrDisable.bind(this));
"accessibility.accessfu.activate", this._enableOrDisable.bind(this));
this._enableOrDisable();
},
@ -53,8 +53,8 @@ this.AccessFu = { // jshint ignore:line
if (this._enabled) {
this._disable();
}
if (Utils.MozBuildApp === 'mobile/android') {
EventDispatcher.instance.unregisterListener(this, 'Accessibility:Settings');
if (Utils.MozBuildApp === "mobile/android") {
EventDispatcher.instance.unregisterListener(this, "Accessibility:Settings");
}
delete this._activatePref;
Utils.uninit();
@ -79,9 +79,9 @@ this.AccessFu = { // jshint ignore:line
}
this._enabled = true;
Cu.import('resource://gre/modules/accessibility/Utils.jsm');
Cu.import('resource://gre/modules/accessibility/PointerAdapter.jsm');
Cu.import('resource://gre/modules/accessibility/Presentation.jsm');
Cu.import("resource://gre/modules/accessibility/Utils.jsm");
Cu.import("resource://gre/modules/accessibility/PointerAdapter.jsm");
Cu.import("resource://gre/modules/accessibility/Presentation.jsm");
for (let mm of Utils.AllMessageManagers) {
this._addMessageListeners(mm);
@ -89,9 +89,9 @@ this.AccessFu = { // jshint ignore:line
}
// Add stylesheet
let stylesheetURL = 'chrome://global/content/accessibility/AccessFu.css';
let stylesheetURL = "chrome://global/content/accessibility/AccessFu.css";
let stylesheet = Utils.win.document.createProcessingInstruction(
'xml-stylesheet', 'href="' + stylesheetURL + '" type="text/css"');
"xml-stylesheet", `href="${stylesheetURL}" type="text/css"`);
Utils.win.document.insertBefore(stylesheet, Utils.win.document.firstChild);
this.stylesheet = Cu.getWeakReference(stylesheet);
@ -113,38 +113,38 @@ this.AccessFu = { // jshint ignore:line
// Check for output notification
this._notifyOutputPref =
new PrefCache('accessibility.accessfu.notify_output');
new PrefCache("accessibility.accessfu.notify_output");
this.Input.start();
Output.start();
PointerAdapter.start();
if (Utils.MozBuildApp === 'mobile/android') {
if (Utils.MozBuildApp === "mobile/android") {
EventDispatcher.instance.registerListener(this, [
'Accessibility:ActivateObject',
'Accessibility:Focus',
'Accessibility:LongPress',
'Accessibility:MoveByGranularity',
'Accessibility:NextObject',
'Accessibility:PreviousObject',
'Accessibility:ScrollBackward',
'Accessibility:ScrollForward',
"Accessibility:ActivateObject",
"Accessibility:Focus",
"Accessibility:LongPress",
"Accessibility:MoveByGranularity",
"Accessibility:NextObject",
"Accessibility:PreviousObject",
"Accessibility:ScrollBackward",
"Accessibility:ScrollForward",
]);
}
Services.obs.addObserver(this, 'remote-browser-shown');
Services.obs.addObserver(this, 'inprocess-browser-shown');
Utils.win.addEventListener('TabOpen', this);
Utils.win.addEventListener('TabClose', this);
Utils.win.addEventListener('TabSelect', this);
Services.obs.addObserver(this, "remote-browser-shown");
Services.obs.addObserver(this, "inprocess-browser-shown");
Utils.win.addEventListener("TabOpen", this);
Utils.win.addEventListener("TabClose", this);
Utils.win.addEventListener("TabSelect", this);
if (this.readyCallback) {
this.readyCallback();
delete this.readyCallback;
}
Logger.info('AccessFu:Enabled');
Logger.info("AccessFu:Enabled");
},
/**
@ -160,7 +160,7 @@ this.AccessFu = { // jshint ignore:line
Utils.win.document.removeChild(this.stylesheet.get());
for (let mm of Utils.AllMessageManagers) {
mm.sendAsyncMessage('AccessFu:Stop');
mm.sendAsyncMessage("AccessFu:Stop");
this._removeMessageListeners(mm);
}
@ -168,23 +168,23 @@ this.AccessFu = { // jshint ignore:line
Output.stop();
PointerAdapter.stop();
Utils.win.removeEventListener('TabOpen', this);
Utils.win.removeEventListener('TabClose', this);
Utils.win.removeEventListener('TabSelect', this);
Utils.win.removeEventListener("TabOpen", this);
Utils.win.removeEventListener("TabClose", this);
Utils.win.removeEventListener("TabSelect", this);
Services.obs.removeObserver(this, 'remote-browser-shown');
Services.obs.removeObserver(this, 'inprocess-browser-shown');
Services.obs.removeObserver(this, "remote-browser-shown");
Services.obs.removeObserver(this, "inprocess-browser-shown");
if (Utils.MozBuildApp === 'mobile/android') {
if (Utils.MozBuildApp === "mobile/android") {
EventDispatcher.instance.unregisterListener(this, [
'Accessibility:ActivateObject',
'Accessibility:Focus',
'Accessibility:LongPress',
'Accessibility:MoveByGranularity',
'Accessibility:NextObject',
'Accessibility:PreviousObject',
'Accessibility:ScrollBackward',
'Accessibility:ScrollForward',
"Accessibility:ActivateObject",
"Accessibility:Focus",
"Accessibility:LongPress",
"Accessibility:MoveByGranularity",
"Accessibility:NextObject",
"Accessibility:PreviousObject",
"Accessibility:ScrollBackward",
"Accessibility:ScrollForward",
]);
}
@ -196,7 +196,7 @@ this.AccessFu = { // jshint ignore:line
delete this.doneCallback;
}
Logger.info('AccessFu:Disabled');
Logger.info("AccessFu:Disabled");
},
_enableOrDisable: function _enableOrDisable() {
@ -212,30 +212,30 @@ this.AccessFu = { // jshint ignore:line
this._disable();
}
} catch (x) {
dump('Error ' + x.message + ' ' + x.fileName + ':' + x.lineNumber);
dump("Error " + x.message + " " + x.fileName + ":" + x.lineNumber);
}
},
receiveMessage: function receiveMessage(aMessage) {
Logger.debug(() => {
return ['Recieved', aMessage.name, JSON.stringify(aMessage.json)];
return ["Recieved", aMessage.name, JSON.stringify(aMessage.json)];
});
switch (aMessage.name) {
case 'AccessFu:Ready':
case "AccessFu:Ready":
let mm = Utils.getMessageManager(aMessage.target);
if (this._enabled) {
mm.sendAsyncMessage('AccessFu:Start',
{method: 'start', buildApp: Utils.MozBuildApp});
mm.sendAsyncMessage("AccessFu:Start",
{method: "start", buildApp: Utils.MozBuildApp});
}
break;
case 'AccessFu:Present':
case "AccessFu:Present":
this._output(aMessage.json, aMessage.target);
break;
case 'AccessFu:Input':
case "AccessFu:Input":
this.Input.setEditState(aMessage.json);
break;
case 'AccessFu:DoScroll':
case "AccessFu:DoScroll":
this.Input.doScroll(aMessage.json);
break;
}
@ -259,7 +259,7 @@ this.AccessFu = { // jshint ignore:line
}
if (this._notifyOutputPref.value) {
Services.obs.notifyObservers(null, 'accessibility-output',
Services.obs.notifyObservers(null, "accessibility-output",
JSON.stringify(aPresentationData));
}
},
@ -267,28 +267,28 @@ this.AccessFu = { // jshint ignore:line
_loadFrameScript: function _loadFrameScript(aMessageManager) {
if (this._processedMessageManagers.indexOf(aMessageManager) < 0) {
aMessageManager.loadFrameScript(
'chrome://global/content/accessibility/content-script.js', true);
"chrome://global/content/accessibility/content-script.js", true);
this._processedMessageManagers.push(aMessageManager);
} else if (this._enabled) {
// If the content-script is already loaded and AccessFu is enabled,
// send an AccessFu:Start message.
aMessageManager.sendAsyncMessage('AccessFu:Start',
{method: 'start', buildApp: Utils.MozBuildApp});
aMessageManager.sendAsyncMessage("AccessFu:Start",
{method: "start", buildApp: Utils.MozBuildApp});
}
},
_addMessageListeners: function _addMessageListeners(aMessageManager) {
aMessageManager.addMessageListener('AccessFu:Present', this);
aMessageManager.addMessageListener('AccessFu:Input', this);
aMessageManager.addMessageListener('AccessFu:Ready', this);
aMessageManager.addMessageListener('AccessFu:DoScroll', this);
aMessageManager.addMessageListener("AccessFu:Present", this);
aMessageManager.addMessageListener("AccessFu:Input", this);
aMessageManager.addMessageListener("AccessFu:Ready", this);
aMessageManager.addMessageListener("AccessFu:DoScroll", this);
},
_removeMessageListeners: function _removeMessageListeners(aMessageManager) {
aMessageManager.removeMessageListener('AccessFu:Present', this);
aMessageManager.removeMessageListener('AccessFu:Input', this);
aMessageManager.removeMessageListener('AccessFu:Ready', this);
aMessageManager.removeMessageListener('AccessFu:DoScroll', this);
aMessageManager.removeMessageListener("AccessFu:Present", this);
aMessageManager.removeMessageListener("AccessFu:Input", this);
aMessageManager.removeMessageListener("AccessFu:Ready", this);
aMessageManager.removeMessageListener("AccessFu:DoScroll", this);
},
_handleMessageManager: function _handleMessageManager(aMessageManager) {
@ -298,40 +298,40 @@ this.AccessFu = { // jshint ignore:line
this._loadFrameScript(aMessageManager);
},
onEvent: function (event, data, callback) {
onEvent: function(event, data, callback) {
switch (event) {
case 'Accessibility:Settings':
case "Accessibility:Settings":
this._systemPref = data.enabled;
this._enableOrDisable();
break;
case 'Accessibility:NextObject':
case 'Accessibility:PreviousObject': {
case "Accessibility:NextObject":
case "Accessibility:PreviousObject": {
let rule = data ?
data.rule.substr(0, 1).toUpperCase() + data.rule.substr(1).toLowerCase() :
'Simple';
let method = event.replace(/Accessibility:(\w+)Object/, 'move$1');
this.Input.moveCursor(method, rule, 'gesture');
"Simple";
let method = event.replace(/Accessibility:(\w+)Object/, "move$1");
this.Input.moveCursor(method, rule, "gesture");
break;
}
case 'Accessibility:ActivateObject':
case "Accessibility:ActivateObject":
this.Input.activateCurrent(data);
break;
case 'Accessibility:LongPress':
case "Accessibility:LongPress":
this.Input.sendContextMenuMessage();
break;
case 'Accessibility:ScrollForward':
this.Input.androidScroll('forward');
case "Accessibility:ScrollForward":
this.Input.androidScroll("forward");
break;
case 'Accessibility:ScrollBackward':
this.Input.androidScroll('backward');
case "Accessibility:ScrollBackward":
this.Input.androidScroll("backward");
break;
case 'Accessibility:Focus':
case "Accessibility:Focus":
this._focused = data.gainFocus;
if (this._focused) {
this.autoMove({ forcePresent: true, noOpIfOnScreen: true });
}
break;
case 'Accessibility:MoveByGranularity':
case "Accessibility:MoveByGranularity":
this.Input.moveByGranularity(data);
break;
}
@ -339,8 +339,8 @@ this.AccessFu = { // jshint ignore:line
observe: function observe(aSubject, aTopic, aData) {
switch (aTopic) {
case 'remote-browser-shown':
case 'inprocess-browser-shown':
case "remote-browser-shown":
case "inprocess-browser-shown":
{
// Ignore notifications that aren't from a Browser
let frameLoader = aSubject.QueryInterface(Ci.nsIFrameLoader);
@ -355,13 +355,13 @@ this.AccessFu = { // jshint ignore:line
_handleEvent: function _handleEvent(aEvent) {
switch (aEvent.type) {
case 'TabOpen':
case "TabOpen":
{
let mm = Utils.getMessageManager(aEvent.target);
this._handleMessageManager(mm);
break;
}
case 'TabClose':
case "TabClose":
{
let mm = Utils.getMessageManager(aEvent.target);
let mmIndex = this._processedMessageManagers.indexOf(mm);
@ -371,7 +371,7 @@ this.AccessFu = { // jshint ignore:line
}
break;
}
case 'TabSelect':
case "TabSelect":
{
if (this._focused) {
// We delay this for half a second so the awesomebar could close,
@ -381,7 +381,7 @@ this.AccessFu = { // jshint ignore:line
delay: 500,
forcePresent: true,
noOpIfOnScreen: true,
moveMethod: 'moveFirst' });
moveMethod: "moveFirst" });
}
break;
}
@ -399,7 +399,7 @@ this.AccessFu = { // jshint ignore:line
autoMove: function autoMove(aOptions) {
let mm = Utils.getMessageManager(Utils.CurrentBrowser);
mm.sendAsyncMessage('AccessFu:AutoMove', aOptions);
mm.sendAsyncMessage("AccessFu:AutoMove", aOptions);
},
announce: function announce(aAnnouncement) {
@ -450,21 +450,21 @@ var Output = {
brailleState: {
startOffset: 0,
endOffset: 0,
text: '',
text: "",
selectionStart: 0,
selectionEnd: 0,
init: function init(aOutput) {
if (aOutput && 'output' in aOutput) {
if (aOutput && "output" in aOutput) {
this.startOffset = aOutput.startOffset;
this.endOffset = aOutput.endOffset;
// We need to append a space at the end so that the routing key
// corresponding to the end of the output (i.e. the space) can be hit to
// move the caret there.
this.text = aOutput.output + ' ';
this.selectionStart = typeof aOutput.selectionStart === 'number' ?
this.text = aOutput.output + " ";
this.selectionStart = typeof aOutput.selectionStart === "number" ?
aOutput.selectionStart : this.selectionStart;
this.selectionEnd = typeof aOutput.selectionEnd === 'number' ?
this.selectionEnd = typeof aOutput.selectionEnd === "number" ?
aOutput.selectionEnd : this.selectionEnd;
return { text: this.text,
@ -481,7 +481,7 @@ var Output = {
let prefix = this.text.substring(0, this.startOffset).trim();
if (prefix) {
prefix += ' ';
prefix += " ";
newBraille.push(prefix);
}
@ -489,12 +489,12 @@ var Output = {
let suffix = this.text.substring(this.endOffset).trim();
if (suffix) {
suffix = ' ' + suffix;
suffix = " " + suffix;
newBraille.push(suffix);
}
this.startOffset = braille.startOffset = prefix.length;
this.text = braille.text = newBraille.join('') + ' ';
this.text = braille.text = newBraille.join("") + " ";
this.endOffset = braille.endOffset = braille.text.length - suffix.length;
braille.selectionStart = this.selectionStart;
braille.selectionEnd = this.selectionEnd;
@ -518,7 +518,7 @@ var Output = {
},
start: function start() {
Cu.import('resource://gre/modules/Geometry.jsm');
Cu.import("resource://gre/modules/Geometry.jsm");
},
stop: function stop() {
@ -532,27 +532,27 @@ var Output = {
},
B2G: function B2G(aDetails) {
Utils.dispatchChromeEvent('accessibility-output', aDetails);
Utils.dispatchChromeEvent("accessibility-output", aDetails);
},
Visual: function Visual(aDetail, aBrowser) {
switch (aDetail.eventType) {
case 'viewport-change':
case 'vc-change':
case "viewport-change":
case "vc-change":
{
let highlightBox = null;
if (!this.highlightBox) {
let doc = Utils.win.document;
// Add highlight box
highlightBox = Utils.win.document.
createElementNS('http://www.w3.org/1999/xhtml', 'div');
createElementNS("http://www.w3.org/1999/xhtml", "div");
let parent = doc.body || doc.documentElement;
parent.appendChild(highlightBox);
highlightBox.id = 'virtual-cursor-box';
highlightBox.id = "virtual-cursor-box";
// Add highlight inset for inner shadow
highlightBox.appendChild(
doc.createElementNS('http://www.w3.org/1999/xhtml', 'div'));
doc.createElementNS("http://www.w3.org/1999/xhtml", "div"));
this.highlightBox = Cu.getWeakReference(highlightBox);
} else {
@ -563,20 +563,20 @@ var Output = {
let r = AccessFu.adjustContentBounds(aDetail.bounds, aBrowser, true);
// First hide it to avoid flickering when changing the style.
highlightBox.classList.remove('show');
highlightBox.style.top = (r.top - padding) + 'px';
highlightBox.style.left = (r.left - padding) + 'px';
highlightBox.style.width = (r.width + padding*2) + 'px';
highlightBox.style.height = (r.height + padding*2) + 'px';
highlightBox.classList.add('show');
highlightBox.classList.remove("show");
highlightBox.style.top = (r.top - padding) + "px";
highlightBox.style.left = (r.left - padding) + "px";
highlightBox.style.width = (r.width + padding * 2) + "px";
highlightBox.style.height = (r.height + padding * 2) + "px";
highlightBox.classList.add("show");
break;
}
case 'tabstate-change':
case "tabstate-change":
{
let highlightBox = this.highlightBox ? this.highlightBox.get() : null;
if (highlightBox) {
highlightBox.classList.remove('show');
highlightBox.classList.remove("show");
}
break;
}
@ -588,7 +588,7 @@ var Output = {
const ANDROID_VIEW_TEXT_SELECTION_CHANGED = 0x2000;
for (let androidEvent of aDetails) {
androidEvent.type = 'Accessibility:Event';
androidEvent.type = "Accessibility:Event";
if (androidEvent.bounds) {
androidEvent.bounds = AccessFu.adjustContentBounds(
androidEvent.bounds, aBrowser);
@ -614,7 +614,7 @@ var Output = {
},
Braille: function Braille(aDetails) {
Logger.debug('Braille output: ' + aDetails.output);
Logger.debug("Braille output: " + aDetails.output);
}
};
@ -624,26 +624,26 @@ var Input = {
start: function start() {
// XXX: This is too disruptive on desktop for now.
// Might need to add special modifiers.
if (Utils.MozBuildApp != 'browser') {
Utils.win.document.addEventListener('keypress', this, true);
if (Utils.MozBuildApp != "browser") {
Utils.win.document.addEventListener("keypress", this, true);
}
Utils.win.addEventListener('mozAccessFuGesture', this, true);
Utils.win.addEventListener("mozAccessFuGesture", this, true);
},
stop: function stop() {
if (Utils.MozBuildApp != 'browser') {
Utils.win.document.removeEventListener('keypress', this, true);
if (Utils.MozBuildApp != "browser") {
Utils.win.document.removeEventListener("keypress", this, true);
}
Utils.win.removeEventListener('mozAccessFuGesture', this, true);
Utils.win.removeEventListener("mozAccessFuGesture", this, true);
},
handleEvent: function Input_handleEvent(aEvent) {
try {
switch (aEvent.type) {
case 'keypress':
case "keypress":
this._handleKeypress(aEvent);
break;
case 'mozAccessFuGesture':
case "mozAccessFuGesture":
this._handleGesture(aEvent.detail);
break;
}
@ -654,90 +654,90 @@ var Input = {
_handleGesture: function _handleGesture(aGesture) {
let gestureName = aGesture.type + aGesture.touches.length;
Logger.debug('Gesture', aGesture.type,
'(fingers: ' + aGesture.touches.length + ')');
Logger.debug("Gesture", aGesture.type,
"(fingers: " + aGesture.touches.length + ")");
switch (gestureName) {
case 'dwell1':
case 'explore1':
this.moveToPoint('Simple', aGesture.touches[0].x,
case "dwell1":
case "explore1":
this.moveToPoint("Simple", aGesture.touches[0].x,
aGesture.touches[0].y);
break;
case 'doubletap1':
case "doubletap1":
this.activateCurrent();
break;
case 'doubletaphold1':
Utils.dispatchChromeEvent('accessibility-control', 'quicknav-menu');
case "doubletaphold1":
Utils.dispatchChromeEvent("accessibility-control", "quicknav-menu");
break;
case 'swiperight1':
this.moveCursor('moveNext', 'Simple', 'gestures');
case "swiperight1":
this.moveCursor("moveNext", "Simple", "gestures");
break;
case 'swipeleft1':
this.moveCursor('movePrevious', 'Simple', 'gesture');
case "swipeleft1":
this.moveCursor("movePrevious", "Simple", "gesture");
break;
case 'swipeup1':
case "swipeup1":
this.moveCursor(
'movePrevious', this.quickNavMode.current, 'gesture', true);
"movePrevious", this.quickNavMode.current, "gesture", true);
break;
case 'swipedown1':
this.moveCursor('moveNext', this.quickNavMode.current, 'gesture', true);
case "swipedown1":
this.moveCursor("moveNext", this.quickNavMode.current, "gesture", true);
break;
case 'exploreend1':
case 'dwellend1':
case "exploreend1":
case "dwellend1":
this.activateCurrent(null, true);
break;
case 'swiperight2':
case "swiperight2":
if (aGesture.edge) {
Utils.dispatchChromeEvent('accessibility-control',
'edge-swipe-right');
Utils.dispatchChromeEvent("accessibility-control",
"edge-swipe-right");
break;
}
this.sendScrollMessage(-1, true);
break;
case 'swipedown2':
case "swipedown2":
if (aGesture.edge) {
Utils.dispatchChromeEvent('accessibility-control', 'edge-swipe-down');
Utils.dispatchChromeEvent("accessibility-control", "edge-swipe-down");
break;
}
this.sendScrollMessage(-1);
break;
case 'swipeleft2':
case "swipeleft2":
if (aGesture.edge) {
Utils.dispatchChromeEvent('accessibility-control', 'edge-swipe-left');
Utils.dispatchChromeEvent("accessibility-control", "edge-swipe-left");
break;
}
this.sendScrollMessage(1, true);
break;
case 'swipeup2':
case "swipeup2":
if (aGesture.edge) {
Utils.dispatchChromeEvent('accessibility-control', 'edge-swipe-up');
Utils.dispatchChromeEvent("accessibility-control", "edge-swipe-up");
break;
}
this.sendScrollMessage(1);
break;
case 'explore2':
case "explore2":
Utils.CurrentBrowser.contentWindow.scrollBy(
-aGesture.deltaX, -aGesture.deltaY);
break;
case 'swiperight3':
this.moveCursor('moveNext', this.quickNavMode.current, 'gesture');
case "swiperight3":
this.moveCursor("moveNext", this.quickNavMode.current, "gesture");
break;
case 'swipeleft3':
this.moveCursor('movePrevious', this.quickNavMode.current, 'gesture');
case "swipeleft3":
this.moveCursor("movePrevious", this.quickNavMode.current, "gesture");
break;
case 'swipedown3':
case "swipedown3":
this.quickNavMode.next();
AccessFu.announce('quicknav_' + this.quickNavMode.current);
AccessFu.announce("quicknav_" + this.quickNavMode.current);
break;
case 'swipeup3':
case "swipeup3":
this.quickNavMode.previous();
AccessFu.announce('quicknav_' + this.quickNavMode.current);
AccessFu.announce("quicknav_" + this.quickNavMode.current);
break;
case 'tripletap3':
Utils.dispatchChromeEvent('accessibility-control', 'toggle-shade');
case "tripletap3":
Utils.dispatchChromeEvent("accessibility-control", "toggle-shade");
break;
case 'tap2':
Utils.dispatchChromeEvent('accessibility-control', 'toggle-pause');
case "tap2":
Utils.dispatchChromeEvent("accessibility-control", "toggle-pause");
break;
}
},
@ -762,7 +762,7 @@ var Input = {
let key = String.fromCharCode(aEvent.charCode);
try {
let [methodName, rule] = this.keyMap[key];
this.moveCursor(methodName, rule, 'keyboard');
this.moveCursor(methodName, rule, "keyboard");
} catch (x) {
return;
}
@ -773,12 +773,12 @@ 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');
"moveLast" : "moveNext", "Simple", "keyboard");
break;
case aEvent.DOM_VK_LEFT:
if (this.editState.editing) {
@ -786,26 +786,26 @@ 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');
"moveFirst" : "movePrevious", "Simple", "keyboard");
break;
case aEvent.DOM_VK_UP:
if (this.editState.multiline) {
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') {
if (Utils.MozBuildApp == "mobile/android") {
// Return focus to native Android browser chrome.
Utils.win.WindowEventDispatcher.dispatch('ToggleChrome:Focus');
Utils.win.WindowEventDispatcher.dispatch("ToggleChrome:Focus");
}
break;
case aEvent.DOM_VK_RETURN:
@ -826,29 +826,29 @@ var Input = {
// XXX: Bug 1013408 - There is no alignment between the chrome window's
// viewport size and the content viewport size in Android. This makes
// sending mouse events beyond its bounds impossible.
if (Utils.MozBuildApp === 'mobile/android') {
if (Utils.MozBuildApp === "mobile/android") {
let mm = Utils.getMessageManager(Utils.CurrentBrowser);
mm.sendAsyncMessage('AccessFu:MoveToPoint',
{rule: aRule, x: aX, y: aY, origin: 'top'});
mm.sendAsyncMessage("AccessFu:MoveToPoint",
{rule: aRule, x: aX, y: aY, origin: "top"});
} else {
let win = Utils.win;
Utils.winUtils.sendMouseEvent('mousemove',
Utils.winUtils.sendMouseEvent("mousemove",
aX - win.mozInnerScreenX, aY - win.mozInnerScreenY, 0, 0, 0);
}
},
moveCursor: function moveCursor(aAction, aRule, aInputType, aAdjustRange) {
let mm = Utils.getMessageManager(Utils.CurrentBrowser);
mm.sendAsyncMessage('AccessFu:MoveCursor',
mm.sendAsyncMessage("AccessFu:MoveCursor",
{ action: aAction, rule: aRule,
origin: 'top', inputType: aInputType,
origin: "top", inputType: aInputType,
adjustRange: aAdjustRange });
},
androidScroll: function androidScroll(aDirection) {
let mm = Utils.getMessageManager(Utils.CurrentBrowser);
mm.sendAsyncMessage('AccessFu:AndroidScroll',
{ direction: aDirection, origin: 'top' });
mm.sendAsyncMessage("AccessFu:AndroidScroll",
{ direction: aDirection, origin: "top" });
},
moveByGranularity: function moveByGranularity(aDetails) {
@ -857,7 +857,7 @@ var Input = {
if (!this.editState.editing) {
if (aDetails.granularity & (GRANULARITY_PARAGRAPH | GRANULARITY_LINE)) {
this.moveCursor('move' + aDetails.direction, 'Simple', 'gesture');
this.moveCursor("move" + aDetails.direction, "Simple", "gesture");
return;
}
} else {
@ -866,27 +866,27 @@ var Input = {
}
let mm = Utils.getMessageManager(Utils.CurrentBrowser);
let type = this.editState.editing ? 'AccessFu:MoveCaret' :
'AccessFu:MoveByGranularity';
let type = this.editState.editing ? "AccessFu:MoveCaret" :
"AccessFu:MoveByGranularity";
mm.sendAsyncMessage(type, aDetails);
},
activateCurrent: function activateCurrent(aData, aActivateIfKey = false) {
let mm = Utils.getMessageManager(Utils.CurrentBrowser);
let offset = aData && typeof aData.keyIndex === 'number' ?
let offset = aData && typeof aData.keyIndex === "number" ?
aData.keyIndex - Output.brailleState.startOffset : -1;
mm.sendAsyncMessage('AccessFu:Activate',
mm.sendAsyncMessage("AccessFu:Activate",
{offset: offset, activateIfKey: aActivateIfKey});
},
sendContextMenuMessage: function sendContextMenuMessage() {
let mm = Utils.getMessageManager(Utils.CurrentBrowser);
mm.sendAsyncMessage('AccessFu:ContextMenu', {});
mm.sendAsyncMessage("AccessFu:ContextMenu", {});
},
setEditState: function setEditState(aEditState) {
Logger.debug(() => { return ['setEditState', JSON.stringify(aEditState)] });
Logger.debug(() => { return ["setEditState", JSON.stringify(aEditState)] });
this.editState = aEditState;
},
@ -898,8 +898,8 @@ var Input = {
sendScrollMessage: function sendScrollMessage(aPage, aHorizontal) {
let mm = Utils.getMessageManager(Utils.CurrentBrowser);
mm.sendAsyncMessage('AccessFu:Scroll',
{page: aPage, horizontal: aHorizontal, origin: 'top'});
mm.sendAsyncMessage("AccessFu:Scroll",
{page: aPage, horizontal: aHorizontal, origin: "top"});
},
doScroll: function doScroll(aDetails) {
@ -915,38 +915,38 @@ var Input = {
get keyMap() {
delete this.keyMap;
this.keyMap = {
a: ['moveNext', 'Anchor'],
A: ['movePrevious', 'Anchor'],
b: ['moveNext', 'Button'],
B: ['movePrevious', 'Button'],
c: ['moveNext', 'Combobox'],
C: ['movePrevious', 'Combobox'],
d: ['moveNext', 'Landmark'],
D: ['movePrevious', 'Landmark'],
e: ['moveNext', 'Entry'],
E: ['movePrevious', 'Entry'],
f: ['moveNext', 'FormElement'],
F: ['movePrevious', 'FormElement'],
g: ['moveNext', 'Graphic'],
G: ['movePrevious', 'Graphic'],
h: ['moveNext', 'Heading'],
H: ['movePrevious', 'Heading'],
i: ['moveNext', 'ListItem'],
I: ['movePrevious', 'ListItem'],
k: ['moveNext', 'Link'],
K: ['movePrevious', 'Link'],
l: ['moveNext', 'List'],
L: ['movePrevious', 'List'],
p: ['moveNext', 'PageTab'],
P: ['movePrevious', 'PageTab'],
r: ['moveNext', 'RadioButton'],
R: ['movePrevious', 'RadioButton'],
s: ['moveNext', 'Separator'],
S: ['movePrevious', 'Separator'],
t: ['moveNext', 'Table'],
T: ['movePrevious', 'Table'],
x: ['moveNext', 'Checkbox'],
X: ['movePrevious', 'Checkbox']
a: ["moveNext", "Anchor"],
A: ["movePrevious", "Anchor"],
b: ["moveNext", "Button"],
B: ["movePrevious", "Button"],
c: ["moveNext", "Combobox"],
C: ["movePrevious", "Combobox"],
d: ["moveNext", "Landmark"],
D: ["movePrevious", "Landmark"],
e: ["moveNext", "Entry"],
E: ["movePrevious", "Entry"],
f: ["moveNext", "FormElement"],
F: ["movePrevious", "FormElement"],
g: ["moveNext", "Graphic"],
G: ["movePrevious", "Graphic"],
h: ["moveNext", "Heading"],
H: ["movePrevious", "Heading"],
i: ["moveNext", "ListItem"],
I: ["movePrevious", "ListItem"],
k: ["moveNext", "Link"],
K: ["movePrevious", "Link"],
l: ["moveNext", "List"],
L: ["movePrevious", "List"],
p: ["moveNext", "PageTab"],
P: ["movePrevious", "PageTab"],
r: ["moveNext", "RadioButton"],
R: ["movePrevious", "RadioButton"],
s: ["moveNext", "Separator"],
S: ["movePrevious", "Separator"],
t: ["moveNext", "Table"],
T: ["movePrevious", "Table"],
x: ["moveNext", "Checkbox"],
X: ["movePrevious", "Checkbox"]
};
return this.keyMap;
@ -971,14 +971,14 @@ var Input = {
updateModes: function updateModes(aModes) {
if (aModes) {
this.modes = aModes.split(',');
this.modes = aModes.split(",");
} else {
this.modes = [];
}
},
updateCurrentMode: function updateCurrentMode(aModeIndex) {
Logger.debug('Quicknav mode:', this.modes[aModeIndex]);
Logger.debug("Quicknav mode:", this.modes[aModeIndex]);
this._currentIndex = aModeIndex;
}
}

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

@ -1,12 +1,12 @@
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
this.EXPORTED_SYMBOLS = ['Roles', 'Events', 'Relations',
'Filters', 'States', 'Prefilters'];
this.EXPORTED_SYMBOLS = ["Roles", "Events", "Relations",
"Filters", "States", "Prefilters"];
function ConstantsMap (aObject, aPrefix, aMap = {}, aModifier = null) {
function ConstantsMap(aObject, aPrefix, aMap = {}, aModifier = null) {
let offset = aPrefix.length;
for (var name in aObject) {
if (name.indexOf(aPrefix) === 0) {
@ -19,41 +19,41 @@ function ConstantsMap (aObject, aPrefix, aMap = {}, aModifier = null) {
}
XPCOMUtils.defineLazyGetter(
this, 'Roles',
this, "Roles",
function() {
return ConstantsMap(Ci.nsIAccessibleRole, 'ROLE_');
return ConstantsMap(Ci.nsIAccessibleRole, "ROLE_");
});
XPCOMUtils.defineLazyGetter(
this, 'Events',
this, "Events",
function() {
return ConstantsMap(Ci.nsIAccessibleEvent, 'EVENT_');
return ConstantsMap(Ci.nsIAccessibleEvent, "EVENT_");
});
XPCOMUtils.defineLazyGetter(
this, 'Relations',
this, "Relations",
function() {
return ConstantsMap(Ci.nsIAccessibleRelation, 'RELATION_');
return ConstantsMap(Ci.nsIAccessibleRelation, "RELATION_");
});
XPCOMUtils.defineLazyGetter(
this, 'Prefilters',
this, "Prefilters",
function() {
return ConstantsMap(Ci.nsIAccessibleTraversalRule, 'PREFILTER_');
return ConstantsMap(Ci.nsIAccessibleTraversalRule, "PREFILTER_");
});
XPCOMUtils.defineLazyGetter(
this, 'Filters',
this, "Filters",
function() {
return ConstantsMap(Ci.nsIAccessibleTraversalRule, 'FILTER_');
return ConstantsMap(Ci.nsIAccessibleTraversalRule, "FILTER_");
});
XPCOMUtils.defineLazyGetter(
this, 'States',
this, "States",
function() {
let statesMap = ConstantsMap(Ci.nsIAccessibleStates, 'STATE_', {},
let statesMap = ConstantsMap(Ci.nsIAccessibleStates, "STATE_", {},
(val) => { return { base: val, extended: 0 }; });
ConstantsMap(Ci.nsIAccessibleStates, 'EXT_STATE_', statesMap,
ConstantsMap(Ci.nsIAccessibleStates, "EXT_STATE_", statesMap,
(val) => { return { base: 0, extended: val }; });
return statesMap;
});

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

@ -6,22 +6,22 @@ var Ci = Components.interfaces;
var Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, 'Services',
'resource://gre/modules/Services.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Utils',
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Logger',
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'TraversalRules',
'resource://gre/modules/accessibility/Traversal.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'TraversalHelper',
'resource://gre/modules/accessibility/Traversal.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Presentation',
'resource://gre/modules/accessibility/Presentation.jsm');
XPCOMUtils.defineLazyModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Utils",
"resource://gre/modules/accessibility/Utils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Logger",
"resource://gre/modules/accessibility/Utils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Roles",
"resource://gre/modules/accessibility/Constants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TraversalRules",
"resource://gre/modules/accessibility/Traversal.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TraversalHelper",
"resource://gre/modules/accessibility/Traversal.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Presentation",
"resource://gre/modules/accessibility/Presentation.jsm");
this.EXPORTED_SYMBOLS = ['ContentControl'];
this.EXPORTED_SYMBOLS = ["ContentControl"];
const MOVEMENT_GRANULARITY_CHARACTER = 1;
const MOVEMENT_GRANULARITY_WORD = 2;
@ -33,21 +33,21 @@ this.ContentControl = function ContentControl(aContentScope) {
};
this.ContentControl.prototype = {
messagesOfInterest: ['AccessFu:MoveCursor',
'AccessFu:ClearCursor',
'AccessFu:MoveToPoint',
'AccessFu:AutoMove',
'AccessFu:Activate',
'AccessFu:MoveCaret',
'AccessFu:MoveByGranularity',
'AccessFu:AndroidScroll'],
messagesOfInterest: ["AccessFu:MoveCursor",
"AccessFu:ClearCursor",
"AccessFu:MoveToPoint",
"AccessFu:AutoMove",
"AccessFu:Activate",
"AccessFu:MoveCaret",
"AccessFu:MoveByGranularity",
"AccessFu:AndroidScroll"],
start: function cc_start() {
let cs = this._contentScope.get();
for (let message of this.messagesOfInterest) {
cs.addMessageListener(message, this);
}
cs.addEventListener('mousemove', this);
cs.addEventListener("mousemove", this);
},
stop: function cc_stop() {
@ -55,7 +55,7 @@ this.ContentControl.prototype = {
for (let message of this.messagesOfInterest) {
cs.removeMessageListener(message, this);
}
cs.removeEventListener('mousemove', this);
cs.removeEventListener("mousemove", this);
},
get document() {
@ -72,7 +72,7 @@ this.ContentControl.prototype = {
receiveMessage: function cc_receiveMessage(aMessage) {
Logger.debug(() => {
return ['ContentControl.receiveMessage',
return ["ContentControl.receiveMessage",
aMessage.name,
JSON.stringify(aMessage.json)];
});
@ -81,15 +81,15 @@ this.ContentControl.prototype = {
this.cancelAutoMove();
try {
let func = this['handle' + aMessage.name.slice(9)]; // 'AccessFu:'.length
let func = this["handle" + aMessage.name.slice(9)]; // 'AccessFu:'.length
if (func) {
func.bind(this)(aMessage);
} else {
Logger.warning('ContentControl: Unhandled message:', aMessage.name);
Logger.warning("ContentControl: Unhandled message:", aMessage.name);
}
} catch (x) {
Logger.logException(
x, 'Error handling message: ' + JSON.stringify(aMessage.json));
x, "Error handling message: " + JSON.stringify(aMessage.json));
}
},
@ -97,20 +97,20 @@ this.ContentControl.prototype = {
let vc = this.vc;
let position = vc.position;
if (aMessage.json.origin != 'child' && this.sendToChild(vc, aMessage)) {
if (aMessage.json.origin != "child" && this.sendToChild(vc, aMessage)) {
// Forwarded succesfully to child cursor.
return;
}
// Counter-intuitive, but scrolling backward (ie. up), actually should
// increase range values.
if (this.adjustRange(position, aMessage.json.direction === 'backward')) {
if (this.adjustRange(position, aMessage.json.direction === "backward")) {
return;
}
this._contentScope.get().sendAsyncMessage('AccessFu:DoScroll',
this._contentScope.get().sendAsyncMessage("AccessFu:DoScroll",
{ bounds: Utils.getBounds(position, true),
page: aMessage.json.direction === 'forward' ? 1 : -1,
page: aMessage.json.direction === "forward" ? 1 : -1,
horizontal: false });
},
@ -120,30 +120,30 @@ this.ContentControl.prototype = {
let adjustRange = aMessage.json.adjustRange;
let vc = this.vc;
if (origin != 'child' && this.sendToChild(vc, aMessage)) {
if (origin != "child" && this.sendToChild(vc, aMessage)) {
// Forwarded succesfully to child cursor.
return;
}
if (adjustRange && this.adjustRange(vc.position, action === 'moveNext')) {
if (adjustRange && this.adjustRange(vc.position, action === "moveNext")) {
return;
}
let moved = TraversalHelper.move(vc, action, aMessage.json.rule);
if (moved) {
if (origin === 'child') {
if (origin === "child") {
// We just stepped out of a child, clear child cursor.
Utils.getMessageManager(aMessage.target).sendAsyncMessage(
'AccessFu:ClearCursor', {});
"AccessFu:ClearCursor", {});
} else {
// We potentially landed on a new child cursor. If so, we want to
// either be on the first or last item in the child doc.
let childAction = action;
if (action === 'moveNext') {
childAction = 'moveFirst';
} else if (action === 'movePrevious') {
childAction = 'moveLast';
if (action === "moveNext") {
childAction = "moveFirst";
} else if (action === "movePrevious") {
childAction = "moveLast";
}
// Attempt to forward move to a potential child cursor in our
@ -151,20 +151,20 @@ this.ContentControl.prototype = {
this.sendToChild(vc, aMessage, { action: childAction }, true);
}
} else if (!this._childMessageSenders.has(aMessage.target) &&
origin !== 'top') {
origin !== "top") {
// We failed to move, and the message is not from a parent, so forward
// to it.
this.sendToParent(aMessage);
} else {
this._contentScope.get().sendAsyncMessage('AccessFu:Present',
this._contentScope.get().sendAsyncMessage("AccessFu:Present",
Presentation.noMove(action));
}
},
handleEvent: function cc_handleEvent(aEvent) {
if (aEvent.type === 'mousemove') {
if (aEvent.type === "mousemove") {
this.handleMoveToPoint(
{ json: { x: aEvent.screenX, y: aEvent.screenY, rule: 'Simple' } });
{ json: { x: aEvent.screenX, y: aEvent.screenY, rule: "Simple" } });
}
if (!Utils.getMessageManager(aEvent.target)) {
aEvent.preventDefault();
@ -185,7 +185,7 @@ this.ContentControl.prototype = {
let forwarded = this.sendToChild(this.vc, aMessage);
this.vc.position = null;
if (!forwarded) {
this._contentScope.get().sendAsyncMessage('AccessFu:CursorCleared');
this._contentScope.get().sendAsyncMessage("AccessFu:CursorCleared");
}
this.document.activeElement.blur();
},
@ -197,7 +197,7 @@ this.ContentControl.prototype = {
handleActivate: function cc_handleActivate(aMessage) {
let activateAccessible = (aAccessible) => {
Logger.debug(() => {
return ['activateAccessible', Logger.accessibleToString(aAccessible)];
return ["activateAccessible", Logger.accessibleToString(aAccessible)];
});
try {
if (aMessage.json.activateIfKey &&
@ -234,8 +234,8 @@ this.ContentControl.prototype = {
let node = aAccessible.DOMNode || aAccessible.parent.DOMNode;
for (let eventType of ['mousedown', 'mouseup']) {
let evt = this.document.createEvent('MouseEvents');
for (let eventType of ["mousedown", "mouseup"]) {
let evt = this.document.createEvent("MouseEvents");
evt.initMouseEvent(eventType, true, true, this.window,
x, y, 0, 0, 0, false, false, false, false, 0, null);
node.dispatchEvent(evt);
@ -244,8 +244,8 @@ this.ContentControl.prototype = {
if (!Utils.isActivatableOnFingerUp(aAccessible)) {
// Keys will typically have a sound of their own.
this._contentScope.get().sendAsyncMessage('AccessFu:Present',
Presentation.actionInvoked(aAccessible, 'click'));
this._contentScope.get().sendAsyncMessage("AccessFu:Present",
Presentation.actionInvoked(aAccessible, "click"));
}
};
@ -303,13 +303,13 @@ this.ContentControl.prototype = {
return false;
}
if (elem.tagName === 'INPUT' && elem.type === 'range') {
elem[aStepUp ? 'stepDown' : 'stepUp']();
let evt = this.document.createEvent('UIEvent');
evt.initEvent('change', true, true);
if (elem.tagName === "INPUT" && elem.type === "range") {
elem[aStepUp ? "stepDown" : "stepUp"]();
let evt = this.document.createEvent("UIEvent");
evt.initEvent("change", true, true);
elem.dispatchEvent(evt);
} else {
let evt = this.document.createEvent('KeyboardEvent');
let evt = this.document.createEvent("KeyboardEvent");
let keycode = aStepUp ? evt.DOM_VK_DOWN : evt.DOM_VK_UP;
evt.initKeyEvent(
"keypress", false, true, null, false, false, false, false, keycode, 0);
@ -335,9 +335,9 @@ this.ContentControl.prototype = {
return;
}
if (direction === 'Previous') {
if (direction === "Previous") {
this.vc.movePreviousByText(granularity);
} else if (direction === 'Next') {
} else if (direction === "Next") {
this.vc.moveNextByText(granularity);
}
},
@ -347,7 +347,7 @@ this.ContentControl.prototype = {
if (aOldOffset !== aNewOffset) {
let msg = Presentation.textSelectionChanged(aText, aNewOffset, aNewOffset,
aOldOffset, aOldOffset, true);
this._contentScope.get().sendAsyncMessage('AccessFu:Present', msg);
this._contentScope.get().sendAsyncMessage("AccessFu:Present", msg);
}
},
@ -360,7 +360,7 @@ this.ContentControl.prototype = {
let text = accText.getText(0, accText.characterCount);
let start = {}, end = {};
if (direction === 'Previous' && !aMessage.json.atStart) {
if (direction === "Previous" && !aMessage.json.atStart) {
switch (granularity) {
case MOVEMENT_GRANULARITY_CHARACTER:
accText.caretOffset--;
@ -372,11 +372,11 @@ this.ContentControl.prototype = {
start.value : end.value;
break;
case MOVEMENT_GRANULARITY_PARAGRAPH:
let startOfParagraph = text.lastIndexOf('\n', accText.caretOffset - 1);
let startOfParagraph = text.lastIndexOf("\n", accText.caretOffset - 1);
accText.caretOffset = startOfParagraph !== -1 ? startOfParagraph : 0;
break;
}
} else if (direction === 'Next' && !aMessage.json.atEnd) {
} else if (direction === "Next" && !aMessage.json.atEnd) {
switch (granularity) {
case MOVEMENT_GRANULARITY_CHARACTER:
accText.caretOffset++;
@ -387,7 +387,7 @@ this.ContentControl.prototype = {
accText.caretOffset = end.value;
break;
case MOVEMENT_GRANULARITY_PARAGRAPH:
accText.caretOffset = text.indexOf('\n', accText.caretOffset + 1);
accText.caretOffset = text.indexOf("\n", accText.caretOffset + 1);
break;
}
}
@ -402,7 +402,7 @@ this.ContentControl.prototype = {
let mm = this._childMessageSenders.get(domNode, null);
if (!mm) {
mm = Utils.getMessageManager(domNode);
mm.addWeakMessageListener('AccessFu:MoveCursor', this);
mm.addWeakMessageListener("AccessFu:MoveCursor", this);
this._childMessageSenders.set(domNode, mm);
}
@ -426,7 +426,7 @@ this.ContentControl.prototype = {
// XXX: This is a silly way to make a deep copy
let newJSON = JSON.parse(JSON.stringify(aMessage.json));
newJSON.origin = 'parent';
newJSON.origin = "parent";
for (let attr in aReplacer) {
newJSON[attr] = aReplacer[attr];
}
@ -438,7 +438,7 @@ this.ContentControl.prototype = {
sendToParent: function cc_sendToParent(aMessage) {
// XXX: This is a silly way to make a deep copy
let newJSON = JSON.parse(JSON.stringify(aMessage.json));
newJSON.origin = 'child';
newJSON.origin = "child";
aMessage.target.sendAsyncMessage(aMessage.name, newJSON);
},
@ -465,7 +465,7 @@ this.ContentControl.prototype = {
let forcePresentFunc = () => {
if (aOptions.forcePresent) {
this._contentScope.get().sendAsyncMessage(
'AccessFu:Present', Presentation.pivotChanged(
"AccessFu:Present", Presentation.pivotChanged(
vc.position, null, Ci.nsIAccessiblePivot.REASON_NONE,
vc.startOffset, vc.endOffset, false));
}
@ -483,11 +483,11 @@ this.ContentControl.prototype = {
}
let moved = false;
let moveMethod = aOptions.moveMethod || 'moveNext'; // default is moveNext
let moveFirstOrLast = moveMethod in ['moveFirst', 'moveLast'];
let moveMethod = aOptions.moveMethod || "moveNext"; // default is moveNext
let moveFirstOrLast = moveMethod in ["moveFirst", "moveLast"];
if (!moveFirstOrLast || acc) {
// We either need next/previous or there is an anchor we need to use.
moved = vc[moveFirstOrLast ? 'moveNext' : moveMethod](rule, acc, true,
moved = vc[moveFirstOrLast ? "moveNext" : moveMethod](rule, acc, true,
false);
}
if (moveFirstOrLast && !moved) {
@ -496,7 +496,7 @@ this.ContentControl.prototype = {
}
let sentToChild = this.sendToChild(vc, {
name: 'AccessFu:AutoMove',
name: "AccessFu:AutoMove",
json: {
moveMethod: aOptions.moveMethod,
moveToFocused: aOptions.moveToFocused,

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

@ -2,30 +2,30 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
const Ci = Components.interfaces;
const Cu = Components.utils;
const TEXT_NODE = 3;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Services',
'resource://gre/modules/Services.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Utils',
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Logger',
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Presentation',
'resource://gre/modules/accessibility/Presentation.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Events',
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'States',
'resource://gre/modules/accessibility/Constants.jsm');
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Utils",
"resource://gre/modules/accessibility/Utils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Logger",
"resource://gre/modules/accessibility/Utils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Presentation",
"resource://gre/modules/accessibility/Presentation.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Roles",
"resource://gre/modules/accessibility/Constants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Events",
"resource://gre/modules/accessibility/Constants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "States",
"resource://gre/modules/accessibility/Constants.jsm");
this.EXPORTED_SYMBOLS = ['EventManager'];
this.EXPORTED_SYMBOLS = ["EventManager"];
this.EventManager = function EventManager(aContentScope, aContentControl) {
this.contentScope = aContentScope;
@ -47,7 +47,7 @@ this.EventManager.prototype = {
start: function start() {
try {
if (!this._started) {
Logger.debug('EventManager.start');
Logger.debug("EventManager.start");
this._started = true;
@ -56,15 +56,15 @@ this.EventManager.prototype = {
this.webProgress.addProgressListener(this,
(Ci.nsIWebProgress.NOTIFY_STATE_ALL |
Ci.nsIWebProgress.NOTIFY_LOCATION));
this.addEventListener('wheel', this, true);
this.addEventListener('scroll', this, true);
this.addEventListener('resize', this, true);
this.addEventListener("wheel", this, true);
this.addEventListener("scroll", this, true);
this.addEventListener("resize", this, true);
this._preDialogPosition = new WeakMap();
}
this.present(Presentation.tabStateChanged(null, 'newtab'));
this.present(Presentation.tabStateChanged(null, "newtab"));
} catch (x) {
Logger.logException(x, 'Failed to start EventManager');
Logger.logException(x, "Failed to start EventManager");
}
},
@ -74,14 +74,14 @@ this.EventManager.prototype = {
if (!this._started) {
return;
}
Logger.debug('EventManager.stop');
Logger.debug("EventManager.stop");
AccessibilityEventObserver.removeListener(this);
try {
this._preDialogPosition = new WeakMap();
this.webProgress.removeProgressListener(this);
this.removeEventListener('wheel', this, true);
this.removeEventListener('scroll', this, true);
this.removeEventListener('resize', this, true);
this.removeEventListener("wheel", this, true);
this.removeEventListener("scroll", this, true);
this.removeEventListener("resize", this, true);
} catch (x) {
// contentScope is dead.
} finally {
@ -91,22 +91,22 @@ this.EventManager.prototype = {
handleEvent: function handleEvent(aEvent) {
Logger.debug(() => {
return ['DOMEvent', aEvent.type];
return ["DOMEvent", aEvent.type];
});
try {
switch (aEvent.type) {
case 'wheel':
case "wheel":
{
let delta = aEvent.deltaX || aEvent.deltaY;
this.contentControl.autoMove(
null,
{ moveMethod: delta > 0 ? 'moveNext' : 'movePrevious',
{ moveMethod: delta > 0 ? "moveNext" : "movePrevious",
onScreenOnly: true, noOpIfOnScreen: true, delay: 500 });
break;
}
case 'scroll':
case 'resize':
case "scroll":
case "resize":
{
// the target could be an element, document or window
let window = null;
@ -121,24 +121,24 @@ this.EventManager.prototype = {
}
}
} catch (x) {
Logger.logException(x, 'Error handling DOM event');
Logger.logException(x, "Error handling DOM event");
}
},
handleAccEvent: function handleAccEvent(aEvent) {
Logger.debug(() => {
return ['A11yEvent', Logger.eventToString(aEvent),
return ["A11yEvent", Logger.eventToString(aEvent),
Logger.accessibleToString(aEvent.accessible)];
});
// Don't bother with non-content events in firefox.
if (Utils.MozBuildApp == 'browser' &&
if (Utils.MozBuildApp == "browser" &&
aEvent.eventType != Events.VIRTUALCURSOR_CHANGED &&
// XXX Bug 442005 results in DocAccessible::getDocType returning
// NS_ERROR_FAILURE. Checking for aEvent.accessibleDocument.docType ==
// 'window' does not currently work.
(aEvent.accessibleDocument.DOMDocument.doctype &&
aEvent.accessibleDocument.DOMDocument.doctype.name === 'window')) {
aEvent.accessibleDocument.DOMDocument.doctype.name === "window")) {
return;
}
@ -175,18 +175,18 @@ this.EventManager.prototype = {
this.present(
Presentation.
actionInvoked(aEvent.accessible,
event.isEnabled ? 'on' : 'off'));
event.isEnabled ? "on" : "off"));
} else {
this.present(
Presentation.
actionInvoked(aEvent.accessible,
event.isEnabled ? 'check' : 'uncheck'));
event.isEnabled ? "check" : "uncheck"));
}
} else if (state.contains(States.SELECTED)) {
this.present(
Presentation.
actionInvoked(aEvent.accessible,
event.isEnabled ? 'select' : 'unselect'));
event.isEnabled ? "select" : "unselect"));
}
break;
}
@ -197,7 +197,7 @@ this.EventManager.prototype = {
this.present(Presentation.nameChanged(acc));
} else {
let {liveRegion, isPolite} = this._handleLiveRegion(aEvent,
['text', 'all']);
["text", "all"]);
if (liveRegion) {
this.present(Presentation.nameChanged(acc, isPolite));
}
@ -232,12 +232,12 @@ this.EventManager.prototype = {
{
let evt = aEvent.QueryInterface(
Ci.nsIAccessibleObjectAttributeChangedEvent);
if (evt.changedAttribute.toString() !== 'aria-hidden') {
if (evt.changedAttribute.toString() !== "aria-hidden") {
// Only handle aria-hidden attribute change.
break;
}
let hidden = Utils.isHidden(aEvent.accessible);
this[hidden ? '_handleHide' : '_handleShow'](evt);
this[hidden ? "_handleHide" : "_handleShow"](evt);
if (this.inTest) {
this.sendMsgFunc("AccessFu:AriaHidden", { hidden: hidden });
}
@ -258,7 +258,7 @@ this.EventManager.prototype = {
case Events.TEXT_REMOVED:
{
let {liveRegion, isPolite} = this._handleLiveRegion(aEvent,
['text', 'all']);
["text", "all"]);
if (aEvent.isFromUserInput || liveRegion) {
// Handle all text mutations coming from the user or if they happen
// on a live region.
@ -309,7 +309,7 @@ this.EventManager.prototype = {
this.present(Presentation.valueChanged(target));
} else {
let {liveRegion, isPolite} = this._handleLiveRegion(aEvent,
['text', 'all']);
["text", "all"]);
if (liveRegion) {
this.present(Presentation.valueChanged(target, isPolite));
}
@ -368,7 +368,7 @@ this.EventManager.prototype = {
_handleShow: function _handleShow(aEvent) {
let {liveRegion, isPolite} = this._handleLiveRegion(aEvent,
['additions', 'all']);
["additions", "all"]);
// Only handle show if it is a relevant live region.
if (!liveRegion) {
return;
@ -383,7 +383,7 @@ this.EventManager.prototype = {
_handleHide: function _handleHide(aEvent) {
let {liveRegion, isPolite} = this._handleLiveRegion(
aEvent, ['removals', 'all']);
aEvent, ["removals", "all"]);
let acc = aEvent.accessible;
if (liveRegion) {
// Hide for text is handled by the EVENT_TEXT_REMOVED handler.
@ -417,7 +417,7 @@ this.EventManager.prototype = {
let isInserted = event.isInserted;
let txtIface = aEvent.accessible.QueryInterface(Ci.nsIAccessibleText);
let text = '';
let text = "";
try {
text = txtIface.getText(0, Ci.nsIAccessibleText.TEXT_OFFSET_END_OF_TEXT);
} catch (x) {
@ -430,7 +430,7 @@ this.EventManager.prototype = {
// If there are embedded objects in the text, ignore them.
// Assuming changes to the descendants would already be handled by the
// show/hide event.
let modifiedText = event.modifiedText.replace(/\uFFFC/g, '');
let modifiedText = event.modifiedText.replace(/\uFFFC/g, "");
if (modifiedText != event.modifiedText && !modifiedText.trim()) {
return;
}
@ -456,13 +456,13 @@ this.EventManager.prototype = {
}
let parseLiveAttrs = function parseLiveAttrs(aAccessible) {
let attrs = Utils.getAttributes(aAccessible);
if (attrs['container-live']) {
if (attrs["container-live"]) {
return {
live: attrs['container-live'],
relevant: attrs['container-relevant'] || 'additions text',
busy: attrs['container-busy'],
atomic: attrs['container-atomic'],
memberOf: attrs['member-of']
live: attrs["container-live"],
relevant: attrs["container-relevant"] || "additions text",
busy: attrs["container-busy"],
atomic: attrs["container-atomic"],
memberOf: attrs["member-of"]
};
}
return null;
@ -486,7 +486,7 @@ this.EventManager.prototype = {
};
let {live, relevant, /* busy, atomic, memberOf */ } = getLiveAttributes(aEvent);
// If container-live is not present or is set to |off| ignore the event.
if (!live || live === 'off') {
if (!live || live === "off") {
return {};
}
// XXX: support busy and atomic.
@ -499,7 +499,7 @@ this.EventManager.prototype = {
}
return {
liveRegion: aEvent.accessible,
isPolite: live === 'polite'
isPolite: live === "polite"
};
},
@ -542,7 +542,7 @@ this.EventManager.prototype = {
},
onStateChange: function onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
let tabstate = '';
let tabstate = "";
let loadingState = Ci.nsIWebProgressListener.STATE_TRANSFERRING |
Ci.nsIWebProgressListener.STATE_IS_DOCUMENT;
@ -550,10 +550,10 @@ this.EventManager.prototype = {
Ci.nsIWebProgressListener.STATE_IS_NETWORK;
if ((aStateFlags & loadingState) == loadingState) {
tabstate = 'loading';
tabstate = "loading";
} else if ((aStateFlags & loadedState) == loadedState &&
!aWebProgress.isLoadingDocument) {
tabstate = 'loaded';
tabstate = "loaded";
}
if (tabstate) {
@ -564,7 +564,7 @@ this.EventManager.prototype = {
onLocationChange: function onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {
let docAcc = Utils.AccService.getAccessibleFor(aWebProgress.DOMWindow.document);
this.present(Presentation.tabStateChanged(docAcc, 'newdoc'));
this.present(Presentation.tabStateChanged(docAcc, "newdoc"));
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener,
@ -597,7 +597,7 @@ const AccessibilityEventObserver = {
if (this.started || this.listenerCount === 0) {
return;
}
Services.obs.addObserver(this, 'accessible-event');
Services.obs.addObserver(this, "accessible-event");
this.started = true;
},
@ -608,7 +608,7 @@ const AccessibilityEventObserver = {
if (!this.started) {
return;
}
Services.obs.removeObserver(this, 'accessible-event');
Services.obs.removeObserver(this, "accessible-event");
// Clean up all registered event managers.
this.eventManagers = new WeakMap();
this.listenerCount = 0;
@ -629,7 +629,7 @@ const AccessibilityEventObserver = {
}
this.eventManagers.set(content, aEventManager);
// Since at least one EventManager was registered, start listening.
Logger.debug('AccessibilityEventObserver.addListener. Total:',
Logger.debug("AccessibilityEventObserver.addListener. Total:",
this.listenerCount);
this.start();
},
@ -647,7 +647,7 @@ const AccessibilityEventObserver = {
return;
}
this.listenerCount--;
Logger.debug('AccessibilityEventObserver.removeListener. Total:',
Logger.debug("AccessibilityEventObserver.removeListener. Total:",
this.listenerCount);
if (this.listenerCount === 0) {
// If there are no EventManagers registered at the moment, stop listening
@ -679,13 +679,13 @@ const AccessibilityEventObserver = {
* Handle the 'accessible-event' message.
*/
observe: function observe(aSubject, aTopic, aData) {
if (aTopic !== 'accessible-event') {
if (aTopic !== "accessible-event") {
return;
}
let event = aSubject.QueryInterface(Ci.nsIAccessibleEvent);
if (!event.accessibleDocument) {
Logger.warning(
'AccessibilityEventObserver.observe: no accessible document:',
"AccessibilityEventObserver.observe: no accessible document:",
Logger.eventToString(event), "accessible:",
Logger.accessibleToString(event.accessible));
return;
@ -694,10 +694,10 @@ const AccessibilityEventObserver = {
// Match the content window to its EventManager.
let eventManager = this.getListener(content);
if (!eventManager || !eventManager._started) {
if (Utils.MozBuildApp === 'browser' &&
if (Utils.MozBuildApp === "browser" &&
!(content instanceof Ci.nsIDOMChromeWindow)) {
Logger.warning(
'AccessibilityEventObserver.observe: ignored event:',
"AccessibilityEventObserver.observe: ignored event:",
Logger.eventToString(event), "accessible:",
Logger.accessibleToString(event.accessible), "document:",
Logger.accessibleToString(event.accessibleDocument));
@ -707,7 +707,7 @@ const AccessibilityEventObserver = {
try {
eventManager.handleAccEvent(event);
} catch (x) {
Logger.logException(x, 'Error handing accessible event');
Logger.logException(x, "Error handing accessible event");
} finally {
return;
}

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

@ -4,7 +4,7 @@
/* exported GestureSettings, GestureTracker */
/******************************************************************************
/** ****************************************************************************
All gestures have the following pathways when being resolved(v)/rejected(x):
Tap -> DoubleTap (x)
-> Dwell (x)
@ -34,24 +34,24 @@
Explore -> ExploreEnd (v)
******************************************************************************/
'use strict';
"use strict";
const Cu = Components.utils;
this.EXPORTED_SYMBOLS = ['GestureSettings', 'GestureTracker']; // jshint ignore:line
this.EXPORTED_SYMBOLS = ["GestureSettings", "GestureTracker"]; // jshint ignore:line
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, 'Utils', // jshint ignore:line
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Logger', // jshint ignore:line
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'setTimeout', // jshint ignore:line
'resource://gre/modules/Timer.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'clearTimeout', // jshint ignore:line
'resource://gre/modules/Timer.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'PromiseUtils', // jshint ignore:line
'resource://gre/modules/PromiseUtils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, "Utils", // jshint ignore:line
"resource://gre/modules/accessibility/Utils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Logger", // jshint ignore:line
"resource://gre/modules/accessibility/Utils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "setTimeout", // jshint ignore:line
"resource://gre/modules/Timer.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "clearTimeout", // jshint ignore:line
"resource://gre/modules/Timer.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PromiseUtils", // jshint ignore:line
"resource://gre/modules/PromiseUtils.jsm");
// Default maximum duration of swipe
const SWIPE_MAX_DURATION = 200;
@ -75,7 +75,7 @@ const EDGE = 0.1;
const TIMEOUT_MULTIPLIER = 1;
// A single pointer down/up sequence periodically precedes the tripple swipe
// gesture on Android. This delay acounts for that.
const IS_ANDROID = Utils.MozBuildApp === 'mobile/android' &&
const IS_ANDROID = Utils.MozBuildApp === "mobile/android" &&
Utils.AndroidSdkVersion >= 14;
/**
@ -202,7 +202,7 @@ this.GestureTracker = { // jshint ignore:line
*/
_init: function GestureTracker__init(aDetail, aTimeStamp, aGesture) {
// Only create a new gesture on |pointerdown| event.
if (aDetail.type !== 'pointerdown') {
if (aDetail.type !== "pointerdown") {
return;
}
let GestureConstructor = aGesture || (IS_ANDROID ? DoubleTap : Tap);
@ -218,9 +218,9 @@ this.GestureTracker = { // jshint ignore:line
*/
handle: function GestureTracker_handle(aDetail, aTimeStamp) {
Logger.gesture(() => {
return ['Pointer event', Utils.dpi, 'at:', aTimeStamp, JSON.stringify(aDetail)];
return ["Pointer event", Utils.dpi, "at:", aTimeStamp, JSON.stringify(aDetail)];
});
this[this.current ? '_update' : '_init'](aDetail, aTimeStamp);
this[this.current ? "_update" : "_init"](aDetail, aTimeStamp);
},
/**
@ -279,7 +279,7 @@ this.GestureTracker = { // jshint ignore:line
* 'startY'.
* @return {Object} a mozAccessFuGesture detail structure.
*/
function compileDetail(aType, aPoints, keyMap = {x: 'startX', y: 'startY'}) {
function compileDetail(aType, aPoints, keyMap = {x: "startX", y: "startY"}) {
let touches = [];
let maxDeltaX = 0;
let maxDeltaY = 0;
@ -321,7 +321,7 @@ function compileDetail(aType, aPoints, keyMap = {x: 'startX', y: 'startY'}) {
*/
function Gesture(aTimeStamp, aPoints = {}, aLastEvent = undefined) {
this.startTime = Date.now();
Logger.gesture('Creating', this.id, 'gesture.');
Logger.gesture("Creating", this.id, "gesture.");
this.points = aPoints;
this.lastEvent = aLastEvent;
this._deferred = PromiseUtils.defer();
@ -349,7 +349,7 @@ Gesture.prototype = {
* Clear the existing timer.
*/
clearTimer: function Gesture_clearTimer() {
Logger.gesture('clearTimeout', this.type);
Logger.gesture("clearTimeout", this.type);
clearTimeout(this._timer);
delete this._timer;
},
@ -360,11 +360,11 @@ Gesture.prototype = {
* started the gesture resolution sequence.
*/
startTimer: function Gesture_startTimer(aTimeStamp) {
Logger.gesture('startTimer', this.type);
Logger.gesture("startTimer", this.type);
this.clearTimer();
let delay = this._getDelay(aTimeStamp);
let handler = () => {
Logger.gesture('timer handler');
Logger.gesture("timer handler");
this.clearTimer();
if (!this._inProgress) {
this._deferred.reject();
@ -408,7 +408,7 @@ Gesture.prototype = {
let identifier = point.identifier;
let gesturePoint = this.points[identifier];
if (gesturePoint) {
if (aType === 'pointerdown' && aCanCreate) {
if (aType === "pointerdown" && aCanCreate) {
// scratch the previous pointer with that id.
this.points[identifier] = new Point(point);
} else {
@ -440,7 +440,7 @@ Gesture.prototype = {
* @param {Object} aDetail a compiled mozAccessFuGesture detail structure.
*/
_emit: function Gesture__emit(aDetail) {
let evt = new Utils.win.CustomEvent('mozAccessFuGesture', {
let evt = new Utils.win.CustomEvent("mozAccessFuGesture", {
bubbles: true,
cancelable: true,
detail: aDetail
@ -455,7 +455,7 @@ Gesture.prototype = {
*/
pointerdown: function Gesture_pointerdown(aPoints, aTimeStamp) {
this._inProgress = true;
this._update(aPoints, 'pointerdown',
this._update(aPoints, "pointerdown",
aTimeStamp - this.startTime < GestureSettings.maxMultitouch);
},
@ -464,7 +464,7 @@ Gesture.prototype = {
* @param {Array} aPoints A new pointer move points.
*/
pointermove: function Gesture_pointermove(aPoints) {
this._update(aPoints, 'pointermove');
this._update(aPoints, "pointermove");
},
/**
@ -472,7 +472,7 @@ Gesture.prototype = {
* @param {Array} aPoints A new pointer up points.
*/
pointerup: function Gesture_pointerup(aPoints) {
let complete = this._update(aPoints, 'pointerup', false, true);
let complete = this._update(aPoints, "pointerup", false, true);
if (complete) {
this._deferred.resolve();
}
@ -506,7 +506,7 @@ Gesture.prototype = {
if (this.isComplete) {
return;
}
Logger.gesture('Resolving', this.id, 'gesture.');
Logger.gesture("Resolving", this.id, "gesture.");
this.isComplete = true;
this.clearTimer();
let detail = this.compile();
@ -531,7 +531,7 @@ Gesture.prototype = {
if (this.isComplete) {
return;
}
Logger.gesture('Rejecting', this.id, 'gesture.');
Logger.gesture("Rejecting", this.id, "gesture.");
this.isComplete = true;
this.clearTimer();
return {
@ -558,7 +558,7 @@ function ExploreGesture() {
this.compile = () => {
// Unlike most of other gestures explore based gestures compile using the
// current point position and not the start one.
return compileDetail(this.type, this.points, {x: 'x', y: 'y'});
return compileDetail(this.type, this.points, {x: "x", y: "y"});
};
}
@ -567,7 +567,7 @@ function ExploreGesture() {
*/
function checkProgressGesture(aGesture) {
aGesture._inProgress = true;
if (aGesture.lastEvent === 'pointerup') {
if (aGesture.lastEvent === "pointerup") {
if (aGesture.test) {
aGesture.test(true);
}
@ -629,7 +629,7 @@ function DwellEnd(aTimeStamp, aPoints, aLastEvent) {
}
DwellEnd.prototype = Object.create(TravelGesture.prototype);
DwellEnd.prototype.type = 'dwellend';
DwellEnd.prototype.type = "dwellend";
/**
* TapHoldEnd gesture. This gesture can be represented as the following diagram:
@ -647,7 +647,7 @@ function TapHoldEnd(aTimeStamp, aPoints, aLastEvent) {
}
TapHoldEnd.prototype = Object.create(TravelGesture.prototype);
TapHoldEnd.prototype.type = 'tapholdend';
TapHoldEnd.prototype.type = "tapholdend";
/**
* DoubleTapHoldEnd gesture. This gesture can be represented as the following
@ -666,7 +666,7 @@ function DoubleTapHoldEnd(aTimeStamp, aPoints, aLastEvent) {
}
DoubleTapHoldEnd.prototype = Object.create(TravelGesture.prototype);
DoubleTapHoldEnd.prototype.type = 'doubletapholdend';
DoubleTapHoldEnd.prototype.type = "doubletapholdend";
/**
* A common tap gesture object.
@ -700,7 +700,7 @@ TapGesture.prototype._getDelay = function TapGesture__getDelay() {
TapGesture.prototype.pointerup = function TapGesture_pointerup(aPoints) {
if (this._rejectToOnPointerDown) {
let complete = this._update(aPoints, 'pointerup', false, true);
let complete = this._update(aPoints, "pointerup", false, true);
if (complete) {
this.clearTimer();
if (GestureSettings.maxGestureResolveTimeout) {
@ -742,7 +742,7 @@ function Tap(aTimeStamp, aPoints, aLastEvent) {
}
Tap.prototype = Object.create(TapGesture.prototype);
Tap.prototype.type = 'tap';
Tap.prototype.type = "tap";
/**
@ -758,7 +758,7 @@ function DoubleTap(aTimeStamp, aPoints, aLastEvent) {
}
DoubleTap.prototype = Object.create(TapGesture.prototype);
DoubleTap.prototype.type = 'doubletap';
DoubleTap.prototype.type = "doubletap";
/**
* Triple Tap gesture.
@ -773,7 +773,7 @@ function TripleTap(aTimeStamp, aPoints, aLastEvent) {
}
TripleTap.prototype = Object.create(TapGesture.prototype);
TripleTap.prototype.type = 'tripletap';
TripleTap.prototype.type = "tripletap";
/**
* Common base object for gestures that are created as resolved.
@ -802,7 +802,7 @@ function Dwell(aTimeStamp, aPoints, aLastEvent) {
}
Dwell.prototype = Object.create(ResolvedGesture.prototype);
Dwell.prototype.type = 'dwell';
Dwell.prototype.type = "dwell";
Dwell.prototype.resolveTo = DwellEnd;
/**
@ -817,7 +817,7 @@ function TapHold(aTimeStamp, aPoints, aLastEvent) {
}
TapHold.prototype = Object.create(ResolvedGesture.prototype);
TapHold.prototype.type = 'taphold';
TapHold.prototype.type = "taphold";
TapHold.prototype.resolveTo = TapHoldEnd;
/**
@ -832,7 +832,7 @@ function DoubleTapHold(aTimeStamp, aPoints, aLastEvent) {
}
DoubleTapHold.prototype = Object.create(ResolvedGesture.prototype);
DoubleTapHold.prototype.type = 'doubletaphold';
DoubleTapHold.prototype.type = "doubletaphold";
DoubleTapHold.prototype.resolveTo = DoubleTapHoldEnd;
/**
@ -848,7 +848,7 @@ function Explore(aTimeStamp, aPoints, aLastEvent) {
}
Explore.prototype = Object.create(ResolvedGesture.prototype);
Explore.prototype.type = 'explore';
Explore.prototype.type = "explore";
Explore.prototype.resolveTo = ExploreEnd;
/**
@ -867,7 +867,7 @@ function ExploreEnd(aTimeStamp, aPoints, aLastEvent) {
}
ExploreEnd.prototype = Object.create(TravelGesture.prototype);
ExploreEnd.prototype.type = 'exploreend';
ExploreEnd.prototype.type = "exploreend";
/**
* Swipe gesture.
@ -884,7 +884,7 @@ function Swipe(aTimeStamp, aPoints, aLastEvent) {
}
Swipe.prototype = Object.create(Gesture.prototype);
Swipe.prototype.type = 'swipe';
Swipe.prototype.type = "swipe";
Swipe.prototype._getDelay = function Swipe__getDelay(aTimeStamp) {
// Swipe should be completed within the GestureSettings.swipeMaxDuration from
// the initial pointer down event.
@ -924,7 +924,7 @@ Swipe.prototype.test = function Swipe_test(aComplete) {
Swipe.prototype.compile = function Swipe_compile() {
let type = this.type;
let detail = compileDetail(type, this.points,
{x1: 'startX', y1: 'startY', x2: 'x', y2: 'y'});
{x1: "startX", y1: "startY", x2: "x", y2: "y"});
let deltaX = detail.deltaX;
let deltaY = detail.deltaY;
let edge = EDGE * Utils.dpi;
@ -932,10 +932,10 @@ Swipe.prototype.compile = function Swipe_compile() {
// Horizontal swipe.
let startPoints = detail.touches.map(touch => touch.x1);
if (deltaX > 0) {
detail.type = type + 'right';
detail.type = type + "right";
detail.edge = Math.min.apply(null, startPoints) <= edge;
} else {
detail.type = type + 'left';
detail.type = type + "left";
detail.edge =
Utils.win.screen.width - Math.max.apply(null, startPoints) <= edge;
}
@ -943,10 +943,10 @@ Swipe.prototype.compile = function Swipe_compile() {
// Vertical swipe.
let startPoints = detail.touches.map(touch => touch.y1);
if (deltaY > 0) {
detail.type = type + 'down';
detail.type = type + "down";
detail.edge = Math.min.apply(null, startPoints) <= edge;
} else {
detail.type = type + 'up';
detail.type = type + "up";
detail.edge =
Utils.win.screen.height - Math.max.apply(null, startPoints) <= edge;
}

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

@ -4,7 +4,7 @@
/* exported UtteranceGenerator, BrailleGenerator */
'use strict';
"use strict";
const {utils: Cu, interfaces: Ci} = Components;
@ -17,19 +17,19 @@ const IGNORE_EXPLICIT_NAME = 0x20;
const OUTPUT_DESC_FIRST = 0;
const OUTPUT_DESC_LAST = 1;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Utils', // jshint ignore:line
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'PrefCache', // jshint ignore:line
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Logger', // jshint ignore:line
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles', // jshint ignore:line
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'States', // jshint ignore:line
'resource://gre/modules/accessibility/Constants.jsm');
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Utils", // jshint ignore:line
"resource://gre/modules/accessibility/Utils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PrefCache", // jshint ignore:line
"resource://gre/modules/accessibility/Utils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Logger", // jshint ignore:line
"resource://gre/modules/accessibility/Utils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Roles", // jshint ignore:line
"resource://gre/modules/accessibility/Constants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "States", // jshint ignore:line
"resource://gre/modules/accessibility/Constants.jsm");
this.EXPORTED_SYMBOLS = ['UtteranceGenerator', 'BrailleGenerator']; // jshint ignore:line
this.EXPORTED_SYMBOLS = ["UtteranceGenerator", "BrailleGenerator"]; // jshint ignore:line
var OutputGenerator = {
@ -57,7 +57,7 @@ var OutputGenerator = {
// NAME_FROM_SUBTREE_RULE.
return (((nameRule & INCLUDE_VALUE) && aAccessible.value) ||
((nameRule & NAME_FROM_SUBTREE_RULE) &&
(Utils.getAttributes(aAccessible)['explicit-name'] === 'true' &&
(Utils.getAttributes(aAccessible)["explicit-name"] === "true" &&
!(nameRule & IGNORE_EXPLICIT_NAME))));
};
@ -166,7 +166,7 @@ var OutputGenerator = {
*/
_addName: function _addName(aOutput, aAccessible, aFlags) {
let name;
if ((Utils.getAttributes(aAccessible)['explicit-name'] === 'true' &&
if ((Utils.getAttributes(aAccessible)["explicit-name"] === "true" &&
!(aFlags & IGNORE_EXPLICIT_NAME)) || (aFlags & INCLUDE_NAME)) {
name = aAccessible.name;
}
@ -177,17 +177,17 @@ var OutputGenerator = {
// so we can make sure we don't speak duplicated descriptions
let tmpName = name || aAccessible.name;
if (tmpName && (description !== tmpName)) {
name = name || '';
name = name || "";
name = this.outputOrder === OUTPUT_DESC_FIRST ?
description + ' - ' + name :
name + ' - ' + description;
description + " - " + name :
name + " - " + description;
}
}
if (!name || !name.trim()) {
return;
}
aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? 'push' : 'unshift'](name);
aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? "push" : "unshift"](name);
},
/**
@ -200,7 +200,7 @@ var OutputGenerator = {
if (!landmarkName) {
return;
}
aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? 'unshift' : 'push']({
aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? "unshift" : "push"]({
string: landmarkName
});
},
@ -232,7 +232,7 @@ var OutputGenerator = {
case Roles.MATHML_UNDER:
case Roles.MATHML_UNDER_OVER:
// For scripted accessibles, use the string 'mathmlscripted'.
roleStr = 'mathmlscripted';
roleStr = "mathmlscripted";
break;
case Roles.MATHML_FRACTION:
// From a semantic point of view, the only important point is to
@ -244,7 +244,7 @@ var OutputGenerator = {
if (linethickness) {
let numberMatch = linethickness.match(/^(?:\d|\.)+/);
if (numberMatch && !parseFloat(numberMatch[0])) {
roleStr += 'withoutbar';
roleStr += "withoutbar";
}
}
break;
@ -258,11 +258,11 @@ var OutputGenerator = {
// (e.g. numerator for the first child of a mathmlfraction).
let mathRole = Utils.getMathRole(aAccessible);
if (mathRole) {
aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? 'push' : 'unshift']({
aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? "push" : "unshift"]({
string: this._getOutputName(mathRole)});
}
if (roleStr) {
aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? 'push' : 'unshift']({
aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? "push" : "unshift"]({
string: this._getOutputName(roleStr)});
}
},
@ -273,10 +273,10 @@ var OutputGenerator = {
* @param {nsIAccessible} aAccessible current accessible object.
*/
_addMencloseNotations: function _addMencloseNotations(aOutput, aAccessible) {
let notations = Utils.getAttributes(aAccessible).notation || 'longdiv';
aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? 'push' : 'unshift'].apply(
aOutput, notations.split(' ').map(notation => {
return { string: this._getOutputName('notation-' + notation) };
let notations = Utils.getAttributes(aAccessible).notation || "longdiv";
aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? "push" : "unshift"].apply(
aOutput, notations.split(" ").map(notation => {
return { string: this._getOutputName("notation-" + notation) };
}));
},
@ -287,16 +287,16 @@ var OutputGenerator = {
* @param {String} aRoleStr aAccessible's role string.
*/
_addType: function _addType(aOutput, aAccessible, aRoleStr) {
if (aRoleStr !== 'entry') {
if (aRoleStr !== "entry") {
return;
}
let typeName = Utils.getAttributes(aAccessible)['text-input-type'];
let typeName = Utils.getAttributes(aAccessible)["text-input-type"];
// Ignore the the input type="text" case.
if (!typeName || typeName === 'text') {
if (!typeName || typeName === "text") {
return;
}
aOutput.push({string: 'textInputType_' + typeName});
aOutput.push({string: "textInputType_" + typeName});
},
_addState: function _addState(aOutput, aState, aRoleStr) {}, // jshint ignore:line
@ -305,115 +305,115 @@ var OutputGenerator = {
get outputOrder() {
if (!this._utteranceOrder) {
this._utteranceOrder = new PrefCache('accessibility.accessfu.utterance');
this._utteranceOrder = new PrefCache("accessibility.accessfu.utterance");
}
return typeof this._utteranceOrder.value === 'number' ?
return typeof this._utteranceOrder.value === "number" ?
this._utteranceOrder.value : this.defaultOutputOrder;
},
_getOutputName: function _getOutputName(aName) {
return aName.replace(/\s/g, '');
return aName.replace(/\s/g, "");
},
roleRuleMap: {
'menubar': INCLUDE_DESC,
'scrollbar': INCLUDE_DESC,
'grip': INCLUDE_DESC,
'alert': INCLUDE_DESC | INCLUDE_NAME,
'menupopup': INCLUDE_DESC,
'menuitem': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'tooltip': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'columnheader': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'rowheader': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'column': NAME_FROM_SUBTREE_RULE,
'row': NAME_FROM_SUBTREE_RULE,
'cell': INCLUDE_DESC | INCLUDE_NAME,
'application': INCLUDE_NAME,
'document': INCLUDE_NAME,
'grouping': INCLUDE_DESC | INCLUDE_NAME,
'toolbar': INCLUDE_DESC,
'table': INCLUDE_DESC | INCLUDE_NAME,
'link': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'helpballoon': NAME_FROM_SUBTREE_RULE,
'list': INCLUDE_DESC | INCLUDE_NAME,
'listitem': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'outline': INCLUDE_DESC,
'outlineitem': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'pagetab': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'graphic': INCLUDE_DESC,
'switch': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'pushbutton': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'checkbutton': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'radiobutton': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'buttondropdown': NAME_FROM_SUBTREE_RULE,
'combobox': INCLUDE_DESC | INCLUDE_VALUE,
'droplist': INCLUDE_DESC,
'progressbar': INCLUDE_DESC | INCLUDE_VALUE,
'slider': INCLUDE_DESC | INCLUDE_VALUE,
'spinbutton': INCLUDE_DESC | INCLUDE_VALUE,
'diagram': INCLUDE_DESC,
'animation': INCLUDE_DESC,
'equation': INCLUDE_DESC,
'buttonmenu': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'buttondropdowngrid': NAME_FROM_SUBTREE_RULE,
'pagetablist': INCLUDE_DESC,
'canvas': INCLUDE_DESC,
'check menu item': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'label': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'password text': INCLUDE_DESC,
'popup menu': INCLUDE_DESC,
'radio menu item': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'table column header': NAME_FROM_SUBTREE_RULE,
'table row header': NAME_FROM_SUBTREE_RULE,
'tear off menu item': NAME_FROM_SUBTREE_RULE,
'toggle button': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'parent menuitem': NAME_FROM_SUBTREE_RULE,
'header': INCLUDE_DESC,
'footer': INCLUDE_DESC,
'entry': INCLUDE_DESC | INCLUDE_NAME | INCLUDE_VALUE,
'caption': INCLUDE_DESC,
'document frame': INCLUDE_DESC,
'heading': INCLUDE_DESC,
'calendar': INCLUDE_DESC | INCLUDE_NAME,
'combobox option': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'listbox option': INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
'listbox rich option': NAME_FROM_SUBTREE_RULE,
'gridcell': NAME_FROM_SUBTREE_RULE,
'check rich option': NAME_FROM_SUBTREE_RULE,
'term': NAME_FROM_SUBTREE_RULE,
'definition': NAME_FROM_SUBTREE_RULE,
'key': NAME_FROM_SUBTREE_RULE,
'image map': INCLUDE_DESC,
'option': INCLUDE_DESC,
'listbox': INCLUDE_DESC,
'definitionlist': INCLUDE_DESC | INCLUDE_NAME,
'dialog': INCLUDE_DESC | INCLUDE_NAME,
'chrome window': IGNORE_EXPLICIT_NAME,
'app root': IGNORE_EXPLICIT_NAME,
'statusbar': NAME_FROM_SUBTREE_RULE,
'mathml table': INCLUDE_DESC | INCLUDE_NAME,
'mathml labeled row': NAME_FROM_SUBTREE_RULE,
'mathml table row': NAME_FROM_SUBTREE_RULE,
'mathml cell': INCLUDE_DESC | INCLUDE_NAME,
'mathml fraction': INCLUDE_DESC,
'mathml square root': INCLUDE_DESC,
'mathml root': INCLUDE_DESC,
'mathml enclosed': INCLUDE_DESC,
'mathml sub': INCLUDE_DESC,
'mathml sup': INCLUDE_DESC,
'mathml sub sup': INCLUDE_DESC,
'mathml under': INCLUDE_DESC,
'mathml over': INCLUDE_DESC,
'mathml under over': INCLUDE_DESC,
'mathml multiscripts': INCLUDE_DESC,
'mathml identifier': INCLUDE_DESC,
'mathml number': INCLUDE_DESC,
'mathml operator': INCLUDE_DESC,
'mathml text': INCLUDE_DESC,
'mathml string literal': INCLUDE_DESC,
'mathml row': INCLUDE_DESC,
'mathml style': INCLUDE_DESC,
'mathml error': INCLUDE_DESC },
"menubar": INCLUDE_DESC,
"scrollbar": INCLUDE_DESC,
"grip": INCLUDE_DESC,
"alert": INCLUDE_DESC | INCLUDE_NAME,
"menupopup": INCLUDE_DESC,
"menuitem": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"tooltip": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"columnheader": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"rowheader": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"column": NAME_FROM_SUBTREE_RULE,
"row": NAME_FROM_SUBTREE_RULE,
"cell": INCLUDE_DESC | INCLUDE_NAME,
"application": INCLUDE_NAME,
"document": INCLUDE_NAME,
"grouping": INCLUDE_DESC | INCLUDE_NAME,
"toolbar": INCLUDE_DESC,
"table": INCLUDE_DESC | INCLUDE_NAME,
"link": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"helpballoon": NAME_FROM_SUBTREE_RULE,
"list": INCLUDE_DESC | INCLUDE_NAME,
"listitem": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"outline": INCLUDE_DESC,
"outlineitem": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"pagetab": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"graphic": INCLUDE_DESC,
"switch": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"pushbutton": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"checkbutton": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"radiobutton": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"buttondropdown": NAME_FROM_SUBTREE_RULE,
"combobox": INCLUDE_DESC | INCLUDE_VALUE,
"droplist": INCLUDE_DESC,
"progressbar": INCLUDE_DESC | INCLUDE_VALUE,
"slider": INCLUDE_DESC | INCLUDE_VALUE,
"spinbutton": INCLUDE_DESC | INCLUDE_VALUE,
"diagram": INCLUDE_DESC,
"animation": INCLUDE_DESC,
"equation": INCLUDE_DESC,
"buttonmenu": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"buttondropdowngrid": NAME_FROM_SUBTREE_RULE,
"pagetablist": INCLUDE_DESC,
"canvas": INCLUDE_DESC,
"check menu item": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"label": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"password text": INCLUDE_DESC,
"popup menu": INCLUDE_DESC,
"radio menu item": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"table column header": NAME_FROM_SUBTREE_RULE,
"table row header": NAME_FROM_SUBTREE_RULE,
"tear off menu item": NAME_FROM_SUBTREE_RULE,
"toggle button": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"parent menuitem": NAME_FROM_SUBTREE_RULE,
"header": INCLUDE_DESC,
"footer": INCLUDE_DESC,
"entry": INCLUDE_DESC | INCLUDE_NAME | INCLUDE_VALUE,
"caption": INCLUDE_DESC,
"document frame": INCLUDE_DESC,
"heading": INCLUDE_DESC,
"calendar": INCLUDE_DESC | INCLUDE_NAME,
"combobox option": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"listbox option": INCLUDE_DESC | NAME_FROM_SUBTREE_RULE,
"listbox rich option": NAME_FROM_SUBTREE_RULE,
"gridcell": NAME_FROM_SUBTREE_RULE,
"check rich option": NAME_FROM_SUBTREE_RULE,
"term": NAME_FROM_SUBTREE_RULE,
"definition": NAME_FROM_SUBTREE_RULE,
"key": NAME_FROM_SUBTREE_RULE,
"image map": INCLUDE_DESC,
"option": INCLUDE_DESC,
"listbox": INCLUDE_DESC,
"definitionlist": INCLUDE_DESC | INCLUDE_NAME,
"dialog": INCLUDE_DESC | INCLUDE_NAME,
"chrome window": IGNORE_EXPLICIT_NAME,
"app root": IGNORE_EXPLICIT_NAME,
"statusbar": NAME_FROM_SUBTREE_RULE,
"mathml table": INCLUDE_DESC | INCLUDE_NAME,
"mathml labeled row": NAME_FROM_SUBTREE_RULE,
"mathml table row": NAME_FROM_SUBTREE_RULE,
"mathml cell": INCLUDE_DESC | INCLUDE_NAME,
"mathml fraction": INCLUDE_DESC,
"mathml square root": INCLUDE_DESC,
"mathml root": INCLUDE_DESC,
"mathml enclosed": INCLUDE_DESC,
"mathml sub": INCLUDE_DESC,
"mathml sup": INCLUDE_DESC,
"mathml sub sup": INCLUDE_DESC,
"mathml under": INCLUDE_DESC,
"mathml over": INCLUDE_DESC,
"mathml under over": INCLUDE_DESC,
"mathml multiscripts": INCLUDE_DESC,
"mathml identifier": INCLUDE_DESC,
"mathml number": INCLUDE_DESC,
"mathml operator": INCLUDE_DESC,
"mathml text": INCLUDE_DESC,
"mathml string literal": INCLUDE_DESC,
"mathml row": INCLUDE_DESC,
"mathml style": INCLUDE_DESC,
"mathml error": INCLUDE_DESC },
mathmlRolesSet: new Set([
Roles.MATHML_MATH,
@ -464,7 +464,7 @@ var OutputGenerator = {
}
if (aFlags & INCLUDE_VALUE && aAccessible.value.trim()) {
output[this.outputOrder === OUTPUT_DESC_FIRST ? 'push' : 'unshift'](
output[this.outputOrder === OUTPUT_DESC_FIRST ? "push" : "unshift"](
aAccessible.value);
}
@ -486,7 +486,7 @@ var OutputGenerator = {
},
entry: function entry(aAccessible, aRoleStr, aState, aFlags) {
let rolestr = aState.contains(States.MULTI_LINE) ? 'textarea' : 'entry';
let rolestr = aState.contains(States.MULTI_LINE) ? "textarea" : "entry";
return this.objectOutputFunctions.defaultFunc.apply(
this, [aAccessible, rolestr, aState, aFlags]);
},
@ -499,7 +499,7 @@ var OutputGenerator = {
this._addState(output, aState);
this._addRole(output, aAccessible, aRoleStr);
output.push({
string: 'objItemOfN',
string: "objItemOfN",
args: [itemno.value, itemof.value]
});
@ -525,10 +525,10 @@ var OutputGenerator = {
}
this._addRole(output, aAccessible, aRoleStr);
output.push.call(output, {
string: this._getOutputName('tblColumnInfo'),
string: this._getOutputName("tblColumnInfo"),
count: table.columnCount
}, {
string: this._getOutputName('tblRowInfo'),
string: this._getOutputName("tblRowInfo"),
count: table.rowCount
});
this._addName(output, aAccessible, aFlags);
@ -584,25 +584,25 @@ this.UtteranceGenerator = { // jshint ignore:line
__proto__: OutputGenerator, // jshint ignore:line
gActionMap: {
jump: 'jumpAction',
press: 'pressAction',
check: 'checkAction',
uncheck: 'uncheckAction',
on: 'onAction',
off: 'offAction',
select: 'selectAction',
unselect: 'unselectAction',
open: 'openAction',
close: 'closeAction',
switch: 'switchAction',
click: 'clickAction',
collapse: 'collapseAction',
expand: 'expandAction',
activate: 'activateAction',
cycle: 'cycleAction'
jump: "jumpAction",
press: "pressAction",
check: "checkAction",
uncheck: "uncheckAction",
on: "onAction",
off: "offAction",
select: "selectAction",
unselect: "unselectAction",
open: "openAction",
close: "closeAction",
switch: "switchAction",
click: "clickAction",
collapse: "collapseAction",
expand: "expandAction",
activate: "activateAction",
cycle: "cycleAction"
},
//TODO: May become more verbose in the future.
// TODO: May become more verbose in the future.
genForAction: function genForAction(aObject, aActionName) {
return [{string: this.gActionMap[aActionName]}];
},
@ -611,7 +611,7 @@ this.UtteranceGenerator = { // jshint ignore:line
function genForLiveRegion(aContext, aIsHide, aModifiedText) {
let utterance = [];
if (aIsHide) {
utterance.push({string: 'hidden'});
utterance.push({string: "hidden"});
}
return utterance.concat(aModifiedText || this.genForContext(aContext));
},
@ -624,23 +624,23 @@ this.UtteranceGenerator = { // jshint ignore:line
genForTabStateChange: function genForTabStateChange(aObject, aTabState) {
switch (aTabState) {
case 'newtab':
return [{string: 'tabNew'}];
case 'loading':
return [{string: 'tabLoading'}];
case 'loaded':
return [aObject.name, {string: 'tabLoaded'}];
case 'loadstopped':
return [{string: 'tabLoadStopped'}];
case 'reload':
return [{string: 'tabReload'}];
case "newtab":
return [{string: "tabNew"}];
case "loading":
return [{string: "tabLoading"}];
case "loaded":
return [aObject.name, {string: "tabLoaded"}];
case "loadstopped":
return [{string: "tabLoadStopped"}];
case "reload":
return [{string: "tabReload"}];
default:
return [];
}
},
genForEditingMode: function genForEditingMode(aIsEditing) {
return [{string: aIsEditing ? 'editingMode' : 'navigationMode'}];
return [{string: aIsEditing ? "editingMode" : "navigationMode"}];
},
objectOutputFunctions: {
@ -655,7 +655,7 @@ this.UtteranceGenerator = { // jshint ignore:line
heading: function heading(aAccessible, aRoleStr, aState, aFlags) {
let level = {};
aAccessible.groupPosition(level, {}, {});
let utterance = [{string: 'headingLevel', args: [level.value]}];
let utterance = [{string: "headingLevel", args: [level.value]}];
this._addName(utterance, aAccessible, aFlags);
this._addLandmark(utterance, aAccessible);
@ -670,11 +670,10 @@ this.UtteranceGenerator = { // jshint ignore:line
let utterance = [];
if (itemno.value == 1) {
// Start of list
utterance.push({string: 'listStart'});
}
else if (itemno.value == itemof.value) {
utterance.push({string: "listStart"});
} else if (itemno.value == itemof.value) {
// last item
utterance.push({string: 'listEnd'});
utterance.push({string: "listEnd"});
}
this._addName(utterance, aAccessible, aFlags);
@ -725,12 +724,12 @@ this.UtteranceGenerator = { // jshint ignore:line
}
};
addCellChanged(utterance, cell.columnChanged, 'columnInfo',
addCellChanged(utterance, cell.columnChanged, "columnInfo",
cell.columnIndex);
addCellChanged(utterance, cell.rowChanged, 'rowInfo', cell.rowIndex);
addCellChanged(utterance, cell.rowChanged, "rowInfo", cell.rowIndex);
addExtent(utterance, cell.columnExtent, 'spansColumns');
addExtent(utterance, cell.rowExtent, 'spansRows');
addExtent(utterance, cell.columnExtent, "spansColumns");
addExtent(utterance, cell.rowExtent, "spansRows");
addHeaders(utterance, cell.columnHeaders);
addHeaders(utterance, cell.rowHeaders);
@ -774,53 +773,53 @@ this.UtteranceGenerator = { // jshint ignore:line
_addState: function _addState(aOutput, aState, aRoleStr) {
if (aState.contains(States.UNAVAILABLE)) {
aOutput.push({string: 'stateUnavailable'});
aOutput.push({string: "stateUnavailable"});
}
if (aState.contains(States.READONLY)) {
aOutput.push({string: 'stateReadonly'});
aOutput.push({string: "stateReadonly"});
}
// Don't utter this in Jelly Bean, we let TalkBack do it for us there.
// This is because we expose the checked information on the node itself.
// XXX: this means the checked state is always appended to the end,
// regardless of the utterance ordering preference.
if ((Utils.AndroidSdkVersion < 16 || Utils.MozBuildApp === 'browser') &&
if ((Utils.AndroidSdkVersion < 16 || Utils.MozBuildApp === "browser") &&
aState.contains(States.CHECKABLE)) {
let checked = aState.contains(States.CHECKED);
let statetr;
if (aRoleStr === 'switch') {
statetr = checked ? 'stateOn' : 'stateOff';
if (aRoleStr === "switch") {
statetr = checked ? "stateOn" : "stateOff";
} else {
statetr = checked ? 'stateChecked' : 'stateNotChecked';
statetr = checked ? "stateChecked" : "stateNotChecked";
}
aOutput.push({string: statetr});
}
if (aState.contains(States.PRESSED)) {
aOutput.push({string: 'statePressed'});
aOutput.push({string: "statePressed"});
}
if (aState.contains(States.EXPANDABLE)) {
let statetr = aState.contains(States.EXPANDED) ?
'stateExpanded' : 'stateCollapsed';
"stateExpanded" : "stateCollapsed";
aOutput.push({string: statetr});
}
if (aState.contains(States.REQUIRED)) {
aOutput.push({string: 'stateRequired'});
aOutput.push({string: "stateRequired"});
}
if (aState.contains(States.TRAVERSED)) {
aOutput.push({string: 'stateTraversed'});
aOutput.push({string: "stateTraversed"});
}
if (aState.contains(States.HASPOPUP)) {
aOutput.push({string: 'stateHasPopup'});
aOutput.push({string: "stateHasPopup"});
}
if (aState.contains(States.SELECTED)) {
aOutput.push({string: 'stateSelected'});
aOutput.push({string: "stateSelected"});
}
},
@ -829,7 +828,7 @@ this.UtteranceGenerator = { // jshint ignore:line
let utterance = [];
this._addRole(utterance, aAccessible, aRoleStr);
utterance.push({
string: this._getOutputName('listItemsCount'),
string: this._getOutputName("listItemsCount"),
count: aItemCount
});
@ -851,7 +850,7 @@ this.BrailleGenerator = { // jshint ignore:line
// add the static text indicating a list item; do this for both listitems or
// direct first children of listitems, because these are both common
// browsing scenarios
let addListitemIndicator = function addListitemIndicator(indicator = '*') {
let addListitemIndicator = function addListitemIndicator(indicator = "*") {
output.unshift(indicator);
};
@ -859,14 +858,14 @@ this.BrailleGenerator = { // jshint ignore:line
acc.parent.role == Roles.LISTITEM &&
acc.previousSibling.role == Roles.STATICTEXT) {
if (acc.parent.parent && acc.parent.parent.DOMNode &&
acc.parent.parent.DOMNode.nodeName == 'UL') {
acc.parent.parent.DOMNode.nodeName == "UL") {
addListitemIndicator();
} else {
addListitemIndicator(acc.previousSibling.name.trim());
}
} else if (acc.role == Roles.LISTITEM && acc.firstChild &&
acc.firstChild.role == Roles.STATICTEXT) {
if (acc.parent.DOMNode.nodeName == 'UL') {
if (acc.parent.DOMNode.nodeName == "UL") {
addListitemIndicator();
} else {
addListitemIndicator(acc.firstChild.name.trim());
@ -905,7 +904,7 @@ this.BrailleGenerator = { // jshint ignore:line
};
braille.push({
string: this._getOutputName('cellInfo'),
string: this._getOutputName("cellInfo"),
args: [cell.columnIndex + 1, cell.rowIndex + 1]
});
@ -972,7 +971,7 @@ this.BrailleGenerator = { // jshint ignore:line
},
_getOutputName: function _getOutputName(aName) {
return OutputGenerator._getOutputName(aName) + 'Abbr';
return OutputGenerator._getOutputName(aName) + "Abbr";
},
_addRole: function _addRole(aBraille, aAccessible, aRoleStr) {
@ -987,15 +986,15 @@ this.BrailleGenerator = { // jshint ignore:line
if (aState.contains(States.CHECKABLE)) {
aBraille.push({
string: aState.contains(States.CHECKED) ?
this._getOutputName('stateChecked') :
this._getOutputName('stateUnchecked')
this._getOutputName("stateChecked") :
this._getOutputName("stateUnchecked")
});
}
if (aRoleStr === 'toggle button') {
if (aRoleStr === "toggle button") {
aBraille.push({
string: aState.contains(States.PRESSED) ?
this._getOutputName('statePressed') :
this._getOutputName('stateUnpressed')
this._getOutputName("statePressed") :
this._getOutputName("stateUnpressed")
});
}
}

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

@ -4,26 +4,26 @@
/* exported PointerRelay, PointerAdapter */
'use strict';
"use strict";
const Ci = Components.interfaces;
const Cu = Components.utils;
this.EXPORTED_SYMBOLS = ['PointerRelay', 'PointerAdapter']; // jshint ignore:line
this.EXPORTED_SYMBOLS = ["PointerRelay", "PointerAdapter"]; // jshint ignore:line
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, 'Utils', // jshint ignore:line
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Logger', // jshint ignore:line
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'GestureSettings', // jshint ignore:line
'resource://gre/modules/accessibility/Gestures.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'GestureTracker', // jshint ignore:line
'resource://gre/modules/accessibility/Gestures.jsm');
XPCOMUtils.defineLazyModuleGetter(this, "Utils", // jshint ignore:line
"resource://gre/modules/accessibility/Utils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Logger", // jshint ignore:line
"resource://gre/modules/accessibility/Utils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "GestureSettings", // jshint ignore:line
"resource://gre/modules/accessibility/Gestures.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "GestureTracker", // jshint ignore:line
"resource://gre/modules/accessibility/Gestures.jsm");
// The virtual touch ID generated by a mouse event.
const MOUSE_ID = 'mouse';
const MOUSE_ID = "mouse";
// Synthesized touch ID.
const SYNTH_ID = -1;
@ -37,34 +37,34 @@ var PointerRelay = { // jshint ignore:line
delete this._eventsOfInterest;
switch (Utils.widgetToolkit) {
case 'android':
case "android":
this._eventsOfInterest = {
'touchstart': true,
'touchmove': true,
'touchend': true };
"touchstart": true,
"touchmove": true,
"touchend": true };
break;
case 'gonk':
case "gonk":
this._eventsOfInterest = {
'touchstart': true,
'touchmove': true,
'touchend': true,
'mousedown': false,
'mousemove': false,
'mouseup': false,
'click': false };
"touchstart": true,
"touchmove": true,
"touchend": true,
"mousedown": false,
"mousemove": false,
"mouseup": false,
"click": false };
break;
default:
// Desktop.
this._eventsOfInterest = {
'mousemove': true,
'mousedown': true,
'mouseup': true,
'click': false
"mousemove": true,
"mousedown": true,
"mouseup": true,
"click": false
};
if ('ontouchstart' in Utils.win) {
for (let eventType of ['touchstart', 'touchmove', 'touchend']) {
if ("ontouchstart" in Utils.win) {
for (let eventType of ["touchstart", "touchmove", "touchend"]) {
this._eventsOfInterest[eventType] = true;
}
}
@ -75,16 +75,16 @@ var PointerRelay = { // jshint ignore:line
},
_eventMap: {
'touchstart': 'pointerdown',
'mousedown': 'pointerdown',
'touchmove': 'pointermove',
'mousemove': 'pointermove',
'touchend': 'pointerup',
'mouseup': 'pointerup'
"touchstart": "pointerdown",
"mousedown": "pointerdown",
"touchmove": "pointermove",
"mousemove": "pointermove",
"touchend": "pointerup",
"mouseup": "pointerup"
},
start: function PointerRelay_start(aOnPointerEvent) {
Logger.debug('PointerRelay.start');
Logger.debug("PointerRelay.start");
this.onPointerEvent = aOnPointerEvent;
for (let eventType in this._eventsOfInterest) {
Utils.win.addEventListener(eventType, this, true, true);
@ -92,7 +92,7 @@ var PointerRelay = { // jshint ignore:line
},
stop: function PointerRelay_stop() {
Logger.debug('PointerRelay.stop');
Logger.debug("PointerRelay.stop");
delete this.lastPointerMove;
delete this.onPointerEvent;
for (let eventType in this._eventsOfInterest) {
@ -102,7 +102,7 @@ var PointerRelay = { // jshint ignore:line
handleEvent: function PointerRelay_handleEvent(aEvent) {
// Don't bother with chrome mouse events.
if (Utils.MozBuildApp === 'browser' &&
if (Utils.MozBuildApp === "browser" &&
aEvent.view.top instanceof Ci.nsIDOMChromeWindow) {
return;
}
@ -119,7 +119,7 @@ var PointerRelay = { // jshint ignore:line
target: aEvent.target
}];
if (Utils.widgetToolkit === 'android' &&
if (Utils.widgetToolkit === "android" &&
changedTouches.length === 1 && changedTouches[0].identifier === 1) {
return;
}
@ -154,13 +154,13 @@ var PointerRelay = { // jshint ignore:line
this.PointerAdapter = { // jshint ignore:line
start: function PointerAdapter_start() {
Logger.debug('PointerAdapter.start');
Logger.debug("PointerAdapter.start");
GestureTracker.reset();
PointerRelay.start(this.handleEvent);
},
stop: function PointerAdapter_stop() {
Logger.debug('PointerAdapter.stop');
Logger.debug("PointerAdapter.stop");
PointerRelay.stop();
GestureTracker.reset();
},

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

@ -4,26 +4,26 @@
/* exported Presentation */
'use strict';
"use strict";
const {utils: Cu, interfaces: Ci} = Components;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import('resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Logger', // jshint ignore:line
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'PivotContext', // jshint ignore:line
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'UtteranceGenerator', // jshint ignore:line
'resource://gre/modules/accessibility/OutputGenerator.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'BrailleGenerator', // jshint ignore:line
'resource://gre/modules/accessibility/OutputGenerator.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles', // jshint ignore:line
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'States', // jshint ignore:line
'resource://gre/modules/accessibility/Constants.jsm');
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/accessibility/Utils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Logger", // jshint ignore:line
"resource://gre/modules/accessibility/Utils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PivotContext", // jshint ignore:line
"resource://gre/modules/accessibility/Utils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "UtteranceGenerator", // jshint ignore:line
"resource://gre/modules/accessibility/OutputGenerator.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "BrailleGenerator", // jshint ignore:line
"resource://gre/modules/accessibility/OutputGenerator.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Roles", // jshint ignore:line
"resource://gre/modules/accessibility/Constants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "States", // jshint ignore:line
"resource://gre/modules/accessibility/Constants.jsm");
this.EXPORTED_SYMBOLS = ['Presentation']; // jshint ignore:line
this.EXPORTED_SYMBOLS = ["Presentation"]; // jshint ignore:line
/**
* The interface for all presenter classes. A presenter could be, for example,
@ -35,7 +35,7 @@ Presenter.prototype = {
/**
* The type of presenter. Used for matching it with the appropriate output method.
*/
type: 'Base',
type: "Base",
/**
* The virtual cursor's position changed.
@ -145,7 +145,7 @@ function VisualPresenter() {}
VisualPresenter.prototype = Object.create(Presenter.prototype);
VisualPresenter.prototype.type = 'Visual';
VisualPresenter.prototype.type = "Visual";
/**
* The padding in pixels between the object and the highlight border.
@ -168,7 +168,7 @@ VisualPresenter.prototype.viewportChanged =
return {
type: this.type,
details: {
eventType: 'viewport-change',
eventType: "viewport-change",
bounds: bounds,
padding: this.BORDER_PADDING
}
@ -197,13 +197,13 @@ VisualPresenter.prototype.pivotChanged =
return {
type: this.type,
details: {
eventType: 'vc-change',
eventType: "vc-change",
bounds: bounds,
padding: this.BORDER_PADDING
}
};
} catch (e) {
Logger.logException(e, 'Failed to get bounds');
Logger.logException(e, "Failed to get bounds");
return null;
}
};
@ -215,8 +215,8 @@ VisualPresenter.prototype.tabSelected =
VisualPresenter.prototype.tabStateChanged =
function VisualPresenter_tabStateChanged(aDocObj, aPageState) {
if (aPageState == 'newdoc') {
return {type: this.type, details: {eventType: 'tabstate-change'}};
if (aPageState == "newdoc") {
return {type: this.type, details: {eventType: "tabstate-change"}};
}
return null;
@ -229,7 +229,7 @@ function AndroidPresenter() {}
AndroidPresenter.prototype = Object.create(Presenter.prototype);
AndroidPresenter.prototype.type = 'Android';
AndroidPresenter.prototype.type = "Android";
// Android AccessibilityEvent type constants.
AndroidPresenter.prototype.ANDROID_VIEW_CLICKED = 0x01;
@ -441,7 +441,7 @@ AndroidPresenter.prototype.editingModeChanged =
AndroidPresenter.prototype.announce =
function AndroidPresenter_announce(aAnnouncement) {
let localizedAnnouncement = Utils.localize(aAnnouncement).join(' ');
let localizedAnnouncement = Utils.localize(aAnnouncement).join(" ");
return {
type: this.type,
details: [{
@ -469,7 +469,7 @@ AndroidPresenter.prototype.noMove =
details: [
{ eventType: this.ANDROID_VIEW_ACCESSIBILITY_FOCUSED,
exitView: aMoveMethod,
text: ['']
text: [""]
}]
};
};
@ -481,10 +481,10 @@ function B2GPresenter() {}
B2GPresenter.prototype = Object.create(Presenter.prototype);
B2GPresenter.prototype.type = 'B2G';
B2GPresenter.prototype.type = "B2G";
B2GPresenter.prototype.keyboardEchoSetting =
new PrefCache('accessibility.accessfu.keyboard_echo');
new PrefCache("accessibility.accessfu.keyboard_echo");
B2GPresenter.prototype.NO_ECHO = 0;
B2GPresenter.prototype.CHARACTER_ECHO = 1;
B2GPresenter.prototype.WORD_ECHO = 2;
@ -500,8 +500,8 @@ B2GPresenter.prototype.PIVOT_CHANGE_HAPTIC_PATTERN = [40];
* Pivot move reasons.
* @type {Array}
*/
B2GPresenter.prototype.pivotChangedReasons = ['none', 'next', 'prev', 'first',
'last', 'text', 'point'];
B2GPresenter.prototype.pivotChangedReasons = ["none", "next", "prev", "first",
"last", "text", "point"];
B2GPresenter.prototype.pivotChanged =
function B2GPresenter_pivotChanged(aContext, aReason, aIsUserInput) {
@ -512,7 +512,7 @@ B2GPresenter.prototype.pivotChanged =
return {
type: this.type,
details: {
eventType: 'vc-change',
eventType: "vc-change",
data: UtteranceGenerator.genForContext(aContext),
options: {
pattern: this.PIVOT_CHANGE_HAPTIC_PATTERN,
@ -530,7 +530,7 @@ B2GPresenter.prototype.nameChanged =
return {
type: this.type,
details: {
eventType: 'name-change',
eventType: "name-change",
data: aAccessible.name,
options: {enqueue: aIsPolite}
}
@ -548,7 +548,7 @@ B2GPresenter.prototype.valueChanged =
return {
type: this.type,
details: {
eventType: 'value-change',
eventType: "value-change",
data: aAccessible.value,
options: {enqueue: aIsPolite}
}
@ -558,7 +558,7 @@ B2GPresenter.prototype.valueChanged =
B2GPresenter.prototype.textChanged = function B2GPresenter_textChanged(
aAccessible, aIsInserted, aStart, aLength, aText, aModifiedText) {
let echoSetting = this.keyboardEchoSetting.value;
let text = '';
let text = "";
if (echoSetting == this.CHARACTER_ECHO ||
echoSetting == this.CHARACTER_AND_WORD_ECHO) {
@ -584,7 +584,7 @@ B2GPresenter.prototype.textChanged = function B2GPresenter_textChanged(
return {
type: this.type,
details: {
eventType: 'text-change',
eventType: "text-change",
data: text
}
};
@ -596,7 +596,7 @@ B2GPresenter.prototype.actionInvoked =
return {
type: this.type,
details: {
eventType: 'action',
eventType: "action",
data: UtteranceGenerator.genForAction(aObject, aActionName)
}
};
@ -607,7 +607,7 @@ B2GPresenter.prototype.liveRegion = function B2GPresenter_liveRegion(aContext,
return {
type: this.type,
details: {
eventType: 'liveregion-change',
eventType: "liveregion-change",
data: UtteranceGenerator.genForLiveRegion(aContext, aIsHide,
aModifiedText),
options: {enqueue: aIsPolite}
@ -620,7 +620,7 @@ B2GPresenter.prototype.announce =
return {
type: this.type,
details: {
eventType: 'announcement',
eventType: "announcement",
data: aAnnouncement
}
};
@ -631,7 +631,7 @@ B2GPresenter.prototype.noMove =
return {
type: this.type,
details: {
eventType: 'no-move',
eventType: "no-move",
data: aMoveMethod
}
};
@ -644,7 +644,7 @@ function BraillePresenter() {}
BraillePresenter.prototype = Object.create(Presenter.prototype);
BraillePresenter.prototype.type = 'Braille';
BraillePresenter.prototype.type = "Braille";
BraillePresenter.prototype.pivotChanged =
function BraillePresenter_pivotChanged(aContext) {
@ -656,7 +656,7 @@ BraillePresenter.prototype.pivotChanged =
type: this.type,
details: {
output: Utils.localize(BrailleGenerator.genForContext(aContext)).join(
' '),
" "),
selectionStart: 0,
selectionEnd: 0
}
@ -678,9 +678,9 @@ this.Presentation = { // jshint ignore:line
get presenters() {
delete this.presenters;
let presenterMap = {
'mobile/android': [VisualPresenter, AndroidPresenter],
'b2g': [VisualPresenter, B2GPresenter],
'browser': [VisualPresenter, B2GPresenter, AndroidPresenter]
"mobile/android": [VisualPresenter, AndroidPresenter],
"b2g": [VisualPresenter, B2GPresenter],
"browser": [VisualPresenter, B2GPresenter, AndroidPresenter]
};
this.presenters = presenterMap[Utils.MozBuildApp].map(P => new P());
return this.presenters;

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

@ -4,25 +4,25 @@
/* exported TraversalRules, TraversalHelper */
'use strict';
"use strict";
const Ci = Components.interfaces;
const Cu = Components.utils;
this.EXPORTED_SYMBOLS = ['TraversalRules', 'TraversalHelper']; // jshint ignore:line
this.EXPORTED_SYMBOLS = ["TraversalRules", "TraversalHelper"]; // jshint ignore:line
Cu.import('resource://gre/modules/accessibility/Utils.jsm');
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles', // jshint ignore:line
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Filters', // jshint ignore:line
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'States', // jshint ignore:line
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Prefilters', // jshint ignore:line
'resource://gre/modules/accessibility/Constants.jsm');
Cu.import("resource://gre/modules/accessibility/Utils.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Roles", // jshint ignore:line
"resource://gre/modules/accessibility/Constants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Filters", // jshint ignore:line
"resource://gre/modules/accessibility/Constants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "States", // jshint ignore:line
"resource://gre/modules/accessibility/Constants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Prefilters", // jshint ignore:line
"resource://gre/modules/accessibility/Constants.jsm");
var gSkipEmptyImages = new PrefCache('accessibility.accessfu.skip_empty_images');
var gSkipEmptyImages = new PrefCache("accessibility.accessfu.skip_empty_images");
function BaseTraversalRule(aRoles, aMatchFunc, aPreFilter, aContainerRule) {
this._explicitMatchRoles = new Set(aRoles);
@ -47,12 +47,11 @@ 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)) ?
Filters.MATCH | Filters.IGNORE_SUBTREE : Filters.IGNORE;
Filters.MATCH | Filters.IGNORE_SUBTREE : Filters.IGNORE;
}
let matchResult =
@ -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(
@ -232,13 +230,13 @@ this.TraversalRules = { // jshint ignore:line
}
let matchedRole = Utils.matchRoles(aAccessible, [
'banner',
'complementary',
'contentinfo',
'main',
'navigation',
'search',
'region'
"banner",
"complementary",
"contentinfo",
"main",
"navigation",
"search",
"region"
]);
return matchedRole ? Filters.MATCH : Filters.IGNORE;
@ -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)) {
@ -361,7 +357,7 @@ this.TraversalRules = { // jshint ignore:line
Roles.SWITCH /* A type of checkbox that represents on/off values */]),
_shouldSkipImage: function _shouldSkipImage(aAccessible) {
if (gSkipEmptyImages.value && aAccessible.name === '') {
if (gSkipEmptyImages.value && aAccessible.name === "") {
return Filters.IGNORE;
}
return Filters.MATCH;
@ -409,9 +405,9 @@ this.TraversalHelper = {
}
return moved;
} else {
return aVirtualCursor[aMethod](rule);
}
return aVirtualCursor[aMethod](rule);
}
};

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

@ -4,41 +4,41 @@
/* exported Utils, Logger, PivotContext, PrefCache */
'use strict';
"use strict";
const {classes: Cc, utils: Cu, interfaces: Ci} = Components;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Services', // jshint ignore:line
'resource://gre/modules/Services.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Rect', // jshint ignore:line
'resource://gre/modules/Geometry.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles', // jshint ignore:line
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Events', // jshint ignore:line
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Relations', // jshint ignore:line
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'States', // jshint ignore:line
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'PluralForm', // jshint ignore:line
'resource://gre/modules/PluralForm.jsm');
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services", // jshint ignore:line
"resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Rect", // jshint ignore:line
"resource://gre/modules/Geometry.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Roles", // jshint ignore:line
"resource://gre/modules/accessibility/Constants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Events", // jshint ignore:line
"resource://gre/modules/accessibility/Constants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Relations", // jshint ignore:line
"resource://gre/modules/accessibility/Constants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "States", // jshint ignore:line
"resource://gre/modules/accessibility/Constants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm", // jshint ignore:line
"resource://gre/modules/PluralForm.jsm");
this.EXPORTED_SYMBOLS = ['Utils', 'Logger', 'PivotContext', 'PrefCache']; // jshint ignore:line
this.EXPORTED_SYMBOLS = ["Utils", "Logger", "PivotContext", "PrefCache"]; // jshint ignore:line
this.Utils = { // jshint ignore:line
_buildAppMap: {
'{3c2e2abc-06d4-11e1-ac3b-374f68613e61}': 'b2g',
'{d1bfe7d9-c01e-4237-998b-7b5f960a4314}': 'graphene',
'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}': 'browser',
'{aa3c5121-dab2-40e2-81ca-7ea25febc110}': 'mobile/android',
'{a23983c0-fd0e-11dc-95ff-0800200c9a66}': 'mobile/xul'
"{3c2e2abc-06d4-11e1-ac3b-374f68613e61}": "b2g",
"{d1bfe7d9-c01e-4237-998b-7b5f960a4314}": "graphene",
"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}": "browser",
"{aa3c5121-dab2-40e2-81ca-7ea25febc110}": "mobile/android",
"{a23983c0-fd0e-11dc-95ff-0800200c9a66}": "mobile/xul"
},
init: function Utils_init(aWindow) {
if (this._win) {
// XXX: only supports attaching to one window now.
throw new Error('Only one top-level window could used with AccessFu');
throw new Error("Only one top-level window could used with AccessFu");
}
this._win = Cu.getWeakReference(aWindow);
},
@ -68,7 +68,7 @@ this.Utils = { // jshint ignore:line
get AccService() {
if (!this._AccService) {
this._AccService = Cc['@mozilla.org/accessibilityService;1'].
this._AccService = Cc["@mozilla.org/accessibilityService;1"].
getService(Ci.nsIAccessibilityService);
}
@ -103,16 +103,16 @@ this.Utils = { // jshint ignore:line
get ScriptName() {
if (!this._ScriptName) {
this._ScriptName =
(Services.appinfo.processType == 2) ? 'AccessFuContent' : 'AccessFu';
(Services.appinfo.processType == 2) ? "AccessFuContent" : "AccessFu";
}
return this._ScriptName;
},
get AndroidSdkVersion() {
if (!this._AndroidSdkVersion) {
if (Services.appinfo.OS == 'Android') {
if (Services.appinfo.OS == "Android") {
this._AndroidSdkVersion = Services.sysinfo.getPropertyAsInt32(
'version');
"version");
} else {
// Most useful in desktop debugging.
this._AndroidSdkVersion = 16;
@ -131,11 +131,11 @@ this.Utils = { // jshint ignore:line
return null;
}
switch (this.MozBuildApp) {
case 'mobile/android':
case "mobile/android":
return this.win.BrowserApp;
case 'browser':
case "browser":
return this.win.gBrowser;
case 'b2g':
case "b2g":
return this.win.shell;
default:
return null;
@ -146,7 +146,7 @@ this.Utils = { // jshint ignore:line
if (!this.BrowserApp) {
return null;
}
if (this.MozBuildApp == 'b2g') {
if (this.MozBuildApp == "b2g") {
return this.BrowserApp.contentBrowser;
}
return this.BrowserApp.selectedBrowser;
@ -164,7 +164,7 @@ this.Utils = { // jshint ignore:line
for (let i = 0; i < mm.childCount; i++) {
let childMM = mm.getChildAt(i);
if ('sendAsyncMessage' in childMM) {
if ("sendAsyncMessage" in childMM) {
messageManagers.add(childMM);
} else {
collectLeafMessageManagers(childMM);
@ -177,14 +177,14 @@ this.Utils = { // jshint ignore:line
let document = this.CurrentContentDoc;
if (document) {
if (document.location.host === 'b2g') {
if (document.location.host === "b2g") {
// The document is a b2g app chrome (ie. Mulet).
let contentBrowser = this.win.content.shell.contentBrowser;
messageManagers.add(this.getMessageManager(contentBrowser));
document = contentBrowser.contentDocument;
}
let remoteframes = document.querySelectorAll('iframe');
let remoteframes = document.querySelectorAll("iframe");
for (let i = 0; i < remoteframes.length; ++i) {
let mm = this.getMessageManager(remoteframes[i]);
@ -217,13 +217,13 @@ this.Utils = { // jshint ignore:line
get stringBundle() {
delete this.stringBundle;
let bundle = Services.strings.createBundle(
'chrome://global/locale/AccessFu.properties');
"chrome://global/locale/AccessFu.properties");
this.stringBundle = {
get: function stringBundle_get(aDetails = {}) {
if (!aDetails || typeof aDetails === 'string') {
if (!aDetails || typeof aDetails === "string") {
return aDetails;
}
let str = '';
let str = "";
let string = aDetails.string;
if (!string) {
return str;
@ -238,10 +238,10 @@ this.Utils = { // jshint ignore:line
}
if (count) {
str = PluralForm.get(count, str);
str = str.replace('#1', count);
str = str.replace("#1", count);
}
} catch (e) {
Logger.debug('Failed to get a string from a bundle for', string);
Logger.debug("Failed to get a string from a bundle for", string);
} finally {
return str;
}
@ -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) {
@ -364,7 +364,7 @@ this.Utils = { // jshint ignore:line
try {
acc = acc.parent;
} catch (x) {
Logger.debug('Failed to get parent:', x);
Logger.debug("Failed to get parent:", x);
acc = null;
}
}
@ -376,7 +376,7 @@ this.Utils = { // jshint ignore:line
// Need to account for aria-hidden, so can't just check for INVISIBLE
// state.
let hidden = Utils.getAttributes(aAccessible).hidden;
return hidden && hidden === 'true';
return hidden && hidden === "true";
},
visibleChildCount: function visibleChildCount(aAccessible) {
@ -390,7 +390,7 @@ this.Utils = { // jshint ignore:line
},
inHiddenSubtree: function inHiddenSubtree(aAccessible) {
for (let acc=aAccessible; acc; acc=acc.parent) {
for (let acc = aAccessible; acc; acc = acc.parent) {
if (this.isHidden(acc)) {
return true;
}
@ -418,7 +418,7 @@ this.Utils = { // jshint ignore:line
},
matchAttributeValue: function matchAttributeValue(aAttributeValue, values) {
let attrSet = new Set(aAttributeValue.split(' '));
let attrSet = new Set(aAttributeValue.split(" "));
for (let value of values) {
if (attrSet.has(value)) {
return value;
@ -428,34 +428,34 @@ this.Utils = { // jshint ignore:line
getLandmarkName: function getLandmarkName(aAccessible) {
return this.matchRoles(aAccessible, [
'banner',
'complementary',
'contentinfo',
'main',
'navigation',
'search'
"banner",
"complementary",
"contentinfo",
"main",
"navigation",
"search"
]);
},
getMathRole: function getMathRole(aAccessible) {
return this.matchRoles(aAccessible, [
'base',
'close-fence',
'denominator',
'numerator',
'open-fence',
'overscript',
'presubscript',
'presuperscript',
'root-index',
'subscript',
'superscript',
'underscript'
"base",
"close-fence",
"denominator",
"numerator",
"open-fence",
"overscript",
"presubscript",
"presuperscript",
"root-index",
"subscript",
"superscript",
"underscript"
]);
},
matchRoles: function matchRoles(aAccessible, aRoles) {
let roles = this.getAttributes(aAccessible)['xml-roles'];
let roles = this.getAttributes(aAccessible)["xml-roles"];
if (!roles) {
return;
}
@ -481,7 +481,7 @@ this.Utils = { // jshint ignore:line
isListItemDecorator: function isListItemDecorator(aStaticText,
aExcludeOrdered) {
let parent = aStaticText.parent;
if (aExcludeOrdered && parent.parent.DOMNode.nodeName === 'OL') {
if (aExcludeOrdered && parent.parent.DOMNode.nodeName === "OL") {
return false;
}
@ -493,7 +493,7 @@ this.Utils = { // jshint ignore:line
let details = {
type: aType,
details: JSON.stringify(
typeof aDetails === 'string' ? { eventType: aDetails } : aDetails)
typeof aDetails === "string" ? { eventType: aDetails } : aDetails)
};
let window = this.win;
let shell = window.shell || window.content.shell;
@ -516,7 +516,7 @@ this.Utils = { // jshint ignore:line
if (aAccessible.role === Roles.KEY) {
return true;
}
let quick_activate = this.getAttributes(aAccessible)['moz-quick-activate'];
let quick_activate = this.getAttributes(aAccessible)["moz-quick-activate"];
return quick_activate && JSON.parse(quick_activate);
}
};
@ -542,7 +542,7 @@ State.prototype = {
for (let i = 0; i < statesArray.length; i++) {
statesArray[i] = stateStrings.item(i);
}
return '[' + statesArray.join(', ') + ']';
return "[" + statesArray.join(", ") + "]";
}
};
@ -552,7 +552,7 @@ this.Logger = { // jshint ignore:line
INFO: 1,
WARNING: 2,
ERROR: 3,
_LEVEL_NAMES: ['GESTURE', 'DEBUG', 'INFO', 'WARNING', 'ERROR'],
_LEVEL_NAMES: ["GESTURE", "DEBUG", "INFO", "WARNING", "ERROR"],
logLevel: 1, // INFO;
@ -564,9 +564,9 @@ this.Logger = { // jshint ignore:line
}
let args = Array.prototype.slice.call(arguments, 1);
let message = (typeof(args[0]) === 'function' ? args[0]() : args).join(' ');
message = '[' + Utils.ScriptName + '] ' + this._LEVEL_NAMES[aLogLevel + 1] +
' ' + message + '\n';
let message = (typeof(args[0]) === "function" ? args[0]() : args).join(" ");
message = "[" + Utils.ScriptName + "] " + this._LEVEL_NAMES[aLogLevel + 1] +
" " + message + "\n";
dump(message);
// Note: used for testing purposes. If |this.test| is true, also log to
// the console service.
@ -605,26 +605,26 @@ this.Logger = { // jshint ignore:line
},
logException: function logException(
aException, aErrorMessage = 'An exception has occured') {
aException, aErrorMessage = "An exception has occured") {
try {
let stackMessage = '';
let stackMessage = "";
if (aException.stack) {
stackMessage = ' ' + aException.stack.replace(/\n/g, '\n ');
stackMessage = " " + aException.stack.replace(/\n/g, "\n ");
} else if (aException.location) {
let frame = aException.location;
let stackLines = [];
while (frame && frame.lineNumber) {
stackLines.push(
' ' + frame.name + '@' + frame.filename + ':' + frame.lineNumber);
" " + frame.name + "@" + frame.filename + ":" + frame.lineNumber);
frame = frame.caller;
}
stackMessage = stackLines.join('\n');
stackMessage = stackLines.join("\n");
} else {
stackMessage =
'(' + aException.fileName + ':' + aException.lineNumber + ')';
"(" + aException.fileName + ":" + aException.lineNumber + ")";
}
this.error(aErrorMessage + ':\n ' +
aException.message + '\n' +
this.error(aErrorMessage + ":\n " +
aException.message + "\n" +
stackMessage);
} catch (x) {
this.error(x);
@ -633,14 +633,14 @@ this.Logger = { // jshint ignore:line
accessibleToString: function accessibleToString(aAccessible) {
if (!aAccessible) {
return '[ null ]';
return "[ null ]";
}
try {
return '[ ' + Utils.AccService.getStringRole(aAccessible.role) +
' | ' + aAccessible.name + ' ]';
return "[ " + Utils.AccService.getStringRole(aAccessible.role) +
" | " + aAccessible.name + " ]";
} catch (x) {
return '[ defunct ]';
return "[ defunct ]";
}
},
@ -651,7 +651,7 @@ this.Logger = { // jshint ignore:line
let stateStrings = event.isExtraState ?
Utils.AccService.getStringStates(0, event.state) :
Utils.AccService.getStringStates(event.state, 0);
str += ' (' + stateStrings.item(0) + ')';
str += " (" + stateStrings.item(0) + ")";
}
if (aEvent.eventType == Events.VIRTUALCURSOR_CHANGED) {
@ -659,8 +659,8 @@ this.Logger = { // jshint ignore:line
Ci.nsIAccessibleVirtualCursorChangeEvent);
let pivot = aEvent.accessible.QueryInterface(
Ci.nsIAccessibleDocument).virtualCursor;
str += ' (' + this.accessibleToString(event.oldAccessible) + ' -> ' +
this.accessibleToString(pivot.position) + ')';
str += " (" + this.accessibleToString(event.oldAccessible) + " -> " +
this.accessibleToString(pivot.position) + ")";
}
return str;
@ -680,13 +680,13 @@ this.Logger = { // jshint ignore:line
_dumpTreeInternal:
function _dumpTreeInternal(aLogLevel, aAccessible, aIndent) {
let indentStr = '';
let indentStr = "";
for (let i = 0; i < aIndent; i++) {
indentStr += ' ';
indentStr += " ";
}
this.log(aLogLevel, indentStr,
this.accessibleToString(aAccessible),
'(' + this.statesToString(aAccessible) + ')');
"(" + this.statesToString(aAccessible) + ")");
for (let i = 0; i < aAccessible.childCount; i++) {
this._dumpTreeInternal(aLogLevel, aAccessible.getChildAt(i),
aIndent + 1);
@ -754,7 +754,7 @@ PivotContext.prototype = {
// affect the offsets of links yet to be processed.
for (let i = hypertextAcc.linkCount - 1; i >= 0; i--) {
let link = hypertextAcc.getLinkAt(i);
let linkText = '';
let linkText = "";
if (link instanceof Ci.nsIAccessibleText) {
linkText = link.QueryInterface(Ci.nsIAccessibleText).
getText(0,
@ -763,7 +763,7 @@ PivotContext.prototype = {
let start = link.startIndex;
let end = link.endIndex;
for (let offset of ['startOffset', 'endOffset']) {
for (let offset of ["startOffset", "endOffset"]) {
if (this[offset] >= end) {
result[offset] += linkText.length - (end - start);
}
@ -792,7 +792,7 @@ PivotContext.prototype = {
}
} catch (x) {
// A defunct accessible will raise an exception geting parent.
Logger.debug('Failed to get parent:', x);
Logger.debug("Failed to get parent:", x);
}
return ancestry.reverse();
},
@ -879,13 +879,13 @@ PivotContext.prototype = {
get interactionHints() {
let hints = [];
this.newAncestry.concat(this.accessible).reverse().forEach(aAccessible => {
let hint = Utils.getAttributes(aAccessible)['moz-hint'];
let hint = Utils.getAttributes(aAccessible)["moz-hint"];
if (hint) {
hints.push(hint);
} else if (aAccessible.actionCount > 0) {
hints.push({
string: Utils.AccService.getStringRole(
aAccessible.role).replace(/\s/g, '') + '-hint'
aAccessible.role).replace(/\s/g, "") + "-hint"
});
}
});
@ -946,7 +946,7 @@ PivotContext.prototype = {
if (!cellInfo.current) {
Logger.warning(aAccessible,
'does not support nsIAccessibleTableCell interface.');
"does not support nsIAccessibleTableCell interface.");
this._cells.set(domNode, null);
return null;
}
@ -1058,7 +1058,7 @@ PrefCache.prototype = {
observe: function observe(aSubject) {
this.value = this._getValue(aSubject.QueryInterface(Ci.nsIPrefBranch));
Logger.info('pref changed', this.name, this.value);
Logger.info("pref changed", this.name, this.value);
if (this.callback) {
try {
this.callback(this.name, this.value, false);

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

@ -7,23 +7,23 @@
var Ci = Components.interfaces;
var Cu = Components.utils;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Logger',
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Presentation',
'resource://gre/modules/accessibility/Presentation.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Utils',
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'EventManager',
'resource://gre/modules/accessibility/EventManager.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'ContentControl',
'resource://gre/modules/accessibility/ContentControl.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'States',
'resource://gre/modules/accessibility/Constants.jsm');
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Logger",
"resource://gre/modules/accessibility/Utils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Presentation",
"resource://gre/modules/accessibility/Presentation.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Utils",
"resource://gre/modules/accessibility/Utils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "EventManager",
"resource://gre/modules/accessibility/EventManager.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ContentControl",
"resource://gre/modules/accessibility/ContentControl.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Roles",
"resource://gre/modules/accessibility/Constants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "States",
"resource://gre/modules/accessibility/Constants.jsm");
Logger.info('content-script.js', content.document.location);
Logger.info("content-script.js", content.document.location);
var eventManager = null;
var contentControl = null;
@ -31,7 +31,7 @@ var contentControl = null;
function forwardToParent(aMessage) {
// XXX: This is a silly way to make a deep copy
let newJSON = JSON.parse(JSON.stringify(aMessage.json));
newJSON.origin = 'child';
newJSON.origin = "child";
sendAsyncMessage(aMessage.name, newJSON);
}
@ -43,8 +43,8 @@ function forwardToChild(aMessage, aListener, aVCPosition) {
}
Logger.debug(() => {
return ['forwardToChild', Logger.accessibleToString(acc),
aMessage.name, JSON.stringify(aMessage.json, null, ' ')];
return ["forwardToChild", Logger.accessibleToString(acc),
aMessage.name, JSON.stringify(aMessage.json, null, " ")];
});
let mm = Utils.getMessageManager(acc.DOMNode);
@ -55,7 +55,7 @@ function forwardToChild(aMessage, aListener, aVCPosition) {
// XXX: This is a silly way to make a deep copy
let newJSON = JSON.parse(JSON.stringify(aMessage.json));
newJSON.origin = 'parent';
newJSON.origin = "parent";
if (Utils.isContentProcess) {
// XXX: OOP content's screen offset is 0,
// so we remove the real screen offset here.
@ -71,8 +71,8 @@ function activateContextMenu(aMessage) {
if (!forwardToChild(aMessage, activateContextMenu, position)) {
let center = Utils.getBounds(position, true).center();
let evt = content.document.createEvent('HTMLEvents');
evt.initEvent('contextmenu', true, true);
let evt = content.document.createEvent("HTMLEvents");
evt.initEvent("contextmenu", true, true);
evt.clientX = center.x;
evt.clientY = center.y;
position.DOMNode.dispatchEvent(evt);
@ -83,14 +83,14 @@ function presentCaretChange(aText, aOldOffset, aNewOffset) {
if (aOldOffset !== aNewOffset) {
let msg = Presentation.textSelectionChanged(aText, aNewOffset, aNewOffset,
aOldOffset, aOldOffset, true);
sendAsyncMessage('AccessFu:Present', msg);
sendAsyncMessage("AccessFu:Present", msg);
}
}
function scroll(aMessage) {
let position = Utils.getVirtualCursor(content.document).position;
if (!forwardToChild(aMessage, scroll, position)) {
sendAsyncMessage('AccessFu:DoScroll',
sendAsyncMessage("AccessFu:DoScroll",
{ bounds: Utils.getBounds(position, true),
page: aMessage.json.page,
horizontal: aMessage.json.horizontal });
@ -98,18 +98,18 @@ function scroll(aMessage) {
}
addMessageListener(
'AccessFu:Start',
"AccessFu:Start",
function(m) {
if (m.json.logLevel) {
Logger.logLevel = Logger[m.json.logLevel];
}
Logger.debug('AccessFu:Start');
Logger.debug("AccessFu:Start");
if (m.json.buildApp)
Utils.MozBuildApp = m.json.buildApp;
addMessageListener('AccessFu:ContextMenu', activateContextMenu);
addMessageListener('AccessFu:Scroll', scroll);
addMessageListener("AccessFu:ContextMenu", activateContextMenu);
addMessageListener("AccessFu:Scroll", scroll);
if (!contentControl) {
contentControl = new ContentControl(this);
@ -125,7 +125,7 @@ addMessageListener(
function contentStarted() {
let accDoc = Utils.AccService.getAccessibleFor(content.document);
if (accDoc && !Utils.getState(accDoc).contains(States.BUSY)) {
sendAsyncMessage('AccessFu:ContentStarted');
sendAsyncMessage("AccessFu:ContentStarted");
} else {
content.setTimeout(contentStarted, 0);
}
@ -139,15 +139,15 @@ addMessageListener(
});
addMessageListener(
'AccessFu:Stop',
"AccessFu:Stop",
function(m) {
Logger.debug('AccessFu:Stop');
Logger.debug("AccessFu:Stop");
removeMessageListener('AccessFu:ContextMenu', activateContextMenu);
removeMessageListener('AccessFu:Scroll', scroll);
removeMessageListener("AccessFu:ContextMenu", activateContextMenu);
removeMessageListener("AccessFu:Scroll", scroll);
eventManager.stop();
contentControl.stop();
});
sendAsyncMessage('AccessFu:Ready');
sendAsyncMessage("AccessFu:Ready");

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

@ -26,7 +26,7 @@ async function testContentBounds(browser, acc) {
}
async function runTests(browser, accDoc) {
loadFrameScripts(browser, { name: 'layout.js', dir: MOCHITESTS_DIR });
loadFrameScripts(browser, { name: "layout.js", dir: MOCHITESTS_DIR });
let p1 = findAccessibleChildByID(accDoc, "p1");
let p2 = findAccessibleChildByID(accDoc, "p2");

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

@ -16,7 +16,7 @@ async function runTests(browser, accDoc) {
COORDTYPE_SCREEN_RELATIVE);
}
loadFrameScripts(browser, { name: 'layout.js', dir: MOCHITESTS_DIR });
loadFrameScripts(browser, { name: "layout.js", dir: MOCHITESTS_DIR });
testTextNode("p1");
testTextNode("p2");

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

@ -2,15 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
// Load the shared-head file first.
/* import-globals-from ../shared-head.js */
Services.scriptloader.loadSubScript(
'chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js',
"chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js",
this);
// Loading and common.js from accessible/tests/mochitest/ for all tests, as
// well as events.js.
loadScripts({ name: 'common.js', dir: MOCHITESTS_DIR },
{ name: 'layout.js', dir: MOCHITESTS_DIR }, 'events.js');
loadScripts({ name: "common.js", dir: MOCHITESTS_DIR },
{ name: "layout.js", dir: MOCHITESTS_DIR }, "events.js");

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

@ -2,16 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
add_task(async function () {
add_task(async function() {
// Create a11y service.
let a11yInit = initPromise();
let accService = Cc['@mozilla.org/accessibilityService;1'].getService(
let accService = Cc["@mozilla.org/accessibilityService;1"].getService(
Ci.nsIAccessibilityService);
await a11yInit;
ok(accService, 'Service initialized');
ok(accService, "Service initialized");
// Accessible object reference will live longer than the scope of this
// function.
@ -24,7 +24,7 @@ add_task(async function () {
}
}, 10);
});
ok(acc, 'Accessible object is created');
ok(acc, "Accessible object is created");
let canShutdown = false;
// This promise will resolve only if canShutdown flag is set to true. If
@ -32,10 +32,10 @@ add_task(async function () {
// down, the promise will reject.
let a11yShutdown = new Promise((resolve, reject) =>
shutdownPromise().then(flag => canShutdown ? resolve() :
reject('Accessible service was shut down incorrectly')));
reject("Accessible service was shut down incorrectly")));
accService = null;
ok(!accService, 'Service is removed');
ok(!accService, "Service is removed");
// Force garbage collection that should not trigger shutdown because there is
// a reference to an accessible object.
@ -47,7 +47,7 @@ add_task(async function () {
canShutdown = true;
// Remove a reference to an accessible object.
acc = null;
ok(!acc, 'Accessible object is removed');
ok(!acc, "Accessible object is removed");
// Force garbage collection that should now trigger shutdown.
forceGC();

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

@ -2,21 +2,21 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
add_task(async function () {
add_task(async function() {
// Create a11y service.
let a11yInit = initPromise();
let accService = Cc['@mozilla.org/accessibilityService;1'].getService(
let accService = Cc["@mozilla.org/accessibilityService;1"].getService(
Ci.nsIAccessibilityService);
await a11yInit;
ok(accService, 'Service initialized');
ok(accService, "Service initialized");
// Accessible document reference will live longer than the scope of this
// function.
let docAcc = accService.getAccessibleFor(document);
ok(docAcc, 'Accessible document is created');
ok(docAcc, "Accessible document is created");
let canShutdown = false;
// This promise will resolve only if canShutdown flag is set to true. If
@ -24,10 +24,10 @@ add_task(async function () {
// down, the promise will reject.
let a11yShutdown = new Promise((resolve, reject) =>
shutdownPromise().then(flag => canShutdown ? resolve() :
reject('Accessible service was shut down incorrectly')));
reject("Accessible service was shut down incorrectly")));
accService = null;
ok(!accService, 'Service is removed');
ok(!accService, "Service is removed");
// Force garbage collection that should not trigger shutdown because there is
// a reference to an accessible document.
@ -39,7 +39,7 @@ add_task(async function () {
canShutdown = true;
// Remove a reference to an accessible document.
docAcc = null;
ok(!docAcc, 'Accessible document is removed');
ok(!docAcc, "Accessible document is removed");
// Force garbage collection that should now trigger shutdown.
forceGC();

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

@ -2,19 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
add_task(async function () {
add_task(async function() {
// Create a11y service.
let a11yInit = initPromise();
let accService = Cc['@mozilla.org/accessibilityService;1'].getService(
let accService = Cc["@mozilla.org/accessibilityService;1"].getService(
Ci.nsIAccessibilityService);
await a11yInit;
ok(accService, 'Service initialized');
ok(accService, "Service initialized");
let docAcc = accService.getAccessibleFor(document);
ok(docAcc, 'Accessible document is created');
ok(docAcc, "Accessible document is created");
// Accessible object reference will live longer than the scope of this
// function.
@ -27,7 +27,7 @@ add_task(async function () {
}
}, 10);
});
ok(acc, 'Accessible object is created');
ok(acc, "Accessible object is created");
let canShutdown = false;
// This promise will resolve only if canShutdown flag is set to true. If
@ -35,10 +35,10 @@ add_task(async function () {
// down, the promise will reject.
let a11yShutdown = new Promise((resolve, reject) =>
shutdownPromise().then(flag => canShutdown ? resolve() :
reject('Accessible service was shut down incorrectly')));
reject("Accessible service was shut down incorrectly")));
accService = null;
ok(!accService, 'Service is removed');
ok(!accService, "Service is removed");
// Force garbage collection that should not trigger shutdown because there are
// references to accessible objects.
@ -48,7 +48,7 @@ add_task(async function () {
// Remove a reference to an accessible object.
acc = null;
ok(!acc, 'Accessible object is removed');
ok(!acc, "Accessible object is removed");
// Force garbage collection that should not trigger shutdown because there is
// a reference to an accessible document.
forceGC();
@ -59,7 +59,7 @@ add_task(async function () {
canShutdown = true;
// Remove a reference to an accessible document.
docAcc = null;
ok(!docAcc, 'Accessible document is removed');
ok(!docAcc, "Accessible document is removed");
// Force garbage collection that should now trigger shutdown.
forceGC();

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

@ -2,19 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
add_task(async function () {
add_task(async function() {
// Create a11y service.
let a11yInit = initPromise();
let accService = Cc['@mozilla.org/accessibilityService;1'].getService(
let accService = Cc["@mozilla.org/accessibilityService;1"].getService(
Ci.nsIAccessibilityService);
await a11yInit;
ok(accService, 'Service initialized');
ok(accService, "Service initialized");
let docAcc = accService.getAccessibleFor(document);
ok(docAcc, 'Accessible document is created');
ok(docAcc, "Accessible document is created");
// Accessible object reference will live longer than the scope of this
// function.
@ -27,7 +27,7 @@ add_task(async function () {
}
}, 10);
});
ok(acc, 'Accessible object is created');
ok(acc, "Accessible object is created");
let canShutdown = false;
// This promise will resolve only if canShutdown flag is set to true. If
@ -35,10 +35,10 @@ add_task(async function () {
// down, the promise will reject.
let a11yShutdown = new Promise((resolve, reject) =>
shutdownPromise().then(flag => canShutdown ? resolve() :
reject('Accessible service was shut down incorrectly')));
reject("Accessible service was shut down incorrectly")));
accService = null;
ok(!accService, 'Service is removed');
ok(!accService, "Service is removed");
// Force garbage collection that should not trigger shutdown because there are
// references to accessible objects.
@ -48,7 +48,7 @@ add_task(async function () {
// Remove a reference to an accessible document.
docAcc = null;
ok(!docAcc, 'Accessible document is removed');
ok(!docAcc, "Accessible document is removed");
// Force garbage collection that should not trigger shutdown because there is
// a reference to an accessible object.
forceGC();
@ -59,7 +59,7 @@ add_task(async function () {
canShutdown = true;
// Remove a reference to an accessible object.
acc = null;
ok(!acc, 'Accessible object is removed');
ok(!acc, "Accessible object is removed");
// Force garbage collection that should now trigger shutdown.
forceGC();

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

@ -2,18 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
add_task(async function () {
add_task(async function() {
// Making sure that the e10s is enabled on Windows for testing.
await setE10sPrefs();
let docLoaded = waitForEvent(
Ci.nsIAccessibleEvent.EVENT_DOCUMENT_LOAD_COMPLETE, 'body');
Ci.nsIAccessibleEvent.EVENT_DOCUMENT_LOAD_COMPLETE, "body");
let a11yInit = initPromise();
let accService = Cc['@mozilla.org/accessibilityService;1'].getService(
let accService = Cc["@mozilla.org/accessibilityService;1"].getService(
Ci.nsIAccessibilityService);
ok(accService, 'Service initialized');
ok(accService, "Service initialized");
await a11yInit;
await BrowserTestUtils.withNewTab({
@ -29,22 +29,22 @@ add_task(async function () {
}, async function(browser) {
let docLoadedEvent = await docLoaded;
let docAcc = docLoadedEvent.accessibleDocument;
ok(docAcc, 'Accessible document proxy is created');
ok(docAcc, "Accessible document proxy is created");
// Remove unnecessary dangling references
docLoaded = null;
docLoadedEvent = null;
forceGC();
let acc = docAcc.getChildAt(0);
ok(acc, 'Accessible proxy is created');
ok(acc, "Accessible proxy is created");
let canShutdown = false;
let a11yShutdown = new Promise((resolve, reject) =>
shutdownPromise().then(flag => canShutdown ? resolve() :
reject('Accessible service was shut down incorrectly')));
reject("Accessible service was shut down incorrectly")));
accService = null;
ok(!accService, 'Service is removed');
ok(!accService, "Service is removed");
// Force garbage collection that should not trigger shutdown because there
// is a reference to an accessible proxy.
forceGC();
@ -53,7 +53,7 @@ add_task(async function () {
// Remove a reference to an accessible proxy.
acc = null;
ok(!acc, 'Accessible proxy is removed');
ok(!acc, "Accessible proxy is removed");
// Force garbage collection that should not trigger shutdown because there is
// a reference to an accessible document proxy.
forceGC();
@ -64,7 +64,7 @@ add_task(async function () {
canShutdown = true;
// Remove a last reference to an accessible document proxy.
docAcc = null;
ok(!docAcc, 'Accessible document proxy is removed');
ok(!docAcc, "Accessible document proxy is removed");
// Force garbage collection that should now trigger shutdown.
forceGC();

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

@ -2,18 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
add_task(async function () {
add_task(async function() {
// Making sure that the e10s is enabled on Windows for testing.
await setE10sPrefs();
let docLoaded = waitForEvent(
Ci.nsIAccessibleEvent.EVENT_DOCUMENT_LOAD_COMPLETE, 'body');
Ci.nsIAccessibleEvent.EVENT_DOCUMENT_LOAD_COMPLETE, "body");
let a11yInit = initPromise();
let accService = Cc['@mozilla.org/accessibilityService;1'].getService(
let accService = Cc["@mozilla.org/accessibilityService;1"].getService(
Ci.nsIAccessibilityService);
ok(accService, 'Service initialized');
ok(accService, "Service initialized");
await a11yInit;
await BrowserTestUtils.withNewTab({
@ -29,22 +29,22 @@ add_task(async function () {
}, async function(browser) {
let docLoadedEvent = await docLoaded;
let docAcc = docLoadedEvent.accessibleDocument;
ok(docAcc, 'Accessible document proxy is created');
ok(docAcc, "Accessible document proxy is created");
// Remove unnecessary dangling references
docLoaded = null;
docLoadedEvent = null;
forceGC();
let acc = docAcc.getChildAt(0);
ok(acc, 'Accessible proxy is created');
ok(acc, "Accessible proxy is created");
let canShutdown = false;
let a11yShutdown = new Promise((resolve, reject) =>
shutdownPromise().then(flag => canShutdown ? resolve() :
reject('Accessible service was shut down incorrectly')));
reject("Accessible service was shut down incorrectly")));
accService = null;
ok(!accService, 'Service is removed');
ok(!accService, "Service is removed");
// Force garbage collection that should not trigger shutdown because there
// is a reference to an accessible proxy.
forceGC();
@ -53,7 +53,7 @@ add_task(async function () {
// Remove a reference to an accessible document proxy.
docAcc = null;
ok(!docAcc, 'Accessible document proxy is removed');
ok(!docAcc, "Accessible document proxy is removed");
// Force garbage collection that should not trigger shutdown because there is
// a reference to an accessible proxy.
forceGC();
@ -64,7 +64,7 @@ add_task(async function () {
canShutdown = true;
// Remove a last reference to an accessible proxy.
acc = null;
ok(!acc, 'Accessible proxy is removed');
ok(!acc, "Accessible proxy is removed");
// Force garbage collection that should now trigger shutdown.
forceGC();

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

@ -2,34 +2,34 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
add_task(async function () {
info('Creating a service');
add_task(async function() {
info("Creating a service");
// Create a11y service.
let a11yInit = initPromise();
let accService1 = Cc['@mozilla.org/accessibilityService;1'].getService(
let accService1 = Cc["@mozilla.org/accessibilityService;1"].getService(
Ci.nsIAccessibilityService);
await a11yInit;
ok(accService1, 'Service initialized');
ok(accService1, "Service initialized");
// Add another reference to a11y service. This will not trigger
// 'a11y-init-or-shutdown' event
let accService2 = Cc['@mozilla.org/accessibilityService;1'].getService(
let accService2 = Cc["@mozilla.org/accessibilityService;1"].getService(
Ci.nsIAccessibilityService);
ok(accService2, 'Service initialized');
ok(accService2, "Service initialized");
info('Removing all service references');
info("Removing all service references");
let canShutdown = false;
// This promise will resolve only if canShutdown flag is set to true. If
// 'a11y-init-or-shutdown' event with '0' flag comes before it can be shut
// down, the promise will reject.
let a11yShutdown = new Promise((resolve, reject) =>
shutdownPromise().then(flag => canShutdown ?
resolve() : reject('Accessible service was shut down incorrectly')));
resolve() : reject("Accessible service was shut down incorrectly")));
// Remove first a11y service reference.
accService1 = null;
ok(!accService1, 'Service is removed');
ok(!accService1, "Service is removed");
// Force garbage collection that should not trigger shutdown because there is
// another reference.
forceGC();
@ -41,7 +41,7 @@ add_task(async function () {
canShutdown = true;
// Remove last a11y service reference.
accService2 = null;
ok(!accService2, 'Service is removed');
ok(!accService2, "Service is removed");
// Force garbage collection that should trigger shutdown.
forceGC();
await a11yShutdown;

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

@ -2,9 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
add_task(async function () {
add_task(async function() {
// Making sure that the e10s is enabled on Windows for testing.
await setE10sPrefs();
@ -19,33 +19,33 @@ add_task(async function () {
<body></body>
</html>`
}, async function(browser) {
info('Creating a service in parent and waiting for service to be created ' +
'in content');
info("Creating a service in parent and waiting for service to be created " +
"in content");
// Create a11y service in the main process. This will trigger creating of
// the a11y service in parent as well.
let parentA11yInit = initPromise();
let contentA11yInit = initPromise(browser);
let accService = Cc['@mozilla.org/accessibilityService;1'].getService(
let accService = Cc["@mozilla.org/accessibilityService;1"].getService(
Ci.nsIAccessibilityService);
ok(accService, 'Service initialized in parent');
ok(accService, "Service initialized in parent");
await Promise.all([parentA11yInit, contentA11yInit]);
info('Adding additional reference to accessibility service in content ' +
'process');
info("Adding additional reference to accessibility service in content " +
"process");
// Add a new reference to the a11y service inside the content process.
loadFrameScripts(browser, `let accService = Components.classes[
'@mozilla.org/accessibilityService;1'].getService(
Components.interfaces.nsIAccessibilityService);`);
info('Trying to shut down a service in content and making sure it stays ' +
'alive as it was started by parent');
info("Trying to shut down a service in content and making sure it stays " +
"alive as it was started by parent");
let contentCanShutdown = false;
// This promise will resolve only if contentCanShutdown flag is set to true.
// If 'a11y-init-or-shutdown' event with '0' flag (in content) comes before
// it can be shut down, the promise will reject.
let contentA11yShutdown = new Promise((resolve, reject) =>
shutdownPromise(browser).then(flag => contentCanShutdown ?
resolve() : reject('Accessible service was shut down incorrectly')));
resolve() : reject("Accessible service was shut down incorrectly")));
// Remove a11y service reference in content and force garbage collection.
// This should not trigger shutdown since a11y was originally initialized by
// the main process.
@ -54,13 +54,13 @@ add_task(async function () {
// Have some breathing room between a11y service shutdowns.
await new Promise(resolve => executeSoon(resolve));
info('Removing a service in parent');
info("Removing a service in parent");
// Now allow a11y service to shutdown in content.
contentCanShutdown = true;
// Remove the a11y service reference in the main process.
let parentA11yShutdown = shutdownPromise();
accService = null;
ok(!accService, 'Service is removed in parent');
ok(!accService, "Service is removed in parent");
// Force garbage collection that should trigger shutdown in both parent and
// content.
forceGC();

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

@ -2,16 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
add_task(async function () {
add_task(async function() {
// Making sure that the e10s is enabled on Windows for testing.
await setE10sPrefs();
let a11yInit = initPromise();
let accService = Cc['@mozilla.org/accessibilityService;1'].getService(
let accService = Cc["@mozilla.org/accessibilityService;1"].getService(
Ci.nsIAccessibilityService);
ok(accService, 'Service initialized');
ok(accService, "Service initialized");
await a11yInit;
await BrowserTestUtils.withNewTab({
@ -25,11 +25,11 @@ add_task(async function () {
<body><div id="div" style="visibility: hidden;"></div></body>
</html>`
}, async function(browser) {
let onShow = waitForEvent(Ci.nsIAccessibleEvent.EVENT_SHOW, 'div');
await invokeSetStyle(browser, 'div', 'visibility', 'visible');
let onShow = waitForEvent(Ci.nsIAccessibleEvent.EVENT_SHOW, "div");
await invokeSetStyle(browser, "div", "visibility", "visible");
let showEvent = await onShow;
let divAcc = showEvent.accessible;
ok(divAcc, 'Accessible proxy is created');
ok(divAcc, "Accessible proxy is created");
// Remove unnecessary dangling references
onShow = null;
showEvent = null;
@ -38,10 +38,10 @@ add_task(async function () {
let canShutdown = false;
let a11yShutdown = new Promise((resolve, reject) =>
shutdownPromise().then(flag => canShutdown ? resolve() :
reject('Accessible service was shut down incorrectly')));
reject("Accessible service was shut down incorrectly")));
accService = null;
ok(!accService, 'Service is removed');
ok(!accService, "Service is removed");
// Force garbage collection that should not trigger shutdown because there
// is a reference to an accessible proxy.
forceGC();
@ -52,7 +52,7 @@ add_task(async function () {
canShutdown = true;
// Remove a last reference to an accessible proxy.
divAcc = null;
ok(!divAcc, 'Accessible proxy is removed');
ok(!divAcc, "Accessible proxy is removed");
// Force garbage collection that should now trigger shutdown.
forceGC();

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

@ -2,18 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
add_task(async function () {
add_task(async function() {
// Making sure that the e10s is enabled on Windows for testing.
await setE10sPrefs();
let docLoaded = waitForEvent(
Ci.nsIAccessibleEvent.EVENT_DOCUMENT_LOAD_COMPLETE, 'body');
Ci.nsIAccessibleEvent.EVENT_DOCUMENT_LOAD_COMPLETE, "body");
let a11yInit = initPromise();
let accService = Cc['@mozilla.org/accessibilityService;1'].getService(
let accService = Cc["@mozilla.org/accessibilityService;1"].getService(
Ci.nsIAccessibilityService);
ok(accService, 'Service initialized');
ok(accService, "Service initialized");
await a11yInit;
await BrowserTestUtils.withNewTab({
@ -29,7 +29,7 @@ add_task(async function () {
}, async function(browser) {
let docLoadedEvent = await docLoaded;
let docAcc = docLoadedEvent.accessibleDocument;
ok(docAcc, 'Accessible document proxy is created');
ok(docAcc, "Accessible document proxy is created");
// Remove unnecessary dangling references
docLoaded = null;
docLoadedEvent = null;
@ -38,10 +38,10 @@ add_task(async function () {
let canShutdown = false;
let a11yShutdown = new Promise((resolve, reject) =>
shutdownPromise().then(flag => canShutdown ? resolve() :
reject('Accessible service was shut down incorrectly')));
reject("Accessible service was shut down incorrectly")));
accService = null;
ok(!accService, 'Service is removed');
ok(!accService, "Service is removed");
// Force garbage collection that should not trigger shutdown because there
// is a reference to an accessible proxy.
forceGC();
@ -52,7 +52,7 @@ add_task(async function () {
canShutdown = true;
// Remove a last reference to an accessible document proxy.
docAcc = null;
ok(!docAcc, 'Accessible document proxy is removed');
ok(!docAcc, "Accessible document proxy is removed");
// Force garbage collection that should now trigger shutdown.
forceGC();

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

@ -2,9 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
add_task(async function () {
add_task(async function() {
// Making sure that the e10s is enabled on Windows for testing.
await setE10sPrefs();
@ -19,24 +19,24 @@ add_task(async function () {
<body></body>
</html>`
}, async function(browser) {
info('Creating a service in parent and waiting for service to be created ' +
'in content');
info("Creating a service in parent and waiting for service to be created " +
"in content");
// Create a11y service in the main process. This will trigger creating of
// the a11y service in parent as well.
let parentA11yInit = initPromise();
let contentA11yInit = initPromise(browser);
let accService = Cc['@mozilla.org/accessibilityService;1'].getService(
let accService = Cc["@mozilla.org/accessibilityService;1"].getService(
Ci.nsIAccessibilityService);
ok(accService, 'Service initialized in parent');
ok(accService, "Service initialized in parent");
await Promise.all([parentA11yInit, contentA11yInit]);
info('Removing a service in parent and waiting for service to be shut ' +
'down in content');
info("Removing a service in parent and waiting for service to be shut " +
"down in content");
// Remove a11y service reference in the main process.
let parentA11yShutdown = shutdownPromise();
let contentA11yShutdown = shutdownPromise(browser);
accService = null;
ok(!accService, 'Service is removed in parent');
ok(!accService, "Service is removed in parent");
// Force garbage collection that should trigger shutdown in both main and
// content process.
forceGC();

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

@ -2,9 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
add_task(async function () {
add_task(async function() {
// Making sure that the e10s is enabled on Windows for testing.
await setE10sPrefs();
@ -19,7 +19,7 @@ add_task(async function () {
<body></body>
</html>`
}, async function(browser) {
info('Creating a service in content');
info("Creating a service in content");
// Create a11y service in the content process.
let a11yInit = initPromise(browser);
loadFrameScripts(browser, `let accService = Components.classes[
@ -27,7 +27,7 @@ add_task(async function () {
Components.interfaces.nsIAccessibilityService);`);
await a11yInit;
info('Removing a service in content');
info("Removing a service in content");
// Remove a11y service reference from the content process.
let a11yShutdown = shutdownPromise(browser);
// Force garbage collection that should trigger shutdown.

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

@ -2,9 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
add_task(async function () {
add_task(async function() {
// Making sure that the e10s is enabled on Windows for testing.
await setE10sPrefs();
@ -19,26 +19,26 @@ add_task(async function () {
<body></body>
</html>`
}, async function(browser) {
info('Creating a service in parent and waiting for service to be created ' +
'in content');
info("Creating a service in parent and waiting for service to be created " +
"in content");
// Create a11y service in the main process. This will trigger creating of
// the a11y service in parent as well.
let parentA11yInit = initPromise();
let contentA11yInit = initPromise(browser);
let accService = Cc['@mozilla.org/accessibilityService;1'].getService(
let accService = Cc["@mozilla.org/accessibilityService;1"].getService(
Ci.nsIAccessibilityService);
ok(accService, 'Service initialized in parent');
ok(accService, "Service initialized in parent");
await Promise.all([parentA11yInit, contentA11yInit]);
info('Adding additional reference to accessibility service in content ' +
'process');
info("Adding additional reference to accessibility service in content " +
"process");
// Add a new reference to the a11y service inside the content process.
loadFrameScripts(browser, `let accService = Components.classes[
'@mozilla.org/accessibilityService;1'].getService(
Components.interfaces.nsIAccessibilityService);`);
info('Shutting down a service in parent and making sure the one in ' +
'content stays alive');
info("Shutting down a service in parent and making sure the one in " +
"content stays alive");
let contentCanShutdown = false;
let parentA11yShutdown = shutdownPromise();
// This promise will resolve only if contentCanShutdown flag is set to true.
@ -46,12 +46,12 @@ add_task(async function () {
// it can be shut down, the promise will reject.
let contentA11yShutdown = new Promise((resolve, reject) =>
shutdownPromise(browser).then(flag => contentCanShutdown ?
resolve() : reject('Accessible service was shut down incorrectly')));
resolve() : reject("Accessible service was shut down incorrectly")));
// Remove a11y service reference in the main process and force garbage
// collection. This should not trigger shutdown in content since a11y
// service is used by XPCOM.
accService = null;
ok(!accService, 'Service is removed in parent');
ok(!accService, "Service is removed in parent");
// Force garbage collection that should not trigger shutdown because there
// is a reference in a content process.
forceGC();
@ -61,7 +61,7 @@ add_task(async function () {
// Have some breathing room between a11y service shutdowns.
await new Promise(resolve => executeSoon(resolve));
info('Removing a service in content');
info("Removing a service in content");
// Now allow a11y service to shutdown in content.
contentCanShutdown = true;
// Remove last reference to a11y service in content and force garbage

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

@ -2,17 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
add_task(async function () {
add_task(async function() {
// Create a11y service inside of the function scope. Its reference should be
// released once the anonimous function is called.
let a11yInitThenShutdown = initPromise().then(shutdownPromise);
(function() {
let accService = Cc['@mozilla.org/accessibilityService;1'].getService(
let accService = Cc["@mozilla.org/accessibilityService;1"].getService(
Ci.nsIAccessibilityService);
ok(accService, 'Service initialized');
ok(accService, "Service initialized");
})();
// Force garbage collection that should trigger shutdown.

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

@ -2,39 +2,39 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
add_task(async function () {
info('Creating a service');
add_task(async function() {
info("Creating a service");
// Create a11y service.
let a11yInit = initPromise();
let accService = Cc['@mozilla.org/accessibilityService;1'].getService(
let accService = Cc["@mozilla.org/accessibilityService;1"].getService(
Ci.nsIAccessibilityService);
await a11yInit;
ok(accService, 'Service initialized');
ok(accService, "Service initialized");
info('Removing a service');
info("Removing a service");
// Remove the only reference to an a11y service.
let a11yShutdown = shutdownPromise();
accService = null;
ok(!accService, 'Service is removed');
ok(!accService, "Service is removed");
// Force garbage collection that should trigger shutdown.
forceGC();
await a11yShutdown;
info('Recreating a service');
info("Recreating a service");
// Re-create a11y service.
a11yInit = initPromise();
accService = Cc['@mozilla.org/accessibilityService;1'].getService(
accService = Cc["@mozilla.org/accessibilityService;1"].getService(
Ci.nsIAccessibilityService);
await a11yInit;
ok(accService, 'Service initialized again');
ok(accService, "Service initialized again");
info('Removing a service again');
info("Removing a service again");
// Remove the only reference to an a11y service again.
a11yShutdown = shutdownPromise();
accService = null;
ok(!accService, 'Service is removed again');
ok(!accService, "Service is removed again");
// Force garbage collection that should trigger shutdown.
forceGC();
await a11yShutdown;

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

@ -2,24 +2,24 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/attributes.js */
loadScripts({ name: 'attributes.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "attributes.js", dir: MOCHITESTS_DIR });
/**
* Default textbox accessible attributes.
*/
const defaultAttributes = {
'margin-top': '0px',
'margin-right': '0px',
'margin-bottom': '0px',
'margin-left': '0px',
'text-align': 'start',
'text-indent': '0px',
'id': 'textbox',
'tag': 'input',
'display': 'inline'
"margin-top": "0px",
"margin-right": "0px",
"margin-bottom": "0px",
"margin-left": "0px",
"text-align": "start",
"text-indent": "0px",
"id": "textbox",
"tag": "input",
"display": "inline"
};
/**
@ -36,51 +36,51 @@ const defaultAttributes = {
* }
*/
const attributesTests = [{
desc: 'Initiall accessible attributes',
desc: "Initiall accessible attributes",
expected: defaultAttributes,
unexpected: {
'line-number': '1',
'explicit-name': 'true',
'container-live': 'polite',
'live': 'polite'
"line-number": "1",
"explicit-name": "true",
"container-live": "polite",
"live": "polite"
}
}, {
desc: '@line-number attribute is present when textbox is focused',
desc: "@line-number attribute is present when textbox is focused",
action: async function(browser) {
await invokeFocus(browser, 'textbox');
await invokeFocus(browser, "textbox");
},
waitFor: EVENT_FOCUS,
expected: Object.assign({}, defaultAttributes, { 'line-number': '1' }),
expected: Object.assign({}, defaultAttributes, { "line-number": "1" }),
unexpected: {
'explicit-name': 'true',
'container-live': 'polite',
'live': 'polite'
"explicit-name": "true",
"container-live": "polite",
"live": "polite"
}
}, {
desc: '@aria-live sets container-live and live attributes',
desc: "@aria-live sets container-live and live attributes",
attrs: [{
attr: 'aria-live',
value: 'polite'
attr: "aria-live",
value: "polite"
}],
expected: Object.assign({}, defaultAttributes, {
'line-number': '1',
'container-live': 'polite',
'live': 'polite'
"line-number": "1",
"container-live": "polite",
"live": "polite"
}),
unexpected: {
'explicit-name': 'true'
"explicit-name": "true"
}
}, {
desc: '@title attribute sets explicit-name attribute to true',
desc: "@title attribute sets explicit-name attribute to true",
attrs: [{
attr: 'title',
value: 'textbox'
attr: "title",
value: "textbox"
}],
expected: Object.assign({}, defaultAttributes, {
'line-number': '1',
'explicit-name': 'true',
'container-live': 'polite',
'live': 'polite'
"line-number": "1",
"explicit-name": "true",
"container-live": "polite",
"live": "polite"
}),
unexpected: {}
}];
@ -90,21 +90,21 @@ const attributesTests = [{
*/
addAccessibleTask(`
<input id="textbox" value="hello">`,
async function (browser, accDoc) {
let textbox = findAccessibleChildByID(accDoc, 'textbox');
async function(browser, accDoc) {
let textbox = findAccessibleChildByID(accDoc, "textbox");
for (let { desc, action, attrs, expected, waitFor, unexpected } of attributesTests) {
info(desc);
let onUpdate;
if (waitFor) {
onUpdate = waitForEvent(waitFor, 'textbox');
onUpdate = waitForEvent(waitFor, "textbox");
}
if (action) {
await action(browser);
} else if (attrs) {
for (let { attr, value } of attrs) {
await invokeSetAttribute(browser, 'textbox', attr, value);
await invokeSetAttribute(browser, "textbox", attr, value);
}
}

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

@ -2,10 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/name.js */
loadScripts({ name: 'name.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "name.js", dir: MOCHITESTS_DIR });
/**
* Test data has the format of:
@ -18,116 +18,116 @@ loadScripts({ name: 'name.js', dir: MOCHITESTS_DIR });
* }
*/
const tests = [{
desc: 'No description when there are no @alt, @title and @aria-describedby',
expected: ''
desc: "No description when there are no @alt, @title and @aria-describedby",
expected: ""
}, {
desc: 'Description from @aria-describedby attribute',
desc: "Description from @aria-describedby attribute",
attrs: [{
attr: 'aria-describedby',
value: 'description'
attr: "aria-describedby",
value: "description"
}],
waitFor: [[EVENT_DESCRIPTION_CHANGE, 'image']],
expected: 'aria description'
waitFor: [[EVENT_DESCRIPTION_CHANGE, "image"]],
expected: "aria description"
}, {
desc: 'No description from @aria-describedby since it is the same as the ' +
'@alt attribute which is used as the name',
desc: "No description from @aria-describedby since it is the same as the " +
"@alt attribute which is used as the name",
attrs: [{
attr: 'alt',
value: 'aria description'
attr: "alt",
value: "aria description"
}],
waitFor: [[EVENT_REORDER, 'body']],
expected: ''
waitFor: [[EVENT_REORDER, "body"]],
expected: ""
}, {
desc: 'Description from @aria-describedby attribute when @alt and ' +
'@aria-describedby are not the same',
desc: "Description from @aria-describedby attribute when @alt and " +
"@aria-describedby are not the same",
attrs: [{
attr: 'aria-describedby',
value: 'description2'
attr: "aria-describedby",
value: "description2"
}],
waitFor: [[EVENT_DESCRIPTION_CHANGE, 'image']],
expected: 'another description'
waitFor: [[EVENT_DESCRIPTION_CHANGE, "image"]],
expected: "another description"
}, {
desc: 'Description from @aria-describedby attribute when @title (used for ' +
'name) and @aria-describedby are not the same',
desc: "Description from @aria-describedby attribute when @title (used for " +
"name) and @aria-describedby are not the same",
attrs: [{
attr: 'alt'
attr: "alt"
}, {
attr: 'title',
value: 'title'
attr: "title",
value: "title"
}],
waitFor: [[EVENT_REORDER, 'body']],
expected: 'another description'
waitFor: [[EVENT_REORDER, "body"]],
expected: "another description"
}, {
desc: 'No description from @aria-describedby since it is the same as the ' +
'@title attribute which is used as the name',
desc: "No description from @aria-describedby since it is the same as the " +
"@title attribute which is used as the name",
attrs: [{
attr: 'title',
value: 'another description'
attr: "title",
value: "another description"
}],
waitFor: [[EVENT_NAME_CHANGE, 'image']],
expected: ''
waitFor: [[EVENT_NAME_CHANGE, "image"]],
expected: ""
}, {
desc: 'No description with only @title attribute which is used as the name',
desc: "No description with only @title attribute which is used as the name",
attrs: [{
attr: 'aria-describedby'
attr: "aria-describedby"
}],
waitFor: [[EVENT_DESCRIPTION_CHANGE, 'image']],
expected: ''
waitFor: [[EVENT_DESCRIPTION_CHANGE, "image"]],
expected: ""
}, {
desc: 'Description from @title attribute when @alt and @atitle are not the ' +
'same',
desc: "Description from @title attribute when @alt and @atitle are not the " +
"same",
attrs: [{
attr: 'alt',
value: 'aria description'
attr: "alt",
value: "aria description"
}],
waitFor: [[EVENT_REORDER, 'body']],
expected: 'another description'
waitFor: [[EVENT_REORDER, "body"]],
expected: "another description"
}, {
desc: 'No description from @title since it is the same as the @alt ' +
'attribute which is used as the name',
desc: "No description from @title since it is the same as the @alt " +
"attribute which is used as the name",
attrs: [{
attr: 'alt',
value: 'another description'
attr: "alt",
value: "another description"
}],
waitFor: [[EVENT_NAME_CHANGE, 'image']],
expected: ''
waitFor: [[EVENT_NAME_CHANGE, "image"]],
expected: ""
}, {
desc: 'No description from @aria-describedby since it is the same as the ' +
'@alt (used for name) and @title attributes',
desc: "No description from @aria-describedby since it is the same as the " +
"@alt (used for name) and @title attributes",
attrs: [{
attr: 'aria-describedby',
value: 'description2'
attr: "aria-describedby",
value: "description2"
}],
waitFor: [[EVENT_DESCRIPTION_CHANGE, 'image']],
expected: ''
waitFor: [[EVENT_DESCRIPTION_CHANGE, "image"]],
expected: ""
}, {
desc: 'Description from @aria-describedby attribute when it is different ' +
'from @alt (used for name) and @title attributes',
desc: "Description from @aria-describedby attribute when it is different " +
"from @alt (used for name) and @title attributes",
attrs: [{
attr: 'aria-describedby',
value: 'description'
attr: "aria-describedby",
value: "description"
}],
waitFor: [[EVENT_DESCRIPTION_CHANGE, 'image']],
expected: 'aria description'
waitFor: [[EVENT_DESCRIPTION_CHANGE, "image"]],
expected: "aria description"
}, {
desc: 'No description from @aria-describedby since it is the same as the ' +
'@alt attribute (used for name) but different from title',
desc: "No description from @aria-describedby since it is the same as the " +
"@alt attribute (used for name) but different from title",
attrs: [{
attr: 'alt',
value: 'aria description'
attr: "alt",
value: "aria description"
}],
waitFor: [[EVENT_NAME_CHANGE, 'image']],
expected: ''
waitFor: [[EVENT_NAME_CHANGE, "image"]],
expected: ""
}, {
desc: 'Description from @aria-describedby attribute when @alt (used for ' +
'name) and @aria-describedby are not the same but @title and ' +
'aria-describedby are',
desc: "Description from @aria-describedby attribute when @alt (used for " +
"name) and @aria-describedby are not the same but @title and " +
"aria-describedby are",
attrs: [{
attr: 'aria-describedby',
value: 'description2'
attr: "aria-describedby",
value: "description2"
}],
waitFor: [[EVENT_DESCRIPTION_CHANGE, 'image']],
expected: 'another description'
waitFor: [[EVENT_DESCRIPTION_CHANGE, "image"]],
expected: "another description"
}];
/**
@ -138,7 +138,7 @@ addAccessibleTask(`
<p id="description2">another description</p>
<img id="image" />`,
async function(browser, accDoc) {
let imgAcc = findAccessibleChildByID(accDoc, 'image');
let imgAcc = findAccessibleChildByID(accDoc, "image");
for (let { desc, waitFor, attrs, expected } of tests) {
info(desc);
@ -148,14 +148,14 @@ addAccessibleTask(`
}
if (attrs) {
for (let { attr, value } of attrs) {
await invokeSetAttribute(browser, 'image', attr, value);
await invokeSetAttribute(browser, "image", attr, value);
}
}
await onUpdate;
// When attribute change (alt) triggers reorder event, accessible will
// become defunct.
if (isDefunct(imgAcc)) {
imgAcc = findAccessibleChildByID(accDoc, 'image');
imgAcc = findAccessibleChildByID(accDoc, "image");
}
testDescr(imgAcc, expected);
}

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

@ -2,10 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/name.js */
loadScripts({ name: 'name.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "name.js", dir: MOCHITESTS_DIR });
/**
* Rules for name tests that are inspired by
@ -26,37 +26,37 @@ loadScripts({ name: 'name.js', dir: MOCHITESTS_DIR });
* * textchanged - text is inserted into a subtree and the test should only
* continue after a text inserted event
*/
const ARIARule = [{ attr: 'aria-labelledby' }, { attr: 'aria-label' }];
const HTMLControlHeadRule = [...ARIARule, { elm: 'label', isSibling: true }];
const ARIARule = [{ attr: "aria-labelledby" }, { attr: "aria-label" }];
const HTMLControlHeadRule = [...ARIARule, { elm: "label", isSibling: true }];
const rules = {
CSSContent: [{ elm: 'style', isSibling: true }, { fromsubtree: true }],
HTMLARIAGridCell: [...ARIARule, { fromsubtree: true }, { attr: 'title' }],
CSSContent: [{ elm: "style", isSibling: true }, { fromsubtree: true }],
HTMLARIAGridCell: [...ARIARule, { fromsubtree: true }, { attr: "title" }],
HTMLControl: [...HTMLControlHeadRule, { fromsubtree: true },
{ attr: 'title' }],
HTMLElm: [...ARIARule, { attr: 'title' }],
HTMLImg: [...ARIARule, { attr: 'alt', recreated: true }, { attr: 'title' }],
HTMLImgEmptyAlt: [...ARIARule, { attr: 'title' }, { attr: 'alt' }],
HTMLInputButton: [...HTMLControlHeadRule, { attr: 'value' },
{ attr: 'title' }],
HTMLInputImage: [...HTMLControlHeadRule, { attr: 'alt', recreated: true },
{ attr: 'value', recreated: true }, { attr: 'title' }],
{ attr: "title" }],
HTMLElm: [...ARIARule, { attr: "title" }],
HTMLImg: [...ARIARule, { attr: "alt", recreated: true }, { attr: "title" }],
HTMLImgEmptyAlt: [...ARIARule, { attr: "title" }, { attr: "alt" }],
HTMLInputButton: [...HTMLControlHeadRule, { attr: "value" },
{ attr: "title" }],
HTMLInputImage: [...HTMLControlHeadRule, { attr: "alt", recreated: true },
{ attr: "value", recreated: true }, { attr: "title" }],
HTMLInputImageNoValidSrc: [...HTMLControlHeadRule,
{ attr: 'alt', recreated: true }, { attr: 'value', recreated: true }],
{ attr: "alt", recreated: true }, { attr: "value", recreated: true }],
HTMLInputReset: [...HTMLControlHeadRule,
{ attr: 'value', textchanged: true }],
{ attr: "value", textchanged: true }],
HTMLInputSubmit: [...HTMLControlHeadRule,
{ attr: 'value', textchanged: true }],
HTMLLink: [...ARIARule, { fromsubtree: true }, { attr: 'title' }],
HTMLLinkImage: [...ARIARule, { elm: 'img' }, { attr: 'title' }],
HTMLOption: [...ARIARule, { attr: 'label' }, { fromsubtree: true },
{ attr: 'title' }],
HTMLTable: [...ARIARule, { elm: 'caption' }, { attr: 'summary' },
{ attr: 'title' }]
{ attr: "value", textchanged: true }],
HTMLLink: [...ARIARule, { fromsubtree: true }, { attr: "title" }],
HTMLLinkImage: [...ARIARule, { elm: "img" }, { attr: "title" }],
HTMLOption: [...ARIARule, { attr: "label" }, { fromsubtree: true },
{ attr: "title" }],
HTMLTable: [...ARIARule, { elm: "caption" }, { attr: "summary" },
{ attr: "title" }]
};
const markupTests = [{
id: 'btn',
ruleset: 'HTMLControl',
id: "btn",
ruleset: "HTMLControl",
markup: `
<span id="l1">test2</span>
<span id="l2">test3</span>
@ -65,10 +65,10 @@ const markupTests = [{
aria-label="test1"
aria-labelledby="l1 l2"
title="test5">press me</button>`,
expected: ['test2 test3', 'test1', 'test4', 'press me', 'test5']
expected: ["test2 test3", "test1", "test4", "press me", "test5"]
}, {
id: 'btn',
ruleset: 'HTMLInputButton',
id: "btn",
ruleset: "HTMLInputButton",
markup: `
<span id="l1">test2</span>
<span id="l2">test3</span>
@ -82,11 +82,11 @@ const markupTests = [{
src="no name from src"
data="no name from data"
title="name from title"/>`,
expected: ['test2 test3', 'test1', 'test4', 'name from value',
'name from title']
expected: ["test2 test3", "test1", "test4", "name from value",
"name from title"]
}, {
id: 'btn-submit',
ruleset: 'HTMLInputSubmit',
id: "btn-submit",
ruleset: "HTMLInputSubmit",
markup: `
<span id="l1">test2</span>
<span id="l2">test3</span>
@ -100,10 +100,10 @@ const markupTests = [{
src="no name from src"
data="no name from data"
title="no name from title"/>`,
expected: ['test2 test3', 'test1', 'test4', 'name from value']
expected: ["test2 test3", "test1", "test4", "name from value"]
}, {
id: 'btn-reset',
ruleset: 'HTMLInputReset',
id: "btn-reset",
ruleset: "HTMLInputReset",
markup: `
<span id="l1">test2</span>
<span id="l2">test3</span>
@ -117,10 +117,10 @@ const markupTests = [{
src="no name from src"
data="no name from data"
title="no name from title"/>`,
expected: ['test2 test3', 'test1', 'test4', 'name from value']
expected: ["test2 test3", "test1", "test4", "name from value"]
}, {
id: 'btn-image',
ruleset: 'HTMLInputImage',
id: "btn-image",
ruleset: "HTMLInputImage",
markup: `
<span id="l1">test2</span>
<span id="l2">test3</span>
@ -134,11 +134,11 @@ const markupTests = [{
src="http://example.com/a11y/accessible/tests/mochitest/moz.png"
data="no name from data"
title="name from title"/>`,
expected: ['test2 test3', 'test1', 'test4', 'name from alt',
'name from value', 'name from title']
expected: ["test2 test3", "test1", "test4", "name from alt",
"name from value", "name from title"]
}, {
id: 'btn-image',
ruleset: 'HTMLInputImageNoValidSrc',
id: "btn-image",
ruleset: "HTMLInputImageNoValidSrc",
markup: `
<span id="l1">test2</span>
<span id="l2">test3</span>
@ -151,11 +151,11 @@ const markupTests = [{
value="name from value"
data="no name from data"
title="no name from title"/>`,
expected: ['test2 test3', 'test1', 'test4', 'name from alt',
'name from value']
expected: ["test2 test3", "test1", "test4", "name from alt",
"name from value"]
}, {
id: 'opt',
ruleset: 'HTMLOption',
id: "opt",
ruleset: "HTMLOption",
markup: `
<span id="l1">test2</span>
<span id="l2">test3</span>
@ -167,10 +167,10 @@ const markupTests = [{
title="test5">option1</option>
<option>option2</option>
</select>`,
expected: ['test2 test3', 'test1', 'test4', 'option1', 'test5']
expected: ["test2 test3", "test1", "test4", "option1", "test5"]
}, {
id: 'img',
ruleset: 'HTMLImg',
id: "img",
ruleset: "HTMLImg",
markup: `
<span id="l1">test2</span>
<span id="l2">test3</span>
@ -180,10 +180,10 @@ const markupTests = [{
alt="Mozilla logo"
title="This is a logo"
src="http://example.com/a11y/accessible/tests/mochitest/moz.png"/>`,
expected: ['test2 test3', 'Logo of Mozilla', 'Mozilla logo', 'This is a logo']
expected: ["test2 test3", "Logo of Mozilla", "Mozilla logo", "This is a logo"]
}, {
id: 'imgemptyalt',
ruleset: 'HTMLImgEmptyAlt',
id: "imgemptyalt",
ruleset: "HTMLImgEmptyAlt",
markup: `
<span id="l1">test2</span>
<span id="l2">test3</span>
@ -193,10 +193,10 @@ const markupTests = [{
title="This is a logo"
alt=""
src="http://example.com/a11y/accessible/tests/mochitest/moz.png"/>`,
expected: ['test2 test3', 'Logo of Mozilla', 'This is a logo', '']
expected: ["test2 test3", "Logo of Mozilla", "This is a logo", ""]
}, {
id: 'tc',
ruleset: 'HTMLElm',
id: "tc",
ruleset: "HTMLElm",
markup: `
<span id="l1">test2</span>
<span id="l2">test3</span>
@ -215,10 +215,10 @@ const markupTests = [{
</td>
</tr>
</table>`,
expected: ['test2 test3', 'test1', 'test5']
expected: ["test2 test3", "test1", "test5"]
}, {
id: 'gc',
ruleset: 'HTMLARIAGridCell',
id: "gc",
ruleset: "HTMLARIAGridCell",
markup: `
<span id="l1">test2</span>
<span id="l2">test3</span>
@ -239,12 +239,12 @@ const markupTests = [{
</td>
</tr>
</table>`,
expected: ['test2 test3', 'test1',
'This is a paragraph This is a link \u2022 Listitem1 \u2022 Listitem2',
'This is a paragraph This is a link This is a list']
expected: ["test2 test3", "test1",
"This is a paragraph This is a link \u2022 Listitem1 \u2022 Listitem2",
"This is a paragraph This is a link This is a list"]
}, {
id: 't',
ruleset: 'HTMLTable',
id: "t",
ruleset: "HTMLTable",
markup: `
<span id="l1">lby_tst6_1</span>
<span id="l2">lby_tst6_2</span>
@ -260,11 +260,11 @@ const markupTests = [{
<td>cell2</td>
</tr>
</table>`,
expected: ['lby_tst6_1 lby_tst6_2', 'arialabel_tst6', 'caption_tst6',
'summary_tst6', 'title_tst6']
expected: ["lby_tst6_1 lby_tst6_2", "arialabel_tst6", "caption_tst6",
"summary_tst6", "title_tst6"]
}, {
id: 'btn',
ruleset: 'CSSContent',
id: "btn",
ruleset: "CSSContent",
markup: `
<style>
button::before {
@ -272,7 +272,7 @@ const markupTests = [{
}
</style>
<button id="btn">press me</button>`,
expected: ['do not press me', 'press me']
expected: ["do not press me", "press me"]
}, {
// TODO: uncomment when Bug-1256382 is resoved.
// id: 'li',
@ -288,8 +288,8 @@ const markupTests = [{
// </ul>`,
// expected: ['1. Listitem', `${String.fromCharCode(0x2022)} Listitem`]
// }, {
id: 'a',
ruleset: 'HTMLLink',
id: "a",
ruleset: "HTMLLink",
markup: `
<span id="l1">test2</span>
<span id="l2">test3</span>
@ -297,10 +297,10 @@ const markupTests = [{
aria-label="test1"
aria-labelledby="l1 l2"
title="test4">test5</a>`,
expected: ['test2 test3', 'test1', 'test5', 'test4']
expected: ["test2 test3", "test1", "test5", "test4"]
}, {
id: 'a-img',
ruleset: 'HTMLLinkImage',
id: "a-img",
ruleset: "HTMLLinkImage",
markup: `
<span id="l1">test2</span>
<span id="l2">test3</span>
@ -308,7 +308,7 @@ const markupTests = [{
aria-label="test1"
aria-labelledby="l1 l2"
title="test4"><img alt="test5"/></a>`,
expected: ['test2 test3', 'test1', 'test5', 'test4']
expected: ["test2 test3", "test1", "test5", "test4"]
}];
/**

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

@ -2,10 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/relations.js */
loadScripts({ name: 'relations.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "relations.js", dir: MOCHITESTS_DIR });
/**
* A test specification that has the following format:
@ -16,16 +16,16 @@ loadScripts({ name: 'relations.js', dir: MOCHITESTS_DIR });
* ]
*/
const attrRelationsSpec = [
['aria-labelledby', RELATION_LABELLED_BY, RELATION_LABEL_FOR],
['aria-describedby', RELATION_DESCRIBED_BY, RELATION_DESCRIPTION_FOR],
['aria-controls', RELATION_CONTROLLER_FOR, RELATION_CONTROLLED_BY],
['aria-flowto', RELATION_FLOWS_TO, RELATION_FLOWS_FROM]
["aria-labelledby", RELATION_LABELLED_BY, RELATION_LABEL_FOR],
["aria-describedby", RELATION_DESCRIBED_BY, RELATION_DESCRIPTION_FOR],
["aria-controls", RELATION_CONTROLLER_FOR, RELATION_CONTROLLED_BY],
["aria-flowto", RELATION_FLOWS_TO, RELATION_FLOWS_FROM]
];
async function testRelated(browser, accDoc, attr, hostRelation, dependantRelation) {
let host = findAccessibleChildByID(accDoc, 'host');
let dependant1 = findAccessibleChildByID(accDoc, 'dependant1');
let dependant2 = findAccessibleChildByID(accDoc, 'dependant2');
let host = findAccessibleChildByID(accDoc, "host");
let dependant1 = findAccessibleChildByID(accDoc, "dependant1");
let dependant2 = findAccessibleChildByID(accDoc, "dependant2");
/**
* Test data has the format of:
@ -37,18 +37,18 @@ async function testRelated(browser, accDoc, attr, hostRelation, dependantRelatio
* }
*/
const tests = [{
desc: 'No attribute',
desc: "No attribute",
expected: [ null, null, null ]
}, {
desc: 'Set attribute',
attrs: [{ key: attr, value: 'dependant1' }],
desc: "Set attribute",
attrs: [{ key: attr, value: "dependant1" }],
expected: [ host, null, dependant1 ]
}, {
desc: 'Change attribute',
attrs: [{ key: attr, value: 'dependant2' }],
desc: "Change attribute",
attrs: [{ key: attr, value: "dependant2" }],
expected: [ null, host, dependant2 ]
}, {
desc: 'Remove attribute',
desc: "Remove attribute",
attrs: [{ key: attr }],
expected: [ null, null, null ]
}];
@ -58,7 +58,7 @@ async function testRelated(browser, accDoc, attr, hostRelation, dependantRelatio
if (attrs) {
for (let { key, value } of attrs) {
await invokeSetAttribute(browser, 'host', key, value);
await invokeSetAttribute(browser, "host", key, value);
}
}
@ -75,7 +75,7 @@ addAccessibleTask(`
<div id="dependant1">label</div>
<div id="dependant2">label2</div>
<div role="checkbox" id="host"></div>`,
async function (browser, accDoc) {
async function(browser, accDoc) {
for (let spec of attrRelationsSpec) {
await testRelated(browser, accDoc, ...spec);
}

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

@ -2,12 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
/* import-globals-from ../../mochitest/states.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR },
{ name: 'states.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR },
{ name: "states.js", dir: MOCHITESTS_DIR });
/**
* Test data has the format of:
@ -27,66 +27,66 @@ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR },
// State caching tests for attribute changes
const attributeTests = [{
desc: 'Checkbox with @checked attribute set to true should have checked ' +
'state',
desc: "Checkbox with @checked attribute set to true should have checked " +
"state",
attrs: [{
attr: 'checked',
value: 'true'
attr: "checked",
value: "true"
}],
expected: [STATE_CHECKED, 0]
}, {
desc: 'Checkbox with no @checked attribute should not have checked state',
desc: "Checkbox with no @checked attribute should not have checked state",
attrs: [{
attr: 'checked'
attr: "checked"
}],
expected: [0, 0, STATE_CHECKED]
}];
// State caching tests for ARIA changes
const ariaTests = [{
desc: 'File input has busy state when @aria-busy attribute is set to true',
desc: "File input has busy state when @aria-busy attribute is set to true",
attrs: [{
attr: 'aria-busy',
value: 'true'
attr: "aria-busy",
value: "true"
}],
expected: [STATE_BUSY, 0, STATE_REQUIRED | STATE_INVALID]
}, {
desc: 'File input has required state when @aria-required attribute is set ' +
'to true',
desc: "File input has required state when @aria-required attribute is set " +
"to true",
attrs: [{
attr: 'aria-required',
value: 'true'
attr: "aria-required",
value: "true"
}],
expected: [STATE_REQUIRED, 0, STATE_INVALID]
}, {
desc: 'File input has invalid state when @aria-invalid attribute is set to ' +
'true',
desc: "File input has invalid state when @aria-invalid attribute is set to " +
"true",
attrs: [{
attr: 'aria-invalid',
value: 'true'
attr: "aria-invalid",
value: "true"
}],
expected: [STATE_INVALID, 0]
}];
// Extra state caching tests
const extraStateTests = [{
desc: 'Input has no extra enabled state when aria and native disabled ' +
'attributes are set at once',
desc: "Input has no extra enabled state when aria and native disabled " +
"attributes are set at once",
attrs: [{
attr: 'aria-disabled',
value: 'true'
attr: "aria-disabled",
value: "true"
}, {
attr: 'disabled',
value: 'true'
attr: "disabled",
value: "true"
}],
expected: [0, 0, 0, EXT_STATE_ENABLED]
}, {
desc: 'Input has an extra enabled state when aria and native disabled ' +
'attributes are unset at once',
desc: "Input has an extra enabled state when aria and native disabled " +
"attributes are unset at once",
attrs: [{
attr: 'aria-disabled'
attr: "aria-disabled"
}, {
attr: 'disabled'
attr: "disabled"
}],
expected: [0, EXT_STATE_ENABLED]
}];
@ -111,9 +111,9 @@ addAccessibleTask(`
<input id="checkbox" type="checkbox">
<input id="file" type="file">
<input id="text">`,
async function (browser, accDoc) {
await runStateTests(browser, accDoc, 'checkbox', attributeTests);
await runStateTests(browser, accDoc, 'file', ariaTests);
await runStateTests(browser, accDoc, 'text', extraStateTests);
async function(browser, accDoc) {
await runStateTests(browser, accDoc, "checkbox", attributeTests);
await runStateTests(browser, accDoc, "file", ariaTests);
await runStateTests(browser, accDoc, "text", extraStateTests);
}
);

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

@ -2,10 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/value.js */
loadScripts({ name: 'value.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "value.js", dir: MOCHITESTS_DIR });
/**
* Test data has the format of:
@ -19,95 +19,95 @@ loadScripts({ name: 'value.js', dir: MOCHITESTS_DIR });
* }
*/
const valueTests = [{
desc: 'Initially value is set to 1st element of select',
id: 'select',
expected: '1st'
desc: "Initially value is set to 1st element of select",
id: "select",
expected: "1st"
}, {
desc: 'Value should update to 3rd when 3 is pressed',
id: 'select',
desc: "Value should update to 3rd when 3 is pressed",
id: "select",
action: async function(browser) {
await invokeFocus(browser, 'select');
await BrowserTestUtils.synthesizeKey('3', {}, browser);
await invokeFocus(browser, "select");
await BrowserTestUtils.synthesizeKey("3", {}, browser);
},
waitFor: EVENT_TEXT_VALUE_CHANGE,
expected: '3rd'
expected: "3rd"
}, {
desc: 'Initially value is set to @aria-valuenow for slider',
id: 'slider',
expected: ['5', 5, 0, 7, 0]
desc: "Initially value is set to @aria-valuenow for slider",
id: "slider",
expected: ["5", 5, 0, 7, 0]
}, {
desc: 'Value should change when @aria-valuenow is updated',
id: 'slider',
desc: "Value should change when @aria-valuenow is updated",
id: "slider",
attrs: [{
attr: 'aria-valuenow',
value: '6'
attr: "aria-valuenow",
value: "6"
}],
waitFor: EVENT_VALUE_CHANGE,
expected: ['6', 6, 0, 7, 0]
expected: ["6", 6, 0, 7, 0]
}, {
desc: 'Value should change when @aria-valuetext is set',
id: 'slider',
desc: "Value should change when @aria-valuetext is set",
id: "slider",
attrs: [{
attr: 'aria-valuetext',
value: 'plain'
attr: "aria-valuetext",
value: "plain"
}],
waitFor: EVENT_TEXT_VALUE_CHANGE,
expected: ['plain', 6, 0, 7, 0]
expected: ["plain", 6, 0, 7, 0]
}, {
desc: 'Value should change when @aria-valuetext is updated',
id: 'slider',
desc: "Value should change when @aria-valuetext is updated",
id: "slider",
attrs: [{
attr: 'aria-valuetext',
value: 'hey!'
attr: "aria-valuetext",
value: "hey!"
}],
waitFor: EVENT_TEXT_VALUE_CHANGE,
expected: ['hey!', 6, 0, 7, 0]
expected: ["hey!", 6, 0, 7, 0]
}, {
desc: 'Value should change to @aria-valuetext when @aria-valuenow is removed',
id: 'slider',
desc: "Value should change to @aria-valuetext when @aria-valuenow is removed",
id: "slider",
attrs: [{
attr: 'aria-valuenow'
attr: "aria-valuenow"
}],
expected: ['hey!', 0, 0, 7, 0]
expected: ["hey!", 0, 0, 7, 0]
}, {
desc: 'Initially value is not set for combobox',
id: 'combobox',
expected: ''
desc: "Initially value is not set for combobox",
id: "combobox",
expected: ""
}, {
desc: 'Value should change when @value attribute is updated',
id: 'combobox',
desc: "Value should change when @value attribute is updated",
id: "combobox",
attrs: [{
attr: 'value',
value: 'hello'
attr: "value",
value: "hello"
}],
waitFor: EVENT_TEXT_VALUE_CHANGE,
expected: 'hello'
expected: "hello"
}, {
desc: 'Initially value corresponds to @value attribute for progress',
id: 'progress',
expected: '22%'
desc: "Initially value corresponds to @value attribute for progress",
id: "progress",
expected: "22%"
}, {
desc: 'Value should change when @value attribute is updated',
id: 'progress',
desc: "Value should change when @value attribute is updated",
id: "progress",
attrs: [{
attr: 'value',
value: '50'
attr: "value",
value: "50"
}],
waitFor: EVENT_VALUE_CHANGE,
expected: '50%'
expected: "50%"
}, {
desc: 'Initially value corresponds to @value attribute for range',
id: 'range',
expected: '6'
desc: "Initially value corresponds to @value attribute for range",
id: "range",
expected: "6"
}, {
desc: 'Value should change when slider is moved',
id: 'range',
desc: "Value should change when slider is moved",
id: "range",
action: async function(browser) {
await invokeFocus(browser, 'range');
await BrowserTestUtils.synthesizeKey('VK_LEFT', {}, browser);
await invokeFocus(browser, "range");
await BrowserTestUtils.synthesizeKey("VK_LEFT", {}, browser);
},
waitFor: EVENT_VALUE_CHANGE,
expected: '5'
expected: "5"
}];
/**
@ -124,7 +124,7 @@ addAccessibleTask(`
<input id="combobox" role="combobox" aria-autocomplete="inline">
<progress id="progress" value="22" max="100"></progress>
<input type="range" id="range" min="0" max="10" value="6">`,
async function (browser, accDoc) {
async function(browser, accDoc) {
for (let { desc, id, action, attrs, expected, waitFor } of valueTests) {
info(desc);
let acc = findAccessibleChildByID(accDoc, id);

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

@ -2,18 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/**
* Test caret move event and its interface:
* - caretOffset
*/
addAccessibleTask('<input id="textbox" value="hello"/>', async function(browser) {
let onCaretMoved = waitForEvent(EVENT_TEXT_CARET_MOVED, 'textbox');
await invokeFocus(browser, 'textbox');
let onCaretMoved = waitForEvent(EVENT_TEXT_CARET_MOVED, "textbox");
await invokeFocus(browser, "textbox");
let event = await onCaretMoved;
let caretMovedEvent = event.QueryInterface(nsIAccessibleCaretMoveEvent);
is(caretMovedEvent.caretOffset, 5,
'Correct caret offset.');
"Correct caret offset.");
});

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

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/**
* Test hide event and its interface:
@ -17,17 +17,17 @@ addAccessibleTask(`
<div id="next"></div>
</div>`,
async function(browser, accDoc) {
let acc = findAccessibleChildByID(accDoc, 'to-hide');
let acc = findAccessibleChildByID(accDoc, "to-hide");
let onHide = waitForEvent(EVENT_HIDE, acc);
await invokeSetStyle(browser, 'to-hide', 'visibility', 'hidden');
await invokeSetStyle(browser, "to-hide", "visibility", "hidden");
let event = await onHide;
let hideEvent = event.QueryInterface(Ci.nsIAccessibleHideEvent);
is(getAccessibleDOMNodeID(hideEvent.targetParent), 'parent',
'Correct target parent.');
is(getAccessibleDOMNodeID(hideEvent.targetNextSibling), 'next',
'Correct target next sibling.');
is(getAccessibleDOMNodeID(hideEvent.targetPrevSibling), 'previous',
'Correct target previous sibling.');
is(getAccessibleDOMNodeID(hideEvent.targetParent), "parent",
"Correct target parent.");
is(getAccessibleDOMNodeID(hideEvent.targetNextSibling), "next",
"Correct target next sibling.");
is(getAccessibleDOMNodeID(hideEvent.targetPrevSibling), "previous",
"Correct target previous sibling.");
}
);

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

@ -2,14 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/**
* Test show event
*/
addAccessibleTask('<div id="div" style="visibility: hidden;"></div>',
async function(browser) {
let onShow = waitForEvent(EVENT_SHOW, 'div');
await invokeSetStyle(browser, 'div', 'visibility', 'visible');
let onShow = waitForEvent(EVENT_SHOW, "div");
await invokeSetStyle(browser, "div", "visibility", "visible");
await onShow;
});

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

@ -2,19 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
/* import-globals-from ../../mochitest/states.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR },
{ name: 'states.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR },
{ name: "states.js", dir: MOCHITESTS_DIR });
function checkStateChangeEvent(event, state, isExtraState, isEnabled) {
let scEvent = event.QueryInterface(nsIAccessibleStateChangeEvent);
is(scEvent.state, state, 'Correct state of the statechange event.');
is(scEvent.state, state, "Correct state of the statechange event.");
is(scEvent.isExtraState, isExtraState,
'Correct extra state bit of the statechange event.');
is(scEvent.isEnabled, isEnabled, 'Correct state of statechange event state');
"Correct extra state bit of the statechange event.");
is(scEvent.isEnabled, isEnabled, "Correct state of statechange event state");
}
// Insert mock source into the iframe to be able to verify the right document
@ -38,10 +38,10 @@ addAccessibleTask(`
<iframe id="iframe" src="${iframeSrc}"></iframe>
<input id="checkbox" type="checkbox" />`, async function(browser) {
// Test state change
let onStateChange = waitForEvent(EVENT_STATE_CHANGE, 'checkbox');
let onStateChange = waitForEvent(EVENT_STATE_CHANGE, "checkbox");
// Set checked for a checkbox.
await ContentTask.spawn(browser, {}, () => {
content.document.getElementById('checkbox').checked = true;
content.document.getElementById("checkbox").checked = true;
});
let event = await onStateChange;
@ -49,10 +49,10 @@ addAccessibleTask(`
testStates(event.accessible, STATE_CHECKED, 0);
// Test extra state
onStateChange = waitForEvent(EVENT_STATE_CHANGE, 'iframe');
onStateChange = waitForEvent(EVENT_STATE_CHANGE, "iframe");
// Set design mode on.
await ContentTask.spawn(browser, {}, () => {
content.document.getElementById('iframe').contentDocument.designMode = 'on';
content.document.getElementById("iframe").contentDocument.designMode = "on";
});
event = await onStateChange;

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

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
function checkTextChangeEvent(event, id, text, start, end, isInserted, isFromUserInput) {
let tcEvent = event.QueryInterface(nsIAccessibleTextChangeEvent);
@ -40,7 +40,7 @@ async function removeTextFromInput(browser, id, value, start, end) {
el.focus();
el.setSelectionRange(contentStart, contentEnd);
});
await BrowserTestUtils.sendChar('VK_DELETE', browser);
await BrowserTestUtils.sendChar("VK_DELETE", browser);
let event = await onTextRemoved;
checkTextChangeEvent(event, id, value, start, end, false, true);
@ -58,14 +58,14 @@ addAccessibleTask(`
<p id="p">abc</p>
<input id="input" value="input" />`, async function(browser) {
let events = [
{ isInserted: false, str: 'abc', offset: 0 },
{ isInserted: true, str: 'def', offset: 0 }
{ isInserted: false, str: "abc", offset: 0 },
{ isInserted: true, str: "def", offset: 0 }
];
await changeText(browser, 'p', 'def', events);
await changeText(browser, "p", "def", events);
events = [{ isInserted: true, str: 'DEF', offset: 2 }];
await changeText(browser, 'p', 'deDEFf', events);
events = [{ isInserted: true, str: "DEF", offset: 2 }];
await changeText(browser, "p", "deDEFf", events);
// Test isFromUserInput property.
await removeTextFromInput(browser, 'input', 'n', 1, 2);
await removeTextFromInput(browser, "input", "n", 1, 2);
});

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

@ -2,22 +2,22 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
// Test ARIA Dialog
addAccessibleTask('doc_treeupdate_ariadialog.html', async function(browser, accDoc) {
addAccessibleTask("doc_treeupdate_ariadialog.html", async function(browser, accDoc) {
testAccessibleTree(accDoc, {
role: ROLE_DOCUMENT,
children: [ ]
});
// Make dialog visible and update its inner content.
let onShow = waitForEvent(EVENT_SHOW, 'dialog');
let onShow = waitForEvent(EVENT_SHOW, "dialog");
await ContentTask.spawn(browser, {}, () => {
content.document.getElementById('dialog').style.display = 'block';
content.document.getElementById("dialog").style.display = "block";
});
await onShow;

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

@ -2,13 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
async function testContainer1(browser, accDoc) {
const id = 't1_container';
const id = "t1_container";
const docID = getAccessibleDOMNodeID(accDoc);
const acc = findAccessibleChildByID(accDoc, id);
@ -26,7 +26,7 @@ async function testContainer1(browser, accDoc) {
/* ================ Change ARIA owns ====================================== */
let onReorder = waitForEvent(EVENT_REORDER, id);
await invokeSetAttribute(browser, id, 'aria-owns', 't1_button t1_subdiv');
await invokeSetAttribute(browser, id, "aria-owns", "t1_button t1_subdiv");
await onReorder;
// children are swapped again, button and subdiv are appended to
@ -42,7 +42,7 @@ async function testContainer1(browser, accDoc) {
/* ================ Remove ARIA owns ====================================== */
onReorder = waitForEvent(EVENT_REORDER, id);
await invokeSetAttribute(browser, id, 'aria-owns');
await invokeSetAttribute(browser, id, "aria-owns");
await onReorder;
// children follow the DOM order
@ -58,7 +58,7 @@ async function testContainer1(browser, accDoc) {
/* ================ Set ARIA owns ========================================= */
onReorder = waitForEvent(EVENT_REORDER, id);
await invokeSetAttribute(browser, id, 'aria-owns', 't1_button t1_subdiv');
await invokeSetAttribute(browser, id, "aria-owns", "t1_button t1_subdiv");
await onReorder;
// children are swapped again, button and subdiv are appended to
@ -74,8 +74,8 @@ async function testContainer1(browser, accDoc) {
/* ================ Add ID to ARIA owns =================================== */
onReorder = waitForEvent(EVENT_REORDER, docID);
await invokeSetAttribute(browser, id, 'aria-owns',
't1_button t1_subdiv t1_group');
await invokeSetAttribute(browser, id, "aria-owns",
"t1_button t1_subdiv t1_group");
await onReorder;
// children are swapped again, button and subdiv are appended to
@ -93,9 +93,9 @@ async function testContainer1(browser, accDoc) {
/* ================ Append element ======================================== */
onReorder = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, id, contentId => {
let div = content.document.createElement('div');
div.setAttribute('id', 't1_child3');
div.setAttribute('role', 'radio');
let div = content.document.createElement("div");
div.setAttribute("id", "t1_child3");
div.setAttribute("role", "radio");
content.document.getElementById(contentId).appendChild(div);
});
await onReorder;
@ -116,7 +116,7 @@ async function testContainer1(browser, accDoc) {
/* ================ Remove element ======================================== */
onReorder = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, {}, () =>
content.document.getElementById('t1_span').remove());
content.document.getElementById("t1_span").remove());
await onReorder;
// subdiv should go away
@ -132,7 +132,7 @@ async function testContainer1(browser, accDoc) {
/* ================ Remove ID ============================================= */
onReorder = waitForEvent(EVENT_REORDER, docID);
await invokeSetAttribute(browser, 't1_group', 'id');
await invokeSetAttribute(browser, "t1_group", "id");
await onReorder;
tree = {
@ -146,7 +146,7 @@ async function testContainer1(browser, accDoc) {
/* ================ Set ID ================================================ */
onReorder = waitForEvent(EVENT_REORDER, docID);
await invokeSetAttribute(browser, 't1_grouptmp', 'id', 't1_group');
await invokeSetAttribute(browser, "t1_grouptmp", "id", "t1_group");
await onReorder;
tree = {
@ -161,7 +161,7 @@ async function testContainer1(browser, accDoc) {
}
async function removeContainer(browser, accDoc) {
const id = 't2_container1';
const id = "t2_container1";
const acc = findAccessibleChildByID(accDoc, id);
let tree = {
@ -173,8 +173,8 @@ async function removeContainer(browser, accDoc) {
let onReorder = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, {}, () =>
content.document.getElementById('t2_container2').removeChild(
content.document.getElementById('t2_container3')));
content.document.getElementById("t2_container2").removeChild(
content.document.getElementById("t2_container3")));
await onReorder;
tree = {
@ -184,14 +184,14 @@ async function removeContainer(browser, accDoc) {
}
async function stealAndRecacheChildren(browser, accDoc) {
const id1 = 't3_container1';
const id2 = 't3_container2';
const id1 = "t3_container1";
const id2 = "t3_container2";
const acc1 = findAccessibleChildByID(accDoc, id1);
const acc2 = findAccessibleChildByID(accDoc, id2);
/* ================ Steal from other ARIA owns ============================ */
let onReorder = waitForEvent(EVENT_REORDER, id2);
await invokeSetAttribute(browser, id2, 'aria-owns', 't3_child');
await invokeSetAttribute(browser, id2, "aria-owns", "t3_child");
await onReorder;
let tree = {
@ -209,8 +209,8 @@ async function stealAndRecacheChildren(browser, accDoc) {
/* ================ Append element to recache children ==================== */
onReorder = waitForEvent(EVENT_REORDER, id2);
await ContentTask.spawn(browser, id2, id => {
let div = content.document.createElement('div');
div.setAttribute('role', 'radio');
let div = content.document.createElement("div");
div.setAttribute("role", "radio");
content.document.getElementById(id).appendChild(div);
});
await onReorder;
@ -230,7 +230,7 @@ async function stealAndRecacheChildren(browser, accDoc) {
}
async function showHiddenElement(browser, accDoc) {
const id = 't4_container1';
const id = "t4_container1";
const acc = findAccessibleChildByID(accDoc, id);
let tree = {
@ -241,7 +241,7 @@ async function showHiddenElement(browser, accDoc) {
testAccessibleTree(acc, tree);
let onReorder = waitForEvent(EVENT_REORDER, id);
await invokeSetStyle(browser, 't4_child1', 'display', 'block');
await invokeSetStyle(browser, "t4_child1", "display", "block");
await onReorder;
tree = {
@ -254,19 +254,19 @@ async function showHiddenElement(browser, accDoc) {
}
async function rearrangeARIAOwns(browser, accDoc) {
const id = 't5_container';
const id = "t5_container";
const acc = findAccessibleChildByID(accDoc, id);
const tests = [{
val: 't5_checkbox t5_radio t5_button',
roleList: [ 'CHECKBUTTON', 'RADIOBUTTON', 'PUSHBUTTON' ]
val: "t5_checkbox t5_radio t5_button",
roleList: [ "CHECKBUTTON", "RADIOBUTTON", "PUSHBUTTON" ]
}, {
val: 't5_radio t5_button t5_checkbox',
roleList: [ 'RADIOBUTTON', 'PUSHBUTTON', 'CHECKBUTTON' ]
val: "t5_radio t5_button t5_checkbox",
roleList: [ "RADIOBUTTON", "PUSHBUTTON", "CHECKBUTTON" ]
}];
for (let { val, roleList } of tests) {
let onReorder = waitForEvent(EVENT_REORDER, id);
await invokeSetAttribute(browser, id, 'aria-owns', val);
await invokeSetAttribute(browser, id, "aria-owns", val);
await onReorder;
let tree = { SECTION: [ ] };
@ -280,7 +280,7 @@ async function rearrangeARIAOwns(browser, accDoc) {
}
async function removeNotARIAOwnedEl(browser, accDoc) {
const id = 't6_container';
const id = "t6_container";
const acc = findAccessibleChildByID(accDoc, id);
let tree = {
@ -294,7 +294,7 @@ async function removeNotARIAOwnedEl(browser, accDoc) {
let onReorder = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, id, contentId => {
content.document.getElementById(contentId).removeChild(
content.document.getElementById('t6_span'));
content.document.getElementById("t6_span"));
});
await onReorder;
@ -306,7 +306,7 @@ async function removeNotARIAOwnedEl(browser, accDoc) {
testAccessibleTree(acc, tree);
}
addAccessibleTask('doc_treeupdate_ariaowns.html', async function(browser, accDoc) {
addAccessibleTask("doc_treeupdate_ariaowns.html", async function(browser, accDoc) {
await testContainer1(browser, accDoc);
await removeContainer(browser, accDoc);
await stealAndRecacheChildren(browser, accDoc);

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

@ -2,22 +2,22 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
addAccessibleTask(`
<canvas id="canvas">
<div id="dialog" role="dialog" style="display: none;"></div>
</canvas>`, async function(browser, accDoc) {
let canvas = findAccessibleChildByID(accDoc, 'canvas');
let dialog = findAccessibleChildByID(accDoc, 'dialog');
let canvas = findAccessibleChildByID(accDoc, "canvas");
let dialog = findAccessibleChildByID(accDoc, "dialog");
testAccessibleTree(canvas, { CANVAS: [] });
let onShow = waitForEvent(EVENT_SHOW, 'dialog');
await invokeSetStyle(browser, 'dialog', 'display', 'block');
let onShow = waitForEvent(EVENT_SHOW, "dialog");
await invokeSetStyle(browser, "dialog", "display", "block");
await onShow;
testAccessibleTree(dialog, { DIALOG: [] });

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

@ -2,18 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
addAccessibleTask(`
<div id="container"><div id="scrollarea" style="overflow:auto;"><input>
</div></div>
<div id="container2"><div id="scrollarea2" style="overflow:hidden;">
</div></div>`, async function(browser, accDoc) {
const id1 = 'container';
const id2 = 'container2';
const id1 = "container";
const id2 = "container2";
const container = findAccessibleChildByID(accDoc, id1);
const container2 = findAccessibleChildByID(accDoc, id2);
@ -30,8 +30,8 @@ addAccessibleTask(`
let onReorder = waitForEvent(EVENT_REORDER, id1);
await ContentTask.spawn(browser, id1, id => {
let doc = content.document;
doc.getElementById('scrollarea').style.width = '20px';
doc.getElementById(id).appendChild(doc.createElement('input'));
doc.getElementById("scrollarea").style.width = "20px";
doc.getElementById(id).appendChild(doc.createElement("input"));
});
await onReorder;
@ -51,7 +51,7 @@ addAccessibleTask(`
testAccessibleTree(container2, tree);
onReorder = waitForEvent(EVENT_REORDER, id2);
await invokeSetStyle(browser, 'scrollarea2', 'overflow', 'auto');
await invokeSetStyle(browser, "scrollarea2", "overflow", "auto");
await onReorder;
tree = {

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

@ -2,10 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
const iframeSrc = `data:text/html,
<html>
@ -19,7 +19,7 @@ const iframeSrc = `data:text/html,
addAccessibleTask(`
<iframe id="iframe" src="${iframeSrc}"></iframe>`, async function(browser, accDoc) {
// ID of the iframe that is being tested
const id = 'inner-iframe';
const id = "inner-iframe";
let iframe = findAccessibleChildByID(accDoc, id);
@ -33,10 +33,10 @@ addAccessibleTask(`
/* ================= Write iframe document ================================ */
let reorderEventPromise = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, id, contentId => {
let docNode = content.document.getElementById('iframe').contentDocument;
let newHTMLNode = docNode.createElement('html');
let newBodyNode = docNode.createElement('body');
let newTextNode = docNode.createTextNode('New Wave');
let docNode = content.document.getElementById("iframe").contentDocument;
let newHTMLNode = docNode.createElement("html");
let newBodyNode = docNode.createElement("body");
let newTextNode = docNode.createTextNode("New Wave");
newBodyNode.id = contentId;
newBodyNode.appendChild(newTextNode);
newHTMLNode.appendChild(newBodyNode);
@ -49,7 +49,7 @@ addAccessibleTask(`
children: [
{
role: ROLE_TEXT_LEAF,
name: 'New Wave'
name: "New Wave"
}
]
};
@ -58,10 +58,10 @@ addAccessibleTask(`
/* ================= Replace iframe HTML element ========================== */
reorderEventPromise = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, id, contentId => {
let docNode = content.document.getElementById('iframe').contentDocument;
let docNode = content.document.getElementById("iframe").contentDocument;
// We can't use open/write/close outside of iframe document because of
// security error.
let script = docNode.createElement('script');
let script = docNode.createElement("script");
script.textContent = `
document.open();
document.write('<body id="${contentId}">hello</body>');
@ -75,7 +75,7 @@ addAccessibleTask(`
children: [
{
role: ROLE_TEXT_LEAF,
name: 'hello'
name: "hello"
}
]
};
@ -84,12 +84,12 @@ addAccessibleTask(`
/* ================= Replace iframe body ================================== */
reorderEventPromise = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, id, contentId => {
let docNode = content.document.getElementById('iframe').contentDocument;
let newBodyNode = docNode.createElement('body');
let newTextNode = docNode.createTextNode('New Hello');
let docNode = content.document.getElementById("iframe").contentDocument;
let newBodyNode = docNode.createElement("body");
let newTextNode = docNode.createTextNode("New Hello");
newBodyNode.id = contentId;
newBodyNode.appendChild(newTextNode);
newBodyNode.setAttribute('role', 'button');
newBodyNode.setAttribute("role", "button");
docNode.documentElement.replaceChild(newBodyNode, docNode.body);
});
await reorderEventPromise;
@ -99,7 +99,7 @@ addAccessibleTask(`
children: [
{
role: ROLE_TEXT_LEAF,
name: 'New Hello'
name: "New Hello"
}
]
};
@ -109,8 +109,8 @@ addAccessibleTask(`
reorderEventPromise = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, id, contentId => {
// Open document.
let docNode = content.document.getElementById('iframe').contentDocument;
let script = docNode.createElement('script');
let docNode = content.document.getElementById("iframe").contentDocument;
let script = docNode.createElement("script");
script.textContent = `
function closeMe() {
document.write('Works?');
@ -133,8 +133,8 @@ addAccessibleTask(`
reorderEventPromise = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, {}, () => {
// Write and close document.
let docNode = content.document.getElementById('iframe').contentDocument;
docNode.write('Works?');
let docNode = content.document.getElementById("iframe").contentDocument;
docNode.write("Works?");
docNode.close();
});
await reorderEventPromise;
@ -144,7 +144,7 @@ addAccessibleTask(`
children: [
{
role: ROLE_TEXT_LEAF,
name: 'Works?'
name: "Works?"
}
]
};
@ -154,13 +154,13 @@ addAccessibleTask(`
reorderEventPromise = waitForEvent(EVENT_REORDER, iframe);
await ContentTask.spawn(browser, {}, () => {
// Remove HTML element.
let docNode = content.document.getElementById('iframe').contentDocument;
let docNode = content.document.getElementById("iframe").contentDocument;
docNode.firstChild.remove();
});
let event = await reorderEventPromise;
ok(event.accessible instanceof nsIAccessibleDocument,
'Reorder should happen on the document');
"Reorder should happen on the document");
tree = {
role: ROLE_DOCUMENT,
children: [ ]
@ -171,10 +171,10 @@ addAccessibleTask(`
reorderEventPromise = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, id, contentId => {
// Insert HTML element.
let docNode = content.document.getElementById('iframe').contentDocument;
let html = docNode.createElement('html');
let body = docNode.createElement('body');
let text = docNode.createTextNode('Haha');
let docNode = content.document.getElementById("iframe").contentDocument;
let html = docNode.createElement("html");
let body = docNode.createElement("body");
let text = docNode.createTextNode("Haha");
body.appendChild(text);
body.id = contentId;
html.appendChild(body);
@ -187,7 +187,7 @@ addAccessibleTask(`
children: [
{
role: ROLE_TEXT_LEAF,
name: 'Haha'
name: "Haha"
}
]
};
@ -197,13 +197,13 @@ addAccessibleTask(`
reorderEventPromise = waitForEvent(EVENT_REORDER, iframe);
await ContentTask.spawn(browser, {}, () => {
// Remove body element.
let docNode = content.document.getElementById('iframe').contentDocument;
let docNode = content.document.getElementById("iframe").contentDocument;
docNode.documentElement.removeChild(docNode.body);
});
event = await reorderEventPromise;
ok(event.accessible instanceof nsIAccessibleDocument,
'Reorder should happen on the document');
"Reorder should happen on the document");
tree = {
role: ROLE_DOCUMENT,
children: [ ]
@ -213,14 +213,14 @@ addAccessibleTask(`
/* ================ Insert element under document element while body missed */
reorderEventPromise = waitForEvent(EVENT_REORDER, iframe);
await ContentTask.spawn(browser, {}, () => {
let docNode = content.document.getElementById('iframe').contentDocument;
let inputNode = content.window.inputNode = docNode.createElement('input');
let docNode = content.document.getElementById("iframe").contentDocument;
let inputNode = content.window.inputNode = docNode.createElement("input");
docNode.documentElement.appendChild(inputNode);
});
event = await reorderEventPromise;
ok(event.accessible instanceof nsIAccessibleDocument,
'Reorder should happen on the document');
"Reorder should happen on the document");
tree = {
DOCUMENT: [
{ ENTRY: [ ] }
@ -231,7 +231,7 @@ addAccessibleTask(`
reorderEventPromise = waitForEvent(EVENT_REORDER, iframe);
await ContentTask.spawn(browser, {}, () => {
let docEl =
content.document.getElementById('iframe').contentDocument.documentElement;
content.document.getElementById("iframe").contentDocument.documentElement;
// Remove aftermath of this test before next test starts.
docEl.firstChild.remove();
});
@ -247,10 +247,10 @@ addAccessibleTask(`
reorderEventPromise = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, id, contentId => {
// Write and close document.
let docNode = content.document.getElementById('iframe').contentDocument;
let docNode = content.document.getElementById("iframe").contentDocument;
// Insert body element.
let body = docNode.createElement('body');
let text = docNode.createTextNode('Yo ho ho i butylka roma!');
let body = docNode.createElement("body");
let text = docNode.createTextNode("Yo ho ho i butylka roma!");
body.appendChild(text);
body.id = contentId;
docNode.documentElement.appendChild(body);
@ -262,15 +262,15 @@ addAccessibleTask(`
children: [
{
role: ROLE_TEXT_LEAF,
name: 'Yo ho ho i butylka roma!'
name: "Yo ho ho i butylka roma!"
}
]
};
testAccessibleTree(iframe, tree);
/* ================= Change source ======================================== */
reorderEventPromise = waitForEvent(EVENT_REORDER, 'iframe');
await invokeSetAttribute(browser, 'iframe', 'src',
reorderEventPromise = waitForEvent(EVENT_REORDER, "iframe");
await invokeSetAttribute(browser, "iframe", "src",
`data:text/html,<html><body id="${id}"><input></body></html>`);
event = await reorderEventPromise;
@ -287,11 +287,11 @@ addAccessibleTask(`
/* ================= Replace iframe body on ARIA role body ================ */
reorderEventPromise = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, id, contentId => {
let docNode = content.document.getElementById('iframe').contentDocument;
let newBodyNode = docNode.createElement('body');
let newTextNode = docNode.createTextNode('New Hello');
let docNode = content.document.getElementById("iframe").contentDocument;
let newBodyNode = docNode.createElement("body");
let newTextNode = docNode.createTextNode("New Hello");
newBodyNode.appendChild(newTextNode);
newBodyNode.setAttribute('role', 'button');
newBodyNode.setAttribute("role", "button");
newBodyNode.id = contentId;
docNode.documentElement.replaceChild(newBodyNode, docNode.body);
});
@ -302,7 +302,7 @@ addAccessibleTask(`
children: [
{
role: ROLE_TEXT_LEAF,
name: 'New Hello'
name: "New Hello"
}
]
};

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

@ -2,10 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
addAccessibleTask(`
<style>
@ -19,8 +19,8 @@ addAccessibleTask(`
<div id="container1"></div>
<div id="container2"><div id="container2_child">text</div></div>`,
async function(browser, accDoc) {
const id1 = 'container1';
const id2 = 'container2';
const id1 = "container1";
const id2 = "container2";
let container1 = findAccessibleChildByID(accDoc, id1);
let container2 = findAccessibleChildByID(accDoc, id2);
@ -41,9 +41,9 @@ addAccessibleTask(`
let onReorder = waitForEvent(EVENT_REORDER, id1);
// Create and add an element with CSS generated content to container1
await ContentTask.spawn(browser, id1, id => {
let node = content.document.createElement('div');
node.textContent = 'text';
node.setAttribute('class', 'gentext');
let node = content.document.createElement("div");
node.textContent = "text";
node.setAttribute("class", "gentext");
content.document.getElementById(id).appendChild(node);
});
await onReorder;
@ -61,7 +61,7 @@ addAccessibleTask(`
onReorder = waitForEvent(EVENT_REORDER, id2);
// Add CSS generated content to an element in container2's subtree
await invokeSetAttribute(browser, 'container2_child', 'class', 'gentext');
await invokeSetAttribute(browser, "container2_child", "class", "gentext");
await onReorder;
tree = {

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

@ -2,25 +2,25 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
async function setHidden(browser, value) {
let onReorder = waitForEvent(EVENT_REORDER, 'container');
await invokeSetAttribute(browser, 'child', 'hidden', value);
let onReorder = waitForEvent(EVENT_REORDER, "container");
await invokeSetAttribute(browser, "child", "hidden", value);
await onReorder;
}
addAccessibleTask('<div id="container"><input id="child"></div>',
async function(browser, accDoc) {
let container = findAccessibleChildByID(accDoc, 'container');
let container = findAccessibleChildByID(accDoc, "container");
testAccessibleTree(container, { SECTION: [ { ENTRY: [ ] } ] });
// Set @hidden attribute
await setHidden(browser, 'true');
await setHidden(browser, "true");
testAccessibleTree(container, { SECTION: [ ] });
// Remove @hidden attribute

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

@ -2,19 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
async function testImageMap(browser, accDoc) {
const id = 'imgmap';
const id = "imgmap";
const acc = findAccessibleChildByID(accDoc, id);
/* ================= Initial tree test ==================================== */
let tree = {
IMAGE_MAP: [
{ role: ROLE_LINK, name: 'b', children: [ ] }
{ role: ROLE_LINK, name: "b", children: [ ] }
]
};
testAccessibleTree(acc, tree);
@ -22,21 +22,21 @@ async function testImageMap(browser, accDoc) {
/* ================= Insert area ========================================== */
let onReorder = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, {}, () => {
let areaElm = content.document.createElement('area');
let mapNode = content.document.getElementById('map');
areaElm.setAttribute('href',
'http://www.bbc.co.uk/radio4/atoz/index.shtml#a');
areaElm.setAttribute('coords', '0,0,13,14');
areaElm.setAttribute('alt', 'a');
areaElm.setAttribute('shape', 'rect');
let areaElm = content.document.createElement("area");
let mapNode = content.document.getElementById("map");
areaElm.setAttribute("href",
"http://www.bbc.co.uk/radio4/atoz/index.shtml#a");
areaElm.setAttribute("coords", "0,0,13,14");
areaElm.setAttribute("alt", "a");
areaElm.setAttribute("shape", "rect");
mapNode.insertBefore(areaElm, mapNode.firstChild);
});
await onReorder;
tree = {
IMAGE_MAP: [
{ role: ROLE_LINK, name: 'a', children: [ ] },
{ role: ROLE_LINK, name: 'b', children: [ ] }
{ role: ROLE_LINK, name: "a", children: [ ] },
{ role: ROLE_LINK, name: "b", children: [ ] }
]
};
testAccessibleTree(acc, tree);
@ -44,22 +44,22 @@ async function testImageMap(browser, accDoc) {
/* ================= Append area ========================================== */
onReorder = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, {}, () => {
let areaElm = content.document.createElement('area');
let mapNode = content.document.getElementById('map');
areaElm.setAttribute('href',
'http://www.bbc.co.uk/radio4/atoz/index.shtml#c');
areaElm.setAttribute('coords', '34,0,47,14');
areaElm.setAttribute('alt', 'c');
areaElm.setAttribute('shape', 'rect');
let areaElm = content.document.createElement("area");
let mapNode = content.document.getElementById("map");
areaElm.setAttribute("href",
"http://www.bbc.co.uk/radio4/atoz/index.shtml#c");
areaElm.setAttribute("coords", "34,0,47,14");
areaElm.setAttribute("alt", "c");
areaElm.setAttribute("shape", "rect");
mapNode.appendChild(areaElm);
});
await onReorder;
tree = {
IMAGE_MAP: [
{ role: ROLE_LINK, name: 'a', children: [ ] },
{ role: ROLE_LINK, name: 'b', children: [ ] },
{ role: ROLE_LINK, name: 'c', children: [ ] }
{ role: ROLE_LINK, name: "a", children: [ ] },
{ role: ROLE_LINK, name: "b", children: [ ] },
{ role: ROLE_LINK, name: "c", children: [ ] }
]
};
testAccessibleTree(acc, tree);
@ -67,25 +67,25 @@ async function testImageMap(browser, accDoc) {
/* ================= Remove area ========================================== */
onReorder = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, {}, () => {
let mapNode = content.document.getElementById('map');
let mapNode = content.document.getElementById("map");
mapNode.removeChild(mapNode.firstElementChild);
});
await onReorder;
tree = {
IMAGE_MAP: [
{ role: ROLE_LINK, name: 'b', children: [ ] },
{ role: ROLE_LINK, name: 'c', children: [ ] }
{ role: ROLE_LINK, name: "b", children: [ ] },
{ role: ROLE_LINK, name: "c", children: [ ] }
]
};
testAccessibleTree(acc, tree);
}
async function testContainer(browser) {
const id = 'container';
const id = "container";
/* ================= Remove name on map =================================== */
let onReorder = waitForEvent(EVENT_REORDER, id);
await invokeSetAttribute(browser, 'map', 'name');
await invokeSetAttribute(browser, "map", "name");
let event = await onReorder;
const acc = event.accessible;
@ -98,10 +98,10 @@ async function testContainer(browser) {
/* ================= Restore name on map ================================== */
onReorder = waitForEvent(EVENT_REORDER, id);
await invokeSetAttribute(browser, 'map', 'name', 'atoz_map');
await invokeSetAttribute(browser, "map", "name", "atoz_map");
// XXX: force repainting of the image (see bug 745788 for details).
await BrowserTestUtils.synthesizeMouse('#imgmap', 10, 10,
{ type: 'mousemove' }, browser);
await BrowserTestUtils.synthesizeMouse("#imgmap", 10, 10,
{ type: "mousemove" }, browser);
await onReorder;
tree = {
@ -117,7 +117,7 @@ async function testContainer(browser) {
/* ================= Remove map =========================================== */
onReorder = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, {}, () => {
let mapNode = content.document.getElementById('map');
let mapNode = content.document.getElementById("map");
mapNode.remove();
});
await onReorder;
@ -132,17 +132,17 @@ async function testContainer(browser) {
/* ================= Insert map =========================================== */
onReorder = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, id, contentId => {
let map = content.document.createElement('map');
let area = content.document.createElement('area');
let map = content.document.createElement("map");
let area = content.document.createElement("area");
map.setAttribute('name', 'atoz_map');
map.setAttribute('id', 'map');
map.setAttribute("name", "atoz_map");
map.setAttribute("id", "map");
area.setAttribute('href',
'http://www.bbc.co.uk/radio4/atoz/index.shtml#b');
area.setAttribute('coords', '17,0,30,14');
area.setAttribute('alt', 'b');
area.setAttribute('shape', 'rect');
area.setAttribute("href",
"http://www.bbc.co.uk/radio4/atoz/index.shtml#b");
area.setAttribute("coords", "17,0,30,14");
area.setAttribute("alt", "b");
area.setAttribute("shape", "rect");
map.appendChild(area);
content.document.getElementById(contentId).appendChild(map);
@ -160,7 +160,7 @@ async function testContainer(browser) {
/* ================= Hide image map ======================================= */
onReorder = waitForEvent(EVENT_REORDER, id);
await invokeSetStyle(browser, 'imgmap', 'display', 'none');
await invokeSetStyle(browser, "imgmap", "display", "none");
await onReorder;
tree = {
@ -170,7 +170,7 @@ async function testContainer(browser) {
}
async function waitForImageMap(browser, accDoc) {
const id = 'imgmap';
const id = "imgmap";
const acc = findAccessibleChildByID(accDoc, id);
if (acc.firstChild) {
return;
@ -179,11 +179,11 @@ async function waitForImageMap(browser, accDoc) {
const onReorder = waitForEvent(EVENT_REORDER, id);
// Wave over image map
await BrowserTestUtils.synthesizeMouse(`#${id}`, 10, 10,
{ type: 'mousemove' }, browser);
{ type: "mousemove" }, browser);
await onReorder;
}
addAccessibleTask('doc_treeupdate_imagemap.html', async function(browser, accDoc) {
addAccessibleTask("doc_treeupdate_imagemap.html", async function(browser, accDoc) {
await waitForImageMap(browser, accDoc);
await testImageMap(browser, accDoc);
await testContainer(browser);

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

@ -2,14 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
async function setDisplayAndWaitForReorder(browser, value) {
let onReorder = waitForEvent(EVENT_REORDER, 'ul');
await invokeSetStyle(browser, 'li', 'display', value);
let onReorder = waitForEvent(EVENT_REORDER, "ul");
await invokeSetStyle(browser, "li", "display", value);
return onReorder;
}
@ -17,7 +17,7 @@ addAccessibleTask(`
<ul id="ul">
<li id="li">item1</li>
</ul>`, async function(browser, accDoc) {
let li = findAccessibleChildByID(accDoc, 'li');
let li = findAccessibleChildByID(accDoc, "li");
let bullet = li.firstChild;
let accTree = {
role: ROLE_LISTITEM,
@ -31,12 +31,12 @@ addAccessibleTask(`
};
testAccessibleTree(li, accTree);
await setDisplayAndWaitForReorder(browser, 'none');
await setDisplayAndWaitForReorder(browser, "none");
ok(isDefunct(li), 'Check that li is defunct.');
ok(isDefunct(bullet), 'Check that bullet is defunct.');
ok(isDefunct(li), "Check that li is defunct.");
ok(isDefunct(bullet), "Check that bullet is defunct.");
let event = await setDisplayAndWaitForReorder(browser, 'list-item');
let event = await setDisplayAndWaitForReorder(browser, "list-item");
testAccessibleTree(findAccessibleChildByID(event.accessible, 'li'), accTree);
testAccessibleTree(findAccessibleChildByID(event.accessible, "li"), accTree);
});

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

@ -2,25 +2,25 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
addAccessibleTask('<ol id="list"></ol>', async function(browser, accDoc) {
let list = findAccessibleChildByID(accDoc, 'list');
let list = findAccessibleChildByID(accDoc, "list");
testAccessibleTree(list, {
role: ROLE_LIST,
children: [ ]
});
await invokeSetAttribute(browser, 'body', 'contentEditable', 'true');
let onReorder = waitForEvent(EVENT_REORDER, 'list');
await invokeSetAttribute(browser, "body", "contentEditable", "true");
let onReorder = waitForEvent(EVENT_REORDER, "list");
await ContentTask.spawn(browser, {}, () => {
let li = content.document.createElement('li');
li.textContent = 'item';
content.document.getElementById('list').appendChild(li);
let li = content.document.createElement("li");
li.textContent = "item";
content.document.getElementById("list").appendChild(li);
});
await onReorder;

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

@ -2,27 +2,27 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
addAccessibleTask('<span id="parent"><span id="child"></span></span>',
async function(browser, accDoc) {
is(findAccessibleChildByID(accDoc, 'parent'), null,
'Check that parent is not accessible.');
is(findAccessibleChildByID(accDoc, 'child'), null,
'Check that child is not accessible.');
is(findAccessibleChildByID(accDoc, "parent"), null,
"Check that parent is not accessible.");
is(findAccessibleChildByID(accDoc, "child"), null,
"Check that child is not accessible.");
let onReorder = waitForEvent(EVENT_REORDER, 'body');
let onReorder = waitForEvent(EVENT_REORDER, "body");
// Add an event listener to parent.
await ContentTask.spawn(browser, {}, () => {
content.window.dummyListener = () => {};
content.document.getElementById('parent').addEventListener(
'click', content.window.dummyListener);
content.document.getElementById("parent").addEventListener(
"click", content.window.dummyListener);
});
await onReorder;
let tree = { TEXT: [] };
testAccessibleTree(findAccessibleChildByID(accDoc, 'parent'), tree);
testAccessibleTree(findAccessibleChildByID(accDoc, "parent"), tree);
});

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

@ -2,37 +2,37 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
addAccessibleTask('<select id="select"></select>', async function(browser, accDoc) {
let select = findAccessibleChildByID(accDoc, 'select');
let select = findAccessibleChildByID(accDoc, "select");
let onEvent = waitForEvent(EVENT_REORDER, 'select');
let onEvent = waitForEvent(EVENT_REORDER, "select");
// Create a combobox with grouping and 2 standalone options
await ContentTask.spawn(browser, {}, () => {
let doc = content.document;
let contentSelect = doc.getElementById('select');
let optGroup = doc.createElement('optgroup');
let contentSelect = doc.getElementById("select");
let optGroup = doc.createElement("optgroup");
for (let i = 0; i < 2; i++) {
let opt = doc.createElement('option');
let opt = doc.createElement("option");
opt.value = i;
opt.text = 'Option: Value ' + i;
opt.text = "Option: Value " + i;
optGroup.appendChild(opt);
}
contentSelect.add(optGroup, null);
for (let i = 0; i < 2; i++) {
let opt = doc.createElement('option');
let opt = doc.createElement("option");
contentSelect.add(opt, null);
}
contentSelect.firstChild.firstChild.id = 'option1Node';
contentSelect.firstChild.firstChild.id = "option1Node";
});
let event = await onEvent;
let option1Node = findAccessibleChildByID(event.accessible, 'option1Node');
let option1Node = findAccessibleChildByID(event.accessible, "option1Node");
let tree = {
COMBOBOX: [ {
@ -49,12 +49,12 @@ addAccessibleTask('<select id="select"></select>', async function(browser, accDo
} ]
};
testAccessibleTree(select, tree);
ok(!isDefunct(option1Node), 'option shouldn\'t be defunct');
ok(!isDefunct(option1Node), "option shouldn't be defunct");
onEvent = waitForEvent(EVENT_REORDER, 'select');
onEvent = waitForEvent(EVENT_REORDER, "select");
// Remove grouping from combobox
await ContentTask.spawn(browser, {}, () => {
let contentSelect = content.document.getElementById('select');
let contentSelect = content.document.getElementById("select");
contentSelect.firstChild.remove();
});
await onEvent;
@ -69,12 +69,12 @@ addAccessibleTask('<select id="select"></select>', async function(browser, accDo
};
testAccessibleTree(select, tree);
ok(isDefunct(option1Node),
'removed option shouldn\'t be accessible anymore!');
"removed option shouldn't be accessible anymore!");
onEvent = waitForEvent(EVENT_REORDER, 'select');
onEvent = waitForEvent(EVENT_REORDER, "select");
// Remove all options from combobox
await ContentTask.spawn(browser, {}, () => {
let contentSelect = content.document.getElementById('select');
let contentSelect = content.document.getElementById("select");
while (contentSelect.length) {
contentSelect.remove(0);
}

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

@ -2,37 +2,37 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
addAccessibleTask('doc_treeupdate_removal.xhtml', async function(browser, accDoc) {
ok(isAccessible(findAccessibleChildByID(accDoc, 'the_table')),
'table should be accessible');
addAccessibleTask("doc_treeupdate_removal.xhtml", async function(browser, accDoc) {
ok(isAccessible(findAccessibleChildByID(accDoc, "the_table")),
"table should be accessible");
// Move the_table element into hidden subtree.
let onReorder = waitForEvent(EVENT_REORDER, 'body');
let onReorder = waitForEvent(EVENT_REORDER, "body");
await ContentTask.spawn(browser, {}, () => content.document.getElementById(
'the_displaynone').appendChild(content.document.getElementById(
'the_table')));
"the_displaynone").appendChild(content.document.getElementById(
"the_table")));
await onReorder;
ok(!isAccessible(findAccessibleChildByID(accDoc, 'the_table')),
'table in display none tree shouldn\'t be accessible');
ok(!isAccessible(findAccessibleChildByID(accDoc, 'the_row')),
'row shouldn\'t be accessible');
ok(!isAccessible(findAccessibleChildByID(accDoc, "the_table")),
"table in display none tree shouldn't be accessible");
ok(!isAccessible(findAccessibleChildByID(accDoc, "the_row")),
"row shouldn't be accessible");
// Remove the_row element (since it did not have accessible, no event needed).
await ContentTask.spawn(browser, {}, () =>
content.document.body.removeChild(
content.document.getElementById('the_row')));
content.document.getElementById("the_row")));
// make sure no accessibles have stuck around.
ok(!isAccessible(findAccessibleChildByID(accDoc, 'the_row')),
'row shouldn\'t be accessible');
ok(!isAccessible(findAccessibleChildByID(accDoc, 'the_table')),
'table shouldn\'t be accessible');
ok(!isAccessible(findAccessibleChildByID(accDoc, 'the_displayNone')),
'display none things shouldn\'t be accessible');
ok(!isAccessible(findAccessibleChildByID(accDoc, "the_row")),
"row shouldn't be accessible");
ok(!isAccessible(findAccessibleChildByID(accDoc, "the_table")),
"table shouldn't be accessible");
ok(!isAccessible(findAccessibleChildByID(accDoc, "the_displayNone")),
"display none things shouldn't be accessible");
});

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

@ -2,10 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
addAccessibleTask(`
<table id="table">
@ -14,7 +14,7 @@ addAccessibleTask(`
<td>cell2</td>
</tr>
</table>`, async function(browser, accDoc) {
let table = findAccessibleChildByID(accDoc, 'table');
let table = findAccessibleChildByID(accDoc, "table");
let tree = {
TABLE: [
@ -26,14 +26,14 @@ addAccessibleTask(`
};
testAccessibleTree(table, tree);
let onReorder = waitForEvent(EVENT_REORDER, 'table');
let onReorder = waitForEvent(EVENT_REORDER, "table");
await ContentTask.spawn(browser, {}, () => {
// append a caption, it should appear as a first element in the
// accessible tree.
let doc = content.document;
let caption = doc.createElement('caption');
caption.textContent = 'table caption';
doc.getElementById('table').appendChild(caption);
let caption = doc.createElement("caption");
caption.textContent = "table caption";
doc.getElementById("table").appendChild(caption);
});
await onReorder;

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

@ -2,10 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
async function removeTextData(browser, accessible, id, role) {
let tree = {
@ -16,7 +16,7 @@ async function removeTextData(browser, accessible, id, role) {
let onReorder = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, id, contentId => {
content.document.getElementById(contentId).firstChild.textContent = '';
content.document.getElementById(contentId).firstChild.textContent = "";
});
await onReorder;
@ -27,8 +27,8 @@ async function removeTextData(browser, accessible, id, role) {
addAccessibleTask(`
<p id="p">text</p>
<pre id="pre">text</pre>`, async function(browser, accDoc) {
let p = findAccessibleChildByID(accDoc, 'p');
let pre = findAccessibleChildByID(accDoc, 'pre');
await removeTextData(browser, p, 'p', ROLE_PARAGRAPH);
await removeTextData(browser, pre, 'pre', ROLE_TEXT_CONTAINER);
let p = findAccessibleChildByID(accDoc, "p");
let pre = findAccessibleChildByID(accDoc, "pre");
await removeTextData(browser, p, "p", ROLE_PARAGRAPH);
await removeTextData(browser, pre, "pre", ROLE_TEXT_CONTAINER);
});

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

@ -2,17 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
async function testTreeOnHide(browser, accDoc, containerID, id, before, after) {
let acc = findAccessibleChildByID(accDoc, containerID);
testAccessibleTree(acc, before);
let onReorder = waitForEvent(EVENT_REORDER, containerID);
await invokeSetStyle(browser, id, 'visibility', 'hidden');
await invokeSetStyle(browser, id, "visibility", "hidden");
await onReorder;
testAccessibleTree(acc, after);
@ -34,12 +34,12 @@ async function test3(browser, accessible) {
] };
testAccessibleTree(accessible, tree);
let onReorder = waitForEvent(EVENT_REORDER, 't3_container');
let onReorder = waitForEvent(EVENT_REORDER, "t3_container");
await ContentTask.spawn(browser, {}, () => {
let doc = content.document;
doc.getElementById('t3_container').style.color = 'red';
doc.getElementById('t3_parent').style.visibility = 'hidden';
doc.getElementById('t3_parent2').style.visibility = 'hidden';
doc.getElementById("t3_container").style.color = "red";
doc.getElementById("t3_parent").style.visibility = "hidden";
doc.getElementById("t3_parent2").style.visibility = "hidden";
});
await onReorder;
@ -66,11 +66,11 @@ async function test4(browser, accessible) {
] };
testAccessibleTree(accessible, tree);
let onReorder = waitForEvent(EVENT_REORDER, 't4_parent');
let onReorder = waitForEvent(EVENT_REORDER, "t4_parent");
await ContentTask.spawn(browser, {}, () => {
let doc = content.document;
doc.getElementById('t4_container').style.color = 'red';
doc.getElementById('t4_child').style.visibility = 'visible';
doc.getElementById("t4_container").style.color = "red";
doc.getElementById("t4_child").style.visibility = "visible";
});
await onReorder;
@ -90,11 +90,11 @@ async function test4(browser, accessible) {
testAccessibleTree(accessible, tree);
}
addAccessibleTask('doc_treeupdate_visibility.html', async function(browser, accDoc) {
let t3Container = findAccessibleChildByID(accDoc, 't3_container');
let t4Container = findAccessibleChildByID(accDoc, 't4_container');
addAccessibleTask("doc_treeupdate_visibility.html", async function(browser, accDoc) {
let t3Container = findAccessibleChildByID(accDoc, "t3_container");
let t4Container = findAccessibleChildByID(accDoc, "t4_container");
await testTreeOnHide(browser, accDoc, 't1_container', 't1_parent', {
await testTreeOnHide(browser, accDoc, "t1_container", "t1_parent", {
SECTION: [{
SECTION: [{
SECTION: [ { TEXT_LEAF: [] } ]
@ -106,7 +106,7 @@ addAccessibleTask('doc_treeupdate_visibility.html', async function(browser, accD
} ]
});
await testTreeOnHide(browser, accDoc, 't2_container', 't2_grandparent', {
await testTreeOnHide(browser, accDoc, "t2_container", "t2_grandparent", {
SECTION: [{ // container
SECTION: [{ // grand parent
SECTION: [{
@ -135,7 +135,7 @@ addAccessibleTask('doc_treeupdate_visibility.html', async function(browser, accD
await test3(browser, t3Container);
await test4(browser, t4Container);
await testTreeOnHide(browser, accDoc, 't5_container', 't5_subcontainer', {
await testTreeOnHide(browser, accDoc, "t5_container", "t5_subcontainer", {
SECTION: [{ // container
SECTION: [{ // subcontainer
TABLE: [{
@ -157,7 +157,7 @@ addAccessibleTask('doc_treeupdate_visibility.html', async function(browser, accD
}]
});
await testTreeOnHide(browser, accDoc, 't6_container', 't6_subcontainer', {
await testTreeOnHide(browser, accDoc, "t6_container", "t6_subcontainer", {
SECTION: [{ // container
SECTION: [{ // subcontainer
TABLE: [{

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

@ -2,14 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
addAccessibleTask('doc_treeupdate_whitespace.html', async function(browser, accDoc) {
let container1 = findAccessibleChildByID(accDoc, 'container1');
let container2Parent = findAccessibleChildByID(accDoc, 'container2-parent');
addAccessibleTask("doc_treeupdate_whitespace.html", async function(browser, accDoc) {
let container1 = findAccessibleChildByID(accDoc, "container1");
let container2Parent = findAccessibleChildByID(accDoc, "container2-parent");
let tree = {
SECTION: [
@ -22,12 +22,12 @@ addAccessibleTask('doc_treeupdate_whitespace.html', async function(browser, accD
};
testAccessibleTree(container1, tree);
let onReorder = waitForEvent(EVENT_REORDER, 'container1');
let onReorder = waitForEvent(EVENT_REORDER, "container1");
// Remove img1 from container1
await ContentTask.spawn(browser, {}, () => {
let doc = content.document;
doc.getElementById('container1').removeChild(
doc.getElementById('img1'));
doc.getElementById("container1").removeChild(
doc.getElementById("img1"));
});
await onReorder;
@ -48,14 +48,14 @@ addAccessibleTask('doc_treeupdate_whitespace.html', async function(browser, accD
};
testAccessibleTree(container2Parent, tree);
onReorder = waitForEvent(EVENT_REORDER, 'container2-parent');
onReorder = waitForEvent(EVENT_REORDER, "container2-parent");
// Append an img with valid src to container2
await ContentTask.spawn(browser, {}, () => {
let doc = content.document;
let img = doc.createElement('img');
img.setAttribute('src',
'http://example.com/a11y/accessible/tests/mochitest/moz.png');
doc.getElementById('container2').appendChild(img);
let img = doc.createElement("img");
img.setAttribute("src",
"http://example.com/a11y/accessible/tests/mochitest/moz.png");
doc.getElementById("container2").appendChild(img);
});
await onReorder;

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

@ -2,14 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
// Load the shared-head file first.
/* import-globals-from ../shared-head.js */
Services.scriptloader.loadSubScript(
'chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js',
"chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js",
this);
// Loading and common.js from accessible/tests/mochitest/ for all tests, as
// well as events.js.
loadScripts({ name: 'common.js', dir: MOCHITESTS_DIR }, 'events.js');
loadScripts({ name: "common.js", dir: MOCHITESTS_DIR }, "events.js");

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

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
// This is loaded by head.js, so has the same globals, hence we import the
// globals from there.
@ -44,7 +44,7 @@ function eventToString(event) {
event.isExtraState ? event.state : 0);
info += `, state: ${stateStr}, is enabled: ${event.isEnabled}`;
} else if (event instanceof nsIAccessibleTextChangeEvent) {
let tcType = event.isInserted ? 'inserted' : 'removed';
let tcType = event.isInserted ? "inserted" : "removed";
info += `, start: ${event.start}, length: ${event.length}, ${tcType} text: ${event.modifiedText}`;
}
@ -94,7 +94,7 @@ function waitForEvent(eventType, matchCriteria) {
return new Promise(resolve => {
let eventObserver = {
observe(subject, topic, data) {
if (topic !== 'accessible-event') {
if (topic !== "accessible-event") {
return;
}
@ -113,14 +113,14 @@ function waitForEvent(eventType, matchCriteria) {
if (matchEvent(event, matchCriteria)) {
Logger.log(`Correct event type: ${eventTypeToString(eventType)}`);
ok(event.accessibleDocument instanceof nsIAccessibleDocument,
'Accessible document present.');
"Accessible document present.");
Services.obs.removeObserver(this, 'accessible-event');
Services.obs.removeObserver(this, "accessible-event");
resolve(event);
}
}
};
Services.obs.addObserver(eventObserver, 'accessible-event');
Services.obs.addObserver(eventObserver, "accessible-event");
});
}
@ -128,12 +128,12 @@ class UnexpectedEvents {
constructor(unexpected) {
if (unexpected.length) {
this.unexpected = unexpected;
Services.obs.addObserver(this, 'accessible-event');
Services.obs.addObserver(this, "accessible-event");
}
}
observe(subject, topic, data) {
if (topic !== 'accessible-event') {
if (topic !== "accessible-event") {
return;
}
@ -149,7 +149,7 @@ class UnexpectedEvents {
stop() {
if (this.unexpected) {
Services.obs.removeObserver(this, 'accessible-event');
Services.obs.removeObserver(this, "accessible-event");
}
}
}

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

@ -5,7 +5,7 @@
"use strict";
function busyChecker(isBusy) {
return function (event) {
return function(event) {
let scEvent;
try {
scEvent = event.QueryInterface(nsIAccessibleStateChangeEvent);
@ -18,13 +18,13 @@ function busyChecker(isBusy) {
}
function inIframeChecker(iframeId) {
return function (event) {
return function(event) {
return getAccessibleDOMNodeID(event.accessibleDocument.parent) == iframeId;
};
}
function urlChecker(url) {
return function (event) {
return function(event) {
info(`${event.accessibleDocument.URL} == ${url}`);
return event.accessibleDocument.URL == url;
};
@ -33,7 +33,7 @@ function urlChecker(url) {
async function runTests(browser, accDoc) {
let onLoadEvents = waitForEvents([
[EVENT_REORDER, getAccessible(browser)],
[EVENT_DOCUMENT_LOAD_COMPLETE, 'body2'],
[EVENT_DOCUMENT_LOAD_COMPLETE, "body2"],
[EVENT_STATE_CHANGE, busyChecker(false)]
], [ // unexpected
[EVENT_DOCUMENT_LOAD_COMPLETE, inIframeChecker("iframe1")],

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

@ -6,8 +6,8 @@
/* import-globals-from ../../mochitest/states.js */
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'states.js', dir: MOCHITESTS_DIR },
{ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "states.js", dir: MOCHITESTS_DIR },
{ name: "role.js", dir: MOCHITESTS_DIR });
async function runTests(browser, accDoc) {
let onFocus = waitForEvent(EVENT_FOCUS, "input");

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

@ -6,8 +6,8 @@
/* import-globals-from ../../mochitest/states.js */
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'states.js', dir: MOCHITESTS_DIR },
{ name: 'role.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "states.js", dir: MOCHITESTS_DIR },
{ name: "role.js", dir: MOCHITESTS_DIR });
async function runTests(browser, accDoc) {
let onFocus = waitForEvent(EVENT_FOCUS, "button");

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

@ -2,14 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
// Load the shared-head file first.
/* import-globals-from ../shared-head.js */
Services.scriptloader.loadSubScript(
'chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js',
"chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js",
this);
// Loading and common.js from accessible/tests/mochitest/ for all tests, as
// well as events.js.
loadScripts({ name: 'common.js', dir: MOCHITESTS_DIR }, 'events.js', 'layout.js');
loadScripts({ name: "common.js", dir: MOCHITESTS_DIR }, "events.js", "layout.js");

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

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* exported initPromise, shutdownPromise, waitForEvent, setE10sPrefs,
unsetE10sPrefs, forceGC */
@ -15,9 +15,9 @@ function setE10sPrefs() {
return new Promise(resolve =>
SpecialPowers.pushPrefEnv({
set: [
['browser.tabs.remote.autostart', true],
['browser.tabs.remote.force-enable', true],
['extensions.e10sBlocksEnabling', false]
["browser.tabs.remote.autostart", true],
["browser.tabs.remote.force-enable", true],
["extensions.e10sBlocksEnabling", false]
]
}, resolve));
}
@ -35,7 +35,7 @@ function unsetE10sPrefs() {
// Load the shared-head file first.
/* import-globals-from shared-head.js */
Services.scriptloader.loadSubScript(
'chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js',
"chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js",
this);
/**
@ -45,10 +45,10 @@ Services.scriptloader.loadSubScript(
function a11yInitOrShutdownPromise() {
return new Promise(resolve => {
let observe = (subject, topic, data) => {
Services.obs.removeObserver(observe, 'a11y-init-or-shutdown');
Services.obs.removeObserver(observe, "a11y-init-or-shutdown");
resolve(data);
};
Services.obs.addObserver(observe, 'a11y-init-or-shutdown');
Services.obs.addObserver(observe, "a11y-init-or-shutdown");
});
}
@ -85,9 +85,9 @@ function initPromise(contentBrowser) {
let a11yInitPromise = contentBrowser ?
contentA11yInitOrShutdownPromise(contentBrowser) :
a11yInitOrShutdownPromise();
return promiseOK(a11yInitPromise, '1').then(
() => ok(true, 'Service initialized correctly'),
() => ok(false, 'Service shutdown incorrectly'));
return promiseOK(a11yInitPromise, "1").then(
() => ok(true, "Service initialized correctly"),
() => ok(false, "Service shutdown incorrectly"));
}
/**
@ -103,9 +103,9 @@ function shutdownPromise(contentBrowser) {
let a11yShutdownPromise = contentBrowser ?
contentA11yInitOrShutdownPromise(contentBrowser) :
a11yInitOrShutdownPromise();
return promiseOK(a11yShutdownPromise, '0').then(
() => ok(true, 'Service shutdown correctly'),
() => ok(false, 'Service initialized incorrectly'));
return promiseOK(a11yShutdownPromise, "0").then(
() => ok(true, "Service shutdown correctly"),
() => ok(false, "Service initialized incorrectly"));
}
/**
@ -119,12 +119,12 @@ function waitForEvent(eventType, expectedId) {
let event = subject.QueryInterface(Ci.nsIAccessibleEvent);
if (event.eventType === eventType &&
event.accessible.id === expectedId) {
Services.obs.removeObserver(this, 'accessible-event');
Services.obs.removeObserver(this, "accessible-event");
resolve(event);
}
}
};
Services.obs.addObserver(eventObserver, 'accessible-event');
Services.obs.addObserver(eventObserver, "accessible-event");
});
}

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

@ -2,18 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/layout.js */
loadScripts({ name: 'layout.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "layout.js", dir: MOCHITESTS_DIR });
async function runTests(browser, accDoc) {
loadFrameScripts(browser, { name: 'layout.js', dir: MOCHITESTS_DIR });
loadFrameScripts(browser, { name: "layout.js", dir: MOCHITESTS_DIR });
let paragraph = findAccessibleChildByID(accDoc, "paragraph", [nsIAccessibleText]);
let offset = 64; // beginning of 4th stanza
let [x /*,y*/] = getPos(paragraph);
let [x /* ,y*/] = getPos(paragraph);
let [docX, docY] = getPos(accDoc);
paragraph.scrollSubstringToPoint(offset, offset,
@ -26,7 +26,7 @@ async function runTests(browser, accDoc) {
paragraph = findAccessibleChildByID(accDoc, "paragraph2", [nsIAccessibleText]);
offset = 52; // // beginning of 4th stanza
[x /*,y*/] = getPos(paragraph);
[x /* ,y*/] = getPos(paragraph);
paragraph.scrollSubstringToPoint(offset, offset,
COORDTYPE_SCREEN_RELATIVE, docX, docY);
testTextPos(paragraph, offset, [x, docY], COORDTYPE_SCREEN_RELATIVE);

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

@ -2,14 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
// Load the shared-head file first.
/* import-globals-from ../shared-head.js */
Services.scriptloader.loadSubScript(
'chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js',
"chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js",
this);
// Loading and common.js from accessible/tests/mochitest/ for all tests, as
// well as events.js.
loadScripts({ name: 'common.js', dir: MOCHITESTS_DIR }, 'events.js');
loadScripts({ name: "common.js", dir: MOCHITESTS_DIR }, "events.js");

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

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../mochitest/common.js */
/* import-globals-from events.js */
@ -19,18 +19,18 @@ const { interfaces: Ci, utils: Cu, classes: Cc } = Components;
* Current browser test directory path used to load subscripts.
*/
const CURRENT_DIR =
'chrome://mochitests/content/browser/accessible/tests/browser/';
"chrome://mochitests/content/browser/accessible/tests/browser/";
/**
* A11y mochitest directory where we find common files used in both browser and
* plain tests.
*/
const MOCHITESTS_DIR =
'chrome://mochitests/content/a11y/accessible/tests/mochitest/';
"chrome://mochitests/content/a11y/accessible/tests/mochitest/";
/**
* A base URL for test files used in content.
*/
const CURRENT_CONTENT_DIR =
'http://example.com/browser/accessible/tests/browser/';
"http://example.com/browser/accessible/tests/browser/";
const LOADED_FRAMESCRIPTS = new Map();
@ -163,7 +163,7 @@ function invokeFocus(browser, id) {
*/
function loadScripts(...scripts) {
for (let script of scripts) {
let path = typeof script === 'string' ? `${CURRENT_DIR}${script}` :
let path = typeof script === "string" ? `${CURRENT_DIR}${script}` :
`${script.dir}${script.name}`;
Services.scriptloader.loadSubScript(path, this);
}
@ -178,8 +178,8 @@ function loadFrameScripts(browser, ...scripts) {
let mm = browser.messageManager;
for (let script of scripts) {
let frameScript;
if (typeof script === 'string') {
if (script.includes('.js')) {
if (typeof script === "string") {
if (script.includes(".js")) {
// If script string includes a .js extention, assume it is a script
// path.
frameScript = `${CURRENT_DIR}${script}`;
@ -214,7 +214,7 @@ function loadFrameScripts(browser, ...scripts) {
* @return {String} a base64 encoded data url of the document container the
* snippet.
**/
function snippetToURL(snippet, bodyAttrs={}) {
function snippetToURL(snippet, bodyAttrs = {}) {
let attrs = Object.assign({}, { id: "body" }, bodyAttrs);
let attrsString = Object.entries(attrs).map(
([attr, value]) => `${attr}=${JSON.stringify(value)}`).join(" ");
@ -242,22 +242,22 @@ function snippetToURL(snippet, bodyAttrs={}) {
function addAccessibleTask(doc, task) {
add_task(async function() {
let url;
if (doc.includes('doc_')) {
if (doc.includes("doc_")) {
url = `${CURRENT_CONTENT_DIR}e10s/${doc}`;
} else {
url = snippetToURL(doc);
}
registerCleanupFunction(() => {
let observers = Services.obs.enumerateObservers('accessible-event');
let observers = Services.obs.enumerateObservers("accessible-event");
while (observers.hasMoreElements()) {
Services.obs.removeObserver(
observers.getNext().QueryInterface(Ci.nsIObserver),
'accessible-event');
"accessible-event");
}
});
let onDocLoad = waitForEvent(EVENT_DOCUMENT_LOAD_COMPLETE, 'body');
let onDocLoad = waitForEvent(EVENT_DOCUMENT_LOAD_COMPLETE, "body");
await BrowserTestUtils.withNewTab({
gBrowser,
@ -275,8 +275,8 @@ function addAccessibleTask(doc, task) {
await SimpleTest.promiseFocus(browser);
loadFrameScripts(browser,
'let { document, window, navigator } = content;',
{ name: 'common.js', dir: MOCHITESTS_DIR });
"let { document, window, navigator } = content;",
{ name: "common.js", dir: MOCHITESTS_DIR });
Logger.log(
`e10s enabled: ${Services.appinfo.browserTabsRemoteAutostart}`);

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

@ -2,12 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
/* import-globals-from ../../mochitest/states.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR },
{ name: 'states.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR },
{ name: "states.js", dir: MOCHITESTS_DIR });
async function runTests(browser, accDoc) {
let getAcc = id => findAccessibleChildByID(accDoc, id);
@ -18,7 +18,7 @@ async function runTests(browser, accDoc) {
let onStateChanged = waitForEvent(EVENT_STATE_CHANGE, "link_traversed");
let newWinOpened = BrowserTestUtils.waitForNewWindow();
await BrowserTestUtils.synthesizeMouse('#link_traversed',
await BrowserTestUtils.synthesizeMouse("#link_traversed",
1, 1, { shiftKey: true }, browser);
await onStateChanged;

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

@ -2,12 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
/* import-globals-from ../../mochitest/role.js */
/* import-globals-from ../../mochitest/states.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR },
{ name: 'states.js', dir: MOCHITESTS_DIR });
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR },
{ name: "states.js", dir: MOCHITESTS_DIR });
async function runTest(browser, accDoc) {
let getAcc = id => findAccessibleChildByID(accDoc, id);
@ -23,7 +23,7 @@ async function runTest(browser, accDoc) {
// scroll into view the item
await ContentTask.spawn(browser, {}, () => {
content.document.getElementById('li_last').scrollIntoView(true);
content.document.getElementById("li_last").scrollIntoView(true);
});
testStates(lastLi, 0, 0, STATE_OFFSCREEN | STATE_INVISIBLE);

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

@ -2,14 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
// Load the shared-head file first.
/* import-globals-from ../shared-head.js */
Services.scriptloader.loadSubScript(
'chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js',
"chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js",
this);
// Loading and common.js from accessible/tests/mochitest/ for all tests, as
// well as events.js.
loadScripts({ name: 'common.js', dir: MOCHITESTS_DIR }, 'events.js');
loadScripts({ name: "common.js", dir: MOCHITESTS_DIR }, "events.js");

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

@ -2,14 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict';
"use strict";
// Load the shared-head file first.
/* import-globals-from ../shared-head.js */
Services.scriptloader.loadSubScript(
'chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js',
"chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js",
this);
// Loading and common.js from accessible/tests/mochitest/ for all tests, as
// well as events.js.
loadScripts({ name: 'common.js', dir: MOCHITESTS_DIR }, 'events.js', 'layout.js');
loadScripts({ name: "common.js", dir: MOCHITESTS_DIR }, "events.js", "layout.js");

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

@ -27,7 +27,7 @@ function dumpAccessibleNode(aNode, level) {
msg += " noName ";
}
dump(msg + '\n');
dump(msg + "\n");
}
@ -42,12 +42,12 @@ function dumpAccessibleTree(aNode, level) {
child = child.nextSibling;
}
} catch (e) {
dump("Error visiting child nodes: " + e + '\n');
dump("Error visiting child nodes: " + e + "\n");
}
}
function A(o) {
var acc = SpecialPowers.Cc['@mozilla.org/accessibilityService;1']
var acc = SpecialPowers.Cc["@mozilla.org/accessibilityService;1"]
.getService(SpecialPowers.Ci.nsIAccessibilityService);
return acc.getAccessibleFor(o);
}
@ -60,10 +60,10 @@ setTimeout(beginAccessible, 100);
setTimeout(doe, 200);
function doe() {
document.getElementById('mw_a').appendChild(document.getElementById('mw_b'));
document.getElementById('mw_c').appendChild(document.getElementById('mw_d'));
document.getElementById('mw_e').appendChild(document.getElementById('mw_f'));
document.getElementById('mw_g').appendChild(document.getElementById('mw_b'));
document.getElementById("mw_a").appendChild(document.getElementById("mw_b"));
document.getElementById("mw_c").appendChild(document.getElementById("mw_d"));
document.getElementById("mw_e").appendChild(document.getElementById("mw_f"));
document.getElementById("mw_g").appendChild(document.getElementById("mw_b"));
}
</script>
</body>

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

@ -1,4 +1,4 @@
////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////
// Event constants
const MOUSEDOWN_EVENT = 1;
@ -10,7 +10,7 @@ const FOCUS_EVENT = 16;
const CLICK_EVENTS = MOUSEDOWN_EVENT | MOUSEUP_EVENT | CLICK_EVENT;
const XUL_EVENTS = CLICK_EVENTS | COMMAND_EVENT;
////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////
// Public functions
/**
@ -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 || []);
@ -108,15 +106,13 @@ function testActionNames(aID, aActions)
}
}
////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////
// Private
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);
}

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

@ -18,27 +18,24 @@
src="../actions.js"></script>
<script type="application/javascript">
////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////
// 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);
}
}
////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////
// Test
// gA11yEventDumpID = "debug"; // debug stuff
//gA11yEventDumpToConsole = true; // 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,30 +34,26 @@
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 ";
}
}
//gA11yEventDumpToConsole = true;
//enableLogging("tree,eventTree,verbose");
// gA11yEventDumpToConsole = true;
// enableLogging("tree,eventTree,verbose");
function doTest()
{
function doTest() {
var actionsArray = [
{
ID: "link1",

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

@ -24,40 +24,33 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
<script type="application/javascript">
// gA11yEventDumpID = "eventDump";
//gA11yEventDumpToConsole = true; // debug stuff
// 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
todo(false, "Focus test are disabled until bug 494175 is fixed.");

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

@ -21,9 +21,8 @@
src="../actions.js"></script>
<script type="application/javascript">
//gA11yEventDumpToConsole = true; // debugging
function doTest()
{
// gA11yEventDumpToConsole = true; // debugging
function doTest() {
var actionsArray = [
{
ID: "lb_apple",

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

@ -8,7 +8,7 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script>
'use strict';
"use strict";
SimpleTest.waitForExplicitFinish();
const finish = SimpleTest.finish.bind(SimpleTest);
@ -46,8 +46,8 @@
let anode = ifrDoc.accessibleNode;
ok(anode, "DOM document has accessible node");
is(anode.role, 'document', 'correct role of a document accessible node');
is(anode.DOMNode, ifrDoc, 'correct DOM Node of a document accessible node');
is(anode.role, "document", "correct role of a document accessible node");
is(anode.DOMNode, ifrDoc, "correct DOM Node of a document accessible node");
// States may differ depending on the document state, for example, if it is
// loaded or is loading still.
@ -55,21 +55,21 @@
switch (anode.states.length) {
case 5:
states = [
'readonly', 'focusable', 'opaque', 'enabled', 'sensitive'
"readonly", "focusable", "opaque", "enabled", "sensitive"
];
break;
case 6:
states = [
'readonly', 'busy', 'focusable', 'opaque', 'enabled', 'sensitive'
"readonly", "busy", "focusable", "opaque", "enabled", "sensitive"
];
break;
case 7:
states = [
'readonly', 'busy', 'focusable', 'opaque', 'stale', 'enabled', 'sensitive'
"readonly", "busy", "focusable", "opaque", "stale", "enabled", "sensitive"
];
break;
default:
ok(false, 'Unexpected amount of states');
ok(false, "Unexpected amount of states");
}
if (states) {
for (var i = 0; i < states.length; i++) {
@ -77,25 +77,25 @@
}
}
ok(anode.is('document', 'focusable'),
'correct role and state on an accessible node');
ok(anode.is("document", "focusable"),
"correct role and state on an accessible node");
is(anode.get('explicit-name'), 'true',
'correct object attribute value on an accessible node');
is(anode.get("explicit-name"), "true",
"correct object attribute value on an accessible node");
ok(anode.has('explicit-name'),
'object attributes are present');
ok(anode.has("explicit-name"),
"object attributes are present");
var attrs = [ 'explicit-name' ];
var attrs = [ "explicit-name" ];
if (anode.attributes.length > 1) {
attrs = [
'margin-left', 'text-align', 'text-indent', 'margin-right',
'tag', 'margin-top', 'margin-bottom', 'display',
'explicit-name'
"margin-left", "text-align", "text-indent", "margin-right",
"tag", "margin-top", "margin-bottom", "display",
"explicit-name"
];
}
is(anode.attributes.length, attrs.length, 'correct number of attributes');
is(anode.attributes.length, attrs.length, "correct number of attributes");
for (var i = 0; i < attrs.length; i++) {
ok(attrs.indexOf(anode.attributes[i]) >= 0,
`${anode.attributes[i]} attribute is expected and found`);

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

@ -1,4 +1,4 @@
////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////
// Object attributes.
/**
@ -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);
@ -101,7 +96,7 @@ function testGroupAttrs(aAccOrElmOrID, aPosInSet, aSetSize, aLevel)
}
}
////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////
// Text attributes.
/**
@ -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)" ?
@ -285,12 +275,11 @@ function buildDefaultTextAttrs(aID, aFontSize, aFontWeight, aFontFamily)
return defAttrs;
}
////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////
// 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,49 +17,48 @@
<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',
'doc-acknowledgments',
'doc-afterword',
'doc-appendix',
'doc-backlink',
'doc-biblioentry',
'doc-bibliography',
'doc-biblioref',
'doc-chapter',
'doc-colophon',
'doc-conclusion',
'doc-cover',
'doc-credit',
'doc-credits',
'doc-dedication',
'doc-endnote',
'doc-endnotes',
'doc-epigraph',
'doc-epilogue',
'doc-errata',
'doc-example',
'doc-footnote',
'doc-foreword',
'doc-glossary',
'doc-glossref',
'doc-index',
'doc-introduction',
'doc-noteref',
'doc-notice',
'doc-pagebreak',
'doc-pagelist',
'doc-part',
'doc-preface',
'doc-prologue',
'doc-pullquote',
'doc-qna',
'doc-subtitle',
'doc-tip',
'doc-toc'
"doc-abstract",
"doc-acknowledgments",
"doc-afterword",
"doc-appendix",
"doc-backlink",
"doc-biblioentry",
"doc-bibliography",
"doc-biblioref",
"doc-chapter",
"doc-colophon",
"doc-conclusion",
"doc-cover",
"doc-credit",
"doc-credits",
"doc-dedication",
"doc-endnote",
"doc-endnotes",
"doc-epigraph",
"doc-epilogue",
"doc-errata",
"doc-example",
"doc-footnote",
"doc-foreword",
"doc-glossary",
"doc-glossref",
"doc-index",
"doc-introduction",
"doc-noteref",
"doc-notice",
"doc-pagebreak",
"doc-pagelist",
"doc-part",
"doc-preface",
"doc-prologue",
"doc-pullquote",
"doc-qna",
"doc-subtitle",
"doc-tip",
"doc-toc"
];
for (let attr of dpub_attrs) {
testAttrs(attr, {"xml-roles": attr}, true);

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

@ -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,50 +16,49 @@
src="../events.js"></script>
<script type="application/javascript">
function doTest()
{
//////////////////////////////////////////////////////////////////////////
function doTest() {
// ////////////////////////////////////////////////////////////////////////
// HTML select with no size attribute.
testGroupAttrs("opt1-nosize", 1, 4);
testGroupAttrs("opt2-nosize", 2, 4);
testGroupAttrs("opt3-nosize", 3, 4);
testGroupAttrs("opt4-nosize", 4, 4);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML select
testGroupAttrs("opt1", 1, 2);
testGroupAttrs("opt2", 2, 2);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML select with options
// XXX bug 469123
//testGroupAttrs("select2_optgroup", 1, 3, 1);
//testGroupAttrs("select2_opt3", 2, 3, 1);
//testGroupAttrs("select2_opt4", 3, 3, 1);
//testGroupAttrs("select2_opt1", 1, 2, 2);
//testGroupAttrs("select2_opt2", 2, 2, 2);
// testGroupAttrs("select2_optgroup", 1, 3, 1);
// testGroupAttrs("select2_opt3", 2, 3, 1);
// testGroupAttrs("select2_opt4", 3, 3, 1);
// testGroupAttrs("select2_opt1", 1, 2, 2);
// testGroupAttrs("select2_opt2", 2, 2, 2);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML input@type="radio" within form
testGroupAttrs("radio1", 1, 2);
testGroupAttrs("radio2", 2, 2);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML input@type="radio" within document
testGroupAttrs("radio3", 1, 2);
testGroupAttrs("radio4", 2, 2);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// Hidden HTML input@type="radio"
testGroupAttrs("radio5", 1, 1);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML ul/ol
testGroupAttrs("li1", 1, 3);
testGroupAttrs("li2", 2, 3);
testGroupAttrs("li3", 3, 3);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML ul/ol (nested lists)
testGroupAttrs("li4", 1, 3, 1);
@ -70,13 +69,13 @@
testGroupAttrs("n_li5", 2, 3, 2);
testGroupAttrs("n_li6", 3, 3, 2);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// ARIA list
testGroupAttrs("li7", 1, 3);
testGroupAttrs("li8", 2, 3);
testGroupAttrs("li9", 3, 3);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// ARIA list (nested lists: list -> listitem -> list -> listitem)
testGroupAttrs("li10", 1, 3, 1);
testGroupAttrs("li11", 2, 3, 1);
@ -86,7 +85,7 @@
testGroupAttrs("n_li11", 2, 3, 2);
testGroupAttrs("n_li12", 3, 3, 2);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// ARIA list (nested lists: list -> listitem -> group -> listitem)
testGroupAttrs("lgt_li1", 1, 2, 1);
testGroupAttrs("lgt_li1_nli1", 1, 2, 2);
@ -95,7 +94,7 @@
testGroupAttrs("lgt_li2_nli1", 1, 2, 2);
testGroupAttrs("lgt_li2_nli2", 2, 2, 2);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// ARIA menu (menuitem, separator, menuitemradio and menuitemcheckbox)
testGroupAttrs("menu_item1", 1, 2);
testGroupAttrs("menu_item2", 2, 2);
@ -105,19 +104,19 @@
testGroupAttrs("menu_item1.4", 2, 3);
testGroupAttrs("menu_item1.5", 3, 3);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// ARIA tab
testGroupAttrs("tab_1", 1, 3);
testGroupAttrs("tab_2", 2, 3);
testGroupAttrs("tab_3", 3, 3);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// ARIA radio
testGroupAttrs("r1", 1, 3);
testGroupAttrs("r2", 2, 3);
testGroupAttrs("r3", 3, 3);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// ARIA tree
testGroupAttrs("ti1", 1, 3, 1);
testGroupAttrs("ti2", 1, 2, 2);
@ -128,7 +127,7 @@
testGroupAttrs("ti7", 3, 3, 2);
testGroupAttrs("ti8", 3, 3, 1);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// ARIA tree (tree -> treeitem -> group -> treeitem)
testGroupAttrs("tree2_ti1", 1, 2, 1);
testGroupAttrs("tree2_ti1a", 1, 2, 2);
@ -137,7 +136,7 @@
testGroupAttrs("tree2_ti2a", 1, 2, 2);
testGroupAttrs("tree2_ti2b", 2, 2, 2);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// ARIA tree (tree -> treeitem, group -> treeitem)
testGroupAttrs("tree3_ti1", 1, 2, 1);
testGroupAttrs("tree3_ti1a", 1, 2, 2);
@ -146,7 +145,7 @@
testGroupAttrs("tree3_ti2a", 1, 2, 2);
testGroupAttrs("tree3_ti2b", 2, 2, 2);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// ARIA grid
testGroupAttrs("grid_row1", 1, 2);
testAbsentAttrs("grid_cell1", {"posinset": "", "setsize": ""});
@ -156,7 +155,7 @@
testAbsentAttrs("grid_cell3", {"posinset": "", "setsize": ""});
testAbsentAttrs("grid_cell4", {"posinset": "", "setsize": ""});
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// ARIA treegrid
testGroupAttrs("treegrid_row1", 1, 2, 1);
testAbsentAttrs("treegrid_cell1", {"posinset": "", "setsize": ""});
@ -170,7 +169,7 @@
testAbsentAttrs("treegrid_cell5", {"posinset": "", "setsize": ""});
testAbsentAttrs("treegrid_cell6", {"posinset": "", "setsize": ""});
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML headings
testGroupAttrs("h1", 0, 0, 1);
testGroupAttrs("h2", 0, 0, 2);
@ -179,19 +178,19 @@
testGroupAttrs("h5", 0, 0, 5);
testGroupAttrs("h6", 0, 0, 6);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// ARIA combobox
testGroupAttrs("combo1_opt1", 1, 4);
testGroupAttrs("combo1_opt2", 2, 4);
testGroupAttrs("combo1_opt3", 3, 4);
testGroupAttrs("combo1_opt4", 4, 4);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// ARIA table
testGroupAttrs("table_cell", 3, 4);
testGroupAttrs("table_row", 2, 2);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// ARIA list constructed by ARIA owns
testGroupAttrs("t1_li1", 1, 3);
testGroupAttrs("t1_li2", 2, 3);

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

@ -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,42 +158,35 @@ 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);
},
removeValueAt: function (aRowIndex, aRemoveFromDb) {},
removeValueAt: function(aRowIndex, aRemoveFromDb) {},
// nsISupports implementation
QueryInterface: function(iid) {

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

@ -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,29 +29,25 @@
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";
}
}
//gA11yEventDumpToConsole = true;
// gA11yEventDumpToConsole = true;
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,92 +12,81 @@ 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");
}
////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////
// private section
Components.utils.import("resource://gre/modules/Services.jsm");
@ -110,8 +98,7 @@ var gBrowserContext =
startURL: ""
};
function openBrowserWindowIntl()
{
function openBrowserWindowIntl() {
var params = "chrome,all,dialog=no";
var rect = gBrowserContext.browserRect;
if (rect) {
@ -130,13 +117,12 @@ function openBrowserWindowIntl()
"_blank", params,
gBrowserContext.startURL);
whenDelayedStartupFinished(browserWindow(), function () {
whenDelayedStartupFinished(browserWindow(), function() {
addA11yLoadEvent(startBrowserTests, browserWindow());
});
}
function startBrowserTests()
{
function startBrowserTests() {
if (gBrowserContext.startURL) // wait for load
addA11yLoadEvent(gBrowserContext.testFunc, currentBrowser().contentWindow);
else

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

@ -1,4 +1,4 @@
////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////
// Interfaces
const nsIAccessibilityService = Components.interfaces.nsIAccessibilityService;
@ -54,7 +54,7 @@ const nsIDOMXULElement = Components.interfaces.nsIDOMXULElement;
const nsIPropertyElement = Components.interfaces.nsIPropertyElement;
////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////
// OS detect
const MAC = (navigator.platform.indexOf("Mac") != -1);
@ -62,13 +62,13 @@ const LINUX = (navigator.platform.indexOf("Linux") != -1);
const SOLARIS = (navigator.platform.indexOf("SunOS") != -1);
const WIN = (navigator.platform.indexOf("Win") != -1);
////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////
// Application detect
// Firefox is assumed by default.
const SEAMONKEY = navigator.userAgent.match(/ SeaMonkey\//);
////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////
// Accessible general
const STATE_BUSY = nsIAccessibleStates.STATE_BUSY;
@ -91,7 +91,7 @@ const MAX_TRIM_LENGTH = 100;
/**
* Services to determine if e10s is enabled.
*/
Components.utils.import('resource://gre/modules/Services.jsm');
Components.utils.import("resource://gre/modules/Services.jsm");
/**
* nsIAccessibilityService service.
@ -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;
@ -195,14 +185,13 @@ function isObject(aObj, aExpectedObj, aMsg)
"', expected '" + prettyName(aExpectedObj) + "'");
}
////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////
// Helpers for getting DOM node/accessible
/**
* 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;
@ -458,7 +439,7 @@ function testAccessibleTree(aAccOrElmOrID, aAccTree, aFlags)
case "textAttrs": {
var prevOffset = -1;
for (var offset in accTree[prop]) {
if (prevOffset !=- 1) {
if (prevOffset != - 1) {
var attrs = accTree[prop][prevOffset];
testTextAttrs(acc, prevOffset, attrs, { }, prevOffset, +offset, true);
}
@ -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;
@ -854,14 +826,13 @@ function shortenString(aString, aMaxLength)
aString.substring(aString.length - trimOffset, aString.length);
}
////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////
// General Utils
////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////
/**
* 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;
@ -886,15 +856,14 @@ function setTestPluginEnabledState(aNewEnabledState, aPluginName)
});
}
////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////
// Private
////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////
// 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);
}
@ -217,11 +195,10 @@ function editableTextTest(aID)
getValueChecker(aID, aResStr), testID);
}
//////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////
// 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,16 +243,14 @@ 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()
{
//dumpTree(aID, `'${aID}' tree:`);
finalCheck: function finalCheck() {
// dumpTree(aID, `'${aID}' tree:`);
aChecker.check();
et.unwrapNextTest(); // replace dummy invoker on real invoker object.
@ -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();

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

@ -19,22 +19,21 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452161
src="editabletext.js"></script>
<script type="application/javascript">
//gA11yEventDumpToConsole = true;
//enableLogging("tree,verbose"); // debug
// 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
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// setTextContents
et.scheduleTest(et.setTextContents, "hello", startOffset);
et.scheduleTest(et.setTextContents, "olleh", startOffset);
et.scheduleTest(et.setTextContents, "", startOffset);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// insertText
et.scheduleTest(et.insertText, "hello", startOffset, "hello");
et.scheduleTest(et.insertText, "ma ", startOffset, "ma hello");
@ -43,14 +42,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452161
// XXX: bug 452584
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// deleteText
// et.deleteText(0, 5, "hello hello");
// et.deleteText(5, 6, "hellohello");
// et.deleteText(5, 10, "hello");
// et.deleteText(0, 5, "");
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// copyNPasteText
// et.copyNPasteText(0, 0, 0, "");
// et.insertText("hello", 0, "hello");
@ -58,7 +57,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452161
// et.copyNPasteText(5, 6, 6, "hhelloo");
// et.copyNPasteText(3, 4, 1, "hehelloo");
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// // cutNPasteText
// et.cutNPasteText(0, 1, 1, "ehhelloo");
// et.cutNPasteText(1, 2, 0, "hehelloo");
@ -67,10 +66,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452161
aTestRun.add(et);
}
//gA11yEventDumpToConsole = true; // debug stuff
// 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,9 +24,8 @@
src="../name.js"></script>
<script type="application/javascript">
function doTest()
{
//////////////////////////////////////////////////////////////////////////
function doTest() {
// ////////////////////////////////////////////////////////////////////////
// HTML:a@href
var obj = {
@ -44,7 +43,7 @@
};
testElm("a_href", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:a no @href
obj = {
@ -61,7 +60,7 @@
};
testElm("a_nohref", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:abbr contained by HTML:td
obj = {
@ -77,7 +76,7 @@
};
testElm("td_abbr", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:address
obj = {
@ -86,7 +85,7 @@
};
testElm("address", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:area@href
obj = {
@ -98,7 +97,7 @@
};
testElm(getAccessible("imgmap").firstChild, obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:area no @href
obj = {
@ -108,7 +107,7 @@
};
testElm(getAccessible("imgmap").lastChild, obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:article
obj = {
role: ROLE_ARTICLE,
@ -117,7 +116,7 @@
};
testElm("article", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:aside
obj = {
role: ROLE_NOTE,
@ -126,13 +125,13 @@
};
testElm("aside", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
obj = { // HTML:audio
role: ROLE_GROUPING
};
testElm("audio", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
obj = { // HTML:b contained by paragraph
role: ROLE_PARAGRAPH,
textAttrs: {
@ -146,7 +145,7 @@
}
testElm("b_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
obj = { // HTML:bdi contained by paragraph
role: ROLE_PARAGRAPH,
todo_textAttrs: {
@ -162,7 +161,7 @@
}
testElm("bdi_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:bdo contained by paragraph
obj = {
@ -177,7 +176,7 @@
}
testElm("bdo_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:blockquote
obj = {
@ -187,7 +186,7 @@
};
testElm("blockquote", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:br contained by paragraph
obj = {
@ -196,7 +195,7 @@
};
testElm("br_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
obj = { // HTML:button
role: ROLE_PUSHBUTTON,
absentStates: STATE_DEFAULT,
@ -205,7 +204,7 @@
};
testElm("button", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:button@type="submit" (default button)
obj = {
@ -215,7 +214,7 @@
};
testElm("button_default", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:canvas
obj = {
@ -223,7 +222,7 @@
};
testElm("canvas", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:caption under table
obj = {
@ -270,7 +269,7 @@
};
testElm("table", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:cite contained by paragraph
obj = {
@ -286,7 +285,7 @@
};
testElm("cite_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:code contained by paragraph
obj = {
@ -302,7 +301,7 @@
};
testElm("code_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:col and HTML:colgroup under table
obj =
@ -315,7 +314,7 @@
] };
testElm("colNcolgroup_table", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:data contained by paragraph
obj =
@ -324,12 +323,12 @@
] };
testElm("data_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:datalist associated with input
todo(false, "datalist and summary tree hierarchy test missed");
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:dd, HTML:dl, HTML:dd
obj = {
@ -355,7 +354,7 @@
};
testElm("dl", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:del contained by paragraph
obj = {
@ -371,7 +370,7 @@
};
testElm("del_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:details with open state
obj = {
@ -387,7 +386,7 @@
};
testElm("details", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:details with closed (default) state
obj = {
@ -402,7 +401,7 @@
};
testElm("details_closed", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:dfn contained by paragraph
obj = {
@ -418,12 +417,12 @@
};
testElm("dfn_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:dialog
ok(isAccessible("dialog"), "dialog element is not accessible");
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:div
obj = {
@ -435,7 +434,7 @@
};
testElm("div", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:em in a paragraph
obj = {
@ -451,7 +450,7 @@
};
testElm("em_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:embed (windowless and windowed plugins)
if (WIN) {
@ -469,7 +468,7 @@
testElm("embed_plugin_windowed", obj);
}
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:fieldset and HTML:legend
obj = {
@ -492,7 +491,7 @@
};
testElm("fieldset", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:figure and HTML:figcaption
obj = {
@ -514,7 +513,7 @@
};
testElm("figure", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:footer
obj = {
@ -532,7 +531,7 @@
testElm("footer_in_article", obj);
testElm("footer_in_section", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:form
obj = {
@ -540,7 +539,7 @@
};
testElm("form", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// // HTML:frameset, HTML:frame and HTML:iframe
obj = {
@ -554,7 +553,7 @@
};
testElm("frameset_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:h1, HTML:h2, HTML:h3, HTML:h4, HTML:h5, HTML:h6
obj = {
@ -599,7 +598,7 @@
};
testElm("h6", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:header
obj = {
@ -617,7 +616,7 @@
testElm("header_in_article", obj);
testElm("header_in_section", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:hr
obj = {
@ -625,7 +624,7 @@
};
testElm("hr", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
obj = { // HTML:i contained by paragraph
role: ROLE_PARAGRAPH,
textAttrs: {
@ -639,7 +638,7 @@
}
testElm("i_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:img
obj = {
@ -648,7 +647,7 @@
};
testElm("img", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:input@type="button"
obj = {
@ -657,7 +656,7 @@
};
testElm("input_button", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:input@type="checkbox"
obj = {
@ -675,7 +674,7 @@
};
testElm("input_checkbox_true", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:input@type="file"
obj = {
@ -686,7 +685,7 @@
};
testElm("input_file", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:input@type="image"
obj = {
@ -705,7 +704,7 @@
testElm("input_image_default", obj);
testElm("input_submit_default", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:input@type="number" and etc
obj = {
@ -733,7 +732,7 @@
};
testElm("input_number", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:input@type="text" and etc
obj = {
@ -751,7 +750,7 @@
testElm("input_text", obj);
testElm("input_url", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:input@type="password"
obj = {
@ -783,7 +782,7 @@
ok(getAccessible("input_password_readonly").firstChild.name != "44",
"text leaf for password shouldn't have its real value as its name!");
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:input@type="radio"
obj = {
@ -801,7 +800,7 @@
};
testElm("input_radio_true", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:input@type="range"
obj = {
@ -809,7 +808,7 @@
};
testElm("input_range", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:input@type="reset"
obj = {
@ -819,7 +818,7 @@
};
testElm("input_reset", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:ins contained by paragraph
obj = {
@ -835,7 +834,7 @@
};
testElm("ins_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:kbd contained by paragraph
obj = {
@ -851,7 +850,7 @@
};
testElm("kbd_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:keygen
obj = {
@ -868,7 +867,7 @@
};
testElm("keygen", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:label
obj = {
@ -904,7 +903,7 @@
};
testElm("label_for_input", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:ul, HTML:ol, HTML:li
obj = { // ul or ol
@ -921,12 +920,12 @@
testElm("ul", obj);
testElm("ol", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:link
ok(!isAccessible("link"), "link element is not accessible");
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:main
obj = {
@ -936,7 +935,7 @@
};
testElm("main", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:map
ok(!isAccessible("map_imagemap"),
@ -947,7 +946,7 @@
};
testElm("map", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:mark contained by paragraph
obj = {
@ -963,7 +962,7 @@
};
testElm("mark_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:math
obj = {
@ -971,7 +970,7 @@
};
testElm("math", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:menu
obj = {
@ -979,12 +978,12 @@
};
testElm("menu", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:meter
todo(isAccessible("meter"), "meter element is not accessible");
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:nav
obj = {
@ -994,7 +993,7 @@
};
testElm("nav", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:object (windowless and windowed plugins) and HTML:param
if (WIN) {
@ -1012,7 +1011,7 @@
testElm("object_plugin_windowed", obj);
}
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:select, HTML:optgroup and HTML:option
obj = { // HMTL:select@size > 1
@ -1063,7 +1062,7 @@
};
testElm("select_combobox", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:output
obj = {
@ -1084,7 +1083,7 @@
};
testElm("output_input", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:pre
obj = {
@ -1093,7 +1092,7 @@
};
testElm("pre", obj);
///////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////
// HTML:progress
obj = {
@ -1109,7 +1108,7 @@
};
testElm("progress_indeterminate", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:q
obj = {
@ -1123,12 +1122,12 @@
};
testElm("q", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:ruby
todo(isAccessible("ruby"), "ruby element is not accessible");
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:s contained by paragraph
obj = {
@ -1144,7 +1143,7 @@
};
testElm("s_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:samp contained by paragraph
obj = {
@ -1156,7 +1155,7 @@
};
testElm("samp_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:section
obj = {
@ -1166,7 +1165,7 @@
};
testElm("section", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:small contained by paragraph
obj = {
@ -1182,17 +1181,17 @@
};
testElm("small_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:source
ok(!isAccessible("source"), "source element is not accessible");
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:span
ok(!isAccessible("span"), "span element is not accessible");
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:strong contained by paragraph
obj = {
@ -1204,7 +1203,7 @@
};
testElm("strong_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:sub contained by paragraph
obj = {
@ -1220,7 +1219,7 @@
};
testElm("sub_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:sup contained by paragraph
obj = {
@ -1236,7 +1235,7 @@
};
testElm("sup_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:svg
obj = {
@ -1244,7 +1243,7 @@
};
testElm("svg", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:textarea
obj = {
@ -1255,7 +1254,7 @@
};
testElm("textarea", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:time
obj = {
@ -1265,7 +1264,7 @@
};
testElm("time", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:u contained by paragraph
obj = {
@ -1281,7 +1280,7 @@
};
testElm("u_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
// HTML:var contained by paragraph
obj = {
@ -1295,7 +1294,7 @@
};
testElm("var_container", obj);
//////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////
obj = { // HTML:video
role: ROLE_GROUPING
};

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