@@ -54,9 +54,8 @@ type Frame struct {
54
54
55
55
// A life cycle event is only considered triggered for a frame if the entire
56
56
// frame subtree has also had the life cycle event triggered.
57
- lifecycleEventsMu sync.RWMutex
58
- lifecycleEvents map [LifecycleEvent ]bool
59
- subtreeLifecycleEvents map [LifecycleEvent ]bool
57
+ lifecycleEventsMu sync.RWMutex
58
+ lifecycleEvents map [LifecycleEvent ]bool
60
59
61
60
documentHandle * ElementHandle
62
61
@@ -92,20 +91,19 @@ func NewFrame(
92
91
}
93
92
94
93
return & Frame {
95
- BaseEventEmitter : NewBaseEventEmitter (ctx ),
96
- ctx : ctx ,
97
- page : m .page ,
98
- manager : m ,
99
- parentFrame : parentFrame ,
100
- childFrames : make (map [api.Frame ]bool ),
101
- id : frameID ,
102
- vu : k6ext .GetVU (ctx ),
103
- lifecycleEvents : make (map [LifecycleEvent ]bool ),
104
- subtreeLifecycleEvents : make (map [LifecycleEvent ]bool ),
105
- inflightRequests : make (map [network.RequestID ]bool ),
106
- executionContexts : make (map [executionWorld ]frameExecutionContext ),
107
- currentDocument : & DocumentInfo {},
108
- log : log ,
94
+ BaseEventEmitter : NewBaseEventEmitter (ctx ),
95
+ ctx : ctx ,
96
+ page : m .page ,
97
+ manager : m ,
98
+ parentFrame : parentFrame ,
99
+ childFrames : make (map [api.Frame ]bool ),
100
+ id : frameID ,
101
+ vu : k6ext .GetVU (ctx ),
102
+ lifecycleEvents : make (map [LifecycleEvent ]bool ),
103
+ inflightRequests : make (map [network.RequestID ]bool ),
104
+ executionContexts : make (map [executionWorld ]frameExecutionContext ),
105
+ currentDocument : & DocumentInfo {},
106
+ log : log ,
109
107
}
110
108
}
111
109
@@ -163,7 +161,6 @@ func (f *Frame) clearLifecycle() {
163
161
// clear lifecycle events
164
162
f .lifecycleEventsMu .Lock ()
165
163
f .lifecycleEvents = make (map [LifecycleEvent ]bool )
166
- f .subtreeLifecycleEvents = make (map [LifecycleEvent ]bool )
167
164
f .lifecycleEventsMu .Unlock ()
168
165
169
166
// keep the request related to the document if present
@@ -190,25 +187,6 @@ func (f *Frame) recalculateLifecycle(event LifecycleEvent) {
190
187
f .log .Debugf ("Frame:recalculateLifecycle" , "fid:%s furl:%q" , f .ID (), f .URL ())
191
188
192
189
f .emit (EventFrameAddLifecycle , event )
193
-
194
- // Start with triggered events.
195
- events := make (map [LifecycleEvent ]bool )
196
- f .lifecycleEventsMu .RLock ()
197
- {
198
- for k , v := range f .lifecycleEvents {
199
- events [k ] = v
200
- }
201
- }
202
- f .lifecycleEventsMu .RUnlock ()
203
-
204
- f .lifecycleEventsMu .Lock ()
205
- {
206
- f .subtreeLifecycleEvents = make (map [LifecycleEvent ]bool )
207
- for k , v := range events {
208
- f .subtreeLifecycleEvents [k ] = v
209
- }
210
- }
211
- f .lifecycleEventsMu .Unlock ()
212
190
}
213
191
214
192
func (f * Frame ) detach () {
@@ -331,13 +309,6 @@ func (f *Frame) hasLifecycleEventFired(event LifecycleEvent) bool {
331
309
return f .lifecycleEvents [event ]
332
310
}
333
311
334
- func (f * Frame ) hasSubtreeLifecycleEventFired (event LifecycleEvent ) bool {
335
- f .lifecycleEventsMu .RLock ()
336
- defer f .lifecycleEventsMu .RUnlock ()
337
-
338
- return f .subtreeLifecycleEvents [event ]
339
- }
340
-
341
312
func (f * Frame ) navigated (name string , url string , loaderID string ) {
342
313
f .log .Debugf ("Frame:navigated" , "fid:%s furl:%q lid:%s name:%q url:%q" , f .ID (), f .URL (), loaderID , name , url )
343
314
@@ -1848,7 +1819,7 @@ func (f *Frame) WaitForNavigation(opts goja.Value) *goja.Promise {
1848
1819
// A lifecycle event won't be received when navigating within the same
1849
1820
// document, so don't wait for it. The event might've also already been
1850
1821
// fired once we're here, so also skip waiting in that case.
1851
- if ! sameDocNav && ! f .hasSubtreeLifecycleEventFired (parsedOpts .WaitUntil ) {
1822
+ if ! sameDocNav && ! f .hasLifecycleEventFired (parsedOpts .WaitUntil ) {
1852
1823
select {
1853
1824
case <- lifecycleEvtCh :
1854
1825
case <- timeoutCtx .Done ():
0 commit comments