@@ -175,11 +175,11 @@ TestCase {
177 // Find an object with the given name in the children tree of "obj"
177 // Find an object with the given name in the children tree of "obj"
178− function findChild(obj, objectName) {
178+ function findChild(obj, objectName, timeout) {
179 if (!obj)
179 if (!obj)
180 qtest_fail("no obj given", 1);
180 qtest_fail("no obj given", 1);
182− return findChildIn(obj, "children", objectName);
182+ return findChildInWithTimeout(obj, "children", objectName);
185 // Find an object with the given name in the children tree of "obj"
185 // Find an object with the given name in the children tree of "obj"
@@ -187,11 +187,32 @@ TestCase {
187 // Note: you should use findChild if you're not sure you need this
187 // Note: you should use findChild if you're not sure you need this
188 // as this tree is much bigger and might contain stuff that goes
188 // as this tree is much bigger and might contain stuff that goes
189 // away randomly.
189 // away randomly.
190− function findInvisibleChild(obj, objectName) {
190+ function findInvisibleChild(obj, objectName, timeout) {
191 if (!obj)
191 if (!obj)
192 qtest_fail("no obj given", 1);
192 qtest_fail("no obj given", 1);
194− return findChildIn(obj, "data", objectName);
194+ return findChildInWithTimeout(obj, "data", objectName, timeout);
197+ // Find a child in the named property with timeout
198+ function findChildInWithTimeout(obj, prop, objectName, timeout) {
200+ qtest_fail("no obj given", 1);
203+ if (timeout === undefined)
206+ var child = findChildIn(obj, prop, objectName);
208+ while (timeSpent < timeout && !child) {
209+ child = findChildIn(obj, prop, objectName);
197 // Find a child in the named property
218 // Find a child in the named property