Index: test/harness/runone.sh
===================================================================
--- test/harness/runone.sh	(revision 3665)
+++ test/harness/runone.sh	(working copy)
@@ -176,7 +176,7 @@
 then
     #echo killing firefox
     pkill firefox > /dev/null 2>&1
-    rm -rf $FF_PROFILE_DIR
+ #   rm -rf $FF_PROFILE_DIR
 else
     #echo killing app $APP_NAME $APP_PID
     kill -9 $APP_PID > /dev/null 2>&1
Index: src/orca/Gecko.py
===================================================================
--- src/orca/Gecko.py	(revision 3665)
+++ src/orca/Gecko.py	(working copy)
@@ -7373,7 +7373,8 @@
 
         return [None, wrapped]
 
-    def findPrevByMatchRule(self, col, matchrule, wrap, currentObj=None):
+    def findPrevByMatchRule(self, col, matchrule, 
+                                  wrap, currentObj, allowNesting=False):
         # get our current object
         if not currentObj:
             [currentObj, characterOffset] = self.getCaretContext()
@@ -7381,9 +7382,12 @@
         # Get the ancestors.  We won't stop on any of them.
         ancestors = []
         obj = currentObj.parent
-        while obj:
+        if allowNesting:
             ancestors.append(obj)
-            obj = obj.parent
+        else:
+            while obj:
+                ancestors.append(obj)
+                obj = obj.parent
 
         wrapped = False
         rs = col.getMatchesTo(currentObj, matchrule, 
@@ -7748,7 +7752,7 @@
 
             if isAria:
                 prevObj = self.findPreviousObject(firstObj)
-                pOffset =0
+                pOffset = 0
             else:
                 [prevObj, pOffset] = \
                     self.findPreviousCaretInOrder(firstObj, start)
@@ -9365,21 +9369,51 @@
         [obj, characterOffset] = self.getCaretContext()
         found = False
         wrap = True
-        while obj and not found:
-            [obj, wrapped] = \
-                  self.findPreviousRole([pyatspi.ROLE_LIST], wrap, obj)
-            # We should only wrap if we haven't already done so.
-            #
-            if wrapped:
-                wrap = False
+        success = False
 
-            # We need to be sure that the list in question is an (un)ordered
-            # list rather than a list in a form field. Form field lists are
-            # focusable; (un)ordered lists are not.
-            #
-            if obj and not obj.getState().contains(pyatspi.STATE_FOCUSABLE):
-                found = True
+        # Try to find it using Collection first
+        if settings.useCollection:       
+            try:
+                startobj = obj
+                col = self.getDocumentFrame().queryCollection() 
+                stateset = pyatspi.StateSet()
+                stateset.add(pyatspi.STATE_FOCUSABLE)
+                rule = col.createMatchRule(stateset.raw(), col.MATCH_NONE,  
+                             "", col.MATCH_ANY,
+                             [pyatspi.ROLE_LIST], col.MATCH_ANY,
+                             "", col.MATCH_ALL,
+                             False)
+                [obj, wrapped] = self.findPrevByMatchRule(col, 
+                                          rule, True, obj, allowNesting = True)
+                if obj and obj != startobj:
+                    found = True
+                else:
+                    found = False
+                success = True 
+                col.freeMatchRule(rule)  
+            except NotImplementedError:
+                debug.printException(debug.LEVEL_SEVERE)
+            except:
+                debug.printException(debug.LEVEL_SEVERE)
+                col.freeMatchRule(rule)
 
+        # Do it iteratively when Collection failed or is disabled
+        if not success or not settings.useCollection:
+            while obj and not found:
+                [obj, wrapped] = \
+                    self.findPreviousRole([pyatspi.ROLE_LIST], wrap, obj)
+                # We should only wrap if we haven't already done so.
+                #
+                if wrapped:
+                    wrap = False
+    
+                # We need to be sure that the list in question is an (un)ordered
+                # list rather than a list in a form field. Form field lists are
+                # focusable; (un)ordered lists are not.
+                #
+                if obj and not obj.getState().contains(pyatspi.STATE_FOCUSABLE):
+                    found = True
+
         if wrapped:
             # Translators: when the user is attempting to locate a
             # particular object and the top of the web page has been
@@ -9426,20 +9460,50 @@
         [obj, characterOffset] = self.getCaretContext()
         found = False
         wrap = True
-        while obj and not found:
-            [obj, wrapped] = \
-                  self.findNextRole([pyatspi.ROLE_LIST], wrap, obj)
-            # We should only wrap if we haven't already done so.
-            #
-            if wrapped:
-                wrap = False
+        success = False
 
-            # We need to be sure that the list in question is an (un)ordered
-            # list rather than a list in a form field. Form field lists are
-            # focusable; (un)ordered lists are not.
-            #
-            if obj and not obj.getState().contains(pyatspi.STATE_FOCUSABLE):
-                found = True
+        # Try to find it using Collection first    
+        if settings.useCollection:       
+            try:
+                startobj = obj
+                col = self.getDocumentFrame().queryCollection() 
+                stateset = pyatspi.StateSet()
+                stateset.add(pyatspi.STATE_FOCUSABLE)
+                rule = col.createMatchRule(stateset.raw(), col.MATCH_NONE,  
+                             "", col.MATCH_ANY,
+                             [pyatspi.ROLE_LIST], col.MATCH_ANY,
+                             "", col.MATCH_ALL,
+                             False)
+                [obj, wrapped] = self.findNextByMatchRule(col, rule, True, obj)
+                if obj and obj != startobj:
+                    found = True
+                else:
+                    found = False
+                success = True 
+                col.freeMatchRule(rule)  
+            except NotImplementedError:
+                debug.printException(debug.LEVEL_SEVERE)
+            except:
+                debug.printException(debug.LEVEL_SEVERE)
+                col.freeMatchRule(rule)
+
+        # Do it iteratively when Collection failed or is disabled
+        if not success or not settings.useCollection:
+            while obj and not found:
+                [obj, wrapped] = \
+                    self.findNextRole([pyatspi.ROLE_LIST], wrap, obj)
+                # We should only wrap if we haven't already done so.
+                #
+                if wrapped:
+                    wrap = False
+    
+                # We need to be sure that the list in question is an (un)ordered
+                # list rather than a list in a form field. Form field lists are
+                # focusable; (un)ordered lists are not.
+                #
+                if obj and not obj.getState().contains(pyatspi.STATE_FOCUSABLE):
+                    found = True
+
         if wrapped:
             # Translators: when the user is attempting to locate a
             # particular object and the bottom of the web page has been
@@ -9486,22 +9550,52 @@
         [obj, characterOffset] = self.getCaretContext()
         found = False
         wrap = True
-        while obj and not found:
-            [obj, wrapped] = \
-                  self.findPreviousRole([pyatspi.ROLE_LIST_ITEM], wrap, obj)
-            # We should only wrap if we haven't already done so.
-            #
-            if wrapped:
-                wrap = False
+        success = False
 
-            # We need to be sure that the list item in question is the child
-            # of an (un)ordered list rather than a list in a form field.
-            # Form field list items are focusable; (un)ordered list items are
-            # not.
-            #
-            if obj and \
-               not (obj.getState().contains(pyatspi.STATE_FOCUSABLE)):
-                found = True
+        # Try to find it using Collection first
+        if settings.useCollection:       
+            try:
+                startobj = obj
+                col = self.getDocumentFrame().queryCollection() 
+                stateset = pyatspi.StateSet()
+                stateset.add(pyatspi.STATE_FOCUSABLE)
+                rule = col.createMatchRule(stateset.raw(), col.MATCH_NONE,  
+                             "", col.MATCH_ANY,
+                             [pyatspi.ROLE_LIST_ITEM], col.MATCH_ANY,
+                             "", col.MATCH_ALL,
+                             False)
+                [obj, wrapped] = self.findPrevByMatchRule(col, rule, True, obj)
+                if obj and obj != startobj:
+                    found = True
+                else:
+                    found = False
+                success = True 
+                col.freeMatchRule(rule)  
+            except NotImplementedError:
+                debug.printException(debug.LEVEL_SEVERE)
+            except:
+                debug.printException(debug.LEVEL_SEVERE)
+                col.freeMatchRule(rule)
+
+        # Do it iteratively when Collection failed or is disabled
+        if not success or not settings.useCollection:
+            while obj and not found:
+                [obj, wrapped] = \
+                    self.findPreviousRole([pyatspi.ROLE_LIST_ITEM], wrap, obj)
+                # We should only wrap if we haven't already done so.
+                #
+                if wrapped:
+                    wrap = False
+    
+                # We need to be sure that the list item in question is the 
+                # child of an (un)ordered list rather than a list in a form 
+                # field. Form field list items are focusable; (un)ordered 
+                # list items are not.
+                #
+                if obj and \
+                not (obj.getState().contains(pyatspi.STATE_FOCUSABLE)):
+                    found = True
+
         if wrapped:
             # Translators: when the user is attempting to locate a
             # particular object and the top of the web page has been
@@ -9526,22 +9620,52 @@
         [obj, characterOffset] = self.getCaretContext()
         found = False
         wrap = True
-        while obj and not found:
-            [obj, wrapped] = \
-                  self.findNextRole([pyatspi.ROLE_LIST_ITEM], wrap, obj)
-            # We should only wrap if we haven't already done so.
-            #
-            if wrapped:
-                wrap = False
+        success = False
 
-            # We need to be sure that the list item in question is the child
-            # of an (un)ordered list rather than a list in a form field.
-            # Form field list items are focusable; (un)ordered list items are
-            # not.
-            #
-            if obj and \
-               not (obj.getState().contains(pyatspi.STATE_FOCUSABLE)):
-                found = True
+        # Try to find it using Collection first    
+        if settings.useCollection:       
+            try:
+                startobj = obj
+                col = self.getDocumentFrame().queryCollection() 
+                stateset = pyatspi.StateSet()
+                stateset.add(pyatspi.STATE_FOCUSABLE)
+                rule = col.createMatchRule(stateset.raw(), col.MATCH_NONE,  
+                             "", col.MATCH_ANY,
+                             [pyatspi.ROLE_LIST_ITEM], col.MATCH_ANY,
+                             "", col.MATCH_ALL,
+                             False)
+                [obj, wrapped] = self.findNextByMatchRule(col, rule, True, obj)
+                if obj and obj != startobj:
+                    found = True
+                else:
+                    found = False
+                success = True 
+                col.freeMatchRule(rule)  
+            except NotImplementedError:
+                debug.printException(debug.LEVEL_SEVERE)
+            except:
+                debug.printException(debug.LEVEL_SEVERE)
+                col.freeMatchRule(rule)
+
+        # Do it iteratively when Collection failed or is disabled
+        if not success or not settings.useCollection:
+            while obj and not found:
+                [obj, wrapped] = \
+                    self.findNextRole([pyatspi.ROLE_LIST_ITEM], wrap, obj)
+                # We should only wrap if we haven't already done so.
+                #
+                if wrapped:
+                    wrap = False
+    
+                # We need to be sure that the list item in question is the 
+                # child of an (un)ordered list rather than a list in a form 
+                # field. Form field list items are focusable; (un)ordered 
+                # list items are not.
+                #
+                if obj and \
+                not (obj.getState().contains(pyatspi.STATE_FOCUSABLE)):
+                    found = True
+
         if wrapped:
             # Translators: when the user is attempting to locate a
             # particular object and the bottom of the web page has been
