Skip to content

Commit 485ec25

Browse files
authored
Reapply "feat: add AbortSignal support to client-side Waiter methods" (#41257)
1 parent 50c8c8d commit 485ec25

19 files changed

Lines changed: 320 additions & 109 deletions

File tree

docs/src/api/class-browsercontext.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,7 @@ Receives the [ConsoleMessage] object and resolves to truthy value when the waiti
17131713

17141714
### option: BrowserContext.waitForConsoleMessage.timeout = %%-wait-for-event-timeout-%%
17151715
* since: v1.34
1716+
### option: BrowserContext.waitForConsoleMessage.signal = %%-wait-for-event-signal-%%
17161717

17171718
### param: BrowserContext.waitForConsoleMessage.callback = %%-java-wait-for-event-callback-%%
17181719
* since: v1.34
@@ -1782,6 +1783,7 @@ Either a predicate that receives an event or an options object. Optional.
17821783

17831784
### option: BrowserContext.waitForEvent.timeout = %%-wait-for-event-timeout-%%
17841785
* since: v1.8
1786+
### option: BrowserContext.waitForEvent.signal = %%-wait-for-event-signal-%%
17851787

17861788
## async method: BrowserContext.waitForPage
17871789
* since: v1.9
@@ -1811,6 +1813,7 @@ Receives the [Page] object and resolves to truthy value when the waiting should
18111813

18121814
### option: BrowserContext.waitForPage.timeout = %%-wait-for-event-timeout-%%
18131815
* since: v1.9
1816+
### option: BrowserContext.waitForPage.signal = %%-wait-for-event-signal-%%
18141817

18151818
### param: BrowserContext.waitForPage.callback = %%-java-wait-for-event-callback-%%
18161819
* since: v1.9
@@ -1837,3 +1840,4 @@ Will throw an error if the browser context is closed before the `event` is fired
18371840

18381841
### option: BrowserContext.waitForEvent2.timeout = %%-wait-for-event-timeout-%%
18391842
* since: v1.8
1843+
### option: BrowserContext.waitForEvent2.signal = %%-wait-for-event-signal-%%

docs/src/api/class-frame.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,6 +2010,7 @@ await frame.WaitForLoadStateAsync(); // Defaults to LoadState.Load
20102010

20112011
### option: Frame.waitForLoadState.timeout = %%-navigation-timeout-js-%%
20122012
* since: v1.8
2013+
### option: Frame.waitForLoadState.signal = %%-wait-for-event-signal-%%
20132014

20142015
## async method: Frame.waitForNavigation
20152016
* since: v1.8
@@ -2093,6 +2094,7 @@ a navigation.
20932094

20942095
### option: Frame.waitForNavigation.timeout = %%-navigation-timeout-js-%%
20952096
* since: v1.8
2097+
### option: Frame.waitForNavigation.signal = %%-wait-for-event-signal-%%
20962098

20972099
### param: Frame.waitForNavigation.callback = %%-java-wait-for-event-callback-%%
20982100
* since: v1.9
@@ -2289,6 +2291,7 @@ await frame.WaitForURLAsync("**/target.html");
22892291

22902292
### option: Frame.waitForURL.timeout = %%-navigation-timeout-js-%%
22912293
* since: v1.11
2294+
### option: Frame.waitForURL.signal = %%-wait-for-event-signal-%%
22922295

22932296
### option: Frame.waitForURL.waitUntil = %%-navigation-wait-until-%%
22942297
* since: v1.11

docs/src/api/class-page.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4507,6 +4507,7 @@ Performs action and waits for the Page to close.
45074507

45084508
### option: Page.waitForClose.timeout = %%-wait-for-event-timeout-%%
45094509
* since: v1.9
4510+
### option: Page.waitForClose.signal = %%-wait-for-event-signal-%%
45104511

45114512
### param: Page.waitForClose.callback = %%-java-wait-for-event-callback-%%
45124513
* since: v1.9
@@ -4538,6 +4539,7 @@ Receives the [ConsoleMessage] object and resolves to truthy value when the waiti
45384539

45394540
### option: Page.waitForConsoleMessage.timeout = %%-wait-for-event-timeout-%%
45404541
* since: v1.9
4542+
### option: Page.waitForConsoleMessage.signal = %%-wait-for-event-signal-%%
45414543

45424544
### param: Page.waitForConsoleMessage.callback = %%-java-wait-for-event-callback-%%
45434545
* since: v1.9
@@ -4569,6 +4571,7 @@ Receives the [Download] object and resolves to truthy value when the waiting sho
45694571

45704572
### option: Page.waitForDownload.timeout = %%-wait-for-event-timeout-%%
45714573
* since: v1.9
4574+
### option: Page.waitForDownload.signal = %%-wait-for-event-signal-%%
45724575

45734576
### param: Page.waitForDownload.callback = %%-java-wait-for-event-callback-%%
45744577
* since: v1.9
@@ -4625,6 +4628,7 @@ Either a predicate that receives an event or an options object. Optional.
46254628

46264629
### option: Page.waitForEvent.timeout = %%-wait-for-event-timeout-%%
46274630
* since: v1.8
4631+
### option: Page.waitForEvent.signal = %%-wait-for-event-signal-%%
46284632

46294633
## async method: Page.waitForFileChooser
46304634
* since: v1.9
@@ -4653,6 +4657,7 @@ Receives the [FileChooser] object and resolves to truthy value when the waiting
46534657

46544658
### option: Page.waitForFileChooser.timeout = %%-wait-for-event-timeout-%%
46554659
* since: v1.9
4660+
### option: Page.waitForFileChooser.signal = %%-wait-for-event-signal-%%
46564661

46574662
### param: Page.waitForFileChooser.callback = %%-java-wait-for-event-callback-%%
46584663
* since: v1.9
@@ -4890,6 +4895,7 @@ Console.WriteLine(await popup.TitleAsync()); // popup is ready to use.
48904895

48914896
### option: Page.waitForLoadState.timeout = %%-navigation-timeout-js-%%
48924897
* since: v1.8
4898+
### option: Page.waitForLoadState.signal = %%-wait-for-event-signal-%%
48934899

48944900
## async method: Page.waitForNavigation
48954901
* since: v1.8
@@ -4976,6 +4982,7 @@ a navigation.
49764982

49774983
### option: Page.waitForNavigation.timeout = %%-navigation-timeout-js-%%
49784984
* since: v1.8
4985+
### option: Page.waitForNavigation.signal = %%-wait-for-event-signal-%%
49794986

49804987
### param: Page.waitForNavigation.callback = %%-java-wait-for-event-callback-%%
49814988
* since: v1.9
@@ -5007,6 +5014,7 @@ Receives the [Page] object and resolves to truthy value when the waiting should
50075014

50085015
### option: Page.waitForPopup.timeout = %%-wait-for-event-timeout-%%
50095016
* since: v1.9
5017+
### option: Page.waitForPopup.signal = %%-wait-for-event-signal-%%
50105018

50115019
### param: Page.waitForPopup.callback = %%-java-wait-for-event-callback-%%
50125020
* since: v1.9
@@ -5116,6 +5124,8 @@ Request URL string, regex or predicate receiving [Request] object.
51165124
Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be
51175125
changed by using the [`method: Page.setDefaultTimeout`] method.
51185126

5127+
### option: Page.waitForRequest.signal = %%-wait-for-event-signal-%%
5128+
51195129
### param: Page.waitForRequest.callback = %%-java-wait-for-event-callback-%%
51205130
* since: v1.9
51215131

@@ -5146,6 +5156,7 @@ Receives the [Request] object and resolves to truthy value when the waiting shou
51465156

51475157
### option: Page.waitForRequestFinished.timeout = %%-wait-for-event-timeout-%%
51485158
* since: v1.12
5159+
### option: Page.waitForRequestFinished.signal = %%-wait-for-event-signal-%%
51495160

51505161
### param: Page.waitForRequestFinished.callback = %%-java-wait-for-event-callback-%%
51515162
* since: v1.12
@@ -5262,6 +5273,8 @@ it gets merged via the [`new URL()`](https://developer.mozilla.org/en-US/docs/We
52625273
Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be
52635274
changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.
52645275

5276+
### option: Page.waitForResponse.signal = %%-wait-for-event-signal-%%
5277+
52655278
### param: Page.waitForResponse.callback = %%-java-wait-for-event-callback-%%
52665279
* since: v1.9
52675280

@@ -5513,6 +5526,7 @@ await page.WaitForURLAsync("**/target.html");
55135526

55145527
### option: Page.waitForURL.timeout = %%-navigation-timeout-js-%%
55155528
* since: v1.11
5529+
### option: Page.waitForURL.signal = %%-wait-for-event-signal-%%
55165530

55175531
### option: Page.waitForURL.waitUntil = %%-navigation-wait-until-%%
55185532
* since: v1.11
@@ -5544,6 +5558,7 @@ Receives the [WebSocket] object and resolves to truthy value when the waiting sh
55445558

55455559
### option: Page.waitForWebSocket.timeout = %%-wait-for-event-timeout-%%
55465560
* since: v1.9
5561+
### option: Page.waitForWebSocket.signal = %%-wait-for-event-signal-%%
55475562

55485563
### param: Page.waitForWebSocket.callback = %%-java-wait-for-event-callback-%%
55495564
* since: v1.9
@@ -5575,6 +5590,7 @@ Receives the [Worker] object and resolves to truthy value when the waiting shoul
55755590

55765591
### option: Page.waitForWorker.timeout = %%-wait-for-event-timeout-%%
55775592
* since: v1.9
5593+
### option: Page.waitForWorker.signal = %%-wait-for-event-signal-%%
55785594

55795595
### param: Page.waitForWorker.callback = %%-java-wait-for-event-callback-%%
55805596
* since: v1.9
@@ -5612,3 +5628,4 @@ Will throw an error if the page is closed before the `event` is fired.
56125628

56135629
### option: Page.waitForEvent2.timeout = %%-wait-for-event-timeout-%%
56145630
* since: v1.8
5631+
### option: Page.waitForEvent2.signal = %%-wait-for-event-signal-%%

docs/src/api/class-websocket.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ Either a predicate that receives an event or an options object. Optional.
9797

9898
### option: WebSocket.waitForEvent.timeout = %%-wait-for-event-timeout-%%
9999
* since: v1.8
100+
### option: WebSocket.waitForEvent.signal = %%-wait-for-event-signal-%%
100101

101102
## async method: WebSocket.waitForFrameReceived
102103
* since: v1.10
@@ -115,6 +116,7 @@ Receives the [WebSocketFrame] object and resolves to truthy value when the waiti
115116

116117
### option: WebSocket.waitForFrameReceived.timeout = %%-wait-for-event-timeout-%%
117118
* since: v1.9
119+
### option: WebSocket.waitForFrameReceived.signal = %%-wait-for-event-signal-%%
118120

119121
### param: WebSocket.waitForFrameReceived.callback = %%-java-wait-for-event-callback-%%
120122
* since: v1.9
@@ -136,6 +138,7 @@ Receives the [WebSocketFrame] object and resolves to truthy value when the waiti
136138

137139
### option: WebSocket.waitForFrameSent.timeout = %%-wait-for-event-timeout-%%
138140
* since: v1.9
141+
### option: WebSocket.waitForFrameSent.signal = %%-wait-for-event-signal-%%
139142

140143
### param: WebSocket.waitForFrameSent.callback = %%-java-wait-for-event-callback-%%
141144
* since: v1.9
@@ -162,3 +165,4 @@ Will throw an error if the socket is closed before the `event` is fired.
162165

163166
### option: WebSocket.waitForEvent2.timeout = %%-wait-for-event-timeout-%%
164167
* since: v1.8
168+
### option: WebSocket.waitForEvent2.signal = %%-wait-for-event-signal-%%

docs/src/api/class-worker.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ Performs action and waits for the Worker to close.
126126

127127
### option: Worker.waitForClose.timeout = %%-wait-for-event-timeout-%%
128128
* since: v1.9
129+
### option: Worker.waitForClose.signal = %%-wait-for-event-signal-%%
129130

130131
### param: Worker.waitForClose.callback = %%-java-wait-for-event-callback-%%
131132
* since: v1.9
@@ -145,6 +146,7 @@ Receives the [ConsoleMessage] object and resolves to true when the waiting shoul
145146

146147
### option: Worker.waitForConsoleMessage.timeout = %%-wait-for-event-timeout-%%
147148
* since: v1.57
149+
### option: Worker.waitForConsoleMessage.signal = %%-wait-for-event-signal-%%
148150

149151
### param: Worker.waitForConsoleMessage.callback = %%-java-wait-for-event-callback-%%
150152
* since: v1.57
@@ -203,3 +205,4 @@ Either a predicate that receives an event or an options object. Optional.
203205

204206
### option: Worker.waitForEvent.timeout = %%-wait-for-event-timeout-%%
205207
* since: v1.57
208+
### option: Worker.waitForEvent.signal = %%-wait-for-event-signal-%%

docs/src/api/params.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,14 @@ Receives the event data and resolves to truthy value when the waiting should res
991991
Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout.
992992
The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`].
993993

994+
## wait-for-event-signal
995+
* langs: js
996+
* since: v1.61
997+
- `signal` <[AbortSignal]>
998+
999+
Allows to cancel the waiting using an [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal). If the signal is aborted, the waiting will be aborted and the operation will throw an error.
1000+
Note that providing a signal does not disable the default timeout; pass `timeout: 0` to disable the timeout entirely.
1001+
9941002
## android-timeout
9951003
* langs: js
9961004
- `timeout` <[float]>

0 commit comments

Comments
 (0)