appium-webdriveragent 13.1.0 → 13.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/Scripts/embed-runner-icon.sh +87 -0
  3. package/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m +1 -1
  4. package/WebDriverAgentLib/Categories/XCUIDevice+FBRotation.m +22 -3
  5. package/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.m +1 -1
  6. package/WebDriverAgentLib/Categories/XCUIElement+FBVisibleFrame.m +12 -3
  7. package/WebDriverAgentLib/Commands/FBCustomCommands.m +2 -2
  8. package/WebDriverAgentLib/Commands/FBElementCommands.m +1 -1
  9. package/WebDriverAgentLib/Commands/FBOrientationCommands.m +1 -1
  10. package/WebDriverAgentLib/Commands/FBScreenshotCommands.m +1 -1
  11. package/WebDriverAgentLib/Info.plist +2 -2
  12. package/WebDriverAgentLib/Routing/FBScreenRecordingRequest.m +1 -1
  13. package/WebDriverAgentLib/Routing/FBTCPSocket.m +1 -1
  14. package/WebDriverAgentLib/Utilities/FBClassChainQueryParser.m +1 -1
  15. package/WebDriverAgentLib/Utilities/FBImageProcessor.m +10 -5
  16. package/WebDriverAgentLib/Utilities/FBMjpegServer.m +2 -2
  17. package/WebDriverAgentLib/Utilities/FBScreenshot.m +1 -1
  18. package/WebDriverAgentLib/Utilities/XCTestPrivateSymbols.h +2 -2
  19. package/WebDriverAgentLib/Utilities/XCTestPrivateSymbols.m +49 -34
  20. package/WebDriverAgentLib/Vendor/CocoaAsyncSocket/GCDAsyncSocket.m +16 -16
  21. package/WebDriverAgentLib/Vendor/CocoaAsyncSocket/GCDAsyncUdpSocket.m +12 -12
  22. package/WebDriverAgentLib/Vendor/CocoaHTTPServer/Categories/DDRange.m +6 -12
  23. package/WebDriverAgentLib/Vendor/CocoaHTTPServer/HTTPLogging.h +12 -12
  24. package/WebDriverAgentLib/Vendor/CocoaHTTPServer/HTTPMessage.m +2 -2
  25. package/WebDriverAgentLib/Vendor/RoutingHTTPServer/RoutingHTTPServer.m +5 -5
  26. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [13.1.2](https://github.com/appium/WebDriverAgent/compare/v13.1.1...v13.1.2) (2026-05-23)
2
+
3
+ ### Bug Fixes
4
+
5
+ * Address compilation warnings ([#1143](https://github.com/appium/WebDriverAgent/issues/1143)) ([f1f9976](https://github.com/appium/WebDriverAgent/commit/f1f9976f4a0a0fb8a8aa3ee1f2483b25275600e6))
6
+
7
+ ## [13.1.1](https://github.com/appium/WebDriverAgent/compare/v13.1.0...v13.1.1) (2026-05-22)
8
+
9
+ ### Bug Fixes
10
+
11
+ * ship Scripts/embed-runner-icon.sh in the npm package ([#1141](https://github.com/appium/WebDriverAgent/issues/1141)) ([17ac1c1](https://github.com/appium/WebDriverAgent/commit/17ac1c16a0890ee0fbfe73504a3ff570dfe1a7bf)), closes [#1138](https://github.com/appium/WebDriverAgent/issues/1138)
12
+
1
13
  ## [13.1.0](https://github.com/appium/WebDriverAgent/compare/v13.0.0...v13.1.0) (2026-05-21)
2
14
 
3
15
  ### Features
@@ -0,0 +1,87 @@
1
+ #!/bin/bash
2
+ # Embed the WDA app icon into the wrapping XCTRunner host app so the
3
+ # installed WebDriverAgent shows the Appium logo on the iOS home screen
4
+ # instead of a blank icon.
5
+ #
6
+ # Apple's USES_XCTRUNNER auto-generates a Runner.app around UI-testing
7
+ # .xctest bundles but does not inherit icons from the test bundle's
8
+ # asset catalog. actool produces AppIcon*.png + Assets.car inside
9
+ # PlugIns/<product>.xctest/ where iOS never looks. This script lifts
10
+ # them up to the Runner.app root and patches Info.plist accordingly.
11
+ #
12
+ # Limitations:
13
+ # - Touches XCTRunner internals; may need updates across Xcode versions.
14
+ # - iOS only; tvOS uses different "Brand Assets" and is not handled.
15
+ # - Cloud device farms that re-sign WDA must preserve these changes.
16
+
17
+ set -euo pipefail
18
+
19
+ RUNNER_APP="${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}-Runner.app"
20
+ XCTEST="${RUNNER_APP}/PlugIns/${PRODUCT_NAME}.xctest"
21
+
22
+ if [ ! -d "$RUNNER_APP" ]; then
23
+ echo "warning: ${PRODUCT_NAME}-Runner.app not found at $RUNNER_APP; skipping icon embed"
24
+ exit 0
25
+ fi
26
+
27
+ if [ ! -d "$XCTEST" ]; then
28
+ echo "warning: ${PRODUCT_NAME}.xctest not found inside Runner.app; skipping icon embed"
29
+ exit 0
30
+ fi
31
+
32
+ shopt -s nullglob
33
+ ICONS=("$XCTEST"/AppIcon*.png)
34
+ if [ ${#ICONS[@]} -eq 0 ]; then
35
+ echo "warning: no compiled AppIcon*.png found inside $XCTEST; skipping icon embed"
36
+ exit 0
37
+ fi
38
+
39
+ cp -f "${ICONS[@]}" "$RUNNER_APP/"
40
+ if [ -f "$XCTEST/Assets.car" ]; then
41
+ cp -f "$XCTEST/Assets.car" "$RUNNER_APP/"
42
+ fi
43
+
44
+ PLIST="$RUNNER_APP/Info.plist"
45
+ /usr/libexec/PlistBuddy -c "Delete :CFBundleIcons" "$PLIST" 2>/dev/null || true
46
+ /usr/libexec/PlistBuddy -c "Delete :CFBundleIcons~ipad" "$PLIST" 2>/dev/null || true
47
+
48
+ /usr/libexec/PlistBuddy -c "Add :CFBundleIcons dict" "$PLIST"
49
+ /usr/libexec/PlistBuddy -c "Add :CFBundleIcons:CFBundlePrimaryIcon dict" "$PLIST"
50
+ /usr/libexec/PlistBuddy -c "Add :CFBundleIcons:CFBundlePrimaryIcon:CFBundleIconName string AppIcon" "$PLIST"
51
+ /usr/libexec/PlistBuddy -c "Add :CFBundleIcons:CFBundlePrimaryIcon:CFBundleIconFiles array" "$PLIST"
52
+ /usr/libexec/PlistBuddy -c "Add :CFBundleIcons:CFBundlePrimaryIcon:CFBundleIconFiles:0 string AppIcon60x60" "$PLIST"
53
+
54
+ /usr/libexec/PlistBuddy -c "Add :CFBundleIcons~ipad dict" "$PLIST"
55
+ /usr/libexec/PlistBuddy -c "Add :CFBundleIcons~ipad:CFBundlePrimaryIcon dict" "$PLIST"
56
+ /usr/libexec/PlistBuddy -c "Add :CFBundleIcons~ipad:CFBundlePrimaryIcon:CFBundleIconName string AppIcon" "$PLIST"
57
+ /usr/libexec/PlistBuddy -c "Add :CFBundleIcons~ipad:CFBundlePrimaryIcon:CFBundleIconFiles array" "$PLIST"
58
+ /usr/libexec/PlistBuddy -c "Add :CFBundleIcons~ipad:CFBundlePrimaryIcon:CFBundleIconFiles:0 string AppIcon60x60" "$PLIST"
59
+ /usr/libexec/PlistBuddy -c "Add :CFBundleIcons~ipad:CFBundlePrimaryIcon:CFBundleIconFiles:1 string AppIcon76x76" "$PLIST"
60
+
61
+ # Re-codesign since we modified the bundle after Xcode signed it.
62
+ # In a scheme post-action context Xcode's CODE_SIGN_* env vars are not exposed,
63
+ # so discover the existing signing identity from the already-signed bundle.
64
+ if [ -d "$RUNNER_APP/_CodeSignature" ]; then
65
+ # Capture the signature info once. Piping codesign straight into
66
+ # `awk ... exit` makes awk close the pipe early, killing codesign with
67
+ # SIGPIPE -- which `set -o pipefail` turns into a fatal error. That trips
68
+ # only when an Authority line exists, i.e. on every real-device build.
69
+ SIGN_INFO=$(codesign -dvv "$RUNNER_APP" 2>&1 || true)
70
+ EXISTING_IDENT="${EXPANDED_CODE_SIGN_IDENTITY:-}"
71
+ if [ -z "$EXISTING_IDENT" ]; then
72
+ EXISTING_IDENT=$(awk -F'=' '/^Authority/ {print $2; exit}' <<< "$SIGN_INFO")
73
+ fi
74
+ # Simulator builds are ad-hoc signed: there is no Authority line, but the
75
+ # bundle can still be re-signed ad-hoc with an identity of "-".
76
+ if [ -z "$EXISTING_IDENT" ] && grep -q '^Signature=adhoc' <<< "$SIGN_INFO"; then
77
+ EXISTING_IDENT="-"
78
+ fi
79
+ if [ -n "$EXISTING_IDENT" ]; then
80
+ codesign --force --sign "$EXISTING_IDENT" \
81
+ --preserve-metadata=identifier,entitlements "$RUNNER_APP"
82
+ else
83
+ echo "warning: bundle is signed but no identity discovered; signature will be invalid"
84
+ fi
85
+ fi
86
+
87
+ echo "embedded icon into $RUNNER_APP"
@@ -232,7 +232,7 @@ static bool fb_isLocked;
232
232
  NSString *description = [NSString stringWithFormat:@"Cannot open '%@' with the default application assigned for it. Consider upgrading to Xcode 14.3+/iOS 16.4+", url];
233
233
  return [[[FBErrorBuilder builder]
234
234
  withDescriptionFormat:@"%@", description]
235
- buildError:error];;
235
+ buildError:error];
236
236
  }
237
237
 
238
238
  - (BOOL)fb_openUrl:(NSString *)url withApplication:(NSString *)bundleId error:(NSError **)error
@@ -30,19 +30,38 @@
30
30
  if (keysForRotationObj.count == 0) {
31
31
  return NO;
32
32
  }
33
- NSInteger orientation = keysForRotationObj.firstObject.integerValue;
33
+ UIDeviceOrientation orientation = (UIDeviceOrientation)keysForRotationObj.firstObject.integerValue;
34
34
  XCUIApplication *application = XCUIApplication.fb_activeApplication;
35
35
  [XCUIDevice sharedDevice].orientation = orientation;
36
36
  return [self waitUntilInterfaceIsAtOrientation:orientation application:application];
37
37
  }
38
38
 
39
- - (BOOL)waitUntilInterfaceIsAtOrientation:(NSInteger)orientation application:(XCUIApplication *)application
39
+ static UIInterfaceOrientation FBInterfaceOrientationFromDeviceOrientation(UIDeviceOrientation orientation)
40
+ {
41
+ switch (orientation) {
42
+ case UIDeviceOrientationPortrait:
43
+ return UIInterfaceOrientationPortrait;
44
+ case UIDeviceOrientationPortraitUpsideDown:
45
+ return UIInterfaceOrientationPortraitUpsideDown;
46
+ case UIDeviceOrientationLandscapeLeft:
47
+ return UIInterfaceOrientationLandscapeRight;
48
+ case UIDeviceOrientationLandscapeRight:
49
+ return UIInterfaceOrientationLandscapeLeft;
50
+ case UIDeviceOrientationUnknown:
51
+ case UIDeviceOrientationFaceUp:
52
+ case UIDeviceOrientationFaceDown:
53
+ default:
54
+ return UIInterfaceOrientationUnknown;
55
+ }
56
+ }
57
+
58
+ - (BOOL)waitUntilInterfaceIsAtOrientation:(UIDeviceOrientation)orientation application:(XCUIApplication *)application
40
59
  {
41
60
  // Tapping elements immediately after rotation may fail due to way UIKit is handling touches.
42
61
  // We should wait till UI cools off, before continuing
43
62
  [application fb_waitUntilStableWithTimeout:FBConfiguration.animationCoolOffTimeout];
44
63
 
45
- return application.interfaceOrientation == orientation;
64
+ return application.interfaceOrientation == FBInterfaceOrientationFromDeviceOrientation(orientation);
46
65
  }
47
66
 
48
67
  - (NSDictionary *)fb_rotationMapping
@@ -113,7 +113,7 @@
113
113
  XCUIElementType type = XCUIElementTypeAny;
114
114
  NSArray<NSNumber *> *uniqueTypes = [snapshots valueForKeyPath:[NSString stringWithFormat:@"@distinctUnionOfObjects.%@", FBStringify(XCUIElement, elementType)]];
115
115
  if (uniqueTypes && [uniqueTypes count] == 1) {
116
- type = [uniqueTypes.firstObject intValue];
116
+ type = (XCUIElementType)[uniqueTypes.firstObject intValue];
117
117
  }
118
118
  XCUIElementQuery *query = onlyChildren
119
119
  ? [self.fb_query childrenMatchingType:type]
@@ -29,13 +29,19 @@
29
29
  {
30
30
  CGRect thisVisibleFrame = [self visibleFrame];
31
31
  if (!CGRectIsEmpty(thisVisibleFrame)) {
32
- return thisVisibleFrame;
32
+ return CGRectMake(CGRectGetMinX(thisVisibleFrame),
33
+ CGRectGetMinY(thisVisibleFrame),
34
+ CGRectGetWidth(thisVisibleFrame),
35
+ CGRectGetHeight(thisVisibleFrame));
33
36
  }
34
37
 
35
38
  NSDictionary *visibleFrameDict = [self fb_attributeValue:FB_XCAXAVisibleFrameAttributeName
36
39
  error:nil];
37
40
  if (nil == visibleFrameDict) {
38
- return thisVisibleFrame;
41
+ return CGRectMake(CGRectGetMinX(thisVisibleFrame),
42
+ CGRectGetMinY(thisVisibleFrame),
43
+ CGRectGetWidth(thisVisibleFrame),
44
+ CGRectGetHeight(thisVisibleFrame));
39
45
  }
40
46
 
41
47
  id x = [visibleFrameDict objectForKey:@"X"];
@@ -46,7 +52,10 @@
46
52
  return CGRectMake([x doubleValue], [y doubleValue], [width doubleValue], [height doubleValue]);
47
53
  }
48
54
 
49
- return thisVisibleFrame;
55
+ return CGRectMake(CGRectGetMinX(thisVisibleFrame),
56
+ CGRectGetMinY(thisVisibleFrame),
57
+ CGRectGetWidth(thisVisibleFrame),
58
+ CGRectGetHeight(thisVisibleFrame));
50
59
  }
51
60
 
52
61
  @end
@@ -253,7 +253,7 @@
253
253
  if (nil == result) {
254
254
  return FBResponseWithUnknownError(error);
255
255
  }
256
- return FBResponseWithObject([result base64EncodedStringWithOptions:0]);
256
+ return FBResponseWithObject([result base64EncodedStringWithOptions:(NSDataBase64EncodingOptions)0]);
257
257
  }
258
258
 
259
259
  + (id<FBResponsePayload>)handleGetBatteryInfo:(FBRouteRequest *)request
@@ -599,7 +599,7 @@
599
599
  modifierFlags = [(NSNumber *)modifiers unsignedIntValue];
600
600
  }
601
601
  NSString *keyValue = [FBKeyboard keyValueForName:item] ?: key;
602
- [destination typeKey:keyValue modifierFlags:modifierFlags];
602
+ [destination typeKey:keyValue modifierFlags:(XCUIKeyModifierFlags)modifierFlags];
603
603
  } else {
604
604
  NSString *message = @"All items of the 'keys' array must be either dictionaries or strings";
605
605
  return FBResponseWithStatus([FBCommandStatus invalidArgumentErrorWithMessage:message
@@ -574,7 +574,7 @@
574
574
  traceback:nil]);
575
575
  }
