chore: refactor waiting for lifecycle events (#2851)
chore: refactor waiting for lifecycle events (#2851)

Instead of checking lifecycle events on every change, we
notify precisely when lifecycle event in the subtree
is satisfied. This allows FrameTask to be later switched
to event-based approach, and will easily translate to the
rpc client.
microsoft/playwright,microsoft/playwright,microsoft/playwright,microsoft/playwright,microsoft/playwright,microsoft/playwright,microsoft/playwright,microsoft/playwright,microsoft/playwright