While checking for hittarget, we first bubble from a target element
up to find the first element without `pointer-events: none` style.
This bubbling does not make much sense: we risk desperately clicking
"body" element, when we were actually asked to click some deeply-nested
"span".
Additionally, in many cases the original intent is to click a button. In this
case, we should use the enclosing "button" as a hit target directly.
Fixes#2175
When a parent session is detached, we do not always get Target.detachedFromTarget
for child sessions. This is especially true when the socket disconnects, leaving
all child sessions in the maps.
Flakily reproducible by browserType.connect multiclient tests.
Main request for an OOPIF starts in the parent session, and the oopif
session is create only after the response has been received. Therefore,
we should adopt the request after oopif session is created.
These requests are usually internal ones, and we can safely abort them.
An example would be DevTools loading cached resources to show the content.
There will never be a matching Network.requestWillBeSent event, so we do not
report them to the user.
This is a speculative fix to the following issue from the bots:
NON-TEST ERROR #0: UNHANDLED ERROR
TypeError: Cannot read property 'url' of undefined
at WKPage._onTargetCreated (/Users/runner/runners/2.169.1/work/playwright/playwright/src/webkit/wkPage.ts:274:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
I assume that _initializeSession did swallow an error, so we erroneously
consider Page to be fully initialized (and having main frame).
When capturing a screenshot with null viewport, we determine the screenshot size
based on body.offsetHeight. This is a very large number for long pages. We should
use window.innerHeight instead.
Since we are recommending Promise.all pattern anyway, this special
logic just adds to the possibility of timeout if something goes wrong.
For example, Firefox sometimes send Page.willOpenNewWindowAsynchronously
later than the new target arrives and input action just hangs.
We throw an exception and then gracefully close the browser.
If something went wrong, we should timeout before the test times out,
kill the process and report the original exception.