576
576
  }
577
- NSString *screenshot = [screenshotData base64EncodedStringWithOptions:0];
577
+ NSString *screenshot = [screenshotData base64EncodedStringWithOptions:(NSDataBase64EncodingOptions)0];
578
578
  screenshotData = nil;
579
579
  return FBResponseWithObject(screenshot);
580
580
  }
@@ -139,7 +139,7 @@ const struct FBWDOrientationValues FBWDOrientationValues = {
139
139
  if (orientationValue == nil) {
140
140
  return NO;
141
141
  }
142
- return [[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:orientationValue.integerValue];
142
+ return [[XCUIDevice sharedDevice] fb_setDeviceInterfaceOrientation:(UIDeviceOrientation)orientationValue.integerValue];
143
143
  }
144
144
 
145
145
  + (NSDictionary *)_orientationsMapping
@@ -33,7 +33,7 @@
33
33
  if (nil == screenshotData) {
34
34
  return FBResponseWithStatus([FBCommandStatus unableToCaptureScreenErrorWithMessage:error.description traceback:nil]);
35
35
  }
36
- NSString *screenshot = [screenshotData base64EncodedStringWithOptions:0];
36
+ NSString *screenshot = [screenshotData base64EncodedStringWithOptions:(NSDataBase64EncodingOptions)0];
37
37
  return FBResponseWithObject(screenshot);
38
38
  }
