appium-webdriveragent 16.0.3 → 16.1.0

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [16.1.0](https://github.com/appium/WebDriverAgent/compare/v16.0.3...v16.1.0) (2026-07-30)
2
+
3
+ ### Features
4
+
5
+ * Add callback for server startup failure ([#1192](https://github.com/appium/WebDriverAgent/issues/1192)) ([3a80439](https://github.com/appium/WebDriverAgent/commit/3a80439603a45321ad8d238186b6327bb2599a8b))
6
+
1
7
  ## [16.0.3](https://github.com/appium/WebDriverAgent/compare/v16.0.2...v16.0.3) (2026-07-28)
2
8
 
3
9
  ### Miscellaneous Chores
@@ -15,11 +15,11 @@
15
15
  <key>CFBundlePackageType</key>
16
16
  <string>FMWK</string>
17
17
  <key>CFBundleShortVersionString</key>
18
- <string>16.0.3</string>
18
+ <string>16.1.0</string>
19
19
  <key>CFBundleSignature</key>
20
20
  <string>????</string>
21
21
  <key>CFBundleVersion</key>
22
- <string>16.0.3</string>
22
+ <string>16.1.0</string>
23
23
  <key>NSPrincipalClass</key>
24
24
  <string/>
25
25
  </dict>
@@ -24,7 +24,11 @@ NS_ASSUME_NONNULL_BEGIN
24
24
  @property (weak, nonatomic) id<FBWebServerDelegate> delegate;
25
25
 
26
26
  /**
27
- Starts WebDriverAgent service by booting HTTP and USB server
27
+ Starts WebDriverAgent service by booting HTTP and USB server.
28
+ If the HTTP server fails to bind (for example the whole configured port range
29
+ is already occupied), the failure is reported to the delegate via
30
+ `webServer:didFailToStartWithError:`. If the delegate does not implement that
31
+ method the process is aborted, as before.
28
32
  */
29
33
  - (void)startServing;
30
34
 
@@ -47,6 +51,18 @@ NS_ASSUME_NONNULL_BEGIN
47
51
  */
48
52
  - (void)webServerDidRequestShutdown:(FBWebServer *)webServer;
49
53
 
54
+ @optional
55
+ /**
56
+ Called when the server failed to start the HTTP listener, for example because
57
+ none of the ports in the configured binding range could be bound.
58
+ If this method is not implemented by the delegate then the process is aborted,
59
+ preserving the previous behavior.
60
+
61
+ @param webServer Server instance.
62
+ @param error The actual error, that caused the server startup to fail.
63
+ */
64
+ - (void)webServer:(FBWebServer *)webServer didFailToStartWithError:(NSError *)error;
65
+
50
66
  @end
51
67
 
52
68
  NS_ASSUME_NONNULL_END
@@ -81,7 +81,9 @@ static NSString *const FBServerURLEndMarker = @"<-ServerURLHere";
81
81
  {
82
82
  [FBLogger logFmt:@"Built at %s %s", __DATE__, __TIME__];
83
83
  self.exceptionHandler = [FBExceptionHandler new];
84
- [self startHTTPServer];
84
+ if (![self startHTTPServer]) {
85
+ return;
86
+ }
85
87
  [self initScreenshotsBroadcaster];
86
88
 
87
89
  self.keepAlive = YES;
@@ -90,7 +92,7 @@ static NSString *const FBServerURLEndMarker = @"<-ServerURLHere";
90
92
  [runLoop runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]);
91
93
  }
92
94
 
93
- - (void)startHTTPServer
95
+ - (BOOL)startHTTPServer
94
96
  {
95
97
  self.server = [[RoutingHTTPServer alloc] init];
96
98
  [self.server setRouteQueue:dispatch_get_main_queue()];
@@ -126,11 +128,16 @@ static NSString *const FBServerURLEndMarker = @"<-ServerURLHere";
126
128
 
127
129
  if (!serverStarted) {
128
130
  [FBLogger logFmt:@"Last attempt to start web server failed with error %@", [error description]];
131
+ if ([self.delegate respondsToSelector:@selector(webServer:didFailToStartWithError:)]) {
132
+ [self.delegate webServer:self didFailToStartWithError:(NSError * _Nonnull)error];
133
+ return NO;
134
+ }
129
135
  abort();
130
136
  }
131
137
 
132
138
  NSString *serverHost = bindingIP ?: ([XCUIDevice sharedDevice].fb_wifiIPAddress ?: @"127.0.0.1");
133
139
  [FBLogger logFmt:@"%@http://%@:%d%@", FBServerURLBeginMarker, serverHost, [self.server port], FBServerURLEndMarker];
140
+ return YES;
134
141
  }
135
142
 
136
143
  - (void)initScreenshotsBroadcaster
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "16.0.3",
3
+ "version": "16.1.0",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "keywords": [
6
6
  "Appium",