Skip to content

Commit cfe052b

Browse files
fix: Make sure we don't store element snapshot in the cache (#1001)
1 parent e22fb9a commit cfe052b

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

WebDriverAgentLib/Commands/FBElementCommands.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ + (NSArray *)routes
269269
NSString *focusedUUID = [elementCache storeElement:(useNativeCachingStrategy
270270
? focusedElement
271271
: [focusedElement fb_stableInstanceWithUid:focusedElement.fb_uid])];
272+
focusedElement.lastSnapshot = nil;
272273
if (focusedUUID && [focusedUUID isEqualToString:(id)request.parameters[@"uuid"]]) {
273274
isFocused = YES;
274275
}

WebDriverAgentLib/Routing/FBResponsePayload.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@
5555
id<FBResponsePayload> FBResponseWithCachedElement(XCUIElement *element, FBElementCache *elementCache, BOOL compact)
5656
{
5757
[elementCache storeElement:maybeStable(element)];
58-
return FBResponseWithStatus([FBCommandStatus okWithValue:FBDictionaryResponseWithElement(element, compact)]);
58+
NSDictionary *response = FBDictionaryResponseWithElement(element, compact);
59+
element.lastSnapshot = nil;
60+
return FBResponseWithStatus([FBCommandStatus okWithValue:response]);
5961
}
6062

6163
id<FBResponsePayload> FBResponseWithCachedElements(NSArray<XCUIElement *> *elements, FBElementCache *elementCache, BOOL compact)
@@ -64,6 +66,7 @@
6466
for (XCUIElement *element in elements) {
6567
[elementCache storeElement:maybeStable(element)];
6668
[elementsResponse addObject:FBDictionaryResponseWithElement(element, compact)];
69+
element.lastSnapshot = nil;
6770
}
6871
return FBResponseWithStatus([FBCommandStatus okWithValue:elementsResponse]);
6972
}

0 commit comments

Comments
 (0)