Bug 420845 - Fire event_reorder on any embedded frames/iframes whos document has just loaded, r=marcoz, davidb

This commit is contained in:
Alexander Surkov 2009-07-18 11:09:16 +08:00
parent efa1efa106
commit d3b128e0a7
3 changed files with 90 additions and 1 deletions

View File

@ -617,7 +617,17 @@ nsDocAccessible::Init()
nsCOMPtr<nsIAccessible> parentAccessible; // Ensure outer doc mParent accessible
GetParent(getter_AddRefs(parentAccessible));
return nsHyperTextAccessibleWrap::Init();
nsresult rv = nsHyperTextAccessibleWrap::Init();
NS_ENSURE_SUCCESS(rv, rv);
// Fire reorder event to notify new accessible document has been created and
// attached to the tree.
nsCOMPtr<nsIAccessibleEvent> reorderEvent =
new nsAccReorderEvent(mParent, PR_FALSE, PR_TRUE, mDOMNode);
NS_ENSURE_TRUE(reorderEvent, NS_ERROR_OUT_OF_MEMORY);
FireDelayedAccessibleEvent(reorderEvent);
return NS_OK;
}
nsresult

View File

@ -88,6 +88,7 @@ _TEST_FILES =\
test_elm_table.html \
test_elm_txtcntnr.html \
test_events_caretmove.html \
test_events_doc.html \
test_events_focus.xul \
test_events_mutation.html \
test_events_tree.xul \

View File

@ -0,0 +1,78 @@
<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>
<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);
this.invoke = function changeIframeSrc_invoke()
{
this.DOMNode.src = aURL;
}
this.getID = function changeIframeSrc_getID()
{
return "change iframe src on " + aURL;
}
}
////////////////////////////////////////////////////////////////////////////
// Do tests
var gQueue = null;
// var gA11yEventDumpID = "eventdump"; // debug stuff
function doTests()
{
gQueue = new eventQueue(EVENT_REORDER);
gQueue.push(new changeIframeSrc("iframe", "about:"));
gQueue.push(new changeIframeSrc("iframe", "about:buildconfig"));
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
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<div id="testContainer">
<iframe id="iframe"></iframe>
</div>
<div id="eventdump"></div>
</body>
</html>