39
39
 
@@ -15,11 +15,11 @@
15
15
  <key>CFBundlePackageType</key>
16
16
  <string>FMWK</string>
17
17
  <key>CFBundleShortVersionString</key>
18
- <string>13.1.0</string>
18
+ <string>13.1.2</string>
19
19
  <key>CFBundleSignature</key>
20
20
  <string>????</string>
21
21
  <key>CFBundleVersion</key>
22
- <string>13.1.0</string>
22
+ <string>13.1.2</string>
23
23
  <key>NSPrincipalClass</key>
24
24
  <string/>
25
25
  </dict>
@@ -46,7 +46,7 @@
46
46
  [videoEncodingInitInvocation setSelector:videoEncodingConstructorSelector];
47
47
  long long codec = self.codec;
48
48
  [videoEncodingInitInvocation setArgument:&codec atIndex:2];
49
- double frameRate = self.fps;
49
+ double frameRate = (double)self.fps;
50
50
  [videoEncodingInitInvocation setArgument:&frameRate atIndex:3];
51
51
  [videoEncodingInitInvocation invokeWithTarget:videoEncodingAllocated];
52
52
  id __unsafe_unretained result;
@@ -39,7 +39,7 @@
39
39
  - (BOOL)startWithError:(NSError **)error
40
40
  {
41
41
  if (![self.listeningSocket acceptOnPort:self.port error:error]) {
42
- return NO;;
42
+ return NO;
43
43
  }
44
44
 
45
45
  return YES;
@@ -117,7 +117,7 @@ NS_ASSUME_NONNULL_END
117
117
  {
118
118
  NSMutableString *value = [NSMutableString stringWithString:self.asString];
119
119
  [value appendFormat:@"%C", character];
120
- self.asString = value.copy;;
120
+ self.asString = value.copy;
121
121
  }
122
122
 
123
123
  - (nullable FBBaseClassChainToken*)followingTokenBasedOn:(unichar)character
@@ -25,6 +25,7 @@ const CGFloat FBMaxCompressionQuality = 1.0f;
25
25
  @interface FBImageProcessor ()
26
26
 
27
27
  @property (nonatomic) NSData *nextImage;
28
+ @property (nonatomic) NSMutableArray<void (^)(NSData *)> *pendingCompletionHandlers;
28
29
  @property (nonatomic, readonly) NSLock *nextImageLock;
29
30
  @property (nonatomic, readonly) dispatch_queue_t scalingQueue;
30
31
  @property (atomic, assign) BOOL isScalingScheduled;
@@ -38,6 +39,7 @@ const CGFloat FBMaxCompressionQuality = 1.0f;
38
39
  self = [super init];
39
40
  if (self) {
40
41
  _nextImageLock = [[NSLock alloc] init];
42
+ _pendingCompletionHandlers = [NSMutableArray array];
41
43
  _scalingQueue = dispatch_queue_create("image.scaling.queue", NULL);
42
44
  _isScalingScheduled = NO;
43
45
  }
@@ -53,6 +55,7 @@ const CGFloat FBMaxCompressionQuality = 1.0f;
53
55
  [FBLogger verboseLog:@"Discarding screenshot"];
54
56
  }
55
57
  self.nextImage = image;
58
+ [self.pendingCompletionHandlers addObject:[completionHandler copy]];
56
59
  BOOL shouldSchedule = !self.isScalingScheduled;
57
60
  if (shouldSchedule) {
58
61
  self.isScalingScheduled = YES;
@@ -62,14 +65,14 @@ const CGFloat FBMaxCompressionQuality = 1.0f;
62
65
  return;
63
66
  }
64
67
 
65
- #pragma clang diagnostic push
66
- #pragma clang diagnostic ignored "-Wcompletion-handler"
67
68
  dispatch_async(self.scalingQueue, ^{
68
69
  while (YES) {
69
70
  @autoreleasepool {
70
71
  [self.nextImageLock lock];
71
72
  NSData *nextImageData = self.nextImage;
72
73
  self.nextImage = nil;
74
+ NSArray<void (^)(NSData *)> *handlers = [self.pendingCompletionHandlers copy];
75
+ [self.pendingCompletionHandlers removeAllObjects];
73
76
  if (nextImageData == nil) {
74
77
  self.isScalingScheduled = NO;
75
78
  [self.nextImageLock unlock];
@@ -80,7 +83,7 @@ const CGFloat FBMaxCompressionQuality = 1.0f;
80
83
  // We do not want this value to be too high because then we get images larger in size than original ones
81
84
  // Although, we also don't want to lose too much of the quality on recompression
82
85
  CGFloat recompressionQuality = MAX(0.9,
83
- MIN(FBMaxCompressionQuality, FBConfiguration.mjpegServerScreenshotQuality / 100.0));
86
+ MIN(FBMaxCompressionQuality, (double)FBConfiguration.mjpegServerScreenshotQuality / 100.0));
84
87
  NSData *thumbnailData = [self.class fixedImageDataWithImageData:nextImageData
85
88
  scalingFactor:scalingFactor
86
89
  uti:UTTypeJPEG
@@ -89,11 +92,13 @@ const CGFloat FBMaxCompressionQuality = 1.0f;
89
92
  // Use it with care. See https://github.com/appium/WebDriverAgent/pull/812
90
93
  fixOrientation:FBConfiguration.mjpegShouldFixOrientation
91
94
  desiredOrientation:nil];
92
- completionHandler(thumbnailData ?: nextImageData);
95
+ NSData *processedImageData = thumbnailData ?: nextImageData;
96
+ for (void (^handler)(NSData *) in handlers) {
97
+ handler(processedImageData);
98
+ }
93
99
  }
94
100
  }
95
101
  });
96
- #pragma clang diagnostic pop
97
102
  }
98
103
 
99
104
  + (nullable NSData *)fixedImageDataWithImageData:(NSData *)imageData
@@ -95,7 +95,7 @@ static NSUInteger FBNormalizedMjpegFramerate(NSUInteger framerate)
95
95
  return;
96
96
  }
97
97
  NSUInteger framerate = FBNormalizedMjpegFramerate(FBConfiguration.mjpegServerFramerate);
98
- uint64_t timerInterval = (uint64_t)(1.0 / framerate * NSEC_PER_SEC);
98
+ uint64_t timerInterval = (uint64_t)(1.0 / (double)framerate * NSEC_PER_SEC);
99
99
  uint64_t timeStarted = clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW);
100
100
  @synchronized (self.listeningClients) {
101
101
  if (0 == self.listeningClients.count) {
@@ -106,7 +106,7 @@ static NSUInteger FBNormalizedMjpegFramerate(NSUInteger framerate)
106
106
 
107
107
  NSError *error;
108
108
  CGFloat compressionQuality = MAX(FBMinCompressionQuality,
109
- MIN(FBMaxCompressionQuality, FBConfiguration.mjpegServerScreenshotQuality / 100.0));
109
+ MIN(FBMaxCompressionQuality, (double)FBConfiguration.mjpegServerScreenshotQuality / 100.0));
110
110
  NSData *screenshotData = [FBScreenshot takeInOriginalResolutionWithScreenID:self.mainScreenID
111
111
  compressionQuality:compressionQuality
112
112
  uti:UTTypeJPEG
@@ -126,7 +126,7 @@ NSString *formatTimeInterval(NSTimeInterval interval) {
126
126
  withDescription:timeoutMsg]
127
127
  buildError:error];
128
128
  }
129
- };
129
+ }
130
130
  if (nil != error && nil != innerError) {
131
131
  *error = innerError;
132
132
  }
@@ -50,8 +50,8 @@ extern NSArray<NSNumber *> *(*XCAXAccessibilityAttributesForStringAttributes)(id
50
50
  */
51
51
  void *FBRetrieveXCTestSymbol(const char *name);
52
52
 
53
- /*! Static constructor that will retrieve XCTest private symbols */
54
- __attribute__((constructor)) void FBLoadXCTestSymbols(void);
53
+ /*! Loads XCTest private symbols. Safe to call multiple times. */
54
+ void FBLoadXCTestSymbols(void);
55
55
 
56
56
  /**
57
57
  Method is used to tranform attribute names into the format, which
@@ -30,41 +30,56 @@ id<XCDebugLogDelegate> (*XCDebugLogger)(void);
30
30
 
31
31
  NSArray<NSNumber *> *(*XCAXAccessibilityAttributesForStringAttributes)(id);
32
32
 
33
- __attribute__((constructor)) void FBLoadXCTestSymbols(void)
33
+ @interface FBXCTestSymbolsLoader : NSObject
34
+ @end
35
+
36
+ @implementation FBXCTestSymbolsLoader
37
+
38
+ + (void)load
39
+ {
40
+ FBLoadXCTestSymbols();
41
+ }
42
+
43
+ @end
44
+
45
+ void FBLoadXCTestSymbols(void)
34
46
  {
35
- NSString *XC_kAXXCAttributeIsVisible = *(NSString*__autoreleasing*)FBRetrieveXCTestSymbol([FB_XCAXAIsVisibleAttributeName UTF8String]);
36
- NSString *XC_kAXXCAttributeIsElement = *(NSString*__autoreleasing*)FBRetrieveXCTestSymbol([FB_XCAXAIsElementAttributeName UTF8String]);
37
-
38
- XCAXAccessibilityAttributesForStringAttributes =
39
- (NSArray<NSNumber *> *(*)(id))FBRetrieveXCTestSymbol("XCAXAccessibilityAttributesForStringAttributes");
40
-
41
- XCSetDebugLogger = (void (*)(id <XCDebugLogDelegate>))FBRetrieveXCTestSymbol("XCSetDebugLogger");
42
- XCDebugLogger = (id<XCDebugLogDelegate>(*)(void))FBRetrieveXCTestSymbol("XCDebugLogger");
43
-
44
- NSArray<NSNumber *> *accessibilityAttributes = XCAXAccessibilityAttributesForStringAttributes(@[XC_kAXXCAttributeIsVisible, XC_kAXXCAttributeIsElement]);
45
- FB_XCAXAIsVisibleAttribute = accessibilityAttributes[0];
46
- FB_XCAXAIsElementAttribute = accessibilityAttributes[1];
47
-
48
- NSCAssert(FB_XCAXAIsVisibleAttribute != nil , @"Failed to retrieve FB_XCAXAIsVisibleAttribute", FB_XCAXAIsVisibleAttribute);
49
- NSCAssert(FB_XCAXAIsElementAttribute != nil , @"Failed to retrieve FB_XCAXAIsElementAttribute", FB_XCAXAIsElementAttribute);
50
-
51
- NSString *XC_kAXXCAttributeMinValue = *(NSString *__autoreleasing *)FBRetrieveXCTestSymbol([FB_XCAXACustomMinValueAttributeName UTF8String]);
52
- NSString *XC_kAXXCAttributeMaxValue = *(NSString *__autoreleasing *)FBRetrieveXCTestSymbol([FB_XCAXACustomMaxValueAttributeName UTF8String]);
53
-
54
- NSString *XC_kAXXCAttributeCustomActions = *(NSString *__autoreleasing *)FBRetrieveXCTestSymbol([FB_XCAXACustomActionsAttributeName UTF8String]);
55
-
56
- NSArray<NSNumber *> *customAttrs = XCAXAccessibilityAttributesForStringAttributes(@[
57
- XC_kAXXCAttributeMinValue,
58
- XC_kAXXCAttributeMaxValue,
59
- XC_kAXXCAttributeCustomActions
60
- ]);
61
- FB_XCAXACustomMinValueAttribute = customAttrs[0];
62
- FB_XCAXACustomMaxValueAttribute = customAttrs[1];
63
- FB_XCAXACustomActionsAttribute = customAttrs[2];
64
-
65
- NSCAssert(FB_XCAXACustomMinValueAttribute != nil, @"Failed to retrieve FB_XCAXACustomMinValueAttribute", FB_XCAXACustomMinValueAttribute);
66
- NSCAssert(FB_XCAXACustomMaxValueAttribute != nil, @"Failed to retrieve FB_XCAXACustomMaxValueAttribute", FB_XCAXACustomMaxValueAttribute);
67
- NSCAssert(FB_XCAXACustomActionsAttribute != nil, @"Failed to retrieve FB_XCAXACustomActionsAttribute", FB_XCAXACustomActionsAttribute);
47
+ static dispatch_once_t loadOnceToken;
48
+ dispatch_once(&loadOnceToken, ^{
49
+ NSString *XC_kAXXCAttributeIsVisible = *(NSString*__autoreleasing*)FBRetrieveXCTestSymbol([FB_XCAXAIsVisibleAttributeName UTF8String]);
50
+ NSString *XC_kAXXCAttributeIsElement = *(NSString*__autoreleasing*)FBRetrieveXCTestSymbol([FB_XCAXAIsElementAttributeName UTF8String]);
51
+
52
+ XCAXAccessibilityAttributesForStringAttributes =
53
+ (NSArray<NSNumber *> *(*)(id))FBRetrieveXCTestSymbol("XCAXAccessibilityAttributesForStringAttributes");
54
+
55
+ XCSetDebugLogger = (void (*)(id <XCDebugLogDelegate>))FBRetrieveXCTestSymbol("XCSetDebugLogger");
56
+ XCDebugLogger = (id<XCDebugLogDelegate>(*)(void))FBRetrieveXCTestSymbol("XCDebugLogger");
57
+
58
+ NSArray<NSNumber *> *accessibilityAttributes = XCAXAccessibilityAttributesForStringAttributes(@[XC_kAXXCAttributeIsVisible, XC_kAXXCAttributeIsElement]);
59
+ FB_XCAXAIsVisibleAttribute = accessibilityAttributes[0];
60
+ FB_XCAXAIsElementAttribute = accessibilityAttributes[1];
61
+
62
+ NSCAssert(FB_XCAXAIsVisibleAttribute != nil , @"Failed to retrieve FB_XCAXAIsVisibleAttribute", FB_XCAXAIsVisibleAttribute);
63
+ NSCAssert(FB_XCAXAIsElementAttribute != nil , @"Failed to retrieve FB_XCAXAIsElementAttribute", FB_XCAXAIsElementAttribute);
64
+
65
+ NSString *XC_kAXXCAttributeMinValue = *(NSString *__autoreleasing *)FBRetrieveXCTestSymbol([FB_XCAXACustomMinValueAttributeName UTF8String]);
66
+ NSString *XC_kAXXCAttributeMaxValue = *(NSString *__autoreleasing *)FBRetrieveXCTestSymbol([FB_XCAXACustomMaxValueAttributeName UTF8String]);
67
+
68
+ NSString *XC_kAXXCAttributeCustomActions = *(NSString *__autoreleasing *)FBRetrieveXCTestSymbol([FB_XCAXACustomActionsAttributeName UTF8String]);
69
+
70
+ NSArray<NSNumber *> *customAttrs = XCAXAccessibilityAttributesForStringAttributes(@[
71
+ XC_kAXXCAttributeMinValue,
72
+ XC_kAXXCAttributeMaxValue,
73
+ XC_kAXXCAttributeCustomActions
74
+ ]);
75
+ FB_XCAXACustomMinValueAttribute = customAttrs[0];
76
+ FB_XCAXACustomMaxValueAttribute = customAttrs[1];
77
+ FB_XCAXACustomActionsAttribute = customAttrs[2];
78
+
79
+ NSCAssert(FB_XCAXACustomMinValueAttribute != nil, @"Failed to retrieve FB_XCAXACustomMinValueAttribute", FB_XCAXACustomMinValueAttribute);
80
+ NSCAssert(FB_XCAXACustomMaxValueAttribute != nil, @"Failed to retrieve FB_XCAXACustomMaxValueAttribute", FB_XCAXACustomMaxValueAttribute);
81
+ NSCAssert(FB_XCAXACustomActionsAttribute != nil, @"Failed to retrieve FB_XCAXACustomActionsAttribute", FB_XCAXACustomActionsAttribute);
82
+ });
68
83
  }
69
84
 
70
85
  void *FBRetrieveXCTestSymbol(const char *name)
@@ -92,18 +92,18 @@ static const int logLevel = GCDAsyncSocketLogLevel;
92
92
 
93
93
  // Logging Disabled
94
94
 
95
- #define LogError(frmt, ...) {}
96
- #define LogWarn(frmt, ...) {}
97
- #define LogInfo(frmt, ...) {}
98
- #define LogVerbose(frmt, ...) {}
95
+ #define LogError(frmt, ...) do {} while (0)
96
+ #define LogWarn(frmt, ...) do {} while (0)
97
+ #define LogInfo(frmt, ...) do {} while (0)
98
+ #define LogVerbose(frmt, ...) do {} while (0)
99
99
 
100
- #define LogCError(frmt, ...) {}
101
- #define LogCWarn(frmt, ...) {}
102
- #define LogCInfo(frmt, ...) {}
103
- #define LogCVerbose(frmt, ...) {}
100
+ #define LogCError(frmt, ...) do {} while (0)
101
+ #define LogCWarn(frmt, ...) do {} while (0)
102
+ #define LogCInfo(frmt, ...) do {} while (0)
103
+ #define LogCVerbose(frmt, ...) do {} while (0)
104
104
 
105
- #define LogTrace() {}
106
- #define LogCTrace(frmt, ...) {}
105
+ #define LogTrace() do {} while (0)
106
+ #define LogCTrace(frmt, ...) do {} while (0)
107
107
 
108
108
  #endif
109
109
 
@@ -251,7 +251,7 @@ static dispatch_queue_t cfstreamThreadSetupQueue; // setup & teardown
251
251
  if ((self = [super init]))
252
252
  {
253
253
  preBufferSize = numBytes;
254
- preBuffer = malloc(preBufferSize);
254
+ preBuffer = (uint8_t *)malloc(preBufferSize);
255
255
 
256
256
  readPointer = preBuffer;
257
257
  writePointer = preBuffer;
@@ -274,7 +274,7 @@ static dispatch_queue_t cfstreamThreadSetupQueue; // setup & teardown
274
274
  size_t additionalBytes = numBytes - availableSpace;
275
275
 
276
276
  size_t newPreBufferSize = preBufferSize + additionalBytes;
277
- uint8_t *newPreBuffer = realloc(preBuffer, newPreBufferSize);
277
+ uint8_t *newPreBuffer = (uint8_t *)realloc(preBuffer, newPreBufferSize);
278
278
 
279
279
  size_t readPointerOffset = readPointer - preBuffer;
280
280
  size_t writePointerOffset = writePointer - preBuffer;
@@ -794,7 +794,7 @@ static dispatch_queue_t cfstreamThreadSetupQueue; // setup & teardown
794
794
  // The implementation of this method is very similar to the above method.
795
795
  // See the above method for a discussion of the algorithm used here.
796
796
 
797
- uint8_t *buff = [buffer mutableBytes];
797
+ uint8_t *buff = (uint8_t *)[buffer mutableBytes];
798
798
  NSUInteger buffLength = bytesDone + numBytes;
799
799
 
800
800
  const void *termBuff = [term bytes];
@@ -8693,7 +8693,7 @@ static void CFWriteStreamCallback (CFWriteStreamRef stream,
8693
8693
  {
8694
8694
  if ([address length] >= sizeof(struct sockaddr))
8695
8695
  {
8696
- const struct sockaddr *sockaddrX = [address bytes];
8696
+ const struct sockaddr *sockaddrX = (const struct sockaddr *)(const void *)[address bytes];
8697
8697
 
8698
8698
  if (sockaddrX->sa_family == AF_INET) {
8699
8699
  return YES;
@@ -8707,7 +8707,7 @@ static void CFWriteStreamCallback (CFWriteStreamRef stream,
8707
8707
  {
8708
8708
  if ([address length] >= sizeof(struct sockaddr))
8709
8709
  {
8710
- const struct sockaddr *sockaddrX = [address bytes];
8710
+ const struct sockaddr *sockaddrX = (const struct sockaddr *)(const void *)[address bytes];
8711
8711
 
8712
8712
  if (sockaddrX->sa_family == AF_INET6) {
8713
8713
  return YES;
@@ -8726,7 +8726,7 @@ static void CFWriteStreamCallback (CFWriteStreamRef stream,
8726
8726
  {
8727
8727
  if ([address length] >= sizeof(struct sockaddr))
8728
8728
  {
8729
- const struct sockaddr *sockaddrX = [address bytes];
8729
+ const struct sockaddr *sockaddrX = (const struct sockaddr *)(const void *)[address bytes];
8730
8730
 
8731
8731
  if (sockaddrX->sa_family == AF_INET)
8732
8732
  {
@@ -70,18 +70,18 @@ static const int logLevel = LOG_LEVEL_VERBOSE;
70
70
 
71
71
  // Logging Disabled
72
72
 
73
- #define LogError(frmt, ...) {}
74
- #define LogWarn(frmt, ...) {}
75
- #define LogInfo(frmt, ...) {}
76
- #define LogVerbose(frmt, ...) {}
73
+ #define LogError(frmt, ...) do {} while (0)
74
+ #define LogWarn(frmt, ...) do {} while (0)
75
+ #define LogInfo(frmt, ...) do {} while (0)
76
+ #define LogVerbose(frmt, ...) do {} while (0)
77
77
 
78
- #define LogCError(frmt, ...) {}
79
- #define LogCWarn(frmt, ...) {}
80
- #define LogCInfo(frmt, ...) {}
81
- #define LogCVerbose(frmt, ...) {}
78
+ #define LogCError(frmt, ...) do {} while (0)
79
+ #define LogCWarn(frmt, ...) do {} while (0)
80
+ #define LogCInfo(frmt, ...) do {} while (0)
81
+ #define LogCVerbose(frmt, ...) do {} while (0)
82
82
 
83
- #define LogTrace() {}
84
- #define LogCTrace(frmt, ...) {}
83
+ #define LogTrace() do {} while (0)
84
+ #define LogCTrace(frmt, ...) do {} while (0)
85
85
 
86
86
  #endif
87
87
 
@@ -4310,12 +4310,12 @@ enum GCDAsyncUdpSocketConfig
4310
4310
 
4311
4311
  if (currentSend->addressFamily == AF_INET)
4312
4312
  {
4313
- result = sendto(socket4FD, buffer, length, 0, dst, dstSize);
4313
+ result = sendto(socket4FD, buffer, length, 0, (const struct sockaddr *)dst, dstSize);
4314
4314
  LogVerbose(@"sendto(socket4FD) = %d", result);
4315
4315
  }
4316
4316
  else
4317
4317
  {
4318
- result = sendto(socket6FD, buffer, length, 0, dst, dstSize);
4318
+ result = sendto(socket6FD, buffer, length, 0, (const struct sockaddr *)dst, dstSize);
4319
4319
  LogVerbose(@"sendto(socket6FD) = %d", result);
4320
4320
  }
4321
4321
  }
@@ -5,27 +5,21 @@
5
5
 
6
6
  DDRange DDUnionRange(DDRange range1, DDRange range2)
7
7
  {
8
- DDRange result;
9
-
10
- result.location = MIN(range1.location, range2.location);
11
- result.length = MAX(DDMaxRange(range1), DDMaxRange(range2)) - result.location;
12
-
13
- return result;
8
+ UInt64 location = MIN(range1.location, range2.location);
9
+ UInt64 length = MAX(DDMaxRange(range1), DDMaxRange(range2)) - location;
10
+
11
+ return DDMakeRange(location, length);
14
12
  }
15
13
 
16
14
  DDRange DDIntersectionRange(DDRange range1, DDRange range2)
17
15
  {
18
- DDRange result;
19
-
20
16
  if((DDMaxRange(range1) < range2.location) || (DDMaxRange(range2) < range1.location))
21
17
  {
22
18
  return DDMakeRange(0, 0);
23
19
  }
24
20
 
25
- result.location = MAX(range1.location, range2.location);
26
- result.length = MIN(DDMaxRange(range1), DDMaxRange(range2)) - result.location;
27
-
28
- return result;
21
+ return DDMakeRange(MAX(range1.location, range2.location),
22
+ MIN(DDMaxRange(range1), DDMaxRange(range2)) - MAX(range1.location, range2.location));
29
23
  }
30
24
 
31
25
  NSString *DDStringFromRange(DDRange range)
@@ -95,28 +95,28 @@
95
95
 
96
96
  // Define logging primitives.
97
97
 
98
- #define HTTPLogError(...) { }
98
+ #define HTTPLogError(...) do {} while (0)
99
99
 
100
- #define HTTPLogWarn(...) { }
100
+ #define HTTPLogWarn(...) do {} while (0)
101
101
 
102
- #define HTTPLogInfo(...) { }
102
+ #define HTTPLogInfo(...) do {} while (0)
103
103
 
104
- #define HTTPLogVerbose(...) { }
104
+ #define HTTPLogVerbose(...) do {} while (0)
105
105
 
106
- #define HTTPLogTrace() { }
106
+ #define HTTPLogTrace() do {} while (0)
107
107
 
108
- #define HTTPLogTrace2(...) { }
108
+ #define HTTPLogTrace2(...) do {} while (0)
109
109
 
110
110
 
111
- #define HTTPLogCError(...) { }
111
+ #define HTTPLogCError(...) do {} while (0)
112
112
 
113
- #define HTTPLogCWarn(...) { }
113
+ #define HTTPLogCWarn(...) do {} while (0)
114
114
 
115
- #define HTTPLogCInfo(...) { }
115
+ #define HTTPLogCInfo(...) do {} while (0)
116
116
 
117
- #define HTTPLogCVerbose(...) { }
117
+ #define HTTPLogCVerbose(...) do {} while (0)
118
118
 
119
- #define HTTPLogCTrace() { }
119
+ #define HTTPLogCTrace() do {} while (0)
120
120
 
121
- #define HTTPLogCTrace2(...) { }
121
+ #define HTTPLogCTrace2(...) do {} while (0)
122
122
 
@@ -68,13 +68,13 @@
68
68
  {
69
69
  // Look for the end of headers (CRLF CRLF or LF LF)
70
70
  NSData *headerEndMarker = [@"\r\n\r\n" dataUsingEncoding:NSASCIIStringEncoding];
71
- NSRange headerEndRange = [_rawData rangeOfData:headerEndMarker options:0 range:NSMakeRange(0, [_rawData length])];
71
+ NSRange headerEndRange = [_rawData rangeOfData:headerEndMarker options:(NSDataSearchOptions)0 range:NSMakeRange(0, [_rawData length])];
72
72
 
73
73
  if (headerEndRange.location == NSNotFound)
74
74
  {
75
75
  // Also check for LF LF (some clients use this)
76
76
  NSData *lfMarker = [@"\n\n" dataUsingEncoding:NSASCIIStringEncoding];
77
- headerEndRange = [_rawData rangeOfData:lfMarker options:0 range:NSMakeRange(0, [_rawData length])];
77
+ headerEndRange = [_rawData rangeOfData:lfMarker options:(NSDataSearchOptions)0 range:NSMakeRange(0, [_rawData length])];
78
78
  }
79
79
 
80
80
  if (headerEndRange.location != NSNotFound)
@@ -149,16 +149,16 @@
149
149
  NSRegularExpression *regex = nil;
150
150
 
151
151
  // Escape regex characters
152
- regex = [NSRegularExpression regularExpressionWithPattern:@"[.+()]" options:0 error:nil];
153
- path = [regex stringByReplacingMatchesInString:path options:0 range:NSMakeRange(0, path.length) withTemplate:@"\\\\$0"];
152
+ regex = [NSRegularExpression regularExpressionWithPattern:@"[.+()]" options:(NSRegularExpressionOptions)0 error:nil];
153
+ path = [regex stringByReplacingMatchesInString:path options:(NSMatchingOptions)0 range:NSMakeRange(0, path.length) withTemplate:@"\\\\$0"];
154
154
 
155
155
  // Parse any :parameters and * in the path
156
156
  regex = [NSRegularExpression regularExpressionWithPattern:@"(:(\\w+)|\\*)"
157
- options:0
157
+ options:(NSRegularExpressionOptions)0
158
158
  error:nil];
159
159
  NSMutableString *regexPath = [NSMutableString stringWithString:path];
160
160
  __block NSInteger diff = 0;
161
- [regex enumerateMatchesInString:path options:0 range:NSMakeRange(0, path.length)
161
+ [regex enumerateMatchesInString:path options:(NSMatchingOptions)0 range:NSMakeRange(0, path.length)
162
162
  usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {
163
163
  NSRange replacementRange = NSMakeRange(diff + result.range.location, result.range.length);
164
164
  NSString *replacementString;
@@ -219,7 +219,7 @@
219
219
  return nil;
220
220
 
221
221
  for (Route *route in methodRoutes) {
222
- NSTextCheckingResult *result = [route.regex firstMatchInString:path options:0 range:NSMakeRange(0, path.length)];
222
+ NSTextCheckingResult *result = [route.regex firstMatchInString:path options:(NSMatchingOptions)0 range:NSMakeRange(0, path.length)];
223
223
  if (!result)
224
224
  continue;
225
225
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "13.1.0",
3
+ "version": "13.1.2",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "main": "./build/lib/index.js",
6
6
  "types": "./build/lib/index.d.ts",
@@ -88,6 +88,7 @@
88
88
  "lib",
89
89
  "build/lib",
90
90
  "Scripts/build.sh",
91
+ "Scripts/embed-runner-icon.sh",
91
92
  "Scripts/*.mjs",
92
93
  "Configurations",
93
94
  "PrivateHeaders",