The way in which dialogs should be handled is configurable by the driver
capabilities object, which we don't support yet. So this implements just
the default mode to dismiss the dialog and return an error if there is
one open.
In the OOPWV, this means we need to refer to the dialog after it has
been open, so we now hold a pointer to whatever dialog is open.
This moves Get Window Handle, Close Window, and Get Window Handles over
to WebContent so they may be implemented closer to the spec and be used
by Ladybird.
Success responses are meant to be wrapped in a JSON object with a single
"value" key. Instead of doing this in both WebContent and WebDriver, do
it once in LibWeb.
There are a couple changes here from the existing Get All Cookies
implementation.
1. Previously, WebDriver actually returned *all* cookies in the cookie
jar. The spec dictates that we only return cookies that match the
document's URL. Specifically, it calls out that we must run just the
first step of RFC 6265 section 5.4 to perform domain matching.
This change adds a special mode to our implementation of that section
to skip the remaining steps.
2. We now fill in the SameSite cookie attribute when serializing the
cookie to JSON (this was a trival FIXME that didn't get picked up
when SameSite was implemented).
This is how WebContent::ConnectionFromClient also behaves. Returning the
element as a DOM::ParentNode isn't quite strict enough for upcoming
endpoints.
Note that this does nothing to "fix" how element references are created.
We continue to return the element ID because, otherwise, all other
element WebDriver endpoints would break.
On the bright side, we avoid several IPC round trips now that we perform
the entire 'find' operation in the WebContent process; and we are able
to work directly on DOM nodes.
This moves setting the navigator.webdriver flag from after WebContent
creates the WebDriver connection, to its own IPC to be triggered from
WebDriver. This is closer to the spec, but mostly serves as an easy
test to validate the connection.
This just sets up the infrastructure for the WebContent process to house
WebDriver IPCs, and adds an IPC for WebContent to create the WebDriver
connection. The WebDriverConnection class inside WebContent ultimately
will contain most of what is currently in WebDriver::Session (so the
copyright attributions are copied here as well).
The socket created by WebDriver is currently /tmp/browser_webdriver
(formatted with some IDs). This will be moved to the /tmp/webdriver
folder, as WebDriver will create multiple sockets to communicate with
both Browser and WebContent as the IPCs are iteratively moved to
WebContent. That path is unveiled here, though it is unused as of this
commit.