If we receive an updated frame ensure we reset cur if required.

Prior to this change `cur` can be stale, meaning the frame returned for
`WaitFrame(ctxt, cdptypes.EmptyFrameID)` will be out of date, and never updated
based on incoming events.
This commit is contained in:
Rob Holland 2017-05-08 13:36:03 +01:00 committed by Kenneth Shaw
parent 622bb2ac33
commit 68bf958ce3

View File

@ -524,6 +524,9 @@ func (h *TargetHandler) pageEvent(ctxt context.Context, ev interface{}) {
case *page.EventFrameNavigated:
h.Lock()
h.frames[e.Frame.ID] = e.Frame
if h.cur != nil && h.cur.ID == e.Frame.ID {
h.cur = e.Frame
}
h.Unlock()
return