Bug 1385817 - Enable the quotes ESLint rule for accessible/ r=yzen

MozReview-Commit-ID: 1pS6xMzeh82

--HG--
extra : rebase_source : 7e600853f85e8ec14047768183ef9289254d3e0d
This commit is contained in:
Dan Banner 2017-08-01 17:13:27 +01:00
Родитель f32ef43797
Коммит b9a328209b
110 изменённых файлов: 2545 добавлений и 2546 удалений

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

@ -10,7 +10,6 @@ module.exports = {
// removed (and hence enabled) at some stage. // removed (and hence enabled) at some stage.
"brace-style": "off", "brace-style": "off",
"consistent-return": "off", "consistent-return": "off",
"quotes": "off",
"object-shorthand": "off", "object-shorthand": "off",
"space-before-function-paren": "off", "space-before-function-paren": "off",
"space-infix-ops": "off", "space-infix-ops": "off",

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -26,7 +26,7 @@ async function testContentBounds(browser, acc) {
} }
async function runTests(browser, accDoc) { 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 p1 = findAccessibleChildByID(accDoc, "p1");
let p2 = findAccessibleChildByID(accDoc, "p2"); let p2 = findAccessibleChildByID(accDoc, "p2");

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

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

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

@ -2,15 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict'; "use strict";
// Load the shared-head file first. // Load the shared-head file first.
/* import-globals-from ../shared-head.js */ /* import-globals-from ../shared-head.js */
Services.scriptloader.loadSubScript( Services.scriptloader.loadSubScript(
'chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js', "chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js",
this); this);
// Loading and common.js from accessible/tests/mochitest/ for all tests, as // Loading and common.js from accessible/tests/mochitest/ for all tests, as
// well as events.js. // well as events.js.
loadScripts({ name: 'common.js', dir: MOCHITESTS_DIR }, loadScripts({ name: "common.js", dir: MOCHITESTS_DIR },
{ name: 'layout.js', dir: MOCHITESTS_DIR }, 'events.js'); { 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 * 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/. */ * 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. // Create a11y service.
let a11yInit = initPromise(); let a11yInit = initPromise();
let accService = Cc['@mozilla.org/accessibilityService;1'].getService( let accService = Cc["@mozilla.org/accessibilityService;1"].getService(
Ci.nsIAccessibilityService); Ci.nsIAccessibilityService);
await a11yInit; await a11yInit;
ok(accService, 'Service initialized'); ok(accService, "Service initialized");
// Accessible object reference will live longer than the scope of this // Accessible object reference will live longer than the scope of this
// function. // function.
@ -24,7 +24,7 @@ add_task(async function () {
} }
}, 10); }, 10);
}); });
ok(acc, 'Accessible object is created'); ok(acc, "Accessible object is created");
let canShutdown = false; let canShutdown = false;
// This promise will resolve only if canShutdown flag is set to true. If // 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. // down, the promise will reject.
let a11yShutdown = new Promise((resolve, reject) => let a11yShutdown = new Promise((resolve, reject) =>
shutdownPromise().then(flag => canShutdown ? resolve() : shutdownPromise().then(flag => canShutdown ? resolve() :
reject('Accessible service was shut down incorrectly'))); reject("Accessible service was shut down incorrectly")));
accService = null; accService = null;
ok(!accService, 'Service is removed'); ok(!accService, "Service is removed");
// Force garbage collection that should not trigger shutdown because there is // Force garbage collection that should not trigger shutdown because there is
// a reference to an accessible object. // a reference to an accessible object.
@ -47,7 +47,7 @@ add_task(async function () {
canShutdown = true; canShutdown = true;
// Remove a reference to an accessible object. // Remove a reference to an accessible object.
acc = null; acc = null;
ok(!acc, 'Accessible object is removed'); ok(!acc, "Accessible object is removed");
// Force garbage collection that should now trigger shutdown. // Force garbage collection that should now trigger shutdown.
forceGC(); forceGC();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -2,24 +2,24 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict'; "use strict";
/* import-globals-from ../../mochitest/attributes.js */ /* import-globals-from ../../mochitest/attributes.js */
loadScripts({ name: 'attributes.js', dir: MOCHITESTS_DIR }); loadScripts({ name: "attributes.js", dir: MOCHITESTS_DIR });
/** /**
* Default textbox accessible attributes. * Default textbox accessible attributes.
*/ */
const defaultAttributes = { const defaultAttributes = {
'margin-top': '0px', "margin-top": "0px",
'margin-right': '0px', "margin-right": "0px",
'margin-bottom': '0px', "margin-bottom": "0px",
'margin-left': '0px', "margin-left": "0px",
'text-align': 'start', "text-align": "start",
'text-indent': '0px', "text-indent": "0px",
'id': 'textbox', "id": "textbox",
'tag': 'input', "tag": "input",
'display': 'inline' "display": "inline"
}; };
/** /**
@ -36,51 +36,51 @@ const defaultAttributes = {
* } * }
*/ */
const attributesTests = [{ const attributesTests = [{
desc: 'Initiall accessible attributes', desc: "Initiall accessible attributes",
expected: defaultAttributes, expected: defaultAttributes,
unexpected: { unexpected: {
'line-number': '1', "line-number": "1",
'explicit-name': 'true', "explicit-name": "true",
'container-live': 'polite', "container-live": "polite",
'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) { action: async function(browser) {
await invokeFocus(browser, 'textbox'); await invokeFocus(browser, "textbox");
}, },
waitFor: EVENT_FOCUS, waitFor: EVENT_FOCUS,
expected: Object.assign({}, defaultAttributes, { 'line-number': '1' }), expected: Object.assign({}, defaultAttributes, { "line-number": "1" }),
unexpected: { unexpected: {
'explicit-name': 'true', "explicit-name": "true",
'container-live': 'polite', "container-live": "polite",
'live': 'polite' "live": "polite"
} }
}, { }, {
desc: '@aria-live sets container-live and live attributes', desc: "@aria-live sets container-live and live attributes",
attrs: [{ attrs: [{
attr: 'aria-live', attr: "aria-live",
value: 'polite' value: "polite"
}], }],
expected: Object.assign({}, defaultAttributes, { expected: Object.assign({}, defaultAttributes, {
'line-number': '1', "line-number": "1",
'container-live': 'polite', "container-live": "polite",
'live': 'polite' "live": "polite"
}), }),
unexpected: { 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: [{ attrs: [{
attr: 'title', attr: "title",
value: 'textbox' value: "textbox"
}], }],
expected: Object.assign({}, defaultAttributes, { expected: Object.assign({}, defaultAttributes, {
'line-number': '1', "line-number": "1",
'explicit-name': 'true', "explicit-name": "true",
'container-live': 'polite', "container-live": "polite",
'live': 'polite' "live": "polite"
}), }),
unexpected: {} unexpected: {}
}]; }];
@ -91,20 +91,20 @@ const attributesTests = [{
addAccessibleTask(` addAccessibleTask(`
<input id="textbox" value="hello">`, <input id="textbox" value="hello">`,
async function (browser, accDoc) { async function (browser, accDoc) {
let textbox = findAccessibleChildByID(accDoc, 'textbox'); let textbox = findAccessibleChildByID(accDoc, "textbox");
for (let { desc, action, attrs, expected, waitFor, unexpected } of attributesTests) { for (let { desc, action, attrs, expected, waitFor, unexpected } of attributesTests) {
info(desc); info(desc);
let onUpdate; let onUpdate;
if (waitFor) { if (waitFor) {
onUpdate = waitForEvent(waitFor, 'textbox'); onUpdate = waitForEvent(waitFor, "textbox");
} }
if (action) { if (action) {
await action(browser); await action(browser);
} else if (attrs) { } else if (attrs) {
for (let { attr, value } of 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict'; "use strict";
/* import-globals-from ../../mochitest/name.js */ /* 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: * Test data has the format of:
@ -18,116 +18,116 @@ loadScripts({ name: 'name.js', dir: MOCHITESTS_DIR });
* } * }
*/ */
const tests = [{ const tests = [{
desc: 'No description when there are no @alt, @title and @aria-describedby', desc: "No description when there are no @alt, @title and @aria-describedby",
expected: '' expected: ""
}, { }, {
desc: 'Description from @aria-describedby attribute', desc: "Description from @aria-describedby attribute",
attrs: [{ attrs: [{
attr: 'aria-describedby', attr: "aria-describedby",
value: 'description' value: "description"
}], }],
waitFor: [[EVENT_DESCRIPTION_CHANGE, 'image']], waitFor: [[EVENT_DESCRIPTION_CHANGE, "image"]],
expected: 'aria description' expected: "aria description"
}, { }, {
desc: 'No description from @aria-describedby since it is the same as the ' + desc: "No description from @aria-describedby since it is the same as the " +
'@alt attribute which is used as the name', "@alt attribute which is used as the name",
attrs: [{ attrs: [{
attr: 'alt', attr: "alt",
value: 'aria description' value: "aria description"
}], }],
waitFor: [[EVENT_REORDER, 'body']], waitFor: [[EVENT_REORDER, "body"]],
expected: '' expected: ""
}, { }, {
desc: 'Description from @aria-describedby attribute when @alt and ' + desc: "Description from @aria-describedby attribute when @alt and " +
'@aria-describedby are not the same', "@aria-describedby are not the same",
attrs: [{ attrs: [{
attr: 'aria-describedby', attr: "aria-describedby",
value: 'description2' value: "description2"
}], }],
waitFor: [[EVENT_DESCRIPTION_CHANGE, 'image']], waitFor: [[EVENT_DESCRIPTION_CHANGE, "image"]],
expected: 'another description' expected: "another description"
}, { }, {
desc: 'Description from @aria-describedby attribute when @title (used for ' + desc: "Description from @aria-describedby attribute when @title (used for " +
'name) and @aria-describedby are not the same', "name) and @aria-describedby are not the same",
attrs: [{ attrs: [{
attr: 'alt' attr: "alt"
}, { }, {
attr: 'title', attr: "title",
value: 'title' value: "title"
}], }],
waitFor: [[EVENT_REORDER, 'body']], waitFor: [[EVENT_REORDER, "body"]],
expected: 'another description' expected: "another description"
}, { }, {
desc: 'No description from @aria-describedby since it is the same as the ' + desc: "No description from @aria-describedby since it is the same as the " +
'@title attribute which is used as the name', "@title attribute which is used as the name",
attrs: [{ attrs: [{
attr: 'title', attr: "title",
value: 'another description' value: "another description"
}], }],
waitFor: [[EVENT_NAME_CHANGE, 'image']], waitFor: [[EVENT_NAME_CHANGE, "image"]],
expected: '' 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: [{ attrs: [{
attr: 'aria-describedby' attr: "aria-describedby"
}], }],
waitFor: [[EVENT_DESCRIPTION_CHANGE, 'image']], waitFor: [[EVENT_DESCRIPTION_CHANGE, "image"]],
expected: '' expected: ""
}, { }, {
desc: 'Description from @title attribute when @alt and @atitle are not the ' + desc: "Description from @title attribute when @alt and @atitle are not the " +
'same', "same",
attrs: [{ attrs: [{
attr: 'alt', attr: "alt",
value: 'aria description' value: "aria description"
}], }],
waitFor: [[EVENT_REORDER, 'body']], waitFor: [[EVENT_REORDER, "body"]],
expected: 'another description' expected: "another description"
}, { }, {
desc: 'No description from @title since it is the same as the @alt ' + desc: "No description from @title since it is the same as the @alt " +
'attribute which is used as the name', "attribute which is used as the name",
attrs: [{ attrs: [{
attr: 'alt', attr: "alt",
value: 'another description' value: "another description"
}], }],
waitFor: [[EVENT_NAME_CHANGE, 'image']], waitFor: [[EVENT_NAME_CHANGE, "image"]],
expected: '' expected: ""
}, { }, {
desc: 'No description from @aria-describedby since it is the same as the ' + desc: "No description from @aria-describedby since it is the same as the " +
'@alt (used for name) and @title attributes', "@alt (used for name) and @title attributes",
attrs: [{ attrs: [{
attr: 'aria-describedby', attr: "aria-describedby",
value: 'description2' value: "description2"
}], }],
waitFor: [[EVENT_DESCRIPTION_CHANGE, 'image']], waitFor: [[EVENT_DESCRIPTION_CHANGE, "image"]],
expected: '' expected: ""
}, { }, {
desc: 'Description from @aria-describedby attribute when it is different ' + desc: "Description from @aria-describedby attribute when it is different " +
'from @alt (used for name) and @title attributes', "from @alt (used for name) and @title attributes",
attrs: [{ attrs: [{
attr: 'aria-describedby', attr: "aria-describedby",
value: 'description' value: "description"
}], }],
waitFor: [[EVENT_DESCRIPTION_CHANGE, 'image']], waitFor: [[EVENT_DESCRIPTION_CHANGE, "image"]],
expected: 'aria description' expected: "aria description"
}, { }, {
desc: 'No description from @aria-describedby since it is the same as the ' + desc: "No description from @aria-describedby since it is the same as the " +
'@alt attribute (used for name) but different from title', "@alt attribute (used for name) but different from title",
attrs: [{ attrs: [{
attr: 'alt', attr: "alt",
value: 'aria description' value: "aria description"
}], }],
waitFor: [[EVENT_NAME_CHANGE, 'image']], waitFor: [[EVENT_NAME_CHANGE, "image"]],
expected: '' expected: ""
}, { }, {
desc: 'Description from @aria-describedby attribute when @alt (used for ' + desc: "Description from @aria-describedby attribute when @alt (used for " +
'name) and @aria-describedby are not the same but @title and ' + "name) and @aria-describedby are not the same but @title and " +
'aria-describedby are', "aria-describedby are",
attrs: [{ attrs: [{
attr: 'aria-describedby', attr: "aria-describedby",
value: 'description2' value: "description2"
}], }],
waitFor: [[EVENT_DESCRIPTION_CHANGE, 'image']], waitFor: [[EVENT_DESCRIPTION_CHANGE, "image"]],
expected: 'another description' expected: "another description"
}]; }];
/** /**
@ -138,7 +138,7 @@ addAccessibleTask(`
<p id="description2">another description</p> <p id="description2">another description</p>
<img id="image" />`, <img id="image" />`,
async function(browser, accDoc) { async function(browser, accDoc) {
let imgAcc = findAccessibleChildByID(accDoc, 'image'); let imgAcc = findAccessibleChildByID(accDoc, "image");
for (let { desc, waitFor, attrs, expected } of tests) { for (let { desc, waitFor, attrs, expected } of tests) {
info(desc); info(desc);
@ -148,14 +148,14 @@ addAccessibleTask(`
} }
if (attrs) { if (attrs) {
for (let { attr, value } of attrs) { for (let { attr, value } of attrs) {
await invokeSetAttribute(browser, 'image', attr, value); await invokeSetAttribute(browser, "image", attr, value);
} }
} }
await onUpdate; await onUpdate;
// When attribute change (alt) triggers reorder event, accessible will // When attribute change (alt) triggers reorder event, accessible will
// become defunct. // become defunct.
if (isDefunct(imgAcc)) { if (isDefunct(imgAcc)) {
imgAcc = findAccessibleChildByID(accDoc, 'image'); imgAcc = findAccessibleChildByID(accDoc, "image");
} }
testDescr(imgAcc, expected); testDescr(imgAcc, expected);
} }

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

@ -2,10 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict'; "use strict";
/* import-globals-from ../../mochitest/name.js */ /* 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 * 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 * * textchanged - text is inserted into a subtree and the test should only
* continue after a text inserted event * continue after a text inserted event
*/ */
const ARIARule = [{ attr: 'aria-labelledby' }, { attr: 'aria-label' }]; const ARIARule = [{ attr: "aria-labelledby" }, { attr: "aria-label" }];
const HTMLControlHeadRule = [...ARIARule, { elm: 'label', isSibling: true }]; const HTMLControlHeadRule = [...ARIARule, { elm: "label", isSibling: true }];
const rules = { const rules = {
CSSContent: [{ elm: 'style', isSibling: true }, { fromsubtree: true }], CSSContent: [{ elm: "style", isSibling: true }, { fromsubtree: true }],
HTMLARIAGridCell: [...ARIARule, { fromsubtree: true }, { attr: 'title' }], HTMLARIAGridCell: [...ARIARule, { fromsubtree: true }, { attr: "title" }],
HTMLControl: [...HTMLControlHeadRule, { fromsubtree: true }, HTMLControl: [...HTMLControlHeadRule, { fromsubtree: true },
{ attr: 'title' }], { attr: "title" }],
HTMLElm: [...ARIARule, { attr: 'title' }], HTMLElm: [...ARIARule, { attr: "title" }],
HTMLImg: [...ARIARule, { attr: 'alt', recreated: true }, { attr: 'title' }], HTMLImg: [...ARIARule, { attr: "alt", recreated: true }, { attr: "title" }],
HTMLImgEmptyAlt: [...ARIARule, { attr: 'title' }, { attr: 'alt' }], HTMLImgEmptyAlt: [...ARIARule, { attr: "title" }, { attr: "alt" }],
HTMLInputButton: [...HTMLControlHeadRule, { attr: 'value' }, HTMLInputButton: [...HTMLControlHeadRule, { attr: "value" },
{ attr: 'title' }], { attr: "title" }],
HTMLInputImage: [...HTMLControlHeadRule, { attr: 'alt', recreated: true }, HTMLInputImage: [...HTMLControlHeadRule, { attr: "alt", recreated: true },
{ attr: 'value', recreated: true }, { attr: 'title' }], { attr: "value", recreated: true }, { attr: "title" }],
HTMLInputImageNoValidSrc: [...HTMLControlHeadRule, HTMLInputImageNoValidSrc: [...HTMLControlHeadRule,
{ attr: 'alt', recreated: true }, { attr: 'value', recreated: true }], { attr: "alt", recreated: true }, { attr: "value", recreated: true }],
HTMLInputReset: [...HTMLControlHeadRule, HTMLInputReset: [...HTMLControlHeadRule,
{ attr: 'value', textchanged: true }], { attr: "value", textchanged: true }],
HTMLInputSubmit: [...HTMLControlHeadRule, HTMLInputSubmit: [...HTMLControlHeadRule,
{ attr: 'value', textchanged: true }], { attr: "value", textchanged: true }],
HTMLLink: [...ARIARule, { fromsubtree: true }, { attr: 'title' }], HTMLLink: [...ARIARule, { fromsubtree: true }, { attr: "title" }],
HTMLLinkImage: [...ARIARule, { elm: 'img' }, { attr: 'title' }], HTMLLinkImage: [...ARIARule, { elm: "img" }, { attr: "title" }],
HTMLOption: [...ARIARule, { attr: 'label' }, { fromsubtree: true }, HTMLOption: [...ARIARule, { attr: "label" }, { fromsubtree: true },
{ attr: 'title' }], { attr: "title" }],
HTMLTable: [...ARIARule, { elm: 'caption' }, { attr: 'summary' }, HTMLTable: [...ARIARule, { elm: "caption" }, { attr: "summary" },
{ attr: 'title' }] { attr: "title" }]
}; };
const markupTests = [{ const markupTests = [{
id: 'btn', id: "btn",
ruleset: 'HTMLControl', ruleset: "HTMLControl",
markup: ` markup: `
<span id="l1">test2</span> <span id="l1">test2</span>
<span id="l2">test3</span> <span id="l2">test3</span>
@ -65,10 +65,10 @@ const markupTests = [{
aria-label="test1" aria-label="test1"
aria-labelledby="l1 l2" aria-labelledby="l1 l2"
title="test5">press me</button>`, title="test5">press me</button>`,
expected: ['test2 test3', 'test1', 'test4', 'press me', 'test5'] expected: ["test2 test3", "test1", "test4", "press me", "test5"]
}, { }, {
id: 'btn', id: "btn",
ruleset: 'HTMLInputButton', ruleset: "HTMLInputButton",
markup: ` markup: `
<span id="l1">test2</span> <span id="l1">test2</span>
<span id="l2">test3</span> <span id="l2">test3</span>
@ -82,11 +82,11 @@ const markupTests = [{
src="no name from src" src="no name from src"
data="no name from data" data="no name from data"
title="name from title"/>`, title="name from title"/>`,
expected: ['test2 test3', 'test1', 'test4', 'name from value', expected: ["test2 test3", "test1", "test4", "name from value",
'name from title'] "name from title"]
}, { }, {
id: 'btn-submit', id: "btn-submit",
ruleset: 'HTMLInputSubmit', ruleset: "HTMLInputSubmit",
markup: ` markup: `
<span id="l1">test2</span> <span id="l1">test2</span>
<span id="l2">test3</span> <span id="l2">test3</span>
@ -100,10 +100,10 @@ const markupTests = [{
src="no name from src" src="no name from src"
data="no name from data" data="no name from data"
title="no name from title"/>`, title="no name from title"/>`,
expected: ['test2 test3', 'test1', 'test4', 'name from value'] expected: ["test2 test3", "test1", "test4", "name from value"]
}, { }, {
id: 'btn-reset', id: "btn-reset",
ruleset: 'HTMLInputReset', ruleset: "HTMLInputReset",
markup: ` markup: `
<span id="l1">test2</span> <span id="l1">test2</span>
<span id="l2">test3</span> <span id="l2">test3</span>
@ -117,10 +117,10 @@ const markupTests = [{
src="no name from src" src="no name from src"
data="no name from data" data="no name from data"
title="no name from title"/>`, title="no name from title"/>`,
expected: ['test2 test3', 'test1', 'test4', 'name from value'] expected: ["test2 test3", "test1", "test4", "name from value"]
}, { }, {
id: 'btn-image', id: "btn-image",
ruleset: 'HTMLInputImage', ruleset: "HTMLInputImage",
markup: ` markup: `
<span id="l1">test2</span> <span id="l1">test2</span>
<span id="l2">test3</span> <span id="l2">test3</span>
@ -134,11 +134,11 @@ const markupTests = [{
src="http://example.com/a11y/accessible/tests/mochitest/moz.png" src="http://example.com/a11y/accessible/tests/mochitest/moz.png"
data="no name from data" data="no name from data"
title="name from title"/>`, title="name from title"/>`,
expected: ['test2 test3', 'test1', 'test4', 'name from alt', expected: ["test2 test3", "test1", "test4", "name from alt",
'name from value', 'name from title'] "name from value", "name from title"]
}, { }, {
id: 'btn-image', id: "btn-image",
ruleset: 'HTMLInputImageNoValidSrc', ruleset: "HTMLInputImageNoValidSrc",
markup: ` markup: `
<span id="l1">test2</span> <span id="l1">test2</span>
<span id="l2">test3</span> <span id="l2">test3</span>
@ -151,11 +151,11 @@ const markupTests = [{
value="name from value" value="name from value"
data="no name from data" data="no name from data"
title="no name from title"/>`, title="no name from title"/>`,
expected: ['test2 test3', 'test1', 'test4', 'name from alt', expected: ["test2 test3", "test1", "test4", "name from alt",
'name from value'] "name from value"]
}, { }, {
id: 'opt', id: "opt",
ruleset: 'HTMLOption', ruleset: "HTMLOption",
markup: ` markup: `
<span id="l1">test2</span> <span id="l1">test2</span>
<span id="l2">test3</span> <span id="l2">test3</span>
@ -167,10 +167,10 @@ const markupTests = [{
title="test5">option1</option> title="test5">option1</option>
<option>option2</option> <option>option2</option>
</select>`, </select>`,
expected: ['test2 test3', 'test1', 'test4', 'option1', 'test5'] expected: ["test2 test3", "test1", "test4", "option1", "test5"]
}, { }, {
id: 'img', id: "img",
ruleset: 'HTMLImg', ruleset: "HTMLImg",
markup: ` markup: `
<span id="l1">test2</span> <span id="l1">test2</span>
<span id="l2">test3</span> <span id="l2">test3</span>
@ -180,10 +180,10 @@ const markupTests = [{
alt="Mozilla logo" alt="Mozilla logo"
title="This is a logo" title="This is a logo"
src="http://example.com/a11y/accessible/tests/mochitest/moz.png"/>`, 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', id: "imgemptyalt",
ruleset: 'HTMLImgEmptyAlt', ruleset: "HTMLImgEmptyAlt",
markup: ` markup: `
<span id="l1">test2</span> <span id="l1">test2</span>
<span id="l2">test3</span> <span id="l2">test3</span>
@ -193,10 +193,10 @@ const markupTests = [{
title="This is a logo" title="This is a logo"
alt="" alt=""
src="http://example.com/a11y/accessible/tests/mochitest/moz.png"/>`, 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', id: "tc",
ruleset: 'HTMLElm', ruleset: "HTMLElm",
markup: ` markup: `
<span id="l1">test2</span> <span id="l1">test2</span>
<span id="l2">test3</span> <span id="l2">test3</span>
@ -215,10 +215,10 @@ const markupTests = [{
</td> </td>
</tr> </tr>
</table>`, </table>`,
expected: ['test2 test3', 'test1', 'test5'] expected: ["test2 test3", "test1", "test5"]
}, { }, {
id: 'gc', id: "gc",
ruleset: 'HTMLARIAGridCell', ruleset: "HTMLARIAGridCell",
markup: ` markup: `
<span id="l1">test2</span> <span id="l1">test2</span>
<span id="l2">test3</span> <span id="l2">test3</span>
@ -239,12 +239,12 @@ const markupTests = [{
</td> </td>
</tr> </tr>
</table>`, </table>`,
expected: ['test2 test3', 'test1', expected: ["test2 test3", "test1",
'This is a paragraph This is a link \u2022 Listitem1 \u2022 Listitem2', "This is a paragraph This is a link \u2022 Listitem1 \u2022 Listitem2",
'This is a paragraph This is a link This is a list'] "This is a paragraph This is a link This is a list"]
}, { }, {
id: 't', id: "t",
ruleset: 'HTMLTable', ruleset: "HTMLTable",
markup: ` markup: `
<span id="l1">lby_tst6_1</span> <span id="l1">lby_tst6_1</span>
<span id="l2">lby_tst6_2</span> <span id="l2">lby_tst6_2</span>
@ -260,11 +260,11 @@ const markupTests = [{
<td>cell2</td> <td>cell2</td>
</tr> </tr>
</table>`, </table>`,
expected: ['lby_tst6_1 lby_tst6_2', 'arialabel_tst6', 'caption_tst6', expected: ["lby_tst6_1 lby_tst6_2", "arialabel_tst6", "caption_tst6",
'summary_tst6', 'title_tst6'] "summary_tst6", "title_tst6"]
}, { }, {
id: 'btn', id: "btn",
ruleset: 'CSSContent', ruleset: "CSSContent",
markup: ` markup: `
<style> <style>
button::before { button::before {
@ -272,7 +272,7 @@ const markupTests = [{
} }
</style> </style>
<button id="btn">press me</button>`, <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. // TODO: uncomment when Bug-1256382 is resoved.
// id: 'li', // id: 'li',
@ -288,8 +288,8 @@ const markupTests = [{
// </ul>`, // </ul>`,
// expected: ['1. Listitem', `${String.fromCharCode(0x2022)} Listitem`] // expected: ['1. Listitem', `${String.fromCharCode(0x2022)} Listitem`]
// }, { // }, {
id: 'a', id: "a",
ruleset: 'HTMLLink', ruleset: "HTMLLink",
markup: ` markup: `
<span id="l1">test2</span> <span id="l1">test2</span>
<span id="l2">test3</span> <span id="l2">test3</span>
@ -297,10 +297,10 @@ const markupTests = [{
aria-label="test1" aria-label="test1"
aria-labelledby="l1 l2" aria-labelledby="l1 l2"
title="test4">test5</a>`, title="test4">test5</a>`,
expected: ['test2 test3', 'test1', 'test5', 'test4'] expected: ["test2 test3", "test1", "test5", "test4"]
}, { }, {
id: 'a-img', id: "a-img",
ruleset: 'HTMLLinkImage', ruleset: "HTMLLinkImage",
markup: ` markup: `
<span id="l1">test2</span> <span id="l1">test2</span>
<span id="l2">test3</span> <span id="l2">test3</span>
@ -308,7 +308,7 @@ const markupTests = [{
aria-label="test1" aria-label="test1"
aria-labelledby="l1 l2" aria-labelledby="l1 l2"
title="test4"><img alt="test5"/></a>`, 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict'; "use strict";
/* import-globals-from ../../mochitest/relations.js */ /* 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: * A test specification that has the following format:
@ -16,16 +16,16 @@ loadScripts({ name: 'relations.js', dir: MOCHITESTS_DIR });
* ] * ]
*/ */
const attrRelationsSpec = [ const attrRelationsSpec = [
['aria-labelledby', RELATION_LABELLED_BY, RELATION_LABEL_FOR], ["aria-labelledby", RELATION_LABELLED_BY, RELATION_LABEL_FOR],
['aria-describedby', RELATION_DESCRIBED_BY, RELATION_DESCRIPTION_FOR], ["aria-describedby", RELATION_DESCRIBED_BY, RELATION_DESCRIPTION_FOR],
['aria-controls', RELATION_CONTROLLER_FOR, RELATION_CONTROLLED_BY], ["aria-controls", RELATION_CONTROLLER_FOR, RELATION_CONTROLLED_BY],
['aria-flowto', RELATION_FLOWS_TO, RELATION_FLOWS_FROM] ["aria-flowto", RELATION_FLOWS_TO, RELATION_FLOWS_FROM]
]; ];
async function testRelated(browser, accDoc, attr, hostRelation, dependantRelation) { async function testRelated(browser, accDoc, attr, hostRelation, dependantRelation) {
let host = findAccessibleChildByID(accDoc, 'host'); let host = findAccessibleChildByID(accDoc, "host");
let dependant1 = findAccessibleChildByID(accDoc, 'dependant1'); let dependant1 = findAccessibleChildByID(accDoc, "dependant1");
let dependant2 = findAccessibleChildByID(accDoc, 'dependant2'); let dependant2 = findAccessibleChildByID(accDoc, "dependant2");
/** /**
* Test data has the format of: * Test data has the format of:
@ -37,18 +37,18 @@ async function testRelated(browser, accDoc, attr, hostRelation, dependantRelatio
* } * }
*/ */
const tests = [{ const tests = [{
desc: 'No attribute', desc: "No attribute",
expected: [ null, null, null ] expected: [ null, null, null ]
}, { }, {
desc: 'Set attribute', desc: "Set attribute",
attrs: [{ key: attr, value: 'dependant1' }], attrs: [{ key: attr, value: "dependant1" }],
expected: [ host, null, dependant1 ] expected: [ host, null, dependant1 ]
}, { }, {
desc: 'Change attribute', desc: "Change attribute",
attrs: [{ key: attr, value: 'dependant2' }], attrs: [{ key: attr, value: "dependant2" }],
expected: [ null, host, dependant2 ] expected: [ null, host, dependant2 ]
}, { }, {
desc: 'Remove attribute', desc: "Remove attribute",
attrs: [{ key: attr }], attrs: [{ key: attr }],
expected: [ null, null, null ] expected: [ null, null, null ]
}]; }];
@ -58,7 +58,7 @@ async function testRelated(browser, accDoc, attr, hostRelation, dependantRelatio
if (attrs) { if (attrs) {
for (let { key, value } of attrs) { for (let { key, value } of attrs) {
await invokeSetAttribute(browser, 'host', key, value); await invokeSetAttribute(browser, "host", key, value);
} }
} }

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

@ -2,12 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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/role.js */
/* import-globals-from ../../mochitest/states.js */ /* import-globals-from ../../mochitest/states.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }, loadScripts({ name: "role.js", dir: MOCHITESTS_DIR },
{ name: 'states.js', dir: MOCHITESTS_DIR }); { name: "states.js", dir: MOCHITESTS_DIR });
/** /**
* Test data has the format of: * Test data has the format of:
@ -27,66 +27,66 @@ loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR },
// State caching tests for attribute changes // State caching tests for attribute changes
const attributeTests = [{ const attributeTests = [{
desc: 'Checkbox with @checked attribute set to true should have checked ' + desc: "Checkbox with @checked attribute set to true should have checked " +
'state', "state",
attrs: [{ attrs: [{
attr: 'checked', attr: "checked",
value: 'true' value: "true"
}], }],
expected: [STATE_CHECKED, 0] 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: [{ attrs: [{
attr: 'checked' attr: "checked"
}], }],
expected: [0, 0, STATE_CHECKED] expected: [0, 0, STATE_CHECKED]
}]; }];
// State caching tests for ARIA changes // State caching tests for ARIA changes
const ariaTests = [{ 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: [{ attrs: [{
attr: 'aria-busy', attr: "aria-busy",
value: 'true' value: "true"
}], }],
expected: [STATE_BUSY, 0, STATE_REQUIRED | STATE_INVALID] expected: [STATE_BUSY, 0, STATE_REQUIRED | STATE_INVALID]
}, { }, {
desc: 'File input has required state when @aria-required attribute is set ' + desc: "File input has required state when @aria-required attribute is set " +
'to true', "to true",
attrs: [{ attrs: [{
attr: 'aria-required', attr: "aria-required",
value: 'true' value: "true"
}], }],
expected: [STATE_REQUIRED, 0, STATE_INVALID] expected: [STATE_REQUIRED, 0, STATE_INVALID]
}, { }, {
desc: 'File input has invalid state when @aria-invalid attribute is set to ' + desc: "File input has invalid state when @aria-invalid attribute is set to " +
'true', "true",
attrs: [{ attrs: [{
attr: 'aria-invalid', attr: "aria-invalid",
value: 'true' value: "true"
}], }],
expected: [STATE_INVALID, 0] expected: [STATE_INVALID, 0]
}]; }];
// Extra state caching tests // Extra state caching tests
const extraStateTests = [{ const extraStateTests = [{
desc: 'Input has no extra enabled state when aria and native disabled ' + desc: "Input has no extra enabled state when aria and native disabled " +
'attributes are set at once', "attributes are set at once",
attrs: [{ attrs: [{
attr: 'aria-disabled', attr: "aria-disabled",
value: 'true' value: "true"
}, { }, {
attr: 'disabled', attr: "disabled",
value: 'true' value: "true"
}], }],
expected: [0, 0, 0, EXT_STATE_ENABLED] expected: [0, 0, 0, EXT_STATE_ENABLED]
}, { }, {
desc: 'Input has an extra enabled state when aria and native disabled ' + desc: "Input has an extra enabled state when aria and native disabled " +
'attributes are unset at once', "attributes are unset at once",
attrs: [{ attrs: [{
attr: 'aria-disabled' attr: "aria-disabled"
}, { }, {
attr: 'disabled' attr: "disabled"
}], }],
expected: [0, EXT_STATE_ENABLED] expected: [0, EXT_STATE_ENABLED]
}]; }];
@ -112,8 +112,8 @@ addAccessibleTask(`
<input id="file" type="file"> <input id="file" type="file">
<input id="text">`, <input id="text">`,
async function (browser, accDoc) { async function (browser, accDoc) {
await runStateTests(browser, accDoc, 'checkbox', attributeTests); await runStateTests(browser, accDoc, "checkbox", attributeTests);
await runStateTests(browser, accDoc, 'file', ariaTests); await runStateTests(browser, accDoc, "file", ariaTests);
await runStateTests(browser, accDoc, 'text', extraStateTests); 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict'; "use strict";
/* import-globals-from ../../mochitest/value.js */ /* 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: * Test data has the format of:
@ -19,95 +19,95 @@ loadScripts({ name: 'value.js', dir: MOCHITESTS_DIR });
* } * }
*/ */
const valueTests = [{ const valueTests = [{
desc: 'Initially value is set to 1st element of select', desc: "Initially value is set to 1st element of select",
id: 'select', id: "select",
expected: '1st' expected: "1st"
}, { }, {
desc: 'Value should update to 3rd when 3 is pressed', desc: "Value should update to 3rd when 3 is pressed",
id: 'select', id: "select",
action: async function(browser) { action: async function(browser) {
await invokeFocus(browser, 'select'); await invokeFocus(browser, "select");
await BrowserTestUtils.synthesizeKey('3', {}, browser); await BrowserTestUtils.synthesizeKey("3", {}, browser);
}, },
waitFor: EVENT_TEXT_VALUE_CHANGE, waitFor: EVENT_TEXT_VALUE_CHANGE,
expected: '3rd' expected: "3rd"
}, { }, {
desc: 'Initially value is set to @aria-valuenow for slider', desc: "Initially value is set to @aria-valuenow for slider",
id: 'slider', id: "slider",
expected: ['5', 5, 0, 7, 0] expected: ["5", 5, 0, 7, 0]
}, { }, {
desc: 'Value should change when @aria-valuenow is updated', desc: "Value should change when @aria-valuenow is updated",
id: 'slider', id: "slider",
attrs: [{ attrs: [{
attr: 'aria-valuenow', attr: "aria-valuenow",
value: '6' value: "6"
}], }],
waitFor: EVENT_VALUE_CHANGE, 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', desc: "Value should change when @aria-valuetext is set",
id: 'slider', id: "slider",
attrs: [{ attrs: [{
attr: 'aria-valuetext', attr: "aria-valuetext",
value: 'plain' value: "plain"
}], }],
waitFor: EVENT_TEXT_VALUE_CHANGE, 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', desc: "Value should change when @aria-valuetext is updated",
id: 'slider', id: "slider",
attrs: [{ attrs: [{
attr: 'aria-valuetext', attr: "aria-valuetext",
value: 'hey!' value: "hey!"
}], }],
waitFor: EVENT_TEXT_VALUE_CHANGE, 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', desc: "Value should change to @aria-valuetext when @aria-valuenow is removed",
id: 'slider', id: "slider",
attrs: [{ 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', desc: "Initially value is not set for combobox",
id: 'combobox', id: "combobox",
expected: '' expected: ""
}, { }, {
desc: 'Value should change when @value attribute is updated', desc: "Value should change when @value attribute is updated",
id: 'combobox', id: "combobox",
attrs: [{ attrs: [{
attr: 'value', attr: "value",
value: 'hello' value: "hello"
}], }],
waitFor: EVENT_TEXT_VALUE_CHANGE, waitFor: EVENT_TEXT_VALUE_CHANGE,
expected: 'hello' expected: "hello"
}, { }, {
desc: 'Initially value corresponds to @value attribute for progress', desc: "Initially value corresponds to @value attribute for progress",
id: 'progress', id: "progress",
expected: '22%' expected: "22%"
}, { }, {
desc: 'Value should change when @value attribute is updated', desc: "Value should change when @value attribute is updated",
id: 'progress', id: "progress",
attrs: [{ attrs: [{
attr: 'value', attr: "value",
value: '50' value: "50"
}], }],
waitFor: EVENT_VALUE_CHANGE, waitFor: EVENT_VALUE_CHANGE,
expected: '50%' expected: "50%"
}, { }, {
desc: 'Initially value corresponds to @value attribute for range', desc: "Initially value corresponds to @value attribute for range",
id: 'range', id: "range",
expected: '6' expected: "6"
}, { }, {
desc: 'Value should change when slider is moved', desc: "Value should change when slider is moved",
id: 'range', id: "range",
action: async function(browser) { action: async function(browser) {
await invokeFocus(browser, 'range'); await invokeFocus(browser, "range");
await BrowserTestUtils.synthesizeKey('VK_LEFT', {}, browser); await BrowserTestUtils.synthesizeKey("VK_LEFT", {}, browser);
}, },
waitFor: EVENT_VALUE_CHANGE, waitFor: EVENT_VALUE_CHANGE,
expected: '5' expected: "5"
}]; }];
/** /**

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

@ -2,18 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict'; "use strict";
/** /**
* Test caret move event and its interface: * Test caret move event and its interface:
* - caretOffset * - caretOffset
*/ */
addAccessibleTask('<input id="textbox" value="hello"/>', async function(browser) { addAccessibleTask('<input id="textbox" value="hello"/>', async function(browser) {
let onCaretMoved = waitForEvent(EVENT_TEXT_CARET_MOVED, 'textbox'); let onCaretMoved = waitForEvent(EVENT_TEXT_CARET_MOVED, "textbox");
await invokeFocus(browser, 'textbox'); await invokeFocus(browser, "textbox");
let event = await onCaretMoved; let event = await onCaretMoved;
let caretMovedEvent = event.QueryInterface(nsIAccessibleCaretMoveEvent); let caretMovedEvent = event.QueryInterface(nsIAccessibleCaretMoveEvent);
is(caretMovedEvent.caretOffset, 5, 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict'; "use strict";
/** /**
* Test hide event and its interface: * Test hide event and its interface:
@ -17,17 +17,17 @@ addAccessibleTask(`
<div id="next"></div> <div id="next"></div>
</div>`, </div>`,
async function(browser, accDoc) { async function(browser, accDoc) {
let acc = findAccessibleChildByID(accDoc, 'to-hide'); let acc = findAccessibleChildByID(accDoc, "to-hide");
let onHide = waitForEvent(EVENT_HIDE, acc); 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 event = await onHide;
let hideEvent = event.QueryInterface(Ci.nsIAccessibleHideEvent); let hideEvent = event.QueryInterface(Ci.nsIAccessibleHideEvent);
is(getAccessibleDOMNodeID(hideEvent.targetParent), 'parent', is(getAccessibleDOMNodeID(hideEvent.targetParent), "parent",
'Correct target parent.'); "Correct target parent.");
is(getAccessibleDOMNodeID(hideEvent.targetNextSibling), 'next', is(getAccessibleDOMNodeID(hideEvent.targetNextSibling), "next",
'Correct target next sibling.'); "Correct target next sibling.");
is(getAccessibleDOMNodeID(hideEvent.targetPrevSibling), 'previous', is(getAccessibleDOMNodeID(hideEvent.targetPrevSibling), "previous",
'Correct target previous sibling.'); "Correct target previous sibling.");
} }
); );

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

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

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

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

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

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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) { function checkTextChangeEvent(event, id, text, start, end, isInserted, isFromUserInput) {
let tcEvent = event.QueryInterface(nsIAccessibleTextChangeEvent); let tcEvent = event.QueryInterface(nsIAccessibleTextChangeEvent);
@ -40,7 +40,7 @@ async function removeTextFromInput(browser, id, value, start, end) {
el.focus(); el.focus();
el.setSelectionRange(contentStart, contentEnd); el.setSelectionRange(contentStart, contentEnd);
}); });
await BrowserTestUtils.sendChar('VK_DELETE', browser); await BrowserTestUtils.sendChar("VK_DELETE", browser);
let event = await onTextRemoved; let event = await onTextRemoved;
checkTextChangeEvent(event, id, value, start, end, false, true); checkTextChangeEvent(event, id, value, start, end, false, true);
@ -58,14 +58,14 @@ addAccessibleTask(`
<p id="p">abc</p> <p id="p">abc</p>
<input id="input" value="input" />`, async function(browser) { <input id="input" value="input" />`, async function(browser) {
let events = [ let events = [
{ isInserted: false, str: 'abc', offset: 0 }, { isInserted: false, str: "abc", offset: 0 },
{ isInserted: true, str: 'def', 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 }]; events = [{ isInserted: true, str: "DEF", offset: 2 }];
await changeText(browser, 'p', 'deDEFf', events); await changeText(browser, "p", "deDEFf", events);
// Test isFromUserInput property. // 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 * 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/. */ * 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/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
// Test ARIA Dialog // Test ARIA Dialog
addAccessibleTask('doc_treeupdate_ariadialog.html', async function(browser, accDoc) { addAccessibleTask("doc_treeupdate_ariadialog.html", async function(browser, accDoc) {
testAccessibleTree(accDoc, { testAccessibleTree(accDoc, {
role: ROLE_DOCUMENT, role: ROLE_DOCUMENT,
children: [ ] children: [ ]
}); });
// Make dialog visible and update its inner content. // Make dialog visible and update its inner content.
let onShow = waitForEvent(EVENT_SHOW, 'dialog'); let onShow = waitForEvent(EVENT_SHOW, "dialog");
await ContentTask.spawn(browser, {}, () => { await ContentTask.spawn(browser, {}, () => {
content.document.getElementById('dialog').style.display = 'block'; content.document.getElementById("dialog").style.display = "block";
}); });
await onShow; await onShow;

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

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

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

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

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

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

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

@ -2,25 +2,25 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
async function setHidden(browser, value) { async function setHidden(browser, value) {
let onReorder = waitForEvent(EVENT_REORDER, 'container'); let onReorder = waitForEvent(EVENT_REORDER, "container");
await invokeSetAttribute(browser, 'child', 'hidden', value); await invokeSetAttribute(browser, "child", "hidden", value);
await onReorder; await onReorder;
} }
addAccessibleTask('<div id="container"><input id="child"></div>', addAccessibleTask('<div id="container"><input id="child"></div>',
async function(browser, accDoc) { async function(browser, accDoc) {
let container = findAccessibleChildByID(accDoc, 'container'); let container = findAccessibleChildByID(accDoc, "container");
testAccessibleTree(container, { SECTION: [ { ENTRY: [ ] } ] }); testAccessibleTree(container, { SECTION: [ { ENTRY: [ ] } ] });
// Set @hidden attribute // Set @hidden attribute
await setHidden(browser, 'true'); await setHidden(browser, "true");
testAccessibleTree(container, { SECTION: [ ] }); testAccessibleTree(container, { SECTION: [ ] });
// Remove @hidden attribute // Remove @hidden attribute

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

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

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

@ -2,14 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
async function setDisplayAndWaitForReorder(browser, value) { async function setDisplayAndWaitForReorder(browser, value) {
let onReorder = waitForEvent(EVENT_REORDER, 'ul'); let onReorder = waitForEvent(EVENT_REORDER, "ul");
await invokeSetStyle(browser, 'li', 'display', value); await invokeSetStyle(browser, "li", "display", value);
return onReorder; return onReorder;
} }
@ -17,7 +17,7 @@ addAccessibleTask(`
<ul id="ul"> <ul id="ul">
<li id="li">item1</li> <li id="li">item1</li>
</ul>`, async function(browser, accDoc) { </ul>`, async function(browser, accDoc) {
let li = findAccessibleChildByID(accDoc, 'li'); let li = findAccessibleChildByID(accDoc, "li");
let bullet = li.firstChild; let bullet = li.firstChild;
let accTree = { let accTree = {
role: ROLE_LISTITEM, role: ROLE_LISTITEM,
@ -31,12 +31,12 @@ addAccessibleTask(`
}; };
testAccessibleTree(li, accTree); testAccessibleTree(li, accTree);
await setDisplayAndWaitForReorder(browser, 'none'); await setDisplayAndWaitForReorder(browser, "none");
ok(isDefunct(li), 'Check that li is defunct.'); ok(isDefunct(li), "Check that li is defunct.");
ok(isDefunct(bullet), 'Check that bullet 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 * 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/. */ * 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/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) { addAccessibleTask('<ol id="list"></ol>', async function(browser, accDoc) {
let list = findAccessibleChildByID(accDoc, 'list'); let list = findAccessibleChildByID(accDoc, "list");
testAccessibleTree(list, { testAccessibleTree(list, {
role: ROLE_LIST, role: ROLE_LIST,
children: [ ] children: [ ]
}); });
await invokeSetAttribute(browser, 'body', 'contentEditable', 'true'); await invokeSetAttribute(browser, "body", "contentEditable", "true");
let onReorder = waitForEvent(EVENT_REORDER, 'list'); let onReorder = waitForEvent(EVENT_REORDER, "list");
await ContentTask.spawn(browser, {}, () => { await ContentTask.spawn(browser, {}, () => {
let li = content.document.createElement('li'); let li = content.document.createElement("li");
li.textContent = 'item'; li.textContent = "item";
content.document.getElementById('list').appendChild(li); content.document.getElementById("list").appendChild(li);
}); });
await onReorder; await onReorder;

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

@ -2,27 +2,27 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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/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>', addAccessibleTask('<span id="parent"><span id="child"></span></span>',
async function(browser, accDoc) { async function(browser, accDoc) {
is(findAccessibleChildByID(accDoc, 'parent'), null, is(findAccessibleChildByID(accDoc, "parent"), null,
'Check that parent is not accessible.'); "Check that parent is not accessible.");
is(findAccessibleChildByID(accDoc, 'child'), null, is(findAccessibleChildByID(accDoc, "child"), null,
'Check that child is not accessible.'); "Check that child is not accessible.");
let onReorder = waitForEvent(EVENT_REORDER, 'body'); let onReorder = waitForEvent(EVENT_REORDER, "body");
// Add an event listener to parent. // Add an event listener to parent.
await ContentTask.spawn(browser, {}, () => { await ContentTask.spawn(browser, {}, () => {
content.window.dummyListener = () => {}; content.window.dummyListener = () => {};
content.document.getElementById('parent').addEventListener( content.document.getElementById("parent").addEventListener(
'click', content.window.dummyListener); "click", content.window.dummyListener);
}); });
await onReorder; await onReorder;
let tree = { TEXT: [] }; 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 * 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/. */ * 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/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) { 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 // Create a combobox with grouping and 2 standalone options
await ContentTask.spawn(browser, {}, () => { await ContentTask.spawn(browser, {}, () => {
let doc = content.document; let doc = content.document;
let contentSelect = doc.getElementById('select'); let contentSelect = doc.getElementById("select");
let optGroup = doc.createElement('optgroup'); let optGroup = doc.createElement("optgroup");
for (let i = 0; i < 2; i++) { for (let i = 0; i < 2; i++) {
let opt = doc.createElement('option'); let opt = doc.createElement("option");
opt.value = i; opt.value = i;
opt.text = 'Option: Value ' + i; opt.text = "Option: Value " + i;
optGroup.appendChild(opt); optGroup.appendChild(opt);
} }
contentSelect.add(optGroup, null); contentSelect.add(optGroup, null);
for (let i = 0; i < 2; i++) { for (let i = 0; i < 2; i++) {
let opt = doc.createElement('option'); let opt = doc.createElement("option");
contentSelect.add(opt, null); contentSelect.add(opt, null);
} }
contentSelect.firstChild.firstChild.id = 'option1Node'; contentSelect.firstChild.firstChild.id = "option1Node";
}); });
let event = await onEvent; let event = await onEvent;
let option1Node = findAccessibleChildByID(event.accessible, 'option1Node'); let option1Node = findAccessibleChildByID(event.accessible, "option1Node");
let tree = { let tree = {
COMBOBOX: [ { COMBOBOX: [ {
@ -49,12 +49,12 @@ addAccessibleTask('<select id="select"></select>', async function(browser, accDo
} ] } ]
}; };
testAccessibleTree(select, tree); 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 // Remove grouping from combobox
await ContentTask.spawn(browser, {}, () => { await ContentTask.spawn(browser, {}, () => {
let contentSelect = content.document.getElementById('select'); let contentSelect = content.document.getElementById("select");
contentSelect.firstChild.remove(); contentSelect.firstChild.remove();
}); });
await onEvent; await onEvent;
@ -69,12 +69,12 @@ addAccessibleTask('<select id="select"></select>', async function(browser, accDo
}; };
testAccessibleTree(select, tree); testAccessibleTree(select, tree);
ok(isDefunct(option1Node), 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 // Remove all options from combobox
await ContentTask.spawn(browser, {}, () => { await ContentTask.spawn(browser, {}, () => {
let contentSelect = content.document.getElementById('select'); let contentSelect = content.document.getElementById("select");
while (contentSelect.length) { while (contentSelect.length) {
contentSelect.remove(0); contentSelect.remove(0);
} }

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

@ -2,37 +2,37 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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/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) { addAccessibleTask("doc_treeupdate_removal.xhtml", async function(browser, accDoc) {
ok(isAccessible(findAccessibleChildByID(accDoc, 'the_table')), ok(isAccessible(findAccessibleChildByID(accDoc, "the_table")),
'table should be accessible'); "table should be accessible");
// Move the_table element into hidden subtree. // 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( await ContentTask.spawn(browser, {}, () => content.document.getElementById(
'the_displaynone').appendChild(content.document.getElementById( "the_displaynone").appendChild(content.document.getElementById(
'the_table'))); "the_table")));
await onReorder; await onReorder;
ok(!isAccessible(findAccessibleChildByID(accDoc, 'the_table')), ok(!isAccessible(findAccessibleChildByID(accDoc, "the_table")),
'table in display none tree shouldn\'t be accessible'); "table in display none tree shouldn't be accessible");
ok(!isAccessible(findAccessibleChildByID(accDoc, 'the_row')), ok(!isAccessible(findAccessibleChildByID(accDoc, "the_row")),
'row shouldn\'t be accessible'); "row shouldn't be accessible");
// Remove the_row element (since it did not have accessible, no event needed). // Remove the_row element (since it did not have accessible, no event needed).
await ContentTask.spawn(browser, {}, () => await ContentTask.spawn(browser, {}, () =>
content.document.body.removeChild( content.document.body.removeChild(
content.document.getElementById('the_row'))); content.document.getElementById("the_row")));
// make sure no accessibles have stuck around. // make sure no accessibles have stuck around.
ok(!isAccessible(findAccessibleChildByID(accDoc, 'the_row')), ok(!isAccessible(findAccessibleChildByID(accDoc, "the_row")),
'row shouldn\'t be accessible'); "row shouldn't be accessible");
ok(!isAccessible(findAccessibleChildByID(accDoc, 'the_table')), ok(!isAccessible(findAccessibleChildByID(accDoc, "the_table")),
'table shouldn\'t be accessible'); "table shouldn't be accessible");
ok(!isAccessible(findAccessibleChildByID(accDoc, 'the_displayNone')), ok(!isAccessible(findAccessibleChildByID(accDoc, "the_displayNone")),
'display none things shouldn\'t be accessible'); "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 * 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/. */ * 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/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
addAccessibleTask(` addAccessibleTask(`
<table id="table"> <table id="table">
@ -14,7 +14,7 @@ addAccessibleTask(`
<td>cell2</td> <td>cell2</td>
</tr> </tr>
</table>`, async function(browser, accDoc) { </table>`, async function(browser, accDoc) {
let table = findAccessibleChildByID(accDoc, 'table'); let table = findAccessibleChildByID(accDoc, "table");
let tree = { let tree = {
TABLE: [ TABLE: [
@ -26,14 +26,14 @@ addAccessibleTask(`
}; };
testAccessibleTree(table, tree); testAccessibleTree(table, tree);
let onReorder = waitForEvent(EVENT_REORDER, 'table'); let onReorder = waitForEvent(EVENT_REORDER, "table");
await ContentTask.spawn(browser, {}, () => { await ContentTask.spawn(browser, {}, () => {
// append a caption, it should appear as a first element in the // append a caption, it should appear as a first element in the
// accessible tree. // accessible tree.
let doc = content.document; let doc = content.document;
let caption = doc.createElement('caption'); let caption = doc.createElement("caption");
caption.textContent = 'table caption'; caption.textContent = "table caption";
doc.getElementById('table').appendChild(caption); doc.getElementById("table").appendChild(caption);
}); });
await onReorder; await onReorder;

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

@ -2,10 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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/role.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }); loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
async function removeTextData(browser, accessible, id, role) { async function removeTextData(browser, accessible, id, role) {
let tree = { let tree = {
@ -16,7 +16,7 @@ async function removeTextData(browser, accessible, id, role) {
let onReorder = waitForEvent(EVENT_REORDER, id); let onReorder = waitForEvent(EVENT_REORDER, id);
await ContentTask.spawn(browser, id, contentId => { await ContentTask.spawn(browser, id, contentId => {
content.document.getElementById(contentId).firstChild.textContent = ''; content.document.getElementById(contentId).firstChild.textContent = "";
}); });
await onReorder; await onReorder;
@ -27,8 +27,8 @@ async function removeTextData(browser, accessible, id, role) {
addAccessibleTask(` addAccessibleTask(`
<p id="p">text</p> <p id="p">text</p>
<pre id="pre">text</pre>`, async function(browser, accDoc) { <pre id="pre">text</pre>`, async function(browser, accDoc) {
let p = findAccessibleChildByID(accDoc, 'p'); let p = findAccessibleChildByID(accDoc, "p");
let pre = findAccessibleChildByID(accDoc, 'pre'); let pre = findAccessibleChildByID(accDoc, "pre");
await removeTextData(browser, p, 'p', ROLE_PARAGRAPH); await removeTextData(browser, p, "p", ROLE_PARAGRAPH);
await removeTextData(browser, pre, 'pre', ROLE_TEXT_CONTAINER); 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 * 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/. */ * 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/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) { async function testTreeOnHide(browser, accDoc, containerID, id, before, after) {
let acc = findAccessibleChildByID(accDoc, containerID); let acc = findAccessibleChildByID(accDoc, containerID);
testAccessibleTree(acc, before); testAccessibleTree(acc, before);
let onReorder = waitForEvent(EVENT_REORDER, containerID); let onReorder = waitForEvent(EVENT_REORDER, containerID);
await invokeSetStyle(browser, id, 'visibility', 'hidden'); await invokeSetStyle(browser, id, "visibility", "hidden");
await onReorder; await onReorder;
testAccessibleTree(acc, after); testAccessibleTree(acc, after);
@ -34,12 +34,12 @@ async function test3(browser, accessible) {
] }; ] };
testAccessibleTree(accessible, tree); testAccessibleTree(accessible, tree);
let onReorder = waitForEvent(EVENT_REORDER, 't3_container'); let onReorder = waitForEvent(EVENT_REORDER, "t3_container");
await ContentTask.spawn(browser, {}, () => { await ContentTask.spawn(browser, {}, () => {
let doc = content.document; let doc = content.document;
doc.getElementById('t3_container').style.color = 'red'; doc.getElementById("t3_container").style.color = "red";
doc.getElementById('t3_parent').style.visibility = 'hidden'; doc.getElementById("t3_parent").style.visibility = "hidden";
doc.getElementById('t3_parent2').style.visibility = 'hidden'; doc.getElementById("t3_parent2").style.visibility = "hidden";
}); });
await onReorder; await onReorder;
@ -66,11 +66,11 @@ async function test4(browser, accessible) {
] }; ] };
testAccessibleTree(accessible, tree); testAccessibleTree(accessible, tree);
let onReorder = waitForEvent(EVENT_REORDER, 't4_parent'); let onReorder = waitForEvent(EVENT_REORDER, "t4_parent");
await ContentTask.spawn(browser, {}, () => { await ContentTask.spawn(browser, {}, () => {
let doc = content.document; let doc = content.document;
doc.getElementById('t4_container').style.color = 'red'; doc.getElementById("t4_container").style.color = "red";
doc.getElementById('t4_child').style.visibility = 'visible'; doc.getElementById("t4_child").style.visibility = "visible";
}); });
await onReorder; await onReorder;
@ -90,11 +90,11 @@ async function test4(browser, accessible) {
testAccessibleTree(accessible, tree); testAccessibleTree(accessible, tree);
} }
addAccessibleTask('doc_treeupdate_visibility.html', async function(browser, accDoc) { addAccessibleTask("doc_treeupdate_visibility.html", async function(browser, accDoc) {
let t3Container = findAccessibleChildByID(accDoc, 't3_container'); let t3Container = findAccessibleChildByID(accDoc, "t3_container");
let t4Container = findAccessibleChildByID(accDoc, 't4_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: [{ SECTION: [{
SECTION: [ { TEXT_LEAF: [] } ] 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: [{ // container
SECTION: [{ // grand parent SECTION: [{ // grand parent
SECTION: [{ SECTION: [{
@ -135,7 +135,7 @@ addAccessibleTask('doc_treeupdate_visibility.html', async function(browser, accD
await test3(browser, t3Container); await test3(browser, t3Container);
await test4(browser, t4Container); await test4(browser, t4Container);
await testTreeOnHide(browser, accDoc, 't5_container', 't5_subcontainer', { await testTreeOnHide(browser, accDoc, "t5_container", "t5_subcontainer", {
SECTION: [{ // container SECTION: [{ // container
SECTION: [{ // subcontainer SECTION: [{ // subcontainer
TABLE: [{ 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: [{ // container
SECTION: [{ // subcontainer SECTION: [{ // subcontainer
TABLE: [{ TABLE: [{

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

@ -2,14 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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/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) { addAccessibleTask("doc_treeupdate_whitespace.html", async function(browser, accDoc) {
let container1 = findAccessibleChildByID(accDoc, 'container1'); let container1 = findAccessibleChildByID(accDoc, "container1");
let container2Parent = findAccessibleChildByID(accDoc, 'container2-parent'); let container2Parent = findAccessibleChildByID(accDoc, "container2-parent");
let tree = { let tree = {
SECTION: [ SECTION: [
@ -22,12 +22,12 @@ addAccessibleTask('doc_treeupdate_whitespace.html', async function(browser, accD
}; };
testAccessibleTree(container1, tree); testAccessibleTree(container1, tree);
let onReorder = waitForEvent(EVENT_REORDER, 'container1'); let onReorder = waitForEvent(EVENT_REORDER, "container1");
// Remove img1 from container1 // Remove img1 from container1
await ContentTask.spawn(browser, {}, () => { await ContentTask.spawn(browser, {}, () => {
let doc = content.document; let doc = content.document;
doc.getElementById('container1').removeChild( doc.getElementById("container1").removeChild(
doc.getElementById('img1')); doc.getElementById("img1"));
}); });
await onReorder; await onReorder;
@ -48,14 +48,14 @@ addAccessibleTask('doc_treeupdate_whitespace.html', async function(browser, accD
}; };
testAccessibleTree(container2Parent, tree); testAccessibleTree(container2Parent, tree);
onReorder = waitForEvent(EVENT_REORDER, 'container2-parent'); onReorder = waitForEvent(EVENT_REORDER, "container2-parent");
// Append an img with valid src to container2 // Append an img with valid src to container2
await ContentTask.spawn(browser, {}, () => { await ContentTask.spawn(browser, {}, () => {
let doc = content.document; let doc = content.document;
let img = doc.createElement('img'); let img = doc.createElement("img");
img.setAttribute('src', img.setAttribute("src",
'http://example.com/a11y/accessible/tests/mochitest/moz.png'); "http://example.com/a11y/accessible/tests/mochitest/moz.png");
doc.getElementById('container2').appendChild(img); doc.getElementById("container2").appendChild(img);
}); });
await onReorder; await onReorder;

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

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

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

@ -33,7 +33,7 @@ function urlChecker(url) {
async function runTests(browser, accDoc) { async function runTests(browser, accDoc) {
let onLoadEvents = waitForEvents([ let onLoadEvents = waitForEvents([
[EVENT_REORDER, getAccessible(browser)], [EVENT_REORDER, getAccessible(browser)],
[EVENT_DOCUMENT_LOAD_COMPLETE, 'body2'], [EVENT_DOCUMENT_LOAD_COMPLETE, "body2"],
[EVENT_STATE_CHANGE, busyChecker(false)] [EVENT_STATE_CHANGE, busyChecker(false)]
], [ // unexpected ], [ // unexpected
[EVENT_DOCUMENT_LOAD_COMPLETE, inIframeChecker("iframe1")], [EVENT_DOCUMENT_LOAD_COMPLETE, inIframeChecker("iframe1")],

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

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

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

@ -6,8 +6,8 @@
/* import-globals-from ../../mochitest/states.js */ /* import-globals-from ../../mochitest/states.js */
/* import-globals-from ../../mochitest/role.js */ /* import-globals-from ../../mochitest/role.js */
loadScripts({ name: 'states.js', dir: MOCHITESTS_DIR }, loadScripts({ name: "states.js", dir: MOCHITESTS_DIR },
{ name: 'role.js', dir: MOCHITESTS_DIR }); { name: "role.js", dir: MOCHITESTS_DIR });
async function runTests(browser, accDoc) { async function runTests(browser, accDoc) {
let onFocus = waitForEvent(EVENT_FOCUS, "button"); 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict'; "use strict";
// Load the shared-head file first. // Load the shared-head file first.
/* import-globals-from ../shared-head.js */ /* import-globals-from ../shared-head.js */
Services.scriptloader.loadSubScript( Services.scriptloader.loadSubScript(
'chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js', "chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js",
this); this);
// Loading and common.js from accessible/tests/mochitest/ for all tests, as // Loading and common.js from accessible/tests/mochitest/ for all tests, as
// well as events.js. // 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict'; "use strict";
/* exported initPromise, shutdownPromise, waitForEvent, setE10sPrefs, /* exported initPromise, shutdownPromise, waitForEvent, setE10sPrefs,
unsetE10sPrefs, forceGC */ unsetE10sPrefs, forceGC */
@ -15,9 +15,9 @@ function setE10sPrefs() {
return new Promise(resolve => return new Promise(resolve =>
SpecialPowers.pushPrefEnv({ SpecialPowers.pushPrefEnv({
set: [ set: [
['browser.tabs.remote.autostart', true], ["browser.tabs.remote.autostart", true],
['browser.tabs.remote.force-enable', true], ["browser.tabs.remote.force-enable", true],
['extensions.e10sBlocksEnabling', false] ["extensions.e10sBlocksEnabling", false]
] ]
}, resolve)); }, resolve));
} }
@ -35,7 +35,7 @@ function unsetE10sPrefs() {
// Load the shared-head file first. // Load the shared-head file first.
/* import-globals-from shared-head.js */ /* import-globals-from shared-head.js */
Services.scriptloader.loadSubScript( Services.scriptloader.loadSubScript(
'chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js', "chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js",
this); this);
/** /**
@ -45,10 +45,10 @@ Services.scriptloader.loadSubScript(
function a11yInitOrShutdownPromise() { function a11yInitOrShutdownPromise() {
return new Promise(resolve => { return new Promise(resolve => {
let observe = (subject, topic, data) => { let observe = (subject, topic, data) => {
Services.obs.removeObserver(observe, 'a11y-init-or-shutdown'); Services.obs.removeObserver(observe, "a11y-init-or-shutdown");
resolve(data); 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 ? let a11yInitPromise = contentBrowser ?
contentA11yInitOrShutdownPromise(contentBrowser) : contentA11yInitOrShutdownPromise(contentBrowser) :
a11yInitOrShutdownPromise(); a11yInitOrShutdownPromise();
return promiseOK(a11yInitPromise, '1').then( return promiseOK(a11yInitPromise, "1").then(
() => ok(true, 'Service initialized correctly'), () => ok(true, "Service initialized correctly"),
() => ok(false, 'Service shutdown incorrectly')); () => ok(false, "Service shutdown incorrectly"));
} }
/** /**
@ -103,9 +103,9 @@ function shutdownPromise(contentBrowser) {
let a11yShutdownPromise = contentBrowser ? let a11yShutdownPromise = contentBrowser ?
contentA11yInitOrShutdownPromise(contentBrowser) : contentA11yInitOrShutdownPromise(contentBrowser) :
a11yInitOrShutdownPromise(); a11yInitOrShutdownPromise();
return promiseOK(a11yShutdownPromise, '0').then( return promiseOK(a11yShutdownPromise, "0").then(
() => ok(true, 'Service shutdown correctly'), () => ok(true, "Service shutdown correctly"),
() => ok(false, 'Service initialized incorrectly')); () => ok(false, "Service initialized incorrectly"));
} }
/** /**
@ -119,12 +119,12 @@ function waitForEvent(eventType, expectedId) {
let event = subject.QueryInterface(Ci.nsIAccessibleEvent); let event = subject.QueryInterface(Ci.nsIAccessibleEvent);
if (event.eventType === eventType && if (event.eventType === eventType &&
event.accessible.id === expectedId) { event.accessible.id === expectedId) {
Services.obs.removeObserver(this, 'accessible-event'); Services.obs.removeObserver(this, "accessible-event");
resolve(event); resolve(event);
} }
} }
}; };
Services.obs.addObserver(eventObserver, 'accessible-event'); Services.obs.addObserver(eventObserver, "accessible-event");
}); });
} }

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

@ -2,13 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict'; "use strict";
/* import-globals-from ../../mochitest/layout.js */ /* 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) { 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 paragraph = findAccessibleChildByID(accDoc, "paragraph", [nsIAccessibleText]);
let offset = 64; // beginning of 4th stanza let offset = 64; // beginning of 4th stanza

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

@ -2,14 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict'; "use strict";
// Load the shared-head file first. // Load the shared-head file first.
/* import-globals-from ../shared-head.js */ /* import-globals-from ../shared-head.js */
Services.scriptloader.loadSubScript( Services.scriptloader.loadSubScript(
'chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js', "chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js",
this); this);
// Loading and common.js from accessible/tests/mochitest/ for all tests, as // Loading and common.js from accessible/tests/mochitest/ for all tests, as
// well as events.js. // 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 * 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/. */ * 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 ../mochitest/common.js */
/* import-globals-from events.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. * Current browser test directory path used to load subscripts.
*/ */
const CURRENT_DIR = 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 * A11y mochitest directory where we find common files used in both browser and
* plain tests. * plain tests.
*/ */
const MOCHITESTS_DIR = 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. * A base URL for test files used in content.
*/ */
const CURRENT_CONTENT_DIR = const CURRENT_CONTENT_DIR =
'http://example.com/browser/accessible/tests/browser/'; "http://example.com/browser/accessible/tests/browser/";
const LOADED_FRAMESCRIPTS = new Map(); const LOADED_FRAMESCRIPTS = new Map();
@ -163,7 +163,7 @@ function invokeFocus(browser, id) {
*/ */
function loadScripts(...scripts) { function loadScripts(...scripts) {
for (let script of 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}`; `${script.dir}${script.name}`;
Services.scriptloader.loadSubScript(path, this); Services.scriptloader.loadSubScript(path, this);
} }
@ -178,8 +178,8 @@ function loadFrameScripts(browser, ...scripts) {
let mm = browser.messageManager; let mm = browser.messageManager;
for (let script of scripts) { for (let script of scripts) {
let frameScript; let frameScript;
if (typeof script === 'string') { if (typeof script === "string") {
if (script.includes('.js')) { if (script.includes(".js")) {
// If script string includes a .js extention, assume it is a script // If script string includes a .js extention, assume it is a script
// path. // path.
frameScript = `${CURRENT_DIR}${script}`; frameScript = `${CURRENT_DIR}${script}`;
@ -242,22 +242,22 @@ function snippetToURL(snippet, bodyAttrs={}) {
function addAccessibleTask(doc, task) { function addAccessibleTask(doc, task) {
add_task(async function() { add_task(async function() {
let url; let url;
if (doc.includes('doc_')) { if (doc.includes("doc_")) {
url = `${CURRENT_CONTENT_DIR}e10s/${doc}`; url = `${CURRENT_CONTENT_DIR}e10s/${doc}`;
} else { } else {
url = snippetToURL(doc); url = snippetToURL(doc);
} }
registerCleanupFunction(() => { registerCleanupFunction(() => {
let observers = Services.obs.enumerateObservers('accessible-event'); let observers = Services.obs.enumerateObservers("accessible-event");
while (observers.hasMoreElements()) { while (observers.hasMoreElements()) {
Services.obs.removeObserver( Services.obs.removeObserver(
observers.getNext().QueryInterface(Ci.nsIObserver), 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({ await BrowserTestUtils.withNewTab({
gBrowser, gBrowser,
@ -275,8 +275,8 @@ function addAccessibleTask(doc, task) {
await SimpleTest.promiseFocus(browser); await SimpleTest.promiseFocus(browser);
loadFrameScripts(browser, loadFrameScripts(browser,
'let { document, window, navigator } = content;', "let { document, window, navigator } = content;",
{ name: 'common.js', dir: MOCHITESTS_DIR }); { name: "common.js", dir: MOCHITESTS_DIR });
Logger.log( Logger.log(
`e10s enabled: ${Services.appinfo.browserTabsRemoteAutostart}`); `e10s enabled: ${Services.appinfo.browserTabsRemoteAutostart}`);

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

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

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

@ -2,12 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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/role.js */
/* import-globals-from ../../mochitest/states.js */ /* import-globals-from ../../mochitest/states.js */
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR }, loadScripts({ name: "role.js", dir: MOCHITESTS_DIR },
{ name: 'states.js', dir: MOCHITESTS_DIR }); { name: "states.js", dir: MOCHITESTS_DIR });
async function runTest(browser, accDoc) { async function runTest(browser, accDoc) {
let getAcc = id => findAccessibleChildByID(accDoc, id); let getAcc = id => findAccessibleChildByID(accDoc, id);
@ -23,7 +23,7 @@ async function runTest(browser, accDoc) {
// scroll into view the item // scroll into view the item
await ContentTask.spawn(browser, {}, () => { 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); 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict'; "use strict";
// Load the shared-head file first. // Load the shared-head file first.
/* import-globals-from ../shared-head.js */ /* import-globals-from ../shared-head.js */
Services.scriptloader.loadSubScript( Services.scriptloader.loadSubScript(
'chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js', "chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js",
this); this);
// Loading and common.js from accessible/tests/mochitest/ for all tests, as // Loading and common.js from accessible/tests/mochitest/ for all tests, as
// well as events.js. // 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict'; "use strict";
// Load the shared-head file first. // Load the shared-head file first.
/* import-globals-from ../shared-head.js */ /* import-globals-from ../shared-head.js */
Services.scriptloader.loadSubScript( Services.scriptloader.loadSubScript(
'chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js', "chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js",
this); this);
// Loading and common.js from accessible/tests/mochitest/ for all tests, as // Loading and common.js from accessible/tests/mochitest/ for all tests, as
// well as events.js. // 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 "; msg += " noName ";
} }
dump(msg + '\n'); dump(msg + "\n");
} }
@ -42,12 +42,12 @@ function dumpAccessibleTree(aNode, level) {
child = child.nextSibling; child = child.nextSibling;
} }
} catch (e) { } catch (e) {
dump("Error visiting child nodes: " + e + '\n'); dump("Error visiting child nodes: " + e + "\n");
} }
} }
function A(o) { function A(o) {
var acc = SpecialPowers.Cc['@mozilla.org/accessibilityService;1'] var acc = SpecialPowers.Cc["@mozilla.org/accessibilityService;1"]
.getService(SpecialPowers.Ci.nsIAccessibilityService); .getService(SpecialPowers.Ci.nsIAccessibilityService);
return acc.getAccessibleFor(o); return acc.getAccessibleFor(o);
} }
@ -60,10 +60,10 @@ setTimeout(beginAccessible, 100);
setTimeout(doe, 200); setTimeout(doe, 200);
function doe() { function doe() {
document.getElementById('mw_a').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_c").appendChild(document.getElementById("mw_d"));
document.getElementById('mw_e').appendChild(document.getElementById('mw_f')); document.getElementById("mw_e").appendChild(document.getElementById("mw_f"));
document.getElementById('mw_g').appendChild(document.getElementById('mw_b')); document.getElementById("mw_g").appendChild(document.getElementById("mw_b"));
} }
</script> </script>
</body> </body>

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

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

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

@ -21,45 +21,45 @@
{ {
// DPub ARIA roles should be exposed via the xml-roles object attribute. // DPub ARIA roles should be exposed via the xml-roles object attribute.
let dpub_attrs = [ let dpub_attrs = [
'doc-abstract', "doc-abstract",
'doc-acknowledgments', "doc-acknowledgments",
'doc-afterword', "doc-afterword",
'doc-appendix', "doc-appendix",
'doc-backlink', "doc-backlink",
'doc-biblioentry', "doc-biblioentry",
'doc-bibliography', "doc-bibliography",
'doc-biblioref', "doc-biblioref",
'doc-chapter', "doc-chapter",
'doc-colophon', "doc-colophon",
'doc-conclusion', "doc-conclusion",
'doc-cover', "doc-cover",
'doc-credit', "doc-credit",
'doc-credits', "doc-credits",
'doc-dedication', "doc-dedication",
'doc-endnote', "doc-endnote",
'doc-endnotes', "doc-endnotes",
'doc-epigraph', "doc-epigraph",
'doc-epilogue', "doc-epilogue",
'doc-errata', "doc-errata",
'doc-example', "doc-example",
'doc-footnote', "doc-footnote",
'doc-foreword', "doc-foreword",
'doc-glossary', "doc-glossary",
'doc-glossref', "doc-glossref",
'doc-index', "doc-index",
'doc-introduction', "doc-introduction",
'doc-noteref', "doc-noteref",
'doc-notice', "doc-notice",
'doc-pagebreak', "doc-pagebreak",
'doc-pagelist', "doc-pagelist",
'doc-part', "doc-part",
'doc-preface', "doc-preface",
'doc-prologue', "doc-prologue",
'doc-pullquote', "doc-pullquote",
'doc-qna', "doc-qna",
'doc-subtitle', "doc-subtitle",
'doc-tip', "doc-tip",
'doc-toc' "doc-toc"
]; ];
for (let attr of dpub_attrs) { for (let attr of dpub_attrs) {
testAttrs(attr, {"xml-roles": attr}, true); testAttrs(attr, {"xml-roles": attr}, true);

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

@ -91,7 +91,7 @@ const MAX_TRIM_LENGTH = 100;
/** /**
* Services to determine if e10s is enabled. * 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. * nsIAccessibilityService service.

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

@ -22,7 +22,7 @@
function doTest() function doTest()
{ {
var canv = document.getElementById("c"); var canv = document.getElementById("c");
var context = canv.getContext('2d'); var context = canv.getContext("2d");
var element = document.getElementById("showA"); var element = document.getElementById("showA");
context.beginPath(); context.beginPath();
context.rect(kX, kY, kWidth, kHeight); context.rect(kX, kY, kWidth, kHeight);
@ -43,7 +43,7 @@
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(function() { addA11yLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set": [['canvas.hitregions.enabled', true]]}, doTest); SpecialPowers.pushPrefEnv({"set": [["canvas.hitregions.enabled", true]]}, doTest);
}); });
</script> </script>

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

@ -49,10 +49,10 @@
<div role="group" id="component"></div> <div role="group" id="component"></div>
<script> <script>
var component = document.getElementById('component'); var component = document.getElementById("component");
var shadow = component.createShadowRoot(); var shadow = component.createShadowRoot();
shadow.innerHTML = '<button>Hello</button>' + shadow.innerHTML = "<button>Hello</button>" +
'<a href="#"> World</a>'; '<a href="#"> World</a>';
</script> </script>

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

@ -28,7 +28,7 @@
{ {
var iframe = document.getElementById("iframe"); var iframe = document.getElementById("iframe");
gService.getAccessibleFor(iframe.contentDocument); gService.getAccessibleFor(iframe.contentDocument);
iframe.style.display = 'none'; iframe.style.display = "none";
} }
</script> </script>
</head> </head>

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

@ -501,20 +501,20 @@
function test7() function test7()
{ {
this.eventSeq = [ this.eventSeq = [
new invokerChecker(EVENT_HIDE, getNode('t7_c')), new invokerChecker(EVENT_HIDE, getNode("t7_c")),
new invokerChecker(EVENT_SHOW, getNode('t7_c')), new invokerChecker(EVENT_SHOW, getNode("t7_c")),
new invokerChecker(EVENT_REORDER, getNode('t7')), new invokerChecker(EVENT_REORDER, getNode("t7")),
new unexpectedInvokerChecker(EVENT_REORDER, getNode('t7_c_directchild')), new unexpectedInvokerChecker(EVENT_REORDER, getNode("t7_c_directchild")),
new unexpectedInvokerChecker(EVENT_REORDER, getNode('t7_c_grandchild')), new unexpectedInvokerChecker(EVENT_REORDER, getNode("t7_c_grandchild")),
new unexpectedInvokerChecker(EVENT_SHOW, () => getNode('t7_c_directchild').firstChild), new unexpectedInvokerChecker(EVENT_SHOW, () => getNode("t7_c_directchild").firstChild),
new unexpectedInvokerChecker(EVENT_SHOW, () => getNode('t7_c_grandchild').firstChild) new unexpectedInvokerChecker(EVENT_SHOW, () => getNode("t7_c_grandchild").firstChild)
]; ];
this.invoke = function test7_invoke() this.invoke = function test7_invoke()
{ {
getNode('t7_c_directchild').textContent = 'ha'; getNode("t7_c_directchild").textContent = "ha";
getNode('t7_c_grandchild').textContent = 'ha'; getNode("t7_c_grandchild").textContent = "ha";
getNode('t7_moveplace').setAttribute('aria-owns', 't7_c'); getNode("t7_moveplace").setAttribute("aria-owns", "t7_c");
}; };
this.getID = function test7_getID() { this.getID = function test7_getID() {
@ -536,11 +536,11 @@
function test8() function test8()
{ {
this.eventSeq = [ this.eventSeq = [
new invokerChecker(EVENT_HIDE, getNode('t8_c1_child')), new invokerChecker(EVENT_HIDE, getNode("t8_c1_child")),
new invokerChecker(EVENT_HIDE, 't8_c2_moved'), new invokerChecker(EVENT_HIDE, "t8_c2_moved"),
new invokerChecker(EVENT_SHOW, 't8_c2_moved'), new invokerChecker(EVENT_SHOW, "t8_c2_moved"),
new invokerChecker(EVENT_REORDER, 't8_c2'), new invokerChecker(EVENT_REORDER, "t8_c2"),
new invokerChecker(EVENT_REORDER, 't8_c1'), new invokerChecker(EVENT_REORDER, "t8_c1"),
]; ];
this.invoke = function test8_invoke() this.invoke = function test8_invoke()
@ -548,9 +548,9 @@
// Remove a node from 't8_c1' container to give the event tree a // Remove a node from 't8_c1' container to give the event tree a
// desired structure (the 't8_c1' container node goes first in the event // desired structure (the 't8_c1' container node goes first in the event
// tree) // tree)
getNode('t8_c1_child').remove(); getNode("t8_c1_child").remove();
// then move 't8_c2_moved' from 't8_c2' to 't8_c1'. // then move 't8_c2_moved' from 't8_c2' to 't8_c1'.
getNode('t8_c1').setAttribute('aria-owns', 't8_c2_moved'); getNode("t8_c1").setAttribute("aria-owns", "t8_c2_moved");
}; };
this.getID = function test8_getID() { this.getID = function test8_getID() {
@ -577,15 +577,15 @@
function test9() function test9()
{ {
this.eventSeq = [ this.eventSeq = [
new invokerChecker(EVENT_HIDE, getNode('t9_c1_child')), new invokerChecker(EVENT_HIDE, getNode("t9_c1_child")),
new invokerChecker(EVENT_HIDE, getNode('t9_c2_child')), new invokerChecker(EVENT_HIDE, getNode("t9_c2_child")),
new invokerChecker(EVENT_HIDE, 't9_c3_moved'), new invokerChecker(EVENT_HIDE, "t9_c3_moved"),
new invokerChecker(EVENT_HIDE, 't9_c2_moved'), new invokerChecker(EVENT_HIDE, "t9_c2_moved"),
new invokerChecker(EVENT_SHOW, 't9_c2_moved'), new invokerChecker(EVENT_SHOW, "t9_c2_moved"),
new invokerChecker(EVENT_REORDER, 't9_c3'), new invokerChecker(EVENT_REORDER, "t9_c3"),
new invokerChecker(EVENT_REORDER, 't9_c2'), new invokerChecker(EVENT_REORDER, "t9_c2"),
new invokerChecker(EVENT_REORDER, 't9_c1'), new invokerChecker(EVENT_REORDER, "t9_c1"),
new unexpectedInvokerChecker(EVENT_SHOW, 't9_c3_moved') new unexpectedInvokerChecker(EVENT_SHOW, "t9_c3_moved")
]; ];
this.invoke = function test9_invoke() this.invoke = function test9_invoke()
@ -593,11 +593,11 @@
// Remove child nodes from 't9_c1' and 't9_c2' containers to give // Remove child nodes from 't9_c1' and 't9_c2' containers to give
// the event tree a needed structure ('t9_c1' and 't9_c2' nodes go // the event tree a needed structure ('t9_c1' and 't9_c2' nodes go
// first in the event tree), // first in the event tree),
getNode('t9_c1_child').remove(); getNode("t9_c1_child").remove();
getNode('t9_c2_child').remove(); getNode("t9_c2_child").remove();
// then do aria-owns magic. // then do aria-owns magic.
getNode('t9_c2_moved').setAttribute('aria-owns', 't9_c3_moved'); getNode("t9_c2_moved").setAttribute("aria-owns", "t9_c3_moved");
getNode('t9_c1').setAttribute('aria-owns', 't9_c2_moved'); getNode("t9_c1").setAttribute("aria-owns", "t9_c2_moved");
}; };
this.getID = function test9_getID() { this.getID = function test9_getID() {
@ -623,14 +623,14 @@
function test10() function test10()
{ {
this.eventSeq = [ this.eventSeq = [
new invokerChecker(EVENT_HIDE, getNode('t10_c1_child')), new invokerChecker(EVENT_HIDE, getNode("t10_c1_child")),
new invokerChecker(EVENT_HIDE, getNode('t10_c2_child')), new invokerChecker(EVENT_HIDE, getNode("t10_c2_child")),
new invokerChecker(EVENT_HIDE, getNode('t10_c2_moved')), new invokerChecker(EVENT_HIDE, getNode("t10_c2_moved")),
new invokerChecker(EVENT_HIDE, getNode('t10_c3_moved')), new invokerChecker(EVENT_HIDE, getNode("t10_c3_moved")),
new invokerChecker(EVENT_SHOW, getNode('t10_c2_moved')), new invokerChecker(EVENT_SHOW, getNode("t10_c2_moved")),
new invokerChecker(EVENT_REORDER, 't10_c2'), new invokerChecker(EVENT_REORDER, "t10_c2"),
new invokerChecker(EVENT_REORDER, 't10_c1'), new invokerChecker(EVENT_REORDER, "t10_c1"),
new invokerChecker(EVENT_REORDER, 't10_c3') new invokerChecker(EVENT_REORDER, "t10_c3")
]; ];
this.invoke = function test10_invoke() this.invoke = function test10_invoke()
@ -638,11 +638,11 @@
// Remove child nodes from 't10_c1' and 't10_c2' containers to give // Remove child nodes from 't10_c1' and 't10_c2' containers to give
// the event tree a needed structure ('t10_c1' and 't10_c2' nodes go first // the event tree a needed structure ('t10_c1' and 't10_c2' nodes go first
// in the event tree), // in the event tree),
getNode('t10_c1_child').remove(); getNode("t10_c1_child").remove();
getNode('t10_c2_child').remove(); getNode("t10_c2_child").remove();
// then do aria-owns stuff. // then do aria-owns stuff.
getNode('t10_c1').setAttribute('aria-owns', 't10_c2_moved'); getNode("t10_c1").setAttribute("aria-owns", "t10_c2_moved");
getNode('t10_c2_moved').setAttribute('aria-owns', 't10_c3_moved'); getNode("t10_c2_moved").setAttribute("aria-owns", "t10_c3_moved");
}; };
this.getID = function test10_getID() { this.getID = function test10_getID() {
@ -658,17 +658,17 @@
function test11() function test11()
{ {
this.eventSeq = [ this.eventSeq = [
new invokerChecker(EVENT_HIDE, getNode('t11_c1_child')), new invokerChecker(EVENT_HIDE, getNode("t11_c1_child")),
new invokerChecker(EVENT_HIDE, getNode('t11_c2')), new invokerChecker(EVENT_HIDE, getNode("t11_c2")),
new orderChecker(), new orderChecker(),
new asyncInvokerChecker(EVENT_SHOW, 't11_c2_child'), new asyncInvokerChecker(EVENT_SHOW, "t11_c2_child"),
new asyncInvokerChecker(EVENT_SHOW, 't11_c2'), new asyncInvokerChecker(EVENT_SHOW, "t11_c2"),
new orderChecker(), new orderChecker(),
new invokerChecker(EVENT_REORDER, 't11'), new invokerChecker(EVENT_REORDER, "t11"),
new unexpectedInvokerChecker(EVENT_HIDE, 't11_c2_child'), new unexpectedInvokerChecker(EVENT_HIDE, "t11_c2_child"),
new unexpectedInvokerChecker(EVENT_REORDER, 't11_c1'), new unexpectedInvokerChecker(EVENT_REORDER, "t11_c1"),
new unexpectedInvokerChecker(EVENT_REORDER, 't11_c2'), new unexpectedInvokerChecker(EVENT_REORDER, "t11_c2"),
new unexpectedInvokerChecker(EVENT_REORDER, 't11_c3') new unexpectedInvokerChecker(EVENT_REORDER, "t11_c3")
]; ];
this.invoke = function test11_invoke() this.invoke = function test11_invoke()
@ -676,11 +676,11 @@
// Remove a node from 't11_c1' container to give the event tree a // Remove a node from 't11_c1' container to give the event tree a
// desired structure (the 't11_c1' container node goes first in // desired structure (the 't11_c1' container node goes first in
// the event tree), // the event tree),
getNode('t11_c1_child').remove(); getNode("t11_c1_child").remove();
// then move 't11_c2_moved' from 't11_c2' to 't11_c1', and then move // then move 't11_c2_moved' from 't11_c2' to 't11_c1', and then move
// 't11_c2' to 't11_c3'. // 't11_c2' to 't11_c3'.
getNode('t11_c1').setAttribute('aria-owns', 't11_c2_child'); getNode("t11_c1").setAttribute("aria-owns", "t11_c2_child");
getNode('t11_c3').setAttribute('aria-owns', 't11_c2'); getNode("t11_c3").setAttribute("aria-owns", "t11_c2");
}; };
this.getID = function test11_getID() { this.getID = function test11_getID() {

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

@ -95,8 +95,8 @@
{ {
var frameDoc = document.getElementById("iframe").contentDocument; var frameDoc = document.getElementById("iframe").contentDocument;
var editableDoc = document.getElementById('editabledoc').contentDocument; var editableDoc = document.getElementById("editabledoc").contentDocument;
editableDoc.designMode = 'on'; editableDoc.designMode = "on";
gQueue = new eventQueue(); gQueue = new eventQueue();

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

@ -168,7 +168,7 @@
this.invoke = function cloneAndAppendToDOM_invoke() this.invoke = function cloneAndAppendToDOM_invoke()
{ {
var newElm = this.DOMNode.cloneNode(true); var newElm = this.DOMNode.cloneNode(true);
newElm.removeAttribute('id'); newElm.removeAttribute("id");
var targets = aTargetsFunc ? var targets = aTargetsFunc ?
aTargetsFunc.call(null, newElm) : [newElm]; aTargetsFunc.call(null, newElm) : [newElm];
@ -237,7 +237,7 @@
} }
this.newElm = this.DOMNode.cloneNode(true); this.newElm = this.DOMNode.cloneNode(true);
this.newElm.removeAttribute('id'); this.newElm.removeAttribute("id");
this.setTarget(kShowEvent, this.newElm); this.setTarget(kShowEvent, this.newElm);
} }
@ -368,7 +368,7 @@
this.invoke = function showHiddenParentOfVisibleChild_invoke() this.invoke = function showHiddenParentOfVisibleChild_invoke()
{ {
getNode("c4_middle").style.visibility = 'visible'; getNode("c4_middle").style.visibility = "visible";
} }
this.getID = function showHiddenParentOfVisibleChild_getID() this.getID = function showHiddenParentOfVisibleChild_getID()
@ -386,13 +386,13 @@
this.invoke = function hideNDestroyDoc_invoke() this.invoke = function hideNDestroyDoc_invoke()
{ {
this.txt = getAccessible('c5').firstChild.firstChild; this.txt = getAccessible("c5").firstChild.firstChild;
this.txt.DOMNode.remove(); this.txt.DOMNode.remove();
} }
this.check = function hideNDestroyDoc_check() this.check = function hideNDestroyDoc_check()
{ {
getNode('c5').remove(); getNode("c5").remove();
} }
this.getID = function hideNDestroyDoc_getID() this.getID = function hideNDestroyDoc_getID()
@ -410,7 +410,7 @@
this.invoke = function hideHideNDestroyDoc_invoke() this.invoke = function hideHideNDestroyDoc_invoke()
{ {
var doc = getAccessible('c6').firstChild; var doc = getAccessible("c6").firstChild;
var l1 = doc.firstChild; var l1 = doc.firstChild;
this.target = l1.firstChild; this.target = l1.firstChild;
var l2 = doc.lastChild; var l2 = doc.lastChild;
@ -420,7 +420,7 @@
this.check = function hideHideNDestroyDoc_check() this.check = function hideHideNDestroyDoc_check()
{ {
getNode('c6').remove(); getNode("c6").remove();
} }
this.getID = function hideHideNDestroyDoc_getID() this.getID = function hideHideNDestroyDoc_getID()

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

@ -28,7 +28,7 @@
this.invoke = function editabledoc_invoke() { this.invoke = function editabledoc_invoke() {
// Note: this should fire an EVENT_STATE_CHANGE // Note: this should fire an EVENT_STATE_CHANGE
this.DOMNode.designMode = 'on'; this.DOMNode.designMode = "on";
}; };
this.check = function editabledoc_check(aEvent) { this.check = function editabledoc_check(aEvent) {

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

@ -16,16 +16,16 @@
function redrawCheckbox(context, element, x, y) function redrawCheckbox(context, element, x, y)
{ {
context.save(); context.save();
context.font = '10px sans-serif'; context.font = "10px sans-serif";
context.textAlign = 'left'; context.textAlign = "left";
context.textBaseline = 'middle'; context.textBaseline = "middle";
var metrics = context.measureText(element.parentNode.textContent); var metrics = context.measureText(element.parentNode.textContent);
context.beginPath(); context.beginPath();
context.strokeStyle = 'black'; context.strokeStyle = "black";
context.rect(x-5, y-5, 10, 10); context.rect(x-5, y-5, 10, 10);
context.stroke(); context.stroke();
if (element.checked) { if (element.checked) {
context.fillStyle = 'black'; context.fillStyle = "black";
context.fill(); context.fill();
} }
context.fillText(element.parentNode.textContent, x+5, y); context.fillText(element.parentNode.textContent, x+5, y);
@ -44,8 +44,8 @@
var offsetX = 20, offsetY = 40; var offsetX = 20, offsetY = 40;
getNode("hitcanvas").scrollIntoView(true); getNode("hitcanvas").scrollIntoView(true);
var context = document.getElementById("hitcanvas").getContext('2d'); var context = document.getElementById("hitcanvas").getContext("2d");
redrawCheckbox(context, document.getElementById('hitcheck'), redrawCheckbox(context, document.getElementById("hitcheck"),
offsetX, offsetY); offsetX, offsetY);
var hitcanvas = getAccessible("hitcanvas"); var hitcanvas = getAccessible("hitcanvas");
@ -71,7 +71,7 @@
} }
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(function() { addA11yLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set": [['canvas.hitregions.enabled', true]]}, doTest); SpecialPowers.pushPrefEnv({"set": [["canvas.hitregions.enabled", true]]}, doTest);
}); });
</script> </script>
</head> </head>

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

@ -16,11 +16,11 @@
<script type="application/javascript"> <script type="application/javascript">
function doTest() function doTest()
{ {
var componentAcc = getAccessible('component1'); var componentAcc = getAccessible("component1");
testChildAtPoint(componentAcc, 1, 1, componentAcc.firstChild, testChildAtPoint(componentAcc, 1, 1, componentAcc.firstChild,
componentAcc.firstChild); componentAcc.firstChild);
componentAcc = getAccessible('component2'); componentAcc = getAccessible("component2");
testChildAtPoint(componentAcc, 1, 1, componentAcc.firstChild, testChildAtPoint(componentAcc, 1, 1, componentAcc.firstChild,
componentAcc.firstChild); componentAcc.firstChild);
SimpleTest.finish(); SimpleTest.finish();
@ -57,7 +57,7 @@
<script> <script>
// This routine adds the comment children of each 'component' to its // This routine adds the comment children of each 'component' to its
// shadow root. // shadow root.
var components = document.querySelectorAll('.components'); var components = document.querySelectorAll(".components");
for (var i = 0; i < components.length; i++) { for (var i = 0; i < components.length; i++) {
var component = components[i]; var component = components[i];
var shadow = component.createShadowRoot(); var shadow = component.createShadowRoot();

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

@ -4,61 +4,61 @@
<title>Traversal Rule test document</title> <title>Traversal Rule test document</title>
<meta charset="utf-8" /> <meta charset="utf-8" />
<script> <script>
var frameContents = '<html>' + var frameContents = "<html>" +
'<head><title>such app</title></head>' + "<head><title>such app</title></head>" +
'<body>' + "<body>" +
'<h1>wow</h1>' + "<h1>wow</h1>" +
'<ul>' + "<ul>" +
'<li><label><input type="checkbox">many option</label></li>' + '<li><label><input type="checkbox">many option</label></li>' +
'</ul>' + "</ul>" +
'<label for="r">much range</label>' + '<label for="r">much range</label>' +
'<input min="0" max="10" value="5" type="range" id="r">' + '<input min="0" max="10" value="5" type="range" id="r">' +
'</body>' + "</body>" +
'</html>'; "</html>";
function showAlert() { function showAlert() {
document.getElementById('alert').hidden = false; document.getElementById("alert").hidden = false;
} }
function hideAlert() { function hideAlert() {
document.getElementById('alert').hidden = true; document.getElementById("alert").hidden = true;
} }
function ariaShowBack() { function ariaShowBack() {
document.getElementById('back').setAttribute('aria-hidden', false); document.getElementById("back").setAttribute("aria-hidden", false);
} }
function ariaHideBack() { function ariaHideBack() {
document.getElementById('back').setAttribute('aria-hidden', true); document.getElementById("back").setAttribute("aria-hidden", true);
} }
function ariaShowIframe() { function ariaShowIframe() {
document.getElementById('iframe').setAttribute('aria-hidden', false); document.getElementById("iframe").setAttribute("aria-hidden", false);
} }
function ariaHideIframe() { function ariaHideIframe() {
document.getElementById('iframe').setAttribute('aria-hidden', true); document.getElementById("iframe").setAttribute("aria-hidden", true);
} }
function renameFruit() { function renameFruit() {
document.getElementById('fruit').setAttribute('aria-label', 'banana'); document.getElementById("fruit").setAttribute("aria-label", "banana");
} }
function renameSlider() { function renameSlider() {
document.getElementById('slider').setAttribute( document.getElementById("slider").setAttribute(
'aria-label', 'mover'); "aria-label", "mover");
} }
function changeSliderValue() { function changeSliderValue() {
document.getElementById('slider').setAttribute('aria-valuenow', '5'); document.getElementById("slider").setAttribute("aria-valuenow", "5");
document.getElementById('slider').setAttribute( document.getElementById("slider").setAttribute(
'aria-valuetext', 'medium'); "aria-valuetext", "medium");
} }
function toggleLight() { function toggleLight() {
var lightSwitch = document.getElementById('light'); var lightSwitch = document.getElementById("light");
lightSwitch.setAttribute('aria-checked', lightSwitch.setAttribute("aria-checked",
lightSwitch.getAttribute('aria-checked') === 'true' ? 'false' : 'true'); lightSwitch.getAttribute("aria-checked") === "true" ? "false" : "true");
} }
</script> </script>

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

@ -1,11 +1,11 @@
'use strict'; "use strict";
/* exported loadJSON, eventMap */ /* exported loadJSON, eventMap */
var Ci = Components.interfaces; var Ci = Components.interfaces;
var Cu = Components.utils; var Cu = Components.utils;
Cu.import('resource://gre/modules/Geometry.jsm'); Cu.import("resource://gre/modules/Geometry.jsm");
var win = getMainChromeWindow(window); var win = getMainChromeWindow(window);
@ -41,7 +41,7 @@ function calculateTouchListCoordinates(aTouchPoints) {
var coords = []; var coords = [];
for (var i = 0, target = aTouchPoints[i]; i < aTouchPoints.length; ++i) { for (var i = 0, target = aTouchPoints[i]; i < aTouchPoints.length; ++i) {
var bounds = getBoundsForDOMElm(target.base); var bounds = getBoundsForDOMElm(target.base);
var parentBounds = getBoundsForDOMElm('root'); var parentBounds = getBoundsForDOMElm("root");
var point = new Point(target.x || 0, target.y || 0); var point = new Point(target.x || 0, target.y || 0);
point.scale(Utils.dpi); point.scale(Utils.dpi);
point.add(bounds[0], bounds[1]); point.add(bounds[0], bounds[1]);
@ -63,7 +63,7 @@ function calculateTouchListCoordinates(aTouchPoints) {
*/ */
function sendTouchEvent(aTouchPoints, aName) { function sendTouchEvent(aTouchPoints, aName) {
var touchList = sendTouchEvent.touchList; var touchList = sendTouchEvent.touchList;
if (aName === 'touchend') { if (aName === "touchend") {
sendTouchEvent.touchList = null; sendTouchEvent.touchList = null;
} else { } else {
var coords = calculateTouchListCoordinates(aTouchPoints); var coords = calculateTouchListCoordinates(aTouchPoints);
@ -71,14 +71,14 @@ function sendTouchEvent(aTouchPoints, aName) {
for (var i = 0; i < coords.length; ++i) { for (var i = 0; i < coords.length; ++i) {
var {x, y} = coords[i]; var {x, y} = coords[i];
var node = document.elementFromPoint(x, y); var node = document.elementFromPoint(x, y);
var touch = document.createTouch(window, node, aName === 'touchstart' ? var touch = document.createTouch(window, node, aName === "touchstart" ?
1 : touchList.item(i).identifier, x, y, x, y); 1 : touchList.item(i).identifier, x, y, x, y);
touches.push(touch); touches.push(touch);
} }
touchList = document.createTouchList(touches); touchList = document.createTouchList(touches);
sendTouchEvent.touchList = touchList; sendTouchEvent.touchList = touchList;
} }
var evt = document.createEvent('TouchEvent'); var evt = document.createEvent("TouchEvent");
evt.initTouchEvent(aName, true, true, window, 0, false, false, false, false, evt.initTouchEvent(aName, true, true, window, 0, false, false, false, false,
touchList, touchList, touchList); touchList, touchList, touchList);
document.dispatchEvent(evt); document.dispatchEvent(evt);
@ -107,24 +107,24 @@ function testMozAccessFuGesture(aExpectedGestures, aTitle) {
var types = aExpectedGestures; var types = aExpectedGestures;
function handleGesture(aEvent) { function handleGesture(aEvent) {
if (aEvent.detail.type !== types[0].type) { if (aEvent.detail.type !== types[0].type) {
info('Got ' + aEvent.detail.type + ' waiting for ' + types[0].type); info("Got " + aEvent.detail.type + " waiting for " + types[0].type);
// The is not the event of interest. // The is not the event of interest.
return; return;
} }
is(!!aEvent.detail.edge, !!types[0].edge); is(!!aEvent.detail.edge, !!types[0].edge);
is(aEvent.detail.touches.length, types[0].fingers || 1, is(aEvent.detail.touches.length, types[0].fingers || 1,
'failed to count fingers: ' + types[0].type); "failed to count fingers: " + types[0].type);
ok(true, 'Received correct mozAccessFuGesture: ' + ok(true, "Received correct mozAccessFuGesture: " +
JSON.stringify(types.shift()) + '. (' + aTitle + ')'); JSON.stringify(types.shift()) + ". (" + aTitle + ")");
if (types.length === 0) { if (types.length === 0) {
win.removeEventListener('mozAccessFuGesture', handleGesture); win.removeEventListener("mozAccessFuGesture", handleGesture);
if (AccessFuTest.sequenceCleanup) { if (AccessFuTest.sequenceCleanup) {
AccessFuTest.sequenceCleanup(); AccessFuTest.sequenceCleanup();
} }
AccessFuTest.nextTest(); AccessFuTest.nextTest();
} }
} }
win.addEventListener('mozAccessFuGesture', handleGesture); win.addEventListener("mozAccessFuGesture", handleGesture);
} }
/** /**
@ -198,8 +198,8 @@ AccessFuTest.addSequence = function AccessFuTest_addSequence(aSequence) {
*/ */
function loadJSON(aPath, aCallback) { function loadJSON(aPath, aCallback) {
var request = new XMLHttpRequest(); var request = new XMLHttpRequest();
request.open('GET', aPath, true); request.open("GET", aPath, true);
request.responseType = 'json'; request.responseType = "json";
request.onload = function onload() { request.onload = function onload() {
aCallback(request.response); aCallback(request.response);
}; };

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

@ -1,6 +1,6 @@
// A common module to run tests on the AccessFu module // A common module to run tests on the AccessFu module
'use strict'; "use strict";
/*global isDeeply, getMainChromeWindow, SimpleTest, SpecialPowers, Logger, /*global isDeeply, getMainChromeWindow, SimpleTest, SpecialPowers, Logger,
AccessFu, Utils, addMessageListener, currentTabDocument, currentBrowser*/ AccessFu, Utils, addMessageListener, currentTabDocument, currentBrowser*/
@ -14,7 +14,7 @@ var gTestFuncs = [];
*/ */
var gIterator; var gIterator;
Components.utils.import('resource://gre/modules/Services.jsm'); Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/accessibility/Utils.jsm"); Components.utils.import("resource://gre/modules/accessibility/Utils.jsm");
Components.utils.import("resource://gre/modules/accessibility/EventManager.jsm"); Components.utils.import("resource://gre/modules/accessibility/EventManager.jsm");
Components.utils.import("resource://gre/modules/accessibility/Gestures.jsm"); Components.utils.import("resource://gre/modules/accessibility/Gestures.jsm");
@ -70,7 +70,7 @@ var AccessFuTest = {
isDeeply(data.details, aWaitForData, "Data is correct"); isDeeply(data.details, aWaitForData, "Data is correct");
aListener.apply(listener); aListener.apply(listener);
}; };
Services.obs.addObserver(listener, 'accessibility-output'); Services.obs.addObserver(listener, "accessibility-output");
return listener; return listener;
}, },
@ -79,12 +79,12 @@ var AccessFuTest = {
}, },
off: function AccessFuTest_off(aListener) { off: function AccessFuTest_off(aListener) {
Services.obs.removeObserver(aListener, 'accessibility-output'); Services.obs.removeObserver(aListener, "accessibility-output");
}, },
once: function AccessFuTest_once(aWaitForData, aListener) { once: function AccessFuTest_once(aWaitForData, aListener) {
return this._addObserver(aWaitForData, function observerAndRemove() { return this._addObserver(aWaitForData, function observerAndRemove() {
Services.obs.removeObserver(this, 'accessibility-output'); Services.obs.removeObserver(this, "accessibility-output");
aListener(); aListener();
}); });
}, },
@ -149,7 +149,7 @@ var AccessFuTest = {
Logger.logLevel = Logger.DEBUG; Logger.logLevel = Logger.DEBUG;
}; };
var prefs = [['accessibility.accessfu.notify_output', 1]]; var prefs = [["accessibility.accessfu.notify_output", 1]];
prefs.push.apply(prefs, aAdditionalPrefs); prefs.push.apply(prefs, aAdditionalPrefs);
this.originalDwellThreshold = GestureSettings.dwellThreshold; this.originalDwellThreshold = GestureSettings.dwellThreshold;
@ -166,7 +166,7 @@ var AccessFuTest = {
this.maxGestureResolveTimeout = GestureSettings.maxGestureResolveTimeout = this.maxGestureResolveTimeout = GestureSettings.maxGestureResolveTimeout =
GestureSettings.maxGestureResolveTimeout * 10; GestureSettings.maxGestureResolveTimeout * 10;
SpecialPowers.pushPrefEnv({ 'set': prefs }, function () { SpecialPowers.pushPrefEnv({ "set": prefs }, function () {
if (AccessFuTest._waitForExplicitFinish) { if (AccessFuTest._waitForExplicitFinish) {
// Run all test functions asynchronously. // Run all test functions asynchronously.
AccessFuTest.nextTest(); AccessFuTest.nextTest();
@ -197,7 +197,7 @@ AccessFuContentTest.prototype = {
this.mms = [Utils.getMessageManager(currentBrowser())]; this.mms = [Utils.getMessageManager(currentBrowser())];
this.setupMessageManager(this.mms[0], function () { this.setupMessageManager(this.mms[0], function () {
// Get child message managers and set them up // Get child message managers and set them up
var frames = currentTabDocument().querySelectorAll('iframe'); var frames = currentTabDocument().querySelectorAll("iframe");
if (frames.length === 0) { if (frames.length === 0) {
self.pump(); self.pump();
return; return;
@ -223,14 +223,14 @@ AccessFuContentTest.prototype = {
finish: function() { finish: function() {
Logger.logLevel = Logger.INFO; Logger.logLevel = Logger.INFO;
for (var mm of this.mms) { for (var mm of this.mms) {
mm.sendAsyncMessage('AccessFu:Stop'); mm.sendAsyncMessage("AccessFu:Stop");
mm.removeMessageListener('AccessFu:Present', this); mm.removeMessageListener("AccessFu:Present", this);
mm.removeMessageListener('AccessFu:Input', this); mm.removeMessageListener("AccessFu:Input", this);
mm.removeMessageListener('AccessFu:CursorCleared', this); mm.removeMessageListener("AccessFu:CursorCleared", this);
mm.removeMessageListener('AccessFu:Focused', this); mm.removeMessageListener("AccessFu:Focused", this);
mm.removeMessageListener('AccessFu:AriaHidden', this); mm.removeMessageListener("AccessFu:AriaHidden", this);
mm.removeMessageListener('AccessFu:Ready', this); mm.removeMessageListener("AccessFu:Ready", this);
mm.removeMessageListener('AccessFu:ContentStarted', this); mm.removeMessageListener("AccessFu:ContentStarted", this);
} }
if (this.finishedCallback) { if (this.finishedCallback) {
this.finishedCallback(); this.finishedCallback();
@ -239,7 +239,7 @@ AccessFuContentTest.prototype = {
setupMessageManager: function (aMessageManager, aCallback) { setupMessageManager: function (aMessageManager, aCallback) {
function contentScript() { function contentScript() {
addMessageListener('AccessFuTest:Focus', function (aMessage) { addMessageListener("AccessFuTest:Focus", function (aMessage) {
var elem = content.document.querySelector(aMessage.json.selector); var elem = content.document.querySelector(aMessage.json.selector);
if (elem) { if (elem) {
if (aMessage.json.blur) { if (aMessage.json.blur) {
@ -251,24 +251,24 @@ AccessFuContentTest.prototype = {
}); });
} }
aMessageManager.addMessageListener('AccessFu:Present', this); aMessageManager.addMessageListener("AccessFu:Present", this);
aMessageManager.addMessageListener('AccessFu:Input', this); aMessageManager.addMessageListener("AccessFu:Input", this);
aMessageManager.addMessageListener('AccessFu:CursorCleared', this); aMessageManager.addMessageListener("AccessFu:CursorCleared", this);
aMessageManager.addMessageListener('AccessFu:Focused', this); aMessageManager.addMessageListener("AccessFu:Focused", this);
aMessageManager.addMessageListener('AccessFu:AriaHidden', this); aMessageManager.addMessageListener("AccessFu:AriaHidden", this);
aMessageManager.addMessageListener('AccessFu:Ready', function () { aMessageManager.addMessageListener("AccessFu:Ready", function () {
aMessageManager.addMessageListener('AccessFu:ContentStarted', aCallback); aMessageManager.addMessageListener("AccessFu:ContentStarted", aCallback);
aMessageManager.sendAsyncMessage('AccessFu:Start', aMessageManager.sendAsyncMessage("AccessFu:Start",
{ buildApp: 'browser', { buildApp: "browser",
androidSdkVersion: Utils.AndroidSdkVersion, androidSdkVersion: Utils.AndroidSdkVersion,
logLevel: 'DEBUG', logLevel: "DEBUG",
inTest: true }); inTest: true });
}); });
aMessageManager.loadFrameScript( aMessageManager.loadFrameScript(
'chrome://global/content/accessibility/content-script.js', false); "chrome://global/content/accessibility/content-script.js", false);
aMessageManager.loadFrameScript( aMessageManager.loadFrameScript(
'data:,(' + contentScript.toString() + ')();', false); "data:,(" + contentScript.toString() + ")();", false);
}, },
pump: function() { pump: function() {
@ -282,7 +282,7 @@ AccessFuContentTest.prototype = {
if (currentPair) { if (currentPair) {
this.actionNum++; this.actionNum++;
this.currentAction = currentPair[0]; this.currentAction = currentPair[0];
if (typeof this.currentAction === 'function') { if (typeof this.currentAction === "function") {
this.currentAction(this.mms[0]); this.currentAction(this.mms[0]);
} else if (this.currentAction) { } else if (this.currentAction) {
this.mms[0].sendAsyncMessage(this.currentAction.name, this.mms[0].sendAsyncMessage(this.currentAction.name,
@ -306,15 +306,15 @@ AccessFuContentTest.prototype = {
return; return;
} }
var actionsString = typeof this.currentAction === 'function' ? var actionsString = typeof this.currentAction === "function" ?
this.currentAction.name + '()' : JSON.stringify(this.currentAction); this.currentAction.name + "()" : JSON.stringify(this.currentAction);
if (typeof expected === 'string') { if (typeof expected === "string") {
ok(true, 'Got ' + expected + ' after ' + actionsString); ok(true, "Got " + expected + " after " + actionsString);
this.pump(); this.pump();
} else if (expected.ignore && !expected.ignore(aMessage)) { } else if (expected.ignore && !expected.ignore(aMessage)) {
expected.is(aMessage.json, 'after ' + actionsString + expected.is(aMessage.json, "after " + actionsString +
' (' + this.actionNum + ')'); " (" + this.actionNum + ")");
expected.is_correct_focus(); expected.is_correct_focus();
this.pump(); this.pump();
} }
@ -325,60 +325,60 @@ AccessFuContentTest.prototype = {
var ContentMessages = { var ContentMessages = {
simpleMoveFirst: { simpleMoveFirst: {
name: 'AccessFu:MoveCursor', name: "AccessFu:MoveCursor",
json: { json: {
action: 'moveFirst', action: "moveFirst",
rule: 'Simple', rule: "Simple",
inputType: 'gesture', inputType: "gesture",
origin: 'top' origin: "top"
} }
}, },
simpleMoveLast: { simpleMoveLast: {
name: 'AccessFu:MoveCursor', name: "AccessFu:MoveCursor",
json: { json: {
action: 'moveLast', action: "moveLast",
rule: 'Simple', rule: "Simple",
inputType: 'gesture', inputType: "gesture",
origin: 'top' origin: "top"
} }
}, },
simpleMoveNext: { simpleMoveNext: {
name: 'AccessFu:MoveCursor', name: "AccessFu:MoveCursor",
json: { json: {
action: 'moveNext', action: "moveNext",
rule: 'Simple', rule: "Simple",
inputType: 'gesture', inputType: "gesture",
origin: 'top' origin: "top"
} }
}, },
simpleMovePrevious: { simpleMovePrevious: {
name: 'AccessFu:MoveCursor', name: "AccessFu:MoveCursor",
json: { json: {
action: 'movePrevious', action: "movePrevious",
rule: 'Simple', rule: "Simple",
inputType: 'gesture', inputType: "gesture",
origin: 'top' origin: "top"
} }
}, },
clearCursor: { clearCursor: {
name: 'AccessFu:ClearCursor', name: "AccessFu:ClearCursor",
json: { json: {
origin: 'top' origin: "top"
} }
}, },
moveOrAdjustUp: function moveOrAdjustUp(aRule) { moveOrAdjustUp: function moveOrAdjustUp(aRule) {
return { return {
name: 'AccessFu:MoveCursor', name: "AccessFu:MoveCursor",
json: { json: {
origin: 'top', origin: "top",
action: 'movePrevious', action: "movePrevious",
inputType: 'gesture', inputType: "gesture",
rule: (aRule || 'Simple'), rule: (aRule || "Simple"),
adjustRange: true adjustRange: true
} }
} }
@ -386,12 +386,12 @@ var ContentMessages = {
moveOrAdjustDown: function moveOrAdjustUp(aRule) { moveOrAdjustDown: function moveOrAdjustUp(aRule) {
return { return {
name: 'AccessFu:MoveCursor', name: "AccessFu:MoveCursor",
json: { json: {
origin: 'top', origin: "top",
action: 'moveNext', action: "moveNext",
inputType: 'gesture', inputType: "gesture",
rule: (aRule || 'Simple'), rule: (aRule || "Simple"),
adjustRange: true adjustRange: true
} }
} }
@ -399,21 +399,21 @@ var ContentMessages = {
androidScrollForward: function adjustUp() { androidScrollForward: function adjustUp() {
return { return {
name: 'AccessFu:AndroidScroll', name: "AccessFu:AndroidScroll",
json: { origin: 'top', direction: 'forward' } json: { origin: "top", direction: "forward" }
}; };
}, },
androidScrollBackward: function adjustDown() { androidScrollBackward: function adjustDown() {
return { return {
name: 'AccessFu:AndroidScroll', name: "AccessFu:AndroidScroll",
json: { origin: 'top', direction: 'backward' } json: { origin: "top", direction: "backward" }
}; };
}, },
focusSelector: function focusSelector(aSelector, aBlur) { focusSelector: function focusSelector(aSelector, aBlur) {
return { return {
name: 'AccessFuTest:Focus', name: "AccessFuTest:Focus",
json: { json: {
selector: aSelector, selector: aSelector,
blur: aBlur blur: aBlur
@ -423,9 +423,9 @@ var ContentMessages = {
activateCurrent: function activateCurrent(aOffset) { activateCurrent: function activateCurrent(aOffset) {
return { return {
name: 'AccessFu:Activate', name: "AccessFu:Activate",
json: { json: {
origin: 'top', origin: "top",
offset: aOffset offset: aOffset
} }
}; };
@ -433,9 +433,9 @@ var ContentMessages = {
moveNextBy: function moveNextBy(aGranularity) { moveNextBy: function moveNextBy(aGranularity) {
return { return {
name: 'AccessFu:MoveByGranularity', name: "AccessFu:MoveByGranularity",
json: { json: {
direction: 'Next', direction: "Next",
granularity: this._granularityMap[aGranularity] granularity: this._granularityMap[aGranularity]
} }
}; };
@ -443,9 +443,9 @@ var ContentMessages = {
movePreviousBy: function movePreviousBy(aGranularity) { movePreviousBy: function movePreviousBy(aGranularity) {
return { return {
name: 'AccessFu:MoveByGranularity', name: "AccessFu:MoveByGranularity",
json: { json: {
direction: 'Previous', direction: "Previous",
granularity: this._granularityMap[aGranularity] granularity: this._granularityMap[aGranularity]
} }
}; };
@ -453,9 +453,9 @@ var ContentMessages = {
moveCaretNextBy: function moveCaretNextBy(aGranularity) { moveCaretNextBy: function moveCaretNextBy(aGranularity) {
return { return {
name: 'AccessFu:MoveCaret', name: "AccessFu:MoveCaret",
json: { json: {
direction: 'Next', direction: "Next",
granularity: this._granularityMap[aGranularity] granularity: this._granularityMap[aGranularity]
} }
}; };
@ -463,18 +463,18 @@ var ContentMessages = {
moveCaretPreviousBy: function moveCaretPreviousBy(aGranularity) { moveCaretPreviousBy: function moveCaretPreviousBy(aGranularity) {
return { return {
name: 'AccessFu:MoveCaret', name: "AccessFu:MoveCaret",
json: { json: {
direction: 'Previous', direction: "Previous",
granularity: this._granularityMap[aGranularity] granularity: this._granularityMap[aGranularity]
} }
}; };
}, },
_granularityMap: { _granularityMap: {
'character': 1, // MOVEMENT_GRANULARITY_CHARACTER "character": 1, // MOVEMENT_GRANULARITY_CHARACTER
'word': 2, // MOVEMENT_GRANULARITY_WORD "word": 2, // MOVEMENT_GRANULARITY_WORD
'paragraph': 8 // MOVEMENT_GRANULARITY_PARAGRAPH "paragraph": 8 // MOVEMENT_GRANULARITY_PARAGRAPH
} }
}; };
@ -486,7 +486,7 @@ function ExpectedMessage (aName, aOptions) {
ExpectedMessage.prototype.lazyCompare = function(aReceived, aExpected, aInfo) { ExpectedMessage.prototype.lazyCompare = function(aReceived, aExpected, aInfo) {
if (aExpected && !aReceived) { if (aExpected && !aReceived) {
return [false, 'Expected something but got nothing -- ' + aInfo]; return [false, "Expected something but got nothing -- " + aInfo];
} }
var matches = true; var matches = true;
@ -494,28 +494,28 @@ ExpectedMessage.prototype.lazyCompare = function(aReceived, aExpected, aInfo) {
for (var attr in aExpected) { for (var attr in aExpected) {
var expected = aExpected[attr]; var expected = aExpected[attr];
var received = aReceived[attr]; var received = aReceived[attr];
if (typeof expected === 'object') { if (typeof expected === "object") {
var [childMatches, childDelta] = this.lazyCompare(received, expected); var [childMatches, childDelta] = this.lazyCompare(received, expected);
if (!childMatches) { if (!childMatches) {
delta.push(attr + ' [ ' + childDelta + ' ]'); delta.push(attr + " [ " + childDelta + " ]");
matches = false; matches = false;
} }
} else { } else {
if (received !== expected) { if (received !== expected) {
delta.push( delta.push(
attr + ' [ expected ' + JSON.stringify(expected) + attr + " [ expected " + JSON.stringify(expected) +
' got ' + JSON.stringify(received) + ' ]'); " got " + JSON.stringify(received) + " ]");
matches = false; matches = false;
} }
} }
} }
var msg = delta.length ? delta.join(' ') : 'Structures lazily match'; var msg = delta.length ? delta.join(" ") : "Structures lazily match";
return [matches, msg + ' -- ' + aInfo]; return [matches, msg + " -- " + aInfo];
}; };
ExpectedMessage.prototype.is = function(aReceived, aInfo) { ExpectedMessage.prototype.is = function(aReceived, aInfo) {
var checkFunc = this.options.todo ? 'todo' : 'ok'; var checkFunc = this.options.todo ? "todo" : "ok";
SimpleTest[checkFunc].apply( SimpleTest[checkFunc].apply(
SimpleTest, this.lazyCompare(aReceived, this.json, aInfo)); SimpleTest, this.lazyCompare(aReceived, this.json, aInfo));
}; };
@ -525,11 +525,11 @@ ExpectedMessage.prototype.is_correct_focus = function(aInfo) {
return; return;
} }
var checkFunc = this.options.focused_todo ? 'todo_is' : 'is'; var checkFunc = this.options.focused_todo ? "todo_is" : "is";
var doc = currentTabDocument(); var doc = currentTabDocument();
SimpleTest[checkFunc].apply(SimpleTest, SimpleTest[checkFunc].apply(SimpleTest,
[ doc.activeElement, doc.querySelector(this.options.focused), [ doc.activeElement, doc.querySelector(this.options.focused),
'Correct element is focused: ' + this.options.focused + ' -- ' + aInfo ]); "Correct element is focused: " + this.options.focused + " -- " + aInfo ]);
}; };
ExpectedMessage.prototype.ignore = function(aMessage) { ExpectedMessage.prototype.ignore = function(aMessage) {
@ -537,7 +537,7 @@ ExpectedMessage.prototype.ignore = function(aMessage) {
}; };
function ExpectedPresent(aB2g, aAndroid, aOptions) { function ExpectedPresent(aB2g, aAndroid, aOptions) {
ExpectedMessage.call(this, 'AccessFu:Present', aOptions); ExpectedMessage.call(this, "AccessFu:Present", aOptions);
if (aB2g) { if (aB2g) {
this.json.b2g = aB2g; this.json.b2g = aB2g;
} }
@ -552,12 +552,12 @@ ExpectedPresent.prototype = Object.create(ExpectedMessage.prototype);
ExpectedPresent.prototype.is = function(aReceived, aInfo) { ExpectedPresent.prototype.is = function(aReceived, aInfo) {
var received = this.extract_presenters(aReceived); var received = this.extract_presenters(aReceived);
for (var presenter of ['b2g', 'android']) { for (var presenter of ["b2g", "android"]) {
if (!this.options['no_' + presenter]) { if (!this.options["no_" + presenter]) {
var todo = this.options.todo || this.options[presenter + '_todo'] var todo = this.options.todo || this.options[presenter + "_todo"]
SimpleTest[todo ? 'todo' : 'ok'].apply( SimpleTest[todo ? "todo" : "ok"].apply(
SimpleTest, this.lazyCompare(received[presenter], SimpleTest, this.lazyCompare(received[presenter],
this.json[presenter], aInfo + ' (' + presenter + ')')); this.json[presenter], aInfo + " (" + presenter + ")"));
} }
} }
}; };
@ -581,14 +581,14 @@ ExpectedPresent.prototype.ignore = function(aMessage) {
var received = this.extract_presenters(aMessage.json); var received = this.extract_presenters(aMessage.json);
return received.count === 0 || return received.count === 0 ||
(received.visual && received.visual.eventType === 'viewport-change') || (received.visual && received.visual.eventType === "viewport-change") ||
(received.android && (received.android &&
received.android[0].eventType === AndroidEvent.VIEW_SCROLLED); received.android[0].eventType === AndroidEvent.VIEW_SCROLLED);
}; };
function ExpectedCursorChange(aSpeech, aOptions) { function ExpectedCursorChange(aSpeech, aOptions) {
ExpectedPresent.call(this, { ExpectedPresent.call(this, {
eventType: 'vc-change', eventType: "vc-change",
data: aSpeech data: aSpeech
}, [{ }, [{
eventType: 0x8000, // VIEW_ACCESSIBILITY_FOCUSED eventType: 0x8000, // VIEW_ACCESSIBILITY_FOCUSED
@ -599,7 +599,7 @@ ExpectedCursorChange.prototype = Object.create(ExpectedPresent.prototype);
function ExpectedCursorTextChange(aSpeech, aStartOffset, aEndOffset, aOptions) { function ExpectedCursorTextChange(aSpeech, aStartOffset, aEndOffset, aOptions) {
ExpectedPresent.call(this, { ExpectedPresent.call(this, {
eventType: 'vc-change', eventType: "vc-change",
data: aSpeech data: aSpeech
}, [{ }, [{
eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, eventType: AndroidEvent.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
@ -616,8 +616,8 @@ ExpectedCursorTextChange.prototype =
function ExpectedClickAction(aOptions) { function ExpectedClickAction(aOptions) {
ExpectedPresent.call(this, { ExpectedPresent.call(this, {
eventType: 'action', eventType: "action",
data: [{ string: 'clickAction' }] data: [{ string: "clickAction" }]
}, [{ }, [{
eventType: AndroidEvent.VIEW_CLICKED eventType: AndroidEvent.VIEW_CLICKED
}], aOptions); }], aOptions);
@ -627,8 +627,8 @@ ExpectedClickAction.prototype = Object.create(ExpectedPresent.prototype);
function ExpectedCheckAction(aChecked, aOptions) { function ExpectedCheckAction(aChecked, aOptions) {
ExpectedPresent.call(this, { ExpectedPresent.call(this, {
eventType: 'action', eventType: "action",
data: [{ string: aChecked ? 'checkAction' : 'uncheckAction' }] data: [{ string: aChecked ? "checkAction" : "uncheckAction" }]
}, [{ }, [{
eventType: AndroidEvent.VIEW_CLICKED, eventType: AndroidEvent.VIEW_CLICKED,
checked: aChecked checked: aChecked
@ -639,8 +639,8 @@ ExpectedCheckAction.prototype = Object.create(ExpectedPresent.prototype);
function ExpectedSwitchAction(aSwitched, aOptions) { function ExpectedSwitchAction(aSwitched, aOptions) {
ExpectedPresent.call(this, { ExpectedPresent.call(this, {
eventType: 'action', eventType: "action",
data: [{ string: aSwitched ? 'onAction' : 'offAction' }] data: [{ string: aSwitched ? "onAction" : "offAction" }]
}, [{ }, [{
eventType: AndroidEvent.VIEW_CLICKED, eventType: AndroidEvent.VIEW_CLICKED,
checked: aSwitched checked: aSwitched
@ -651,7 +651,7 @@ ExpectedSwitchAction.prototype = Object.create(ExpectedPresent.prototype);
function ExpectedNameChange(aName, aOptions) { function ExpectedNameChange(aName, aOptions) {
ExpectedPresent.call(this, { ExpectedPresent.call(this, {
eventType: 'name-change', eventType: "name-change",
data: aName data: aName
}, null, aOptions); }, null, aOptions);
} }
@ -660,7 +660,7 @@ ExpectedNameChange.prototype = Object.create(ExpectedPresent.prototype);
function ExpectedValueChange(aValue, aOptions) { function ExpectedValueChange(aValue, aOptions) {
ExpectedPresent.call(this, { ExpectedPresent.call(this, {
eventType: 'value-change', eventType: "value-change",
data: aValue data: aValue
}, null, aOptions); }, null, aOptions);
} }
@ -669,7 +669,7 @@ ExpectedValueChange.prototype = Object.create(ExpectedPresent.prototype);
function ExpectedTextChanged(aValue, aOptions) { function ExpectedTextChanged(aValue, aOptions) {
ExpectedPresent.call(this, { ExpectedPresent.call(this, {
eventType: 'text-change', eventType: "text-change",
data: aValue data: aValue
}, null, aOptions); }, null, aOptions);
} }
@ -677,7 +677,7 @@ function ExpectedTextChanged(aValue, aOptions) {
ExpectedTextChanged.prototype = Object.create(ExpectedPresent.prototype); ExpectedTextChanged.prototype = Object.create(ExpectedPresent.prototype);
function ExpectedEditState(aEditState, aOptions) { function ExpectedEditState(aEditState, aOptions) {
ExpectedMessage.call(this, 'AccessFu:Input', aOptions); ExpectedMessage.call(this, "AccessFu:Input", aOptions);
this.json = aEditState; this.json = aEditState;
} }
@ -716,7 +716,7 @@ function ExpectedAnnouncement(aAnnouncement, aOptions) {
ExpectedAnnouncement.prototype = Object.create(ExpectedPresent.prototype); ExpectedAnnouncement.prototype = Object.create(ExpectedPresent.prototype);
function ExpectedNoMove(aOptions) { function ExpectedNoMove(aOptions) {
ExpectedPresent.call(this, {eventType: 'no-move' }, null, aOptions); ExpectedPresent.call(this, {eventType: "no-move" }, null, aOptions);
} }
ExpectedNoMove.prototype = Object.create(ExpectedPresent.prototype); ExpectedNoMove.prototype = Object.create(ExpectedPresent.prototype);

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

@ -1,7 +1,7 @@
var Cu = Components.utils; var Cu = Components.utils;
const PREF_UTTERANCE_ORDER = "accessibility.accessfu.utterance"; const PREF_UTTERANCE_ORDER = "accessibility.accessfu.utterance";
Cu.import('resource://gre/modules/accessibility/Utils.jsm'); Cu.import("resource://gre/modules/accessibility/Utils.jsm");
Cu.import("resource://gre/modules/accessibility/OutputGenerator.jsm", this); Cu.import("resource://gre/modules/accessibility/OutputGenerator.jsm", this);
/** /**
@ -20,7 +20,7 @@ Cu.import("resource://gre/modules/accessibility/OutputGenerator.jsm", this);
function testContextOutput(expected, aAccOrElmOrID, aOldAccOrElmOrID, aGenerator) { function testContextOutput(expected, aAccOrElmOrID, aOldAccOrElmOrID, aGenerator) {
var accessible = getAccessible(aAccOrElmOrID); var accessible = getAccessible(aAccOrElmOrID);
var oldAccessible = aOldAccOrElmOrID !== null ? var oldAccessible = aOldAccOrElmOrID !== null ?
getAccessible(aOldAccOrElmOrID || 'root') : null; getAccessible(aOldAccOrElmOrID || "root") : null;
var context = new PivotContext(accessible, oldAccessible); var context = new PivotContext(accessible, oldAccessible);
var output = aGenerator.genForContext(context); var output = aGenerator.genForContext(context);
@ -104,7 +104,7 @@ function testOutput(expected, aAccOrElmOrID, aOldAccOrElmOrID, aOutputKind) {
function testHints(expected, aAccOrElmOrID, aOldAccOrElmOrID) { function testHints(expected, aAccOrElmOrID, aOldAccOrElmOrID) {
var accessible = getAccessible(aAccOrElmOrID); var accessible = getAccessible(aAccOrElmOrID);
var oldAccessible = aOldAccOrElmOrID !== null ? var oldAccessible = aOldAccOrElmOrID !== null ?
getAccessible(aOldAccOrElmOrID || 'root') : null; getAccessible(aOldAccOrElmOrID || "root") : null;
var context = new PivotContext(accessible, oldAccessible); var context = new PivotContext(accessible, oldAccessible);
var hints = context.interactionHints; var hints = context.interactionHints;

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

@ -18,7 +18,7 @@
ok(AccessFu._enabled, "AccessFu was enabled again.")); ok(AccessFu._enabled, "AccessFu was enabled again."));
AccessFuTest.once_log("EventManager.start", AccessFuTest.nextTest); AccessFuTest.once_log("EventManager.start", AccessFuTest.nextTest);
// Start AccessFu via pref. // Start AccessFu via pref.
SpecialPowers.pushPrefEnv({"set": [['accessibility.accessfu.activate', 1]]}); SpecialPowers.pushPrefEnv({"set": [["accessibility.accessfu.activate", 1]]});
} }
// Listen for 'EventManager.stop' and enable AccessFu again. // Listen for 'EventManager.stop' and enable AccessFu again.
@ -54,7 +54,7 @@
isnot(AccessFu._enabled, true, "AccessFu was disabled.")); isnot(AccessFu._enabled, true, "AccessFu was disabled."));
AccessFuTest.once_log("EventManager.stop", AccessFuTest.nextTest); AccessFuTest.once_log("EventManager.stop", AccessFuTest.nextTest);
SpecialPowers.pushPrefEnv({"set": [['accessibility.accessfu.activate', 0]]}); SpecialPowers.pushPrefEnv({"set": [["accessibility.accessfu.activate", 0]]});
} }
function doTest() { function doTest() {

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

@ -23,82 +23,82 @@
<script type="application/javascript"> <script type="application/javascript">
function doTest() { function doTest() {
var doc = currentTabDocument(); var doc = currentTabDocument();
var iframe = doc.createElement('iframe'); var iframe = doc.createElement("iframe");
iframe.id = 'iframe'; iframe.id = "iframe";
iframe.mozbrowser = true; iframe.mozbrowser = true;
iframe.addEventListener('mozbrowserloadend', function () { iframe.addEventListener("mozbrowserloadend", function () {
var contentTest = new AccessFuContentTest( var contentTest = new AccessFuContentTest(
[ [
// Simple traversal forward // Simple traversal forward
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange( new ExpectedCursorChange(
['Traversal Rule test document', 'Phone status bar'], ["Traversal Rule test document", "Phone status bar"],
{ focused: 'body' })], { focused: "body" })],
[ContentMessages.simpleMovePrevious, new ExpectedNoMove()], [ContentMessages.simpleMovePrevious, new ExpectedNoMove()],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])], new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[ContentMessages.simpleMoveNext, new ExpectedCursorChange( [ContentMessages.simpleMoveNext, new ExpectedCursorChange(
['such app', 'wow', {'string': 'headingLevel', 'args': [1]}], ["such app", "wow", {"string": "headingLevel", "args": [1]}],
{ focused: 'iframe' })], { focused: "iframe" })],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['many option', {'string': 'stateNotChecked'}, new ExpectedCursorChange(["many option", {"string": "stateNotChecked"},
{'string': 'checkbutton'}, {'string': 'listStart'}, {"string": "checkbutton"}, {"string": "listStart"},
{'string': 'list'}, {'string': 'listItemsCount', 'count': 1}])], {"string": "list"}, {"string": "listItemsCount", "count": 1}])],
// check checkbox // check checkbox
[ContentMessages.activateCurrent(), [ContentMessages.activateCurrent(),
new ExpectedClickAction({ no_android: true }), new ExpectedClickAction({ no_android: true }),
new ExpectedCheckAction(true)], new ExpectedCheckAction(true)],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['much range', {'string': 'label'}])], new ExpectedCursorChange(["much range", {"string": "label"}])],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['much range', '5', {'string': 'slider'}])], new ExpectedCursorChange(["much range", "5", {"string": "slider"}])],
[ContentMessages.moveOrAdjustUp(), new ExpectedValueChange('6')], [ContentMessages.moveOrAdjustUp(), new ExpectedValueChange("6")],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])], new ExpectedCursorChange(["Home", {"string": "pushbutton"}])],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['apple', {'string': 'pushbutton'}])], new ExpectedCursorChange(["apple", {"string": "pushbutton"}])],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Light', {"string": "stateOff"}, {'string': 'switch'}])], new ExpectedCursorChange(["Light", {"string": "stateOff"}, {"string": "switch"}])],
// switch on // switch on
[ContentMessages.activateCurrent(), [ContentMessages.activateCurrent(),
new ExpectedClickAction({ no_android: true }), new ExpectedClickAction({ no_android: true }),
new ExpectedSwitchAction(true)], new ExpectedSwitchAction(true)],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['slider', '0', {'string': 'slider'}])], new ExpectedCursorChange(["slider", "0", {"string": "slider"}])],
// Simple traversal backward // Simple traversal backward
[ContentMessages.simpleMovePrevious, [ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['Light', {"string": "stateOn"}, {'string': 'switch'}])], new ExpectedCursorChange(["Light", {"string": "stateOn"}, {"string": "switch"}])],
// switch off // switch off
[ContentMessages.activateCurrent(), [ContentMessages.activateCurrent(),
new ExpectedClickAction({ no_android: true }), new ExpectedClickAction({ no_android: true }),
new ExpectedSwitchAction(false)], new ExpectedSwitchAction(false)],
[ContentMessages.simpleMovePrevious, [ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['apple', {'string': 'pushbutton'}])], new ExpectedCursorChange(["apple", {"string": "pushbutton"}])],
[ContentMessages.simpleMovePrevious, [ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])], new ExpectedCursorChange(["Home", {"string": "pushbutton"}])],
[ContentMessages.simpleMovePrevious, [ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['such app', 'much range', '6', {'string': 'slider'}])], new ExpectedCursorChange(["such app", "much range", "6", {"string": "slider"}])],
[ContentMessages.moveOrAdjustDown(), new ExpectedValueChange('5')], [ContentMessages.moveOrAdjustDown(), new ExpectedValueChange("5")],
[ContentMessages.androidScrollForward(), new ExpectedValueChange('6')], [ContentMessages.androidScrollForward(), new ExpectedValueChange("6")],
[ContentMessages.androidScrollBackward(), new ExpectedValueChange('5')], [ContentMessages.androidScrollBackward(), new ExpectedValueChange("5")],
[ContentMessages.simpleMovePrevious, [ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['much range', {'string': 'label'}])], new ExpectedCursorChange(["much range", {"string": "label"}])],
[ContentMessages.simpleMovePrevious, [ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['many option', {'string': 'stateChecked'}, new ExpectedCursorChange(["many option", {"string": "stateChecked"},
{'string': 'checkbutton'}, {'string': 'listStart'}, {"string": "checkbutton"}, {"string": "listStart"},
{'string': 'list'}, {'string': 'listItemsCount', 'count': 1}])], {"string": "list"}, {"string": "listItemsCount", "count": 1}])],
// uncheck checkbox // uncheck checkbox
[ContentMessages.activateCurrent(), [ContentMessages.activateCurrent(),
new ExpectedClickAction({ no_android: true }), new ExpectedClickAction({ no_android: true }),
new ExpectedCheckAction(false)], new ExpectedCheckAction(false)],
[ContentMessages.simpleMovePrevious, [ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['wow', {'string': 'headingLevel', 'args': [1]}])], new ExpectedCursorChange(["wow", {"string": "headingLevel", "args": [1]}])],
[ContentMessages.simpleMovePrevious, [ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])], new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[ContentMessages.simpleMovePrevious, [ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['Phone status bar'])], new ExpectedCursorChange(["Phone status bar"])],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])], new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
@ -106,99 +106,99 @@
// fails. Bug 972035. // fails. Bug 972035.
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange( new ExpectedCursorChange(
['such app', 'wow', {'string': 'headingLevel', 'args': [1]}])], ["such app", "wow", {"string": "headingLevel", "args": [1]}])],
// Move from an inner frame to the last element in the parent doc // Move from an inner frame to the last element in the parent doc
[ContentMessages.simpleMoveLast, [ContentMessages.simpleMoveLast,
new ExpectedCursorChange( new ExpectedCursorChange(
['slider', '0', {'string': 'slider'}], { b2g_todo: true })], ["slider", "0", {"string": "slider"}], { b2g_todo: true })],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'], [ContentMessages.clearCursor, "AccessFu:CursorCleared"],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])], new ExpectedCursorChange(["Traversal Rule test document", "Phone status bar"])],
[ContentMessages.moveOrAdjustDown('FormElement'), [ContentMessages.moveOrAdjustDown("FormElement"),
new ExpectedCursorChange(['Back', {"string": "pushbutton"}])], new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[ContentMessages.moveOrAdjustDown('FormElement'), [ContentMessages.moveOrAdjustDown("FormElement"),
new ExpectedCursorChange(['such app', 'many option', {'string': 'stateNotChecked'}, new ExpectedCursorChange(["such app", "many option", {"string": "stateNotChecked"},
{'string': 'checkbutton'}, {'string': 'listStart'}, {"string": "checkbutton"}, {"string": "listStart"},
{'string': 'list'}, {'string': 'listItemsCount', 'count': 1}])], {"string": "list"}, {"string": "listItemsCount", "count": 1}])],
[ContentMessages.moveOrAdjustDown('FormElement'), [ContentMessages.moveOrAdjustDown("FormElement"),
new ExpectedCursorChange(['much range', '5', {'string': 'slider'}])], new ExpectedCursorChange(["much range", "5", {"string": "slider"}])],
// Calling AdjustOrMove should adjust the range. // Calling AdjustOrMove should adjust the range.
[ContentMessages.moveOrAdjustDown('FormElement'), [ContentMessages.moveOrAdjustDown("FormElement"),
new ExpectedValueChange('4')], new ExpectedValueChange("4")],
[ContentMessages.moveOrAdjustUp('FormElement'), [ContentMessages.moveOrAdjustUp("FormElement"),
new ExpectedValueChange('5')], new ExpectedValueChange("5")],
[ContentMessages.simpleMovePrevious, [ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(['much range', {'string': 'label'}])], new ExpectedCursorChange(["much range", {"string": "label"}])],
[ContentMessages.moveOrAdjustUp('FormElement'), [ContentMessages.moveOrAdjustUp("FormElement"),
new ExpectedCursorChange(['many option', {'string': 'stateNotChecked'}, new ExpectedCursorChange(["many option", {"string": "stateNotChecked"},
{'string': 'checkbutton'}, {'string': 'listStart'}, {"string": "checkbutton"}, {"string": "listStart"},
{'string': 'list'}, {'string': 'listItemsCount', 'count': 1}])], {"string": "list"}, {"string": "listItemsCount", "count": 1}])],
[ContentMessages.moveOrAdjustUp('FormElement'), [ContentMessages.moveOrAdjustUp("FormElement"),
new ExpectedCursorChange(['Back', {"string": "pushbutton"}])], new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'], [ContentMessages.clearCursor, "AccessFu:CursorCleared"],
// Moving to the absolute first item from an embedded document // Moving to the absolute first item from an embedded document
// fails. Bug 972035. // fails. Bug 972035.
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])], new ExpectedCursorChange(["Traversal Rule test document", "Phone status bar"])],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])], new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['such app', 'wow', {'string': 'headingLevel', 'args': [1]}])], new ExpectedCursorChange(["such app", "wow", {"string": "headingLevel", "args": [1]}])],
[ContentMessages.simpleMoveNext, new ExpectedCursorChange( [ContentMessages.simpleMoveNext, new ExpectedCursorChange(
['many option', {'string': 'stateNotChecked'}, ["many option", {"string": "stateNotChecked"},
{'string': 'checkbutton'}, {'string': 'listStart'}, {"string": "checkbutton"}, {"string": "listStart"},
{'string': 'list'}, {'string': 'listItemsCount', 'count': 1}])], {"string": "list"}, {"string": "listItemsCount", "count": 1}])],
[ContentMessages.simpleMoveFirst, [ContentMessages.simpleMoveFirst,
new ExpectedCursorChange(['Phone status bar'], { b2g_todo: true })], new ExpectedCursorChange(["Phone status bar"], { b2g_todo: true })],
// Reset cursors // Reset cursors
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'], [ContentMessages.clearCursor, "AccessFu:CursorCleared"],
// Current virtual cursor's position's name changes // Current virtual cursor's position's name changes
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])], new ExpectedCursorChange(["Traversal Rule test document", "Phone status bar"])],
[ContentMessages.focusSelector('button#fruit', false), [ContentMessages.focusSelector("button#fruit", false),
new ExpectedCursorChange(['apple', {'string': 'pushbutton'}])], new ExpectedCursorChange(["apple", {"string": "pushbutton"}])],
[doc.defaultView.renameFruit, new ExpectedNameChange('banana')], [doc.defaultView.renameFruit, new ExpectedNameChange("banana")],
// Name and value changes inside a live-region (no cursor present) // Name and value changes inside a live-region (no cursor present)
[doc.defaultView.renameSlider, [doc.defaultView.renameSlider,
new ExpectedNameChange('mover')], new ExpectedNameChange("mover")],
[doc.defaultView.changeSliderValue, [doc.defaultView.changeSliderValue,
new ExpectedValueChange('medium')], new ExpectedValueChange("medium")],
// Blur button and reset cursor // Blur button and reset cursor
[ContentMessages.focusSelector('button#fruit', true), null], [ContentMessages.focusSelector("button#fruit", true), null],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'], [ContentMessages.clearCursor, "AccessFu:CursorCleared"],
// Move cursor with focus in outside document // Move cursor with focus in outside document
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])], new ExpectedCursorChange(["Traversal Rule test document", "Phone status bar"])],
[ContentMessages.focusSelector('button#home', false), [ContentMessages.focusSelector("button#home", false),
new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])], new ExpectedCursorChange(["Home", {"string": "pushbutton"}])],
// Blur button and reset cursor // Blur button and reset cursor
[ContentMessages.focusSelector('button#home', true), null], [ContentMessages.focusSelector("button#home", true), null],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'], [ContentMessages.clearCursor, "AccessFu:CursorCleared"],
// Set focus on element outside of embedded frame while // Set focus on element outside of embedded frame while
// cursor is in frame // cursor is in frame
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])], new ExpectedCursorChange(["Traversal Rule test document", "Phone status bar"])],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])], new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['such app', 'wow', {'string': 'headingLevel', 'args': [1]}])], new ExpectedCursorChange(["such app", "wow", {"string": "headingLevel", "args": [1]}])],
[ContentMessages.focusSelector('button#home', false), [ContentMessages.focusSelector("button#home", false),
new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])], new ExpectedCursorChange(["Home", {"string": "pushbutton"}])],
// Blur button and reset cursor // Blur button and reset cursor
[ContentMessages.focusSelector('button#home', true), null], [ContentMessages.focusSelector("button#home", true), null],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'], [ContentMessages.clearCursor, "AccessFu:CursorCleared"],
// XXX: Set focus on iframe itself. // XXX: Set focus on iframe itself.
// XXX: Set focus on element in iframe when cursor is outside of it. // XXX: Set focus on element in iframe when cursor is outside of it.
@ -206,7 +206,7 @@
// aria-hidden element that the virtual cursor is positioned on // aria-hidden element that the virtual cursor is positioned on
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])], new ExpectedCursorChange(["Traversal Rule test document", "Phone status bar"])],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])], new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[doc.defaultView.ariaHideBack, [doc.defaultView.ariaHideBack,
@ -218,84 +218,84 @@
[doc.defaultView.ariaShowBack], [doc.defaultView.ariaShowBack],
[ContentMessages.simpleMovePrevious, [ContentMessages.simpleMovePrevious,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])], new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'], [ContentMessages.clearCursor, "AccessFu:CursorCleared"],
// aria-hidden on the iframe that has the vc. // aria-hidden on the iframe that has the vc.
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])], new ExpectedCursorChange(["Traversal Rule test document", "Phone status bar"])],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])], new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['such app', 'wow', {'string': 'headingLevel', 'args': [1]}])], new ExpectedCursorChange(["such app", "wow", {"string": "headingLevel", "args": [1]}])],
[doc.defaultView.ariaHideIframe, [doc.defaultView.ariaHideIframe,
new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])], new ExpectedCursorChange(["Home", {"string": "pushbutton"}])],
[doc.defaultView.ariaShowIframe], [doc.defaultView.ariaShowIframe],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'], [ContentMessages.clearCursor, "AccessFu:CursorCleared"],
// aria-hidden element and auto Move // aria-hidden element and auto Move
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])], new ExpectedCursorChange(["Traversal Rule test document", "Phone status bar"])],
[doc.defaultView.ariaHideBack], [doc.defaultView.ariaHideBack],
[ContentMessages.focusSelector('button#back', false), [ContentMessages.focusSelector("button#back", false),
// Must not speak Back button as it is aria-hidden // Must not speak Back button as it is aria-hidden
new ExpectedCursorChange( new ExpectedCursorChange(
["such app", "wow", {"string": "headingLevel","args": [1]}])], ["such app", "wow", {"string": "headingLevel","args": [1]}])],
[doc.defaultView.ariaShowBack], [doc.defaultView.ariaShowBack],
[ContentMessages.focusSelector('button#back', true), null], [ContentMessages.focusSelector("button#back", true), null],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'], [ContentMessages.clearCursor, "AccessFu:CursorCleared"],
// Open dialog in outer doc, while cursor is also in outer doc // Open dialog in outer doc, while cursor is also in outer doc
[ContentMessages.simpleMoveLast, [ContentMessages.simpleMoveLast,
new ExpectedCursorChange(['Traversal Rule test document', 'mover', new ExpectedCursorChange(["Traversal Rule test document", "mover",
'medium', {'string': 'slider'}])], "medium", {"string": "slider"}])],
[doc.defaultView.showAlert, [doc.defaultView.showAlert,
new ExpectedCursorChange(['This is an alert!', new ExpectedCursorChange(["This is an alert!",
{'string': 'headingLevel', 'args': [1]}, {"string": "headingLevel", "args": [1]},
{'string': 'dialog'}])], {"string": "dialog"}])],
[doc.defaultView.hideAlert, [doc.defaultView.hideAlert,
new ExpectedCursorChange(['Traversal Rule test document', 'mover', new ExpectedCursorChange(["Traversal Rule test document", "mover",
'medium', {'string': 'slider'}])], "medium", {"string": "slider"}])],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'], [ContentMessages.clearCursor, "AccessFu:CursorCleared"],
// Open dialog in outer doc, while cursor is in inner frame // Open dialog in outer doc, while cursor is in inner frame
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])], new ExpectedCursorChange(["Traversal Rule test document", "Phone status bar"])],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])], new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange( new ExpectedCursorChange(
['such app', 'wow', {'string': 'headingLevel', 'args': [1]}])], ["such app", "wow", {"string": "headingLevel", "args": [1]}])],
[doc.defaultView.showAlert, new ExpectedCursorChange(['This is an alert!', [doc.defaultView.showAlert, new ExpectedCursorChange(["This is an alert!",
{'string': 'headingLevel', 'args': [1]}, {"string": "headingLevel", "args": [1]},
{'string': 'dialog'}])], {"string": "dialog"}])],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Do you agree?'])], new ExpectedCursorChange(["Do you agree?"])],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Yes', {'string': 'pushbutton'}])], new ExpectedCursorChange(["Yes", {"string": "pushbutton"}])],
[ContentMessages.activateCurrent(), [ContentMessages.activateCurrent(),
new ExpectedClickAction(), new ExpectedClickAction(),
new ExpectedCursorChange( new ExpectedCursorChange(
['such app', 'wow', {'string': 'headingLevel', 'args': [1]}])], ["such app", "wow", {"string": "headingLevel", "args": [1]}])],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'], [ContentMessages.clearCursor, "AccessFu:CursorCleared"],
// Open dialog, then focus on something when closing // Open dialog, then focus on something when closing
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])], new ExpectedCursorChange(["Traversal Rule test document", "Phone status bar"])],
[doc.defaultView.showAlert, [doc.defaultView.showAlert,
new ExpectedCursorChange(['This is an alert!', new ExpectedCursorChange(["This is an alert!",
{'string': 'headingLevel', 'args': [1]}, {'string': 'dialog'}])], {"string": "headingLevel", "args": [1]}, {"string": "dialog"}])],
[function hideAlertAndFocusHomeButton() { [function hideAlertAndFocusHomeButton() {
doc.defaultView.hideAlert(); doc.defaultView.hideAlert();
doc.querySelector('button#home').focus(); doc.querySelector("button#home").focus();
}, new ExpectedCursorChange(['Traversal Rule test document', }, new ExpectedCursorChange(["Traversal Rule test document",
'Home', {'string': 'pushbutton'}])], "Home", {"string": "pushbutton"}])],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['banana', {'string': 'pushbutton'}])] new ExpectedCursorChange(["banana", {"string": "pushbutton"}])]
[ContentMessages.simpleMoveNext, new ExpectedNoMove()] [ContentMessages.simpleMoveNext, new ExpectedNoMove()]
]); ]);
@ -306,8 +306,8 @@
}); });
}, doc.defaultView) }, doc.defaultView)
}); });
iframe.src = 'data:text/html;charset=utf-8,' + doc.defaultView.frameContents; iframe.src = "data:text/html;charset=utf-8," + doc.defaultView.frameContents;
doc.getElementById('appframe').appendChild(iframe); doc.getElementById("appframe").appendChild(iframe);
} }
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
@ -316,17 +316,17 @@
openBrowserWindow( openBrowserWindow(
function () { function () {
SpecialPowers.pushPrefEnv({ SpecialPowers.pushPrefEnv({
'set': [ "set": [
// TODO: remove this as part of bug 820712 // TODO: remove this as part of bug 820712
['network.disable.ipc.security', true], ["network.disable.ipc.security", true],
['dom.ipc.browser_frames.oop_by_default', true], ["dom.ipc.browser_frames.oop_by_default", true],
['dom.mozBrowserFramesEnabled', true], ["dom.mozBrowserFramesEnabled", true],
['browser.pagethumbnails.capturing_disabled', true] ["browser.pagethumbnails.capturing_disabled", true]
] ]
}, doTest) }, }, doTest) },
getRootDirectory(window.location.href) + 'doc_content_integration.html'); getRootDirectory(window.location.href) + "doc_content_integration.html");
}); });
</script> </script>
</head> </head>

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

@ -31,40 +31,40 @@
// Read-only text tests // Read-only text tests
[ContentMessages.simpleMoveFirst, [ContentMessages.simpleMoveFirst,
new ExpectedCursorChange( new ExpectedCursorChange(
['Text content test document', 'These are my awards, Mother. ' + ["Text content test document", "These are my awards, Mother. " +
'From Army. The seal is for marksmanship, and the gorilla is ' + "From Army. The seal is for marksmanship, and the gorilla is " +
'for sand racing.'])], "for sand racing."])],
[ContentMessages.moveNextBy('word'), [ContentMessages.moveNextBy("word"),
new ExpectedCursorTextChange('These', 0, 5)], new ExpectedCursorTextChange("These", 0, 5)],
[ContentMessages.moveNextBy('word'), [ContentMessages.moveNextBy("word"),
new ExpectedCursorTextChange('are', 6, 9)], new ExpectedCursorTextChange("are", 6, 9)],
[ContentMessages.moveNextBy('word'), [ContentMessages.moveNextBy("word"),
new ExpectedCursorTextChange('my', 10, 12)], new ExpectedCursorTextChange("my", 10, 12)],
[ContentMessages.moveNextBy('word'), [ContentMessages.moveNextBy("word"),
new ExpectedCursorTextChange('awards,', 13, 20)], new ExpectedCursorTextChange("awards,", 13, 20)],
[ContentMessages.moveNextBy('word'), [ContentMessages.moveNextBy("word"),
new ExpectedCursorTextChange('Mother.', 21, 28)], new ExpectedCursorTextChange("Mother.", 21, 28)],
[ContentMessages.movePreviousBy('word'), [ContentMessages.movePreviousBy("word"),
new ExpectedCursorTextChange('awards,', 13, 20)], new ExpectedCursorTextChange("awards,", 13, 20)],
[ContentMessages.movePreviousBy('word'), [ContentMessages.movePreviousBy("word"),
new ExpectedCursorTextChange('my', 10, 12)], new ExpectedCursorTextChange("my", 10, 12)],
[ContentMessages.movePreviousBy('word'), [ContentMessages.movePreviousBy("word"),
new ExpectedCursorTextChange('are', 6, 9)], new ExpectedCursorTextChange("are", 6, 9)],
[ContentMessages.movePreviousBy('word'), [ContentMessages.movePreviousBy("word"),
new ExpectedCursorTextChange('These', 0, 5)], new ExpectedCursorTextChange("These", 0, 5)],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange(['You\'re a good guy, mon frere. ' + new ExpectedCursorChange(["You're a good guy, mon frere. " +
'That means brother in French. ' + "That means brother in French. " +
'I don\'t know how I know that. ' + "I don't know how I know that. " +
'I took four years of Spanish.'])], "I took four years of Spanish."])],
// XXX: Word boundary should be past the apostraphe. // XXX: Word boundary should be past the apostraphe.
[ContentMessages.moveNextBy('word'), [ContentMessages.moveNextBy("word"),
new ExpectedCursorTextChange('You\'re', 0, 6, new ExpectedCursorTextChange("You're", 0, 6,
{ android_todo: true /* Bug 980512 */})], { android_todo: true /* Bug 980512 */})],
// Editable text tests. // Editable text tests.
[ContentMessages.focusSelector('textarea'), [ContentMessages.focusSelector("textarea"),
new ExpectedAnnouncement('editing'), new ExpectedAnnouncement("editing"),
new ExpectedEditState({ new ExpectedEditState({
editing: true, editing: true,
multiline: true, multiline: true,
@ -72,8 +72,8 @@
atEnd: false atEnd: false
}), }),
new ExpectedCursorChange( new ExpectedCursorChange(
['Please refrain from Mayoneggs during this salmonella scare.', ["Please refrain from Mayoneggs during this salmonella scare.",
{string: 'textarea'}]), {string: "textarea"}]),
new ExpectedTextSelectionChanged(0, 0) new ExpectedTextSelectionChanged(0, 0)
], ],
[ContentMessages.activateCurrent(10), [ContentMessages.activateCurrent(10),
@ -87,27 +87,27 @@
new ExpectedTextCaretChanged(10, 20), new ExpectedTextCaretChanged(10, 20),
new ExpectedTextSelectionChanged(20, 20) new ExpectedTextSelectionChanged(20, 20)
], ],
[ContentMessages.moveCaretNextBy('word'), [ContentMessages.moveCaretNextBy("word"),
new ExpectedTextCaretChanged(20, 29), new ExpectedTextCaretChanged(20, 29),
new ExpectedTextSelectionChanged(29, 29) new ExpectedTextSelectionChanged(29, 29)
], ],
[ContentMessages.moveCaretNextBy('word'), [ContentMessages.moveCaretNextBy("word"),
new ExpectedTextCaretChanged(29, 36), new ExpectedTextCaretChanged(29, 36),
new ExpectedTextSelectionChanged(36, 36) new ExpectedTextSelectionChanged(36, 36)
], ],
[ContentMessages.moveCaretNextBy('character'), [ContentMessages.moveCaretNextBy("character"),
new ExpectedTextCaretChanged(36, 37), new ExpectedTextCaretChanged(36, 37),
new ExpectedTextSelectionChanged(37, 37) new ExpectedTextSelectionChanged(37, 37)
], ],
[ContentMessages.moveCaretNextBy('character'), [ContentMessages.moveCaretNextBy("character"),
new ExpectedTextCaretChanged(37, 38), new ExpectedTextCaretChanged(37, 38),
new ExpectedTextSelectionChanged(38, 38) new ExpectedTextSelectionChanged(38, 38)
], ],
[ContentMessages.moveCaretNextBy('paragraph'), [ContentMessages.moveCaretNextBy("paragraph"),
new ExpectedTextCaretChanged(38, 59), new ExpectedTextCaretChanged(38, 59),
new ExpectedTextSelectionChanged(59, 59) new ExpectedTextSelectionChanged(59, 59)
], ],
[ContentMessages.moveCaretPreviousBy('word'), [ContentMessages.moveCaretPreviousBy("word"),
new ExpectedTextCaretChanged(53, 59), new ExpectedTextCaretChanged(53, 59),
new ExpectedTextSelectionChanged(53, 53) new ExpectedTextSelectionChanged(53, 53)
], ],
@ -115,9 +115,9 @@
// bug xxx // bug xxx
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange( new ExpectedCursorChange(
['So we don\'t get dessert?', {string: 'label'}], ["So we don't get dessert?", {string: "label"}],
{ focused: 'html'}), { focused: "html"}),
new ExpectedAnnouncement('navigating'), new ExpectedAnnouncement("navigating"),
new ExpectedEditState({ new ExpectedEditState({
editing: false, editing: false,
multiline: false, multiline: false,
@ -125,138 +125,138 @@
atEnd: false })], atEnd: false })],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange( new ExpectedCursorChange(
[{ string: 'entry' }], [{ string: "entry" }],
{ focused: 'html'})], { focused: "html"})],
[ContentMessages.activateCurrent(0), [ContentMessages.activateCurrent(0),
new ExpectedClickAction(), new ExpectedClickAction(),
new ExpectedAnnouncement('editing'), new ExpectedAnnouncement("editing"),
new ExpectedEditState({ new ExpectedEditState({
editing: true, editing: true,
multiline: false, multiline: false,
atStart: true, atStart: true,
atEnd: true atEnd: true
}, { focused: 'input[type=text]' }), }, { focused: "input[type=text]" }),
new ExpectedTextSelectionChanged(0, 0) new ExpectedTextSelectionChanged(0, 0)
], ],
[ContentMessages.simpleMovePrevious, [ContentMessages.simpleMovePrevious,
new ExpectedCursorChange( new ExpectedCursorChange(
['So we don\'t get dessert?', {string: 'label'}]), ["So we don't get dessert?", {string: "label"}]),
new ExpectedAnnouncement('navigating'), new ExpectedAnnouncement("navigating"),
new ExpectedEditState({ new ExpectedEditState({
editing: false, editing: false,
multiline: false, multiline: false,
atStart: true, atStart: true,
atEnd: false atEnd: false
},{ focused: 'html' }) },{ focused: "html" })
], ],
[ContentMessages.simpleMoveNext, [ContentMessages.simpleMoveNext,
new ExpectedCursorChange( new ExpectedCursorChange(
[{ string: 'entry' }], [{ string: "entry" }],
{ focused: 'html'})], { focused: "html"})],
[ContentMessages.activateCurrent(0), [ContentMessages.activateCurrent(0),
new ExpectedClickAction(), new ExpectedClickAction(),
new ExpectedAnnouncement('editing'), new ExpectedAnnouncement("editing"),
new ExpectedEditState({ new ExpectedEditState({
editing: true, editing: true,
multiline: false, multiline: false,
atStart: true, atStart: true,
atEnd: true atEnd: true
}, },
{ focused: 'input[type=text]' }), { focused: "input[type=text]" }),
new ExpectedTextSelectionChanged(0, 0)], new ExpectedTextSelectionChanged(0, 0)],
[ContentMessages.simpleMovePrevious, [ContentMessages.simpleMovePrevious,
new ExpectedCursorChange( new ExpectedCursorChange(
[ 'So we don\'t get dessert?', {string: 'label'} ]), [ "So we don't get dessert?", {string: "label"} ]),
new ExpectedAnnouncement('navigating'), new ExpectedAnnouncement("navigating"),
new ExpectedEditState({ new ExpectedEditState({
editing: false, editing: false,
multiline: false, multiline: false,
atStart: true, atStart: true,
atEnd: false atEnd: false
}, { focused: 'html' })], }, { focused: "html" })],
[ContentMessages.focusSelector('input'), [ContentMessages.focusSelector("input"),
new ExpectedAnnouncement('editing'), new ExpectedAnnouncement("editing"),
new ExpectedEditState({ new ExpectedEditState({
editing: true, editing: true,
multiline: false, multiline: false,
atStart: true, atStart: true,
atEnd: true atEnd: true
}), }),
new ExpectedCursorChange([{string: 'entry'}]), new ExpectedCursorChange([{string: "entry"}]),
new ExpectedTextSelectionChanged(0, 0) new ExpectedTextSelectionChanged(0, 0)
], ],
[function() { [function() {
SpecialPowers.pushPrefEnv({"set": [[KEYBOARD_ECHO_SETTING, 3]]}, typeKey('a')()); SpecialPowers.pushPrefEnv({"set": [[KEYBOARD_ECHO_SETTING, 3]]}, typeKey("a")());
}, },
new ExpectedTextChanged('a'), new ExpectedTextChanged("a"),
new ExpectedTextSelectionChanged(1, 1), new ExpectedTextSelectionChanged(1, 1),
], ],
[typeKey('b'), [typeKey("b"),
new ExpectedTextChanged('b'), new ExpectedTextChanged("b"),
new ExpectedTextSelectionChanged(2, 2), new ExpectedTextSelectionChanged(2, 2),
], ],
[typeKey('c'), [typeKey("c"),
new ExpectedTextChanged('c'), new ExpectedTextChanged("c"),
new ExpectedTextSelectionChanged(3, 3), new ExpectedTextSelectionChanged(3, 3),
], ],
[typeKey('d'), [typeKey("d"),
new ExpectedTextChanged('d'), new ExpectedTextChanged("d"),
new ExpectedTextSelectionChanged(4, 4), new ExpectedTextSelectionChanged(4, 4),
], ],
[typeKey(' '), [typeKey(" "),
new ExpectedTextChanged(' abcd'), new ExpectedTextChanged(" abcd"),
new ExpectedTextSelectionChanged(5, 5), new ExpectedTextSelectionChanged(5, 5),
], ],
[typeKey('e'), [typeKey("e"),
new ExpectedTextChanged('e'), new ExpectedTextChanged("e"),
new ExpectedTextSelectionChanged(6, 6), new ExpectedTextSelectionChanged(6, 6),
], ],
[function() { [function() {
SpecialPowers.pushPrefEnv({"set": [[KEYBOARD_ECHO_SETTING, 2]]}, typeKey('a')()); SpecialPowers.pushPrefEnv({"set": [[KEYBOARD_ECHO_SETTING, 2]]}, typeKey("a")());
}, },
new ExpectedTextChanged(''), new ExpectedTextChanged(""),
new ExpectedTextSelectionChanged(7, 7), new ExpectedTextSelectionChanged(7, 7),
], ],
[typeKey('d'), [typeKey("d"),
new ExpectedTextChanged(''), new ExpectedTextChanged(""),
new ExpectedTextSelectionChanged(8, 8), new ExpectedTextSelectionChanged(8, 8),
], ],
[typeKey(' '), [typeKey(" "),
new ExpectedTextChanged(' ead'), new ExpectedTextChanged(" ead"),
new ExpectedTextSelectionChanged(9, 9), new ExpectedTextSelectionChanged(9, 9),
], ],
[function() { [function() {
SpecialPowers.pushPrefEnv({"set": [[KEYBOARD_ECHO_SETTING, 1]]}, typeKey('f')()); SpecialPowers.pushPrefEnv({"set": [[KEYBOARD_ECHO_SETTING, 1]]}, typeKey("f")());
}, },
new ExpectedTextChanged('f'), new ExpectedTextChanged("f"),
new ExpectedTextSelectionChanged(10, 10), new ExpectedTextSelectionChanged(10, 10),
], ],
[typeKey('g'), [typeKey("g"),
new ExpectedTextChanged('g'), new ExpectedTextChanged("g"),
new ExpectedTextSelectionChanged(11, 11), new ExpectedTextSelectionChanged(11, 11),
], ],
[typeKey(' '), [typeKey(" "),
new ExpectedTextChanged(' '), new ExpectedTextChanged(" "),
new ExpectedTextSelectionChanged(12, 12), new ExpectedTextSelectionChanged(12, 12),
], ],
[function() { [function() {
SpecialPowers.pushPrefEnv({"set": [[KEYBOARD_ECHO_SETTING, 0]]}, typeKey('f')()); SpecialPowers.pushPrefEnv({"set": [[KEYBOARD_ECHO_SETTING, 0]]}, typeKey("f")());
}, },
new ExpectedTextChanged(''), new ExpectedTextChanged(""),
new ExpectedTextSelectionChanged(13, 13), new ExpectedTextSelectionChanged(13, 13),
], ],
[typeKey('g'), [typeKey("g"),
new ExpectedTextChanged(''), new ExpectedTextChanged(""),
new ExpectedTextSelectionChanged(14, 14), new ExpectedTextSelectionChanged(14, 14),
], ],
[typeKey(' '), [typeKey(" "),
new ExpectedTextChanged(''), new ExpectedTextChanged(""),
new ExpectedTextSelectionChanged(15, 15), new ExpectedTextSelectionChanged(15, 15),
], ],
]); ]);
const KEYBOARD_ECHO_SETTING = 'accessibility.accessfu.keyboard_echo'; const KEYBOARD_ECHO_SETTING = "accessibility.accessfu.keyboard_echo";
function typeKey(key) { function typeKey(key) {
return function() { synthesizeKey(key, {}, currentTabWindow()); }; return function() { synthesizeKey(key, {}, currentTabWindow()); };
} }

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

@ -14,38 +14,38 @@
function doTest() { function doTest() {
var tests = [{ var tests = [{
accOrElmOrID: 'can_wheel', accOrElmOrID: "can_wheel",
expectedHints: ['Swipe with two fingers to move between pages'] expectedHints: ["Swipe with two fingers to move between pages"]
}, { }, {
accOrElmOrID: 'nested_link', accOrElmOrID: "nested_link",
expectedHints: [{string: 'link-hint'}, expectedHints: [{string: "link-hint"},
'Swipe with two fingers to move between pages'] "Swipe with two fingers to move between pages"]
}, { }, {
accOrElmOrID: 'nested_link', accOrElmOrID: "nested_link",
oldAccOrElmOrID: 'can_wheel', oldAccOrElmOrID: "can_wheel",
expectedHints: [{string: 'link-hint'}] expectedHints: [{string: "link-hint"}]
}, { }, {
accOrElmOrID: 'link_with_default_hint', accOrElmOrID: "link_with_default_hint",
expectedHints: [{string: 'link-hint'}] expectedHints: [{string: "link-hint"}]
}, { }, {
accOrElmOrID: 'link_with_hint_override', accOrElmOrID: "link_with_hint_override",
expectedHints: ['Tap and hold to get to menu'] expectedHints: ["Tap and hold to get to menu"]
}, { }, {
accOrElmOrID: 'button_with_default_hint', accOrElmOrID: "button_with_default_hint",
expectedHints: [{string: 'pushbutton-hint'}] expectedHints: [{string: "pushbutton-hint"}]
}, { }, {
accOrElmOrID: 'button_with_hint_override', accOrElmOrID: "button_with_hint_override",
expectedHints: ['Tap and hold to activate'] expectedHints: ["Tap and hold to activate"]
}, { }, {
accOrElmOrID: 'nested_link2', accOrElmOrID: "nested_link2",
expectedHints: [{string: 'link-hint'}] expectedHints: [{string: "link-hint"}]
}, { }, {
accOrElmOrID: 'nested_link3', accOrElmOrID: "nested_link3",
expectedHints: [{string: 'link-hint'}, {string: 'pushbutton-hint'}, expectedHints: [{string: "link-hint"}, {string: "pushbutton-hint"},
"Double tap and hold to activate"] "Double tap and hold to activate"]
}, { }, {
accOrElmOrID: 'menuitemradio', accOrElmOrID: "menuitemradio",
expectedHints: [{string: 'radiomenuitem-hint'}] expectedHints: [{string: "radiomenuitem-hint"}]
}]; }];
// Test hints. // Test hints.

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

@ -14,12 +14,12 @@
<script type="application/javascript"> <script type="application/javascript">
function startAccessFu() { function startAccessFu() {
SpecialPowers.pushPrefEnv({"set": [['accessibility.accessfu.activate', 1]]}); SpecialPowers.pushPrefEnv({"set": [["accessibility.accessfu.activate", 1]]});
AccessFuTest.once_log("EventManager.start", AccessFuTest.nextTest); AccessFuTest.once_log("EventManager.start", AccessFuTest.nextTest);
} }
function stopAccessFu() { function stopAccessFu() {
SpecialPowers.pushPrefEnv({"set": [['accessibility.accessfu.activate', 0]]}); SpecialPowers.pushPrefEnv({"set": [["accessibility.accessfu.activate", 0]]});
AccessFuTest.once_log("EventManager.stop", () => AccessFuTest.finish()); AccessFuTest.once_log("EventManager.stop", () => AccessFuTest.finish());
} }
@ -35,12 +35,12 @@
function ariaHide(id) { function ariaHide(id) {
var element = document.getElementById(id); var element = document.getElementById(id);
element.setAttribute('aria-hidden', true); element.setAttribute("aria-hidden", true);
} }
function ariaShow(id) { function ariaShow(id) {
var element = document.getElementById(id); var element = document.getElementById(id);
element.setAttribute('aria-hidden', false); element.setAttribute("aria-hidden", false);
} }
function udpate(id, text, property) { function udpate(id, text, property) {

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

@ -18,38 +18,38 @@
var tests = [ var tests = [
{ {
type: 'touchstart', target: [{base: 'button'}], type: "touchstart", target: [{base: "button"}],
expected: {type: 'pointerdown', length: 1} expected: {type: "pointerdown", length: 1}
}, },
{ {
type: 'touchmove', target: [{base: 'button'}], type: "touchmove", target: [{base: "button"}],
expected: {type: 'pointermove', length: 1} expected: {type: "pointermove", length: 1}
}, },
{ {
type: 'touchend', target: [{base: 'button'}], type: "touchend", target: [{base: "button"}],
expected: {type: 'pointerup'} expected: {type: "pointerup"}
}, },
{ {
type: 'touchstart', target: [{base: 'button'}, type: "touchstart", target: [{base: "button"},
{base: 'button', x: 0.5, y: 0.3}], {base: "button", x: 0.5, y: 0.3}],
expected: {type: 'pointerdown', length: 2} expected: {type: "pointerdown", length: 2}
}, },
{ {
type: 'touchend', target: [{base: 'button'}, type: "touchend", target: [{base: "button"},
{base: 'button', x: 0.5, y: 0.3}], {base: "button", x: 0.5, y: 0.3}],
expected: {type: 'pointerup'} expected: {type: "pointerup"}
}, },
{ {
type: 'touchstart', target: [{base: 'button'}, type: "touchstart", target: [{base: "button"},
{base: 'button', x: 0.5, y: 0.3}, {base: "button", x: 0.5, y: 0.3},
{base: 'button', x: 0.5, y: -0.3}], {base: "button", x: 0.5, y: -0.3}],
expected: {type: 'pointerdown', length: 3} expected: {type: "pointerdown", length: 3}
}, },
{ {
type: 'touchend', target: [{base: 'button'}, type: "touchend", target: [{base: "button"},
{base: 'button', x: 0.5, y: 0.3}, {base: "button", x: 0.5, y: 0.3},
{base: 'button', x: 0.5, y: -0.3}], {base: "button", x: 0.5, y: -0.3}],
expected: {type: 'pointerup'} expected: {type: "pointerup"}
} }
]; ];
@ -57,10 +57,10 @@
return function runTest() { return function runTest() {
PointerRelay.start(function onPointerEvent(aDetail) { PointerRelay.start(function onPointerEvent(aDetail) {
is(aDetail.type, test.expected.type, is(aDetail.type, test.expected.type,
'mozAccessFuPointerEvent is correct.'); "mozAccessFuPointerEvent is correct.");
if (test.expected.length) { if (test.expected.length) {
is(aDetail.points.length, test.expected.length, is(aDetail.points.length, test.expected.length,
'mozAccessFuPointerEvent points length is correct.'); "mozAccessFuPointerEvent points length is correct.");
} }
PointerRelay.stop(); PointerRelay.stop();
AccessFuTest.nextTest(); AccessFuTest.nextTest();

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

@ -15,14 +15,14 @@
function prefStart() { function prefStart() {
// Start AccessFu via pref. // Start AccessFu via pref.
SpecialPowers.pushPrefEnv({"set": [['accessibility.accessfu.activate', 1]]}); SpecialPowers.pushPrefEnv({"set": [["accessibility.accessfu.activate", 1]]});
AccessFuTest.once_log("EventManager.start", AccessFuTest.nextTest); AccessFuTest.once_log("EventManager.start", AccessFuTest.nextTest);
} }
function nextMode(aCurrentMode, aNextMode) { function nextMode(aCurrentMode, aNextMode) {
return function() { return function() {
is(AccessFu.Input.quickNavMode.current, aCurrentMode, is(AccessFu.Input.quickNavMode.current, aCurrentMode,
'initial current mode is correct'); "initial current mode is correct");
AccessFu.Input.quickNavMode.next(); AccessFu.Input.quickNavMode.next();
_expectMode(aNextMode, AccessFuTest.nextTest); _expectMode(aNextMode, AccessFuTest.nextTest);
} }
@ -31,7 +31,7 @@
function prevMode(aCurrentMode, aNextMode) { function prevMode(aCurrentMode, aNextMode) {
return function() { return function() {
is(AccessFu.Input.quickNavMode.current, aCurrentMode, is(AccessFu.Input.quickNavMode.current, aCurrentMode,
'initial current mode is correct'); "initial current mode is correct");
AccessFu.Input.quickNavMode.previous(); AccessFu.Input.quickNavMode.previous();
_expectMode(aNextMode, AccessFuTest.nextTest); _expectMode(aNextMode, AccessFuTest.nextTest);
} }
@ -40,7 +40,7 @@
function setMode(aModeIndex, aExpectedMode) { function setMode(aModeIndex, aExpectedMode) {
return function() { return function() {
SpecialPowers.pushPrefEnv( SpecialPowers.pushPrefEnv(
{"set": [['accessibility.accessfu.quicknav_index', aModeIndex]]}, {"set": [["accessibility.accessfu.quicknav_index", aModeIndex]]},
function() { function() {
_expectMode(aExpectedMode, AccessFuTest.nextTest); _expectMode(aExpectedMode, AccessFuTest.nextTest);
}); });
@ -49,21 +49,21 @@
function reconfigureModes() { function reconfigureModes() {
SpecialPowers.pushPrefEnv( SpecialPowers.pushPrefEnv(
{"set": [['accessibility.accessfu.quicknav_modes', 'Landmark,Button,Entry,Graphic']]}, {"set": [["accessibility.accessfu.quicknav_modes", "Landmark,Button,Entry,Graphic"]]},
function() { function() {
// When the modes are reconfigured, the current mode should // When the modes are reconfigured, the current mode should
// be set to the first in the new list. // be set to the first in the new list.
_expectMode('Landmark', AccessFuTest.nextTest); _expectMode("Landmark", AccessFuTest.nextTest);
}); });
} }
function _expectMode(aExpectedMode, aCallback) { function _expectMode(aExpectedMode, aCallback) {
if (AccessFu.Input.quickNavMode.current === aExpectedMode) { if (AccessFu.Input.quickNavMode.current === aExpectedMode) {
ok(true, 'correct mode'); ok(true, "correct mode");
aCallback(); aCallback();
} else { } else {
AccessFuTest.once_log('Quicknav mode: ' + aExpectedMode, function() { AccessFuTest.once_log("Quicknav mode: " + aExpectedMode, function() {
ok(true, 'correct mode'); ok(true, "correct mode");
aCallback(); aCallback();
}); });
} }
@ -73,23 +73,23 @@
function prefStop() { function prefStop() {
ok(AccessFu._enabled, "AccessFu was started via preference."); ok(AccessFu._enabled, "AccessFu was started via preference.");
AccessFuTest.once_log("EventManager.stop", () => AccessFuTest.finish()); AccessFuTest.once_log("EventManager.stop", () => AccessFuTest.finish());
SpecialPowers.pushPrefEnv({"set": [['accessibility.accessfu.activate', 0]]}); SpecialPowers.pushPrefEnv({"set": [["accessibility.accessfu.activate", 0]]});
} }
function doTest() { function doTest() {
AccessFuTest.addFunc(prefStart); AccessFuTest.addFunc(prefStart);
AccessFuTest.addFunc(nextMode('Link', 'Heading')); AccessFuTest.addFunc(nextMode("Link", "Heading"));
AccessFuTest.addFunc(nextMode('Heading', 'FormElement')); AccessFuTest.addFunc(nextMode("Heading", "FormElement"));
AccessFuTest.addFunc(nextMode('FormElement', 'Link')); AccessFuTest.addFunc(nextMode("FormElement", "Link"));
AccessFuTest.addFunc(nextMode('Link', 'Heading')); AccessFuTest.addFunc(nextMode("Link", "Heading"));
AccessFuTest.addFunc(prevMode('Heading', 'Link')); AccessFuTest.addFunc(prevMode("Heading", "Link"));
AccessFuTest.addFunc(prevMode('Link', 'FormElement')); AccessFuTest.addFunc(prevMode("Link", "FormElement"));
AccessFuTest.addFunc(setMode(1, 'Heading')); AccessFuTest.addFunc(setMode(1, "Heading"));
AccessFuTest.addFunc(reconfigureModes); AccessFuTest.addFunc(reconfigureModes);
AccessFuTest.addFunc(prefStop); AccessFuTest.addFunc(prefStop);
AccessFuTest.waitForExplicitFinish(); AccessFuTest.waitForExplicitFinish();
AccessFuTest.runTests([ // Will call SimpleTest.finish(); AccessFuTest.runTests([ // Will call SimpleTest.finish();
['accessibility.accessfu.quicknav_modes', 'Link,Heading,FormElement']]); ["accessibility.accessfu.quicknav_modes", "Link,Heading,FormElement"]]);
} }
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();

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

@ -38,11 +38,11 @@
} }
queueTraversalSequence(gQueue, docAcc, TraversalRules.Heading, null, queueTraversalSequence(gQueue, docAcc, TraversalRules.Heading, null,
['heading-1', 'heading-2', 'heading-3', 'heading-5']); ["heading-1", "heading-2", "heading-3", "heading-5"]);
queueTraversalSequence(gQueue, docAcc, TraversalRules.Entry, null, queueTraversalSequence(gQueue, docAcc, TraversalRules.Entry, null,
['input-1-1', 'label-1-2', 'input-1-3', ["input-1-1", "label-1-2", "input-1-3",
'input-1-4', 'input-1-5']); "input-1-4", "input-1-5"]);
// move back an element to hit all the form elements, because the VC is // move back an element to hit all the form elements, because the VC is
// currently at the first input element // currently at the first input element
@ -50,96 +50,96 @@
TraversalRules.Heading, "heading-1")); TraversalRules.Heading, "heading-1"));
queueTraversalSequence(gQueue, docAcc, TraversalRules.FormElement, null, queueTraversalSequence(gQueue, docAcc, TraversalRules.FormElement, null,
['input-1-1', 'label-1-2', 'button-1-1', ["input-1-1", "label-1-2", "button-1-1",
'radio-1-1', 'radio-1-2', 'input-1-3', "radio-1-1", "radio-1-2", "input-1-3",
'input-1-4', 'button-1-2', 'checkbox-1-1', "input-1-4", "button-1-2", "checkbox-1-1",
'select-1-1', 'select-1-2', 'checkbox-1-2', "select-1-1", "select-1-2", "checkbox-1-2",
'select-1-3', 'input-1-5', 'button-1-3', "select-1-3", "input-1-5", "button-1-3",
'button-2-1', 'button-2-2', 'button-2-3', "button-2-1", "button-2-2", "button-2-3",
'button-2-4', 'checkbox-1-5', 'switch-1']); "button-2-4", "checkbox-1-5", "switch-1"]);
queueTraversalSequence(gQueue, docAcc, TraversalRules.Button, null, queueTraversalSequence(gQueue, docAcc, TraversalRules.Button, null,
['button-1-1', 'button-1-2', 'button-1-3', ["button-1-1", "button-1-2", "button-1-3",
'button-2-1', 'button-2-2', 'button-2-3', "button-2-1", "button-2-2", "button-2-3",
'button-2-4']); "button-2-4"]);
queueTraversalSequence(gQueue, docAcc, TraversalRules.RadioButton, null, queueTraversalSequence(gQueue, docAcc, TraversalRules.RadioButton, null,
['radio-1-1', 'radio-1-2']); ["radio-1-1", "radio-1-2"]);
queueTraversalSequence(gQueue, docAcc, TraversalRules.Checkbox, null, queueTraversalSequence(gQueue, docAcc, TraversalRules.Checkbox, null,
['checkbox-1-1', 'checkbox-1-2', 'checkbox-1-5', ["checkbox-1-1", "checkbox-1-2", "checkbox-1-5",
'switch-1']); "switch-1"]);
queueTraversalSequence(gQueue, docAcc, TraversalRules.Combobox, null, queueTraversalSequence(gQueue, docAcc, TraversalRules.Combobox, null,
['select-1-1', 'select-1-2', 'select-1-3']); ["select-1-1", "select-1-2", "select-1-3"]);
queueTraversalSequence(gQueue, docAcc, TraversalRules.List, null, queueTraversalSequence(gQueue, docAcc, TraversalRules.List, null,
['list-1', 'list-2', 'list-3']); ["list-1", "list-2", "list-3"]);
queueTraversalSequence(gQueue, docAcc, TraversalRules.ListItem, null, queueTraversalSequence(gQueue, docAcc, TraversalRules.ListItem, null,
['listitem-1-1', 'listitem-2-1', 'listitem-2-2', ["listitem-1-1", "listitem-2-1", "listitem-2-2",
'listitem-3-1', 'listitem-3-2', 'listitem-3-3', "listitem-3-1", "listitem-3-2", "listitem-3-3",
'listitem-3-4', 'listitem-3-5', 'listitem-3-6', "listitem-3-4", "listitem-3-5", "listitem-3-6",
'listitem-2-3']); "listitem-2-3"]);
queueTraversalSequence(gQueue, docAcc, TraversalRules.Graphic, null, queueTraversalSequence(gQueue, docAcc, TraversalRules.Graphic, null,
['image-2', 'image-3']); ["image-2", "image-3"]);
queueTraversalSequence(gQueue, docAcc, TraversalRules.Link, null, queueTraversalSequence(gQueue, docAcc, TraversalRules.Link, null,
['link-0', 'link-1', 'link-2', 'link-3']); ["link-0", "link-1", "link-2", "link-3"]);
queueTraversalSequence(gQueue, docAcc, TraversalRules.Anchor, null, queueTraversalSequence(gQueue, docAcc, TraversalRules.Anchor, null,
['anchor-1', 'anchor-2']); ["anchor-1", "anchor-2"]);
queueTraversalSequence(gQueue, docAcc, TraversalRules.Separator, null, queueTraversalSequence(gQueue, docAcc, TraversalRules.Separator, null,
['separator-1', 'separator-2']); ["separator-1", "separator-2"]);
queueTraversalSequence(gQueue, docAcc, TraversalRules.Table, null, queueTraversalSequence(gQueue, docAcc, TraversalRules.Table, null,
['table-1', 'grid', 'table-2']); ["table-1", "grid", "table-2"]);
queueTraversalSequence(gQueue, docAcc, TraversalRules.Simple, null, queueTraversalSequence(gQueue, docAcc, TraversalRules.Simple, null,
['heading-1', 'Name:', 'input-1-1', 'label-1-2', ["heading-1", "Name:", "input-1-1", "label-1-2",
'button-1-1', 'Radios are old: ', 'radio-1-1', "button-1-1", "Radios are old: ", "radio-1-1",
'Radios are new: ', 'radio-1-2', 'Password:', "Radios are new: ", "radio-1-2", "Password:",
'input-1-3', 'Unlucky number:', 'input-1-4', "input-1-3", "Unlucky number:", "input-1-4",
'button-1-2', 'Check me: ', 'checkbox-1-1', "button-1-2", "Check me: ", "checkbox-1-1",
'select-1-1', 'Value 1', 'Value 2', 'Value 3', "select-1-1", "Value 1", "Value 2", "Value 3",
'Check me too: ', 'checkbox-1-2', 'But not me: ', "Check me too: ", "checkbox-1-2", "But not me: ",
'Or me! ', 'Value 1', 'Value 2', 'Value 3', "Or me! ", "Value 1", "Value 2", "Value 3",
'Electronic mailing address:', 'input-1-5', "Electronic mailing address:", "input-1-5",
'button-1-3', 'heading-2', 'heading-3', "button-1-3", "heading-2", "heading-3",
'button-2-1', 'button-2-2', 'button-2-3', "button-2-1", "button-2-2", "button-2-3",
'button-2-4', 'Programming Language', "button-2-4", "Programming Language",
'A esoteric weapon wielded by only the most ' + "A esoteric weapon wielded by only the most " +
'formidable warriors, for its unrelenting strict' + "formidable warriors, for its unrelenting strict" +
' power is unfathomable.', " power is unfathomable.",
'• Lists of Programming Languages', 'Lisp ', "• Lists of Programming Languages", "Lisp ",
'1. Scheme', '2. Racket', '3. Clojure', "1. Scheme", "2. Racket", "3. Clojure",
'4. Standard Lisp', 'link-0', ' Lisp', "4. Standard Lisp", "link-0", " Lisp",
'checkbox-1-5', ' LeLisp', '• JavaScript', "checkbox-1-5", " LeLisp", "• JavaScript",
'heading-5', 'image-2', 'image-3', "heading-5", "image-2", "image-3",
'Not actually an image', 'link-1', 'anchor-1', "Not actually an image", "link-1", "anchor-1",
'link-2', 'anchor-2', 'link-3', '3', '1', '4', "link-2", "anchor-2", "link-3", "3", "1", "4",
'1', 'Sunday', 'M', 'Week 1', '3', '4', '7', '2', "1", "Sunday", "M", "Week 1", "3", "4", "7", "2",
'5 8', 'gridcell4', 'Just an innocuous separator', "5 8", "gridcell4", "Just an innocuous separator",
'Dirty Words', 'Meaning', 'Mud', 'Wet Dirt', "Dirty Words", "Meaning", "Mud", "Wet Dirt",
'Dirt', 'Messy Stuff', 'statusbar-1', 'statusbar-2', "Dirt", "Messy Stuff", "statusbar-1", "statusbar-2",
'switch-1', 'This is a MathML formula ', 'math-1', "switch-1", "This is a MathML formula ", "math-1",
'with some text after.']); "with some text after."]);
queueTraversalSequence(gQueue, docAcc, TraversalRules.Landmark, null, queueTraversalSequence(gQueue, docAcc, TraversalRules.Landmark, null,
['header-1', 'main-1', 'footer-1']); ["header-1", "main-1", "footer-1"]);
queueTraversalSequence(gQueue, docAcc, TraversalRules.Control, null, queueTraversalSequence(gQueue, docAcc, TraversalRules.Control, null,
['input-1-1', 'label-1-2', 'button-1-1', ["input-1-1", "label-1-2", "button-1-1",
'radio-1-1', 'radio-1-2', 'input-1-3', "radio-1-1", "radio-1-2", "input-1-3",
'input-1-4', 'button-1-2', 'checkbox-1-1', "input-1-4", "button-1-2", "checkbox-1-1",
'select-1-1', 'select-1-2', 'checkbox-1-2', "select-1-1", "select-1-2", "checkbox-1-2",
'select-1-3', 'input-1-5', 'button-1-3', "select-1-3", "input-1-5", "button-1-3",
'button-2-1', 'button-2-2', 'button-2-3', "button-2-1", "button-2-2", "button-2-3",
'button-2-4', 'link-0', 'checkbox-1-5', "button-2-4", "link-0", "checkbox-1-5",
'link-1', 'link-2', 'link-3', 'switch-1']); "link-1", "link-2", "link-3", "switch-1"]);
gQueue.invoke(); gQueue.invoke();
} }

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

@ -46,25 +46,25 @@
function testTraversalHelper(aRule, aExpectedSequence) { function testTraversalHelper(aRule, aExpectedSequence) {
vc.position = null; vc.position = null;
walkSequence('moveNext', aRule, aExpectedSequence); walkSequence("moveNext", aRule, aExpectedSequence);
ok(!TraversalHelper.move(vc, 'moveNext', aRule), "reached end"); ok(!TraversalHelper.move(vc, "moveNext", aRule), "reached end");
TraversalHelper.move(vc, 'moveLast', 'Simple'); TraversalHelper.move(vc, "moveLast", "Simple");
walkSequence('movePrevious', aRule, walkSequence("movePrevious", aRule,
Array.from(aExpectedSequence).reverse()); Array.from(aExpectedSequence).reverse());
ok(!TraversalHelper.move(vc, 'movePrevious', aRule), "reached start"); ok(!TraversalHelper.move(vc, "movePrevious", aRule), "reached start");
vc.position = null; vc.position = null;
ok(TraversalHelper.move(vc, 'moveFirst', aRule), "moveFirst"); ok(TraversalHelper.move(vc, "moveFirst", aRule), "moveFirst");
accessibleIs(vc.position, aExpectedSequence[0], accessibleIs(vc.position, aExpectedSequence[0],
"moveFirst to correct accessible"); "moveFirst to correct accessible");
ok(TraversalHelper.move(vc, 'moveLast', aRule), "moveLast"); ok(TraversalHelper.move(vc, "moveLast", aRule), "moveLast");
accessibleIs(vc.position, aExpectedSequence[aExpectedSequence.length - 1], accessibleIs(vc.position, aExpectedSequence[aExpectedSequence.length - 1],
"moveLast to correct accessible"); "moveLast to correct accessible");
@ -77,15 +77,15 @@
var docAcc = getAccessible(doc, [nsIAccessibleDocument]); var docAcc = getAccessible(doc, [nsIAccessibleDocument]);
vc = docAcc.virtualCursor; vc = docAcc.virtualCursor;
testTraversalHelper('Landmark', testTraversalHelper("Landmark",
['heading-1', 'heading-2', 'statusbar-1']); ["heading-1", "heading-2", "statusbar-1"]);
testTraversalHelper('List', testTraversalHelper("List",
['Programming Language', 'listitem-2-1', 'listitem-3-1']); ["Programming Language", "listitem-2-1", "listitem-3-1"]);
testTraversalHelper('Section', testTraversalHelper("Section",
['heading-1', 'heading-2', 'heading-3', ["heading-1", "heading-2", "heading-3",
'heading-5', 'link-1', 'statusbar-1']); "heading-5", "link-1", "statusbar-1"]);
SimpleTest.finish(); SimpleTest.finish();
} }

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

@ -374,7 +374,7 @@ function evaluateXPath(aNode, aExpr, aResolver)
function htmlDocResolver(aPrefix) { function htmlDocResolver(aPrefix) {
var ns = { var ns = {
'html': 'http://www.w3.org/1999/xhtml' "html": "http://www.w3.org/1999/xhtml"
}; };
return ns[aPrefix] || null; return ns[aPrefix] || null;
} }

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

@ -140,7 +140,7 @@
var rule = rules[i]; var rule = rules[i];
for (var j = 0; j < values.length; j++) { for (var j = 0; j < values.length; j++) {
var item = document.createElement("li"); var item = document.createElement("li");
item.id = rule.name + '-' + values[j]; item.id = rule.name + "-" + values[j];
item.value = values[j]; item.value = values[j];
item.textContent = values[j]; item.textContent = values[j];
item.setAttribute("style", "list-style-type: " + rule.name); item.setAttribute("style", "list-style-type: " + rule.name);

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