2009-07-17 20:09:16 -07:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<title>Accessible events testing for document</title>
|
|
|
|
|
|
|
|
<link rel="stylesheet" type="text/css"
|
|
|
|
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
|
|
|
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
2009-07-27 19:28:06 -07:00
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
|
2010-06-08 09:39:58 -07:00
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/a11y/accessible/states.js"></script>
|
2009-07-17 20:09:16 -07:00
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/a11y/accessible/events.js"></script>
|
|
|
|
|
|
|
|
<script type="application/javascript">
|
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Invokers
|
|
|
|
|
|
|
|
function changeIframeSrc(aIdentifier, aURL)
|
|
|
|
{
|
|
|
|
this.DOMNode = getNode(aIdentifier);
|
|
|
|
|
2009-07-27 19:28:06 -07:00
|
|
|
this.eventSeq = [
|
|
|
|
new invokerChecker(EVENT_REORDER, getAccessible(this.DOMNode))
|
|
|
|
];
|
|
|
|
|
2009-07-17 20:09:16 -07:00
|
|
|
this.invoke = function changeIframeSrc_invoke()
|
|
|
|
{
|
|
|
|
this.DOMNode.src = aURL;
|
|
|
|
}
|
|
|
|
|
2010-06-08 09:39:58 -07:00
|
|
|
this.finalCheck = function changeIframeSrc_finalCheck()
|
|
|
|
{
|
|
|
|
var accTree = {
|
|
|
|
role: ROLE_INTERNAL_FRAME,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
role: ROLE_DOCUMENT,
|
|
|
|
name: aURL == "about:" ? "About:" : aURL
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
testAccessibleTree(this.DOMNode, accTree);
|
|
|
|
}
|
|
|
|
|
2009-07-17 20:09:16 -07:00
|
|
|
this.getID = function changeIframeSrc_getID()
|
|
|
|
{
|
|
|
|
return "change iframe src on " + aURL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-08 09:39:58 -07:00
|
|
|
const kHide = 1;
|
|
|
|
const kShow = 2;
|
|
|
|
const kRemove = 3;
|
|
|
|
function morphIFrame(aIdentifier, aAction)
|
|
|
|
{
|
|
|
|
this.DOMNode = getNode(aIdentifier);
|
|
|
|
this.IFrameContainerDOMNode = this.DOMNode.parentNode;
|
|
|
|
|
|
|
|
this.eventSeq = [];
|
|
|
|
|
|
|
|
var checker = null;
|
|
|
|
if (aAction == kShow)
|
|
|
|
checker = new invokerChecker(EVENT_SHOW, this.DOMNode);
|
|
|
|
else
|
|
|
|
checker = new invokerChecker(EVENT_HIDE, this.DOMNode);
|
|
|
|
this.eventSeq.push(checker);
|
|
|
|
|
|
|
|
var reorderChecker =
|
|
|
|
new invokerChecker(EVENT_REORDER, this.IFrameContainerDOMNode);
|
|
|
|
this.eventSeq.push(reorderChecker);
|
|
|
|
|
|
|
|
this.invoke = function morphIFrame_invoke()
|
|
|
|
{
|
|
|
|
if (aAction == kHide) {
|
|
|
|
this.DOMNode.style.display = "none";
|
|
|
|
} else if (aAction == kShow) {
|
|
|
|
this.DOMNode.style.display = "block";
|
|
|
|
} else {
|
|
|
|
this.IFrameContainerDOMNode.removeChild(this.DOMNode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.finalCheck = function morphIFrame_finalCheck()
|
|
|
|
{
|
|
|
|
var accTree = {
|
|
|
|
role: ROLE_SECTION,
|
|
|
|
children: (aAction == kHide || aAction == kRemove) ? [ ] :
|
|
|
|
[
|
|
|
|
{
|
|
|
|
role: ROLE_INTERNAL_FRAME,
|
|
|
|
children: [
|
|
|
|
{ role: ROLE_DOCUMENT }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
testAccessibleTree(this.IFrameContainerDOMNode, accTree);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.getID = function morphIFrame_getID()
|
|
|
|
{
|
|
|
|
if (aAction == kRemove)
|
|
|
|
return "remove iframe";
|
|
|
|
|
|
|
|
return "change display style of iframe to " +
|
2010-06-17 19:43:58 -07:00
|
|
|
((aAction == kHide) ? "none" : "block");
|
2010-06-08 09:39:58 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-27 19:28:06 -07:00
|
|
|
function openDialogWnd(aURL)
|
|
|
|
{
|
|
|
|
// Get application root accessible.
|
|
|
|
var docAcc = getAccessible(document);
|
|
|
|
while (docAcc) {
|
|
|
|
this.mRootAcc = docAcc;
|
2009-12-10 11:12:19 -08:00
|
|
|
try {
|
|
|
|
docAcc = docAcc.parent;
|
|
|
|
} catch (e) {
|
2010-06-30 19:18:08 -07:00
|
|
|
// XXX: it may randomaly fail on propertypage accessible of browser's
|
|
|
|
// tabbbrowser if nsIAccessible::parent returns cached parent only.
|
|
|
|
// This should gone after bug 572951.
|
|
|
|
// Error: failed | Can't get parent for [ 'panel1277435313424' ,
|
|
|
|
// role: propertypage]
|
2009-12-10 11:12:19 -08:00
|
|
|
ok(false, "Can't get parent for " + prettyName(docAcc));
|
|
|
|
throw e;
|
|
|
|
}
|
2009-07-27 19:28:06 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
this.eventSeq = [
|
|
|
|
new invokerChecker(EVENT_REORDER, this.mRootAcc)
|
|
|
|
];
|
|
|
|
|
|
|
|
this.invoke = function openDialogWnd_invoke()
|
|
|
|
{
|
|
|
|
this.mDialog = window.openDialog(aURL);
|
|
|
|
}
|
|
|
|
|
2010-06-08 09:39:58 -07:00
|
|
|
this.finalCheck = function openDialogWnd_finalCheck()
|
2010-06-17 19:43:58 -07:00
|
|
|
{
|
|
|
|
this.finalCheckImpl();
|
|
|
|
}
|
|
|
|
|
|
|
|
this.finalCheckImpl = function openDialogWnd_finalCheckImpl()
|
2009-07-27 19:28:06 -07:00
|
|
|
{
|
|
|
|
var accTree = {
|
|
|
|
role: ROLE_APP_ROOT,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
role: ROLE_CHROME_WINDOW
|
|
|
|
},
|
|
|
|
{
|
|
|
|
role: ROLE_CHROME_WINDOW
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
testAccessibleTree(this.mRootAcc, accTree);
|
|
|
|
|
2010-06-17 19:43:58 -07:00
|
|
|
var dlgDoc = this.mDialog.document;
|
|
|
|
ok(isAccessibleInCache(dlgDoc),
|
|
|
|
"The document accessible for '" + aURL + "' is not in cache!");
|
|
|
|
|
2009-07-27 19:28:06 -07:00
|
|
|
this.mDialog.close();
|
2010-06-17 19:43:58 -07:00
|
|
|
|
|
|
|
ok(!isAccessibleInCache(dlgDoc),
|
|
|
|
"The document accessible for '" + aURL + "' is in cache still!");
|
2009-07-27 19:28:06 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
this.getID = function openDialogWnd_getID()
|
|
|
|
{
|
|
|
|
return "open dialog '" + aURL + "'";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-17 19:43:58 -07:00
|
|
|
function openWndShutdownDoc()
|
|
|
|
{
|
|
|
|
this.__proto__ =
|
|
|
|
new openDialogWnd("chrome://mochikit/content/a11y/accessible/events/docload_wnd.html");
|
|
|
|
|
|
|
|
var thisObj = this;
|
|
|
|
var docChecker = {
|
|
|
|
type: EVENT_HIDE,
|
|
|
|
get target()
|
|
|
|
{
|
|
|
|
var iframe = this.invoker.mDialog.document.getElementById("iframe");
|
|
|
|
this.invoker.iframeDoc = iframe.contentDocument;
|
|
|
|
return iframe;
|
|
|
|
},
|
|
|
|
invoker: thisObj
|
|
|
|
};
|
|
|
|
|
|
|
|
this.eventSeq.push(docChecker);
|
|
|
|
|
|
|
|
this.finalCheck = function openWndShutdownDoc_finalCheck()
|
|
|
|
{
|
|
|
|
// After timeout after event hide for iframe was handled the document
|
|
|
|
// accessible for iframe's document is in cache still.
|
|
|
|
ok(!isAccessibleInCache(this.iframeDoc),
|
|
|
|
"The document accessible for iframe is in cache still after iframe hide!");
|
|
|
|
|
|
|
|
this.finalCheckImpl();
|
|
|
|
|
|
|
|
// After the window is closed all alive subdocument accessibles should
|
|
|
|
// be shut down.
|
|
|
|
ok(!isAccessibleInCache(this.iframeDoc),
|
|
|
|
"The document accessible for iframe is in cache still!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-17 20:09:16 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Do tests
|
|
|
|
|
|
|
|
var gQueue = null;
|
|
|
|
|
2010-06-17 19:43:58 -07:00
|
|
|
// Debug stuff.
|
|
|
|
// gA11yEventDumpID = "eventdump";
|
|
|
|
// gA11yEventDumpToConsole = true;
|
2009-07-17 20:09:16 -07:00
|
|
|
|
|
|
|
function doTests()
|
|
|
|
{
|
2009-07-27 19:28:06 -07:00
|
|
|
gQueue = new eventQueue();
|
2009-07-17 20:09:16 -07:00
|
|
|
|
|
|
|
gQueue.push(new changeIframeSrc("iframe", "about:"));
|
|
|
|
gQueue.push(new changeIframeSrc("iframe", "about:buildconfig"));
|
2010-06-08 09:39:58 -07:00
|
|
|
gQueue.push(new morphIFrame("iframe", kHide));
|
|
|
|
gQueue.push(new morphIFrame("iframe", kShow));
|
|
|
|
gQueue.push(new morphIFrame("iframe", kRemove));
|
2009-07-27 19:28:06 -07:00
|
|
|
gQueue.push(new openDialogWnd("about:"));
|
2010-06-17 19:43:58 -07:00
|
|
|
gQueue.push(new openWndShutdownDoc());
|
2009-07-17 20:09:16 -07:00
|
|
|
|
|
|
|
gQueue.invoke(); // Will call SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
addA11yLoadEvent(doTests);
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=420845"
|
|
|
|
title="Fire event_reorder on any embedded frames/iframes whos document has just loaded">
|
|
|
|
Mozilla Bug 420845
|
2010-06-08 09:39:58 -07:00
|
|
|
</a><br>
|
2009-07-27 19:28:06 -07:00
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=506206"
|
|
|
|
title="Fire event_reorder application root accessible">
|
|
|
|
Mozilla Bug 506206
|
2010-06-08 09:39:58 -07:00
|
|
|
</a><br>
|
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=566103"
|
|
|
|
title="Reorganize accessible document handling">
|
|
|
|
Mozilla Bug 566103
|
2010-06-17 19:43:58 -07:00
|
|
|
</a><br>
|
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=571459"
|
|
|
|
title="Shutdown document accessible when presshell goes away">
|
|
|
|
Mozilla Bug 571459
|
2009-07-27 19:28:06 -07:00
|
|
|
</a>
|
2009-07-17 20:09:16 -07:00
|
|
|
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none"></div>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
|
2010-06-08 09:39:58 -07:00
|
|
|
<div id="testContainer"><iframe id="iframe"></iframe></div>
|
2009-07-17 20:09:16 -07:00
|
|
|
<div id="eventdump"></div>
|
|
|
|
</body>
|
|
|
|
</html>
|