diff --git a/accessible/src/generic/DocAccessible-inl.h b/accessible/src/generic/DocAccessible-inl.h index 58956d8870de..c6c1656500a8 100644 --- a/accessible/src/generic/DocAccessible-inl.h +++ b/accessible/src/generic/DocAccessible-inl.h @@ -10,6 +10,7 @@ #include "DocAccessible.h" #include "nsAccessibilityService.h" #include "NotificationController.h" +#include "States.h" inline void DocAccessible::BindChildDocument(DocAccessible* aDocument) @@ -39,6 +40,21 @@ DocAccessible::UpdateText(nsIContent* 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 stateEvent = + new AccStateChangeEvent(this, mozilla::a11y::states::BUSY, false); + FireDelayedAccessibleEvent(stateEvent); + } +} + inline void DocAccessible::MaybeNotifyOfValueChange(Accessible* aAccessible) { diff --git a/accessible/src/generic/DocAccessible.cpp b/accessible/src/generic/DocAccessible.cpp index 3d2ecbe7f92c..0674328ed5f2 100644 --- a/accessible/src/generic/DocAccessible.cpp +++ b/accessible/src/generic/DocAccessible.cpp @@ -7,7 +7,6 @@ #include "AccIterator.h" #include "DocAccessible-inl.h" #include "nsAccCache.h" -#include "nsAccessibilityService.h" #include "nsAccessiblePivot.h" #include "nsAccTreeWalker.h" #include "nsAccUtils.h" @@ -15,7 +14,6 @@ #include "nsTextEquivUtils.h" #include "Role.h" #include "RootAccessible.h" -#include "States.h" #include "nsIMutableArray.h" #include "nsICommandManager.h" diff --git a/accessible/src/generic/DocAccessible.h b/accessible/src/generic/DocAccessible.h index 96e89f1a1ecc..f485a365f5e6 100644 --- a/accessible/src/generic/DocAccessible.h +++ b/accessible/src/generic/DocAccessible.h @@ -330,12 +330,7 @@ protected: /** * Marks this document as loaded or loading. */ - void NotifyOfLoad(uint32_t aLoadEventType) - { - mLoadState |= eDOMLoaded; - mLoadEventType = aLoadEventType; - } - + void NotifyOfLoad(uint32_t aLoadEventType); void NotifyOfLoading(bool aIsReloading); friend class nsAccDocManager; diff --git a/accessible/tests/mochitest/Makefile.in b/accessible/tests/mochitest/Makefile.in index 17bd9557a093..8777e880d5a2 100644 --- a/accessible/tests/mochitest/Makefile.in +++ b/accessible/tests/mochitest/Makefile.in @@ -39,6 +39,7 @@ DIRS = \ include $(DEPTH)/config/autoconf.mk MOCHITEST_A11Y_FILES =\ + dumbfile.xpi \ formimage.png \ letters.gif \ moz.png \ diff --git a/accessible/tests/mochitest/dumbfile.xpi b/accessible/tests/mochitest/dumbfile.xpi new file mode 100644 index 000000000000..15cb0ecb3e21 Binary files /dev/null and b/accessible/tests/mochitest/dumbfile.xpi differ diff --git a/accessible/tests/mochitest/events.js b/accessible/tests/mochitest/events.js index c006639f1c35..1264d9b3973c 100644 --- a/accessible/tests/mochitest/events.js +++ b/accessible/tests/mochitest/events.js @@ -1417,7 +1417,8 @@ function caretMoveChecker(aCaretOffset, aTargetOrFunc, aTargetFuncArg) * State change checker. */ function stateChangeChecker(aState, aIsExtraState, aIsEnabled, - aTargetOrFunc, aTargetFuncArg, aIsAsync) + aTargetOrFunc, aTargetFuncArg, aIsAsync, + aSkipCurrentStateCheck) { this.__proto__ = new invokerChecker(EVENT_STATE_CHANGE, aTargetOrFunc, aTargetFuncArg, aIsAsync); @@ -1441,6 +1442,11 @@ function stateChangeChecker(aState, aIsExtraState, aIsEnabled, is(event.isEnabled(), aIsEnabled, "Wrong state of statechange event state"); + if (aSkipCurrentStateCheck) { + todo(false, "State checking was skipped!"); + return; + } + var state = aIsEnabled ? (aIsExtraState ? 0 : aState) : 0; var extraState = aIsEnabled ? (aIsExtraState ? aState : 0) : 0; var unxpdState = aIsEnabled ? 0 : (aIsExtraState ? 0 : aState); diff --git a/accessible/tests/mochitest/states/Makefile.in b/accessible/tests/mochitest/states/Makefile.in index 48e6083ac6e2..b76f6740f6e9 100644 --- a/accessible/tests/mochitest/states/Makefile.in +++ b/accessible/tests/mochitest/states/Makefile.in @@ -19,6 +19,7 @@ MOCHITEST_A11Y_FILES =\ test_controls.html \ test_controls.xul \ test_doc.html \ + test_doc_busy.html \ test_docarticle.html \ test_editablebody.html \ test_expandable.xul \ diff --git a/accessible/tests/mochitest/states/test_doc_busy.html b/accessible/tests/mochitest/states/test_doc_busy.html new file mode 100644 index 000000000000..fd042bd789f4 --- /dev/null +++ b/accessible/tests/mochitest/states/test_doc_busy.html @@ -0,0 +1,75 @@ + + + + states of document + + + + + + + + + + + + + + + + Bug 446469 + +

+ +
+  
+ + a file + +