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.
We are expected to return the list of open handles after closing the
current handle. Also just return a WebDriver::Response instead of a
wrapped Error variant.
WebDriver now only has an IPC connection to WebContent. WebDriver still
launches the browser, but now when the session ends, we simply send a
SIGTERM signal to the browser.
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).
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.
First, this moves the WebDriver socket to the /tmp/websocket/ directory,
as WebDriver now creates multiple sockets per session. Those sockets are
now created with Core::LocalServer rather than manually setting up the
listening sockets (this was an existing FIXME which resolved some issues
I was hitting with creating a second listening socket).
WebDriver passes both socket paths to Browser via command line. Browser
continues to connect itself via one socket path, then forwards the other
socket path to the WebContent process created by the OOPWV. WebContent
then connects to WebDriver over this path.
WebContent will temporarily set the navigator.webdriver flag to true
after connecting to WebDriver. This will soon be moved to its own IPC to
be sent by WebDriver.
This is essentially an ErrorOr<JsonValue, Web::WebDriver::Error> class.
Unfortunately, that ErrorOr would not be default-constructible, which is
required for the generated IPC classes. So this is a thin wrapper around
a Variant<JsonValue, Web::WebDriver::Error> to emulate ErrorOr.
Instead of verbosely repeating the NOTE and to_int() checks, move this
step to a helper. When we have real connected elements, we can then just
fix this helper.