Bug 446469 - Missing busy state change event when downloading files, r=tbsaunde

This commit is contained in:
Alexander Surkov 2012-11-17 12:32:51 +09:00
Родитель 34585ddb40
Коммит 3b9f44843c
8 изменённых файлов: 101 добавлений и 9 удалений

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

@ -10,6 +10,7 @@
#include "DocAccessible.h" #include "DocAccessible.h"
#include "nsAccessibilityService.h" #include "nsAccessibilityService.h"
#include "NotificationController.h" #include "NotificationController.h"
#include "States.h"
inline void inline void
DocAccessible::BindChildDocument(DocAccessible* aDocument) DocAccessible::BindChildDocument(DocAccessible* aDocument)
@ -39,6 +40,21 @@ DocAccessible::UpdateText(nsIContent* aTextNode)
mNotificationController->ScheduleTextUpdate(aTextNode); mNotificationController->ScheduleTextUpdate(aTextNode);
} }
inline void
DocAccessible::NotifyOfLoad(uint32_t aLoadEventType)
{
mLoadState |= eDOMLoaded;
mLoadEventType = aLoadEventType;
// If the document is loaded completely then network activity was presumingly
// caused by file loading. Fire busy state change event.
if (HasLoadState(eCompletelyLoaded) && IsLoadEventTarget()) {
nsRefPtr<AccEvent> stateEvent =
new AccStateChangeEvent(this, mozilla::a11y::states::BUSY, false);
FireDelayedAccessibleEvent(stateEvent);
}
}
inline void inline void
DocAccessible::MaybeNotifyOfValueChange(Accessible* aAccessible) DocAccessible::MaybeNotifyOfValueChange(Accessible* aAccessible)
{ {

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

@ -7,7 +7,6 @@
#include "AccIterator.h" #include "AccIterator.h"
#include "DocAccessible-inl.h" #include "DocAccessible-inl.h"
#include "nsAccCache.h" #include "nsAccCache.h"
#include "nsAccessibilityService.h"
#include "nsAccessiblePivot.h" #include "nsAccessiblePivot.h"
#include "nsAccTreeWalker.h" #include "nsAccTreeWalker.h"
#include "nsAccUtils.h" #include "nsAccUtils.h"
@ -15,7 +14,6 @@
#include "nsTextEquivUtils.h" #include "nsTextEquivUtils.h"
#include "Role.h" #include "Role.h"
#include "RootAccessible.h" #include "RootAccessible.h"
#include "States.h"
#include "nsIMutableArray.h" #include "nsIMutableArray.h"
#include "nsICommandManager.h" #include "nsICommandManager.h"

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

@ -330,12 +330,7 @@ protected:
/** /**
* Marks this document as loaded or loading. * Marks this document as loaded or loading.
*/ */
void NotifyOfLoad(uint32_t aLoadEventType) void NotifyOfLoad(uint32_t aLoadEventType);
{
mLoadState |= eDOMLoaded;
mLoadEventType = aLoadEventType;
}
void NotifyOfLoading(bool aIsReloading); void NotifyOfLoading(bool aIsReloading);
friend class nsAccDocManager; friend class nsAccDocManager;

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

@ -39,6 +39,7 @@ DIRS = \
include $(DEPTH)/config/autoconf.mk include $(DEPTH)/config/autoconf.mk
MOCHITEST_A11Y_FILES =\ MOCHITEST_A11Y_FILES =\
dumbfile.xpi \
formimage.png \ formimage.png \
letters.gif \ letters.gif \
moz.png \ moz.png \

Двоичные данные
accessible/tests/mochitest/dumbfile.xpi Normal file

Двоичный файл не отображается.

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

@ -1417,7 +1417,8 @@ function caretMoveChecker(aCaretOffset, aTargetOrFunc, aTargetFuncArg)
* State change checker. * State change checker.
*/ */
function stateChangeChecker(aState, aIsExtraState, aIsEnabled, function stateChangeChecker(aState, aIsExtraState, aIsEnabled,
aTargetOrFunc, aTargetFuncArg, aIsAsync) aTargetOrFunc, aTargetFuncArg, aIsAsync,
aSkipCurrentStateCheck)
{ {
this.__proto__ = new invokerChecker(EVENT_STATE_CHANGE, aTargetOrFunc, this.__proto__ = new invokerChecker(EVENT_STATE_CHANGE, aTargetOrFunc,
aTargetFuncArg, aIsAsync); aTargetFuncArg, aIsAsync);
@ -1441,6 +1442,11 @@ function stateChangeChecker(aState, aIsExtraState, aIsEnabled,
is(event.isEnabled(), aIsEnabled, is(event.isEnabled(), aIsEnabled,
"Wrong state of statechange event state"); "Wrong state of statechange event state");
if (aSkipCurrentStateCheck) {
todo(false, "State checking was skipped!");
return;
}
var state = aIsEnabled ? (aIsExtraState ? 0 : aState) : 0; var state = aIsEnabled ? (aIsExtraState ? 0 : aState) : 0;
var extraState = aIsEnabled ? (aIsExtraState ? aState : 0) : 0; var extraState = aIsEnabled ? (aIsExtraState ? aState : 0) : 0;
var unxpdState = aIsEnabled ? 0 : (aIsExtraState ? 0 : aState); var unxpdState = aIsEnabled ? 0 : (aIsExtraState ? 0 : aState);

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

@ -19,6 +19,7 @@ MOCHITEST_A11Y_FILES =\
test_controls.html \ test_controls.html \
test_controls.xul \ test_controls.xul \
test_doc.html \ test_doc.html \
test_doc_busy.html \
test_docarticle.html \ test_docarticle.html \
test_editablebody.html \ test_editablebody.html \
test_expandable.xul \ test_expandable.xul \

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

@ -0,0 +1,75 @@
<!DOCTYPE html>
<html>
<head>
<title>states of document</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../role.js"></script>
<script type="application/javascript"
src="../states.js"></script>
<script type="application/javascript"
src="../events.js"></script>
<script type="application/javascript">
//gA11yEventDumpToConsole = true; // debugging stuff
function loadFile()
{
// XXX: state change busy false event might be delievered when document
// has state busy true already (these events should be coalesced actually
// in this case as nothing happened).
this.eventSeq = [
new stateChangeChecker(STATE_BUSY, false, true, document, null, false, true),
new stateChangeChecker(STATE_BUSY, false, false, document)
];
this.invoke = function loadFile_invoke()
{
synthesizeMouse(getNode("link"), 1, 1, {});
}
this.getID = function loadFile_getID()
{
return "load file: state busy change events on document";
}
}
var gQueue = null;
function doTest()
{
// State busy change event on file loading.
//enableLogging("docload"); // debugging
gQueue = new eventQueue();
gQueue.push(new loadFile());
//gQueue.onFinish = function() { disableLogging(); } // debugging
gQueue.invoke(); // Will call SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="Missing busy state change event when downloading files"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=446469">Bug 446469</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<a id="link" href="http://example.com/a11y/accessible/dumbfile.xpi">a file</a>
</body>
</html>