From 2f13fe514b223fdeb68e5813b062f82e92ee7c76 Mon Sep 17 00:00:00 2001 From: Ginn Chen Date: Thu, 2 Dec 2010 11:07:14 -0500 Subject: [PATCH 1/2] Bug 615149 - Crash under nsAccDocManager::ClearDocCache. r=surkov, a=davidb --- accessible/src/base/nsAccDocManager.cpp | 22 +++++++++++++++------- accessible/src/base/nsAccDocManager.h | 13 +++++-------- 2 files changed, 20 insertions(+), 15 deletions(-) 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 { From 01eb4dec345bb58e11032734d8550034556eb270 Mon Sep 17 00:00:00 2001 From: David Bolter Date: Thu, 2 Dec 2010 11:07:28 -0500 Subject: [PATCH 2/2] Bug 615282 - Make test_keys.html pass on OSX. r=Marcoz a=testonly --- accessible/tests/mochitest/test_keys.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(); }