Commit graph

157 commits

Author SHA1 Message Date
Timothy Flynn
5385cb1287 LibWeb+WebContentr+WebDriver: Move driver response wrapping to LibWeb
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.
2022-11-13 16:41:07 +00:00
Timothy Flynn
2c3ff6bb74 WebDriver: Port the WebDriver client to be a Web::WebDriver::Client 2022-11-13 16:41:07 +00:00
Timothy Flynn
47493b5734 WebDriver: Implement Close Window closer to the spec
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.
2022-11-13 16:41:07 +00:00
Tobias Christiansen
1aa16b4dd4 WebDriver: Implement POST /session/{id}/window/fullscreen endpoint 2022-11-12 12:12:05 +00:00
Timothy Flynn
04f41bda52 WebContent+WebDriver: Move Get/Set Timeouts to WebContent 2022-11-11 22:03:23 +00:00
Timothy Flynn
cb4b9108d1 LibWeb+WebDriver: Move the timeouts configuration object to LibWeb 2022-11-11 22:03:23 +00:00
Timothy Flynn
7972916be7 Browser+WebDriver: Remove the connection between Browser and WebDriver
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.
2022-11-11 22:03:23 +00:00
Timothy Flynn
c64da0d00c Browser+WebDriver: Add missing header includes
These are currently being included transitively, and will cause an error
when those intermediate includes are removed.
2022-11-11 22:03:23 +00:00
Timothy Flynn
2c9549cb76 Browser+WebContent+WebDriver: Move Get Title to WebContent 2022-11-11 22:03:23 +00:00
Timothy Flynn
7f142745e2 Browser+WebContent+WebDriver: Move Back, Forward, Refresh to WebContent 2022-11-11 22:03:23 +00:00
Timothy Flynn
ff6055e0a3 Browser+WebContent+WebDriver: Move Delete All Cookies to WebContent 2022-11-11 18:02:04 +00:00
Timothy Flynn
b7f21bb92e Browser+WebContent+WebDriver: Move Delete Cookie to WebContent 2022-11-11 18:02:04 +00:00
Timothy Flynn
18abc6c85d Browser+WebContent+WebDriver: Move Add Cookie to WebContent
The new implementation is made a bit simpler by way of TRY. It also
implements setting the SameSite attribute.
2022-11-11 18:02:04 +00:00
Timothy Flynn
a3d6c2f6af Browser+WebContent+WebDriver: Move Get Named Cookie to WebContent
Instead of sending *all* cookies over IPC and filtering by name, we now
filter by name from the cookie jar and send just the first matching
cookie.
2022-11-11 18:02:04 +00:00
Timothy Flynn
c77260c480 Browser+WebContent+WebDriver: Move Get All Cookies to WebContent
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).
2022-11-11 18:02:04 +00:00
Timothy Flynn
31469ee45a Browser+WebContent+WebDriver: Move Execute Async Script to WebContent
With this, WebDriverEndpoints is unused and removed :^)
2022-11-11 11:36:07 +00:00
Timothy Flynn
0b9803dc93 WebContent+WebDriver: Move Execute Script to WebContent 2022-11-11 11:36:07 +00:00
Timothy Flynn
88dcdf681f Browser+WebContent+WebDriver: Move Get Page Source to WebContent 2022-11-11 11:36:07 +00:00
Timothy Flynn
ea0561a0b3 Browser+WebContent+WebDriver: Move Take Element Screenshot to WebContent 2022-11-11 11:36:07 +00:00
Timothy Flynn
de1e882601 Browser+WebContent+WebDriver: Move Take Screenshot to WebContent 2022-11-11 11:36:07 +00:00
Timothy Flynn
93e14799c5 Browser+WebContent+WebDriver: Move Is Element Enabled to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
30d6a73d0e Browser+WebContent+WebDriver: Move Get Element Rect to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
9dd62228c8 Browser+WebContent+WebDriver: Move Get Element Tag Name to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
5d32fd7026 Browser+WebContent+WebDriver: Move Get Element Text to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
06f1b8825c Browser+WebContent+WebDriver: Move Get Element CSS Value to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
3c00d0e92b Browser+WebContent+WebDriver: Move Get Element Property to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
1bc94e135f Browser+WebContent+WebDriver: Move Get Element Attribute to WebContent
In doing so, this also implements a FIXME to handle boolean attributes.
2022-11-10 17:02:11 +00:00
Timothy Flynn
04ea3992e9 Browser+WebContent+WebDriver: Move Is Element Selected to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
560da56a1d Browser+WebContent+WebDriver: Move Find Elements From Element to WC
This also lets us remove the element location strategy and some
WebContent IPC from Browser/LibWebView now that they are unused.
2022-11-10 13:10:16 +00:00
Timothy Flynn
5a750dc58c WebContent+WebDriver: Move Find Element From Element to WebContent 2022-11-10 13:10:16 +00:00
Timothy Flynn
6dca784fc4 WebContent+WebDriver: Move Find Elements to WebContent 2022-11-10 13:10:16 +00:00
Timothy Flynn
61de50c7fd WebContent+WebDriver: Move Find Element to WebContent
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.
2022-11-10 13:10:16 +00:00
Timothy Flynn
03d0c7a5b6 Browser+WebContent+WebDriver: Move [Max,Min]imize Window to WebContent
This also lets us more fully implement the "iconify the window" method,
which requires we block until the document reaches the "hidden" state.
2022-11-09 19:59:26 +00:00
Timothy Flynn
b57d7e4332 Browser+WebContent+WebDriver: Move Get/Set Window Rect to WebContent
This also lets us more fully implement the "restore the window" method,
which requires we block until the document reaches the "visible" state.
2022-11-09 19:59:26 +00:00
Nico Weber
6911c5545c Everywhere: Fix a few comment typos 2022-11-09 16:00:32 +00:00
Timothy Flynn
cc78a74c51 WebContent+WebDriver: Fully implement closing a session
There were a couple steps missing to close the remote end. Further, we
were not removing the session from the list of active sessions.
2022-11-08 19:58:34 -05:00
Timothy Flynn
3ba6b5a7cb WebContent+WebDriver: Move the Get Current URL command to WebContent 2022-11-08 19:58:34 -05:00
Timothy Flynn
31bb79295d WebContent+WebDriver: Move the Navigate To command to WebContent 2022-11-08 19:58:34 -05:00
Timothy Flynn
f7c212a19d WebContent+WebDriver: Set the navigator.webdriver flag from WebDriver
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.
2022-11-08 19:58:34 -05:00
Timothy Flynn
50ae1ad18a Browser+LibWebView+WebDriver: Connect WebDriver to WebContent
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.
2022-11-08 19:58:34 -05:00
Timothy Flynn
8ae10ba0fd LibWeb+WebDriver: Add an IPC-transferable Web::WebDriver::Response class
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.
2022-11-08 19:58:34 -05:00
Timothy Flynn
0246abec80 LibWeb+WebDriver: Move WebDriverError to Web::WebDriver::Error
This is to prepare for WebContent becoming the WebDriver client.
2022-11-08 19:58:34 -05:00
Timothy Flynn
b0eb45f7c7 WebDriver+Browser: Implement GET /session/{id}/element/{id}/screenshot 2022-11-05 01:10:03 +00:00
Timothy Flynn
2d75229192 WebDriver+Browser: Implement GET /session/{id}/element/{id}/selected 2022-11-03 19:40:43 -04:00
Timothy Flynn
d907fb304e WebDriver: Pass StringView by value
See: 8b1108e485.
2022-11-03 19:40:43 -04:00
Timothy Flynn
92cb67522d WebDriver: Consolidate getting a known connected element to a helper
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.
2022-11-03 19:40:43 -04:00
Timothy Flynn
0f2b4d0aac WebDriver+Browser: Implement GET /session/{id}/element/{id}/enabled 2022-11-03 19:15:43 +00:00
Timothy Flynn
08c687ef20 WebDriver+Browser: Implement GET /session/{id}/element/{id}/rect 2022-11-03 19:15:43 +00:00
Timothy Flynn
a490bca29b WebDriver: Rename serialize_window_rect to serialize_rect
This won't only be used for "Window" rects.
2022-11-03 19:15:43 +00:00
Timothy Flynn
61d0b66bfb WebDriver+Browser: Implement GET /session/{id}/source 2022-11-03 14:48:04 +00:00