diff --git a/accessible/src/base/nsAccDocManager.cpp b/accessible/src/base/nsAccDocManager.cpp index 0620e5d6b7e..62c50ef0ece 100644 --- a/accessible/src/base/nsAccDocManager.cpp +++ b/accessible/src/base/nsAccDocManager.cpp @@ -491,17 +491,25 @@ nsAccDocManager::CreateDocOrRootAccessible(nsIDocument *aDocument) // nsAccDocManager static PLDHashOperator -nsAccDocManager::ClearDocCacheEntry(const nsIDocument* aKey, - nsRefPtr& aDocAccessible, - void* aUserArg) +nsAccDocManager::GetFirstEntryInDocCache(const nsIDocument* aKey, + nsDocAccessible* aDocAccessible, + void* aUserArg) { NS_ASSERTION(aDocAccessible, - "Calling ClearDocCacheEntry with a NULL pointer!"); + "No doc accessible for the object in doc accessible cache!"); + *reinterpret_cast(aUserArg) = aDocAccessible; - if (aDocAccessible) - aDocAccessible->Shutdown(); + return PL_DHASH_STOP; +} - return PL_DHASH_REMOVE; +void +nsAccDocManager::ClearDocCache() +{ + nsDocAccessible* docAcc = nsnull; + while (mDocAccessibleCache.EnumerateRead(GetFirstEntryInDocCache, static_cast(&docAcc))) { + if (docAcc) + docAcc->Shutdown(); + } } PLDHashOperator diff --git a/accessible/src/base/nsAccDocManager.h b/accessible/src/base/nsAccDocManager.h index e97bf4ef7ae..578b5892fb5 100644 --- a/accessible/src/base/nsAccDocManager.h +++ b/accessible/src/base/nsAccDocManager.h @@ -152,20 +152,17 @@ private: nsDocAccessibleHashtable; /** - * Shutdown and remove the document accessible from cache. + * Get first entry of the document accessible from cache. */ static PLDHashOperator - ClearDocCacheEntry(const nsIDocument* aKey, - nsRefPtr& aDocAccessible, - void* aUserArg); + GetFirstEntryInDocCache(const nsIDocument* aKey, + nsDocAccessible* aDocAccessible, + void* aUserArg); /** * Clear the cache and shutdown the document accessibles. */ - void ClearDocCache() - { - mDocAccessibleCache.Enumerate(ClearDocCacheEntry, static_cast(this)); - } + void ClearDocCache(); struct nsSearchAccessibleInCacheArg { diff --git a/accessible/tests/mochitest/test_keys.html b/accessible/tests/mochitest/test_keys.html index 6a687fd50cc..c368a4116fe 100644 --- a/accessible/tests/mochitest/test_keys.html +++ b/accessible/tests/mochitest/test_keys.html @@ -1,6 +1,7 @@ + Keyboard shortcuts tests @@ -27,7 +28,7 @@ function doTest() { testKeyboardShortcut("input1", ""); - testKeyboardShortcut("input2", "Alt+Shift+b"); + testKeyboardShortcut("input2", MAC ? "⌃b" : "Alt+Shift+b"); SimpleTest.finish(); }