Bug 918246 - ensure accessibility service is shutdown after a11y crashtests. r=surkov

MozReview-Commit-ID: HjP6pVlGyl0
This commit is contained in:
Yura Zenevich 2017-10-24 12:39:11 -04:00
parent 64a5aa9829
commit 99d2153aa9
3 changed files with 64 additions and 6 deletions

View File

@ -3,10 +3,27 @@
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="bug 471493 'crash [@ nsPropertyTable::GetPropertyInternal]'"
onload="doTest();">
onload="doTest();" class="reftest-wait">
<script type="application/javascript">
<![CDATA[
function addA11yLoadEvent(accService, func) {
function waitForDocLoad() {
setTimeout(() => {
let accDoc = accService.getAccessibleFor(document);
let state = {};
accDoc.getState(state, {});
if (state.value & SpecialPowers.Ci.nsIAccessibleStates.STATE_BUSY) {
return waitForDocLoad();
}
setTimeout(func, 0);
}, 0);
}
waitForDocLoad();
}
function doTest()
{
var accService = SpecialPowers.Cc["@mozilla.org/accessibilityService;1"].
@ -17,8 +34,11 @@
var y = treecol.boxObject.screenY;
var tree = document.getElementById("tree");
var treeAcc = accService.getAccessibleFor(tree);
treeAcc.getChildAtPoint(x + 1, y + 1);
addA11yLoadEvent(accService, () => {
var treeAcc = accService.getAccessibleFor(tree);
treeAcc.getChildAtPoint(x + 1, y + 1);
document.documentElement.removeAttribute("class");
});
}
]]>
</script>

View File

@ -1,3 +1,5 @@
# Disabled because they cause assertions/crashes in later crashtests, see bug 918246
skip load 448064.xhtml
skip load 471493.xul
load 448064.xhtml # This test instantiates a11y, so be careful about adding tests before it
load 471493.xul
# last_test_to_unload_testsuite.xul MUST be the last test in the list because it
# is responsible for shutting down accessibility service affecting later tests.
load last_test_to_unload_testsuite.xul

View File

@ -0,0 +1,36 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="bug 471493 'crash [@ nsPropertyTable::GetPropertyInternal]'"
onload="shutdown();" class="reftest-wait">
<script type="application/javascript">
<![CDATA[
function shutdown() {
!SpecialPowers.Services.appinfo.accessibilityEnabled &&
dump("### Error : Accessibility is expected to be enabled.\n");
// Force garbage collection. We try really hard to garbage collect
// everythin here to ensure that all a11y xpcom bits are shut down and
// avoid intermittent timeouts.
SpecialPowers.gc();
SpecialPowers.forceShrinkingGC();
SpecialPowers.forceCC();
SpecialPowers.gc();
SpecialPowers.forceShrinkingGC();
SpecialPowers.forceCC();
if (SpecialPowers.Services.appinfo.accessibilityEnabled) {
let observe = (subject, topic, data) => {
SpecialPowers.Services.obs.removeObserver(observe, "a11y-init-or-shutdown");
data === "0" && document.documentElement.removeAttribute("class");
};
SpecialPowers.Services.obs.addObserver(observe, "a11y-init-or-shutdown");
} else {
document.documentElement.removeAttribute("class");
}
}
]]>
</script>
</window>