summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/WebDriver
AgeCommit message (Collapse)Author
2023-05-09AK: Remove `must_set()` from `JsonArray`Kemal Zebari
Due to 582c55a, both `must_set()` and `set()` should be providing the same behavior. Not only is that a reason to remove `must_set()`, but it also performs erroneous behavior since it inserts an element at a specified index instead of modifying an element at that index.
2023-04-24AK: Add new failable `JsonArray::{append/set}` functionsCameron Youell
Move all old usages to the more explicit `JsonArray:must_{append/set}`
2023-04-20LibWeb/WebDriver: Handle WindowProxy in internal_json_clone_algorithm()Linus Groh
To test: ```console curl http://0.0.0.0:8000/session \ -H 'Content-Type: application/json' \ -d '{"capabilities": {}}' curl http://0.0.0.0:8000/session/0/execute/sync \ -H 'Content-Type: application/json' \ -d '{"script": "return window;", "args": []}' ``` Which should result in: ```json { "value": { "window-fcc6-11e5-b4f8-330a88ab9d7f": "86307df6-e2f1-4175-85cb-77295ff90898" } } ```
2023-04-13LibJS: Make intrinsics getters return NonnullGCPtrLinus Groh
Some of these are allocated upon initialization of the intrinsics, and some lazily, but in neither case the getters actually return a nullptr. This saves us a whole bunch of pointer dereferences (as NonnullGCPtr has an `operator T&()`), and also has the interesting side effect of forcing us to explicitly use the FunctionObject& overload of call(), as passing a NonnullGCPtr is ambigous - it could implicitly be turned into a Value _or_ a FunctionObject& (so we have to dereference manually).
2023-03-26LibWeb/WebDriver: Wait for more data to arrive if request is incompleteAliaksandr Kalenik
Currently significant portion of requests coming to WebDriver server fails with error while parsing json body because requests are parsed when they are not complete yet. This change solves this by waiting for more data to arrive if HTTP request parser found that there is not enough data yet to parse the whole request. In the future we would probably want to move this logic to LibHTTP because this problem is relevant for any HTTP server.
2023-03-26LibHTTP+WebDriver+WebServer: Return error from HTTP request parserAliaksandr Kalenik
2023-03-19LibWeb: Add keep-alive in response headers if it present in requestAliaksandr Kalenik
This fix addresses issue where, if request headers contain "Connection: keep-alive", we keep socket open without letting client know that we support keep-alive connections. This can result in a large number of open and unused sockets.
2023-03-16LibWeb+WebContent+WebDriver: Add WebDriver endpoint to open new windowAliaksandr Kalenik
2023-03-15LibJS+LibWeb: Wrap raw JS::Cell*/& fields in GCPtr/NonnullGCPtrMatthew Olsson
2023-03-13WebDriver: Fix typo in browser capabilities key parsingTimothy Flynn
2023-03-13Everywhere: Remove unintentional partial stream reads and writesTim Schumacher
2023-03-13AK: Rename Stream::{read,write} to Stream::{read_some,write_some}Tim Schumacher
Similar to POSIX read, the basic read and write functions of AK::Stream do not have a lower limit of how much data they read or write (apart from "none at all"). Rename the functions to "read some [data]" and "write some [data]" (with "data" being omitted, since everything here is reading and writing data) to make them sufficiently distinct from the functions that ensure to use the entire buffer (which should be the go-to function for most usages). No functional changes, just a lot of new FIXMEs.
2023-03-11WebDriver: Fix crash in async execute script endpointAliaksandr Kalenik
Removal of dummy execution context in 9aca54091a53b5b287096311a6bbcfdd21f42d2f caused a crash in `execute_async_script` because of empty execution contexts stack during `create_resolving_functions` call.
2023-03-10Everywhere: Rename equals_ignoring_case => equals_ignoring_ascii_caseAndreas Kling
Let's make it clear that these functions deal with ASCII case only.
2023-03-09AK: Remove infallible version of StringBuilder::to_byte_bufferLinus Groh
Also drop the try_ prefix from the fallible function, as it is no longer needed to distinguish the two.
2023-03-09LibWeb: Use fallible version of StringBuilder::to_byte_bufferKarol Baraniecki
2023-03-07LibWeb: Mark Web::WebDriver::Response as [[nodiscard]]Timothy Flynn
2023-03-05LibWeb+WebContent+WebDriver: Port WebDriver parameters to StringTimothy Flynn
This changes the parameters parsed from a WebDriver HTTP request to String for transferring over IPC. Conveniently, most locations these were ultimately passed to only need a StringView.
2023-03-05LibWeb: Allow constructing a WebDriver::Error from an OOM AK::ErrorTimothy Flynn
This will allow easily surrounding operations that may fail due to OOM with TRY. Note that we now also have to define a "normal" constructor for WebDriver::Error in order to add the AK::Error constructor.
2023-02-22LibWeb: Make factory method of DOM::ElementFactory fallibleKenneth Myhra
2023-02-19WebDriver: Add computedlabel endpointJonah
2023-02-13LibCore: Remove `Stream.h`Tim Schumacher
2023-02-13LibCore: Move Stream-based sockets into the `Core` namespaceTim Schumacher
2023-02-10AK+Everywhere: Do not implicitly copy variables in TRY macrosTimothy Flynn
For example, consider cases where we want to propagate errors only in specific instances: auto result = read_data(); // something like ErrorOr<ByteBuffer> if (result.is_error() && result.error().code() != EINTR) continue; auto bytes = TRY(result); The TRY invocation will currently copy the byte buffer when the expression (in this case, just a local variable) is stored into _temporary_result. This patch binds the expression to a reference to prevent such copies. In less trival invocations (such as TRY(some_function()), this will incur only temporary lifetime extensions, i.e. no functional change.
2023-02-08Everywhere: Use ReadonlySpan<T> instead of Span<T const>MacDue
2023-02-02LibWeb: Restore handling of the serenity:ladybird/headless capabilityTimothy Flynn
This was refactored a bit incorrectly in d8fde14.
2023-01-27WebDriver+LibWeb: Rename "click" to "element_click"Sam Atkins
This matches the name used in the spec, and is unambiguous.
2023-01-26LibWeb: Replace uses of JsonObject::get_deprecated()/get_ptr()Sam Atkins
2023-01-17AK+Everywhere: Rename JsonObject::get() to ::get_deprecated()Sam Atkins
This is a preparatory step to making `get()` return `ErrorOr`.
2023-01-16WebDriver: Add computedrole endpointJonah
2023-01-15Everywhere: Fully qualify IsLvalueReference in TRY() macrosAndrew Kaster
If USING_AK_GLOBALLY is not defined, the name IsLvalueReference might not be available in the global namespace. Follow the pattern established in LibTest to fully qualify AK types in macros to avoid this problem.
2023-01-13AK+Everywhere: Disallow returning a reference from a fallible expressionTimothy Flynn
This will silently make a copy. Rather than masking this behavior, let's explicitly disallow it.
2023-01-08LibJS+Everywhere: Make PrimitiveString and Utf16String fallibleTimothy Flynn
This makes construction of Utf16String fallible in OOM conditions. The immediate impact is that PrimitiveString must then be fallible as well, as it may either transcode UTF-8 to UTF-16, or create a UTF-16 string from ropes. There are a couple of places where it is very non-trivial to propagate the error further. A FIXME has been added to those locations.
2023-01-05LibWeb+WebContent: Convert BrowsingContext to new pixel unitsSam Atkins
This fixes a few glitches. We no longer give the page double the width it should have, and we mark the correct area of the page as needing repainting.
2023-01-04LibIPC+Everywhere: Change IPC::encode's return type to ErrorOrTimothy Flynn
In doing so, this removes all uses of the Encoder's stream operator, except for where it is currently still used in the generated IPC code. So the stream operator currently discards any errors, which is the existing behavior. A subsequent commit will propagate the errors.
2023-01-02Everywhere: Remove unused includes of AK/Array.hBen Wiederhake
These instances were detected by searching for files that include Array.h, but don't match the regex: \\b(Array(?!\.h>)|iota_array|integer_sequence_generate_array)\\b These are the three symbols defined by Array.h. In theory, one might use LibCPP to detect things like this automatically, but let's do this one step after another.
2022-12-26LibIPC+Everywhere: Change IPC decoders to construct values in-placeTimothy Flynn
Currently, the generated IPC decoders will default-construct the type to be decoded, then pass that value by reference to the concrete decoder. This, of course, requires that the type is default-constructible. This was an issue for decoding Variants, which had to require the first type in the Variant list is Empty, to ensure it is default constructible. Further, this made it possible for values to become uninitialized in user-defined decoders. This patch makes the decoder interface such that the concrete decoders themselves contruct the decoded type upon return from the decoder. To do so, the default decoders in IPC::Decoder had to be moved to the IPC namespace scope, as these decoders are now specializations instead of overloaded methods (C++ requires specializations to be in a namespace scope).
2022-12-25WebDriver: Implement stub for .../element/{element id}/clickBaitinq
This patch adds a stub implementation for the POST /session/{session id}/element/{element id}/click endpoint.
2022-12-14LibJS: Convert Promise::create() to NonnullGCPtrLinus Groh
2022-12-14LibJS: Convert ECMAScriptFunctionObject::create() to NonnullGCPtrLinus Groh
2022-12-06Everywhere: Rename to_{string => deprecated_string}() where applicableLinus Groh
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-12-04WebContent+WebDriver: Implement `POST /session/{id}/window` endpointVictor Song
2022-11-27WebDriver: Implement stub for /session/{id}/printBaitinq
2022-11-24LibWeb+WebDriver: Support running headless WebDriver sessionsTimothy Flynn
This adds an "extension capability" for clients to indicate that a headless browser should be used for the session.
2022-11-23LibJS+LibWeb: Make CyclicModule.h not include AST.hAndreas Kling
This led to some fallout as many things in LibJS and LibWeb were pulling in other things via CyclicModule.h
2022-11-18LibWeb: Implement most of WebDriver capability matchingTimothy Flynn
We don't completely implement version matching, and currently ignore the "proxy" capability.
2022-11-18LibWeb+WebDriver: Begin processing and matching WebDriver capabilitiesTimothy Flynn
Still some TODOs here: * We don't handle all capabilities (e.g. proxy) * We don't match the capabilities against the running browser But this will parse the capabilities JSON object received from the WebDriver client.
2022-11-18LibWeb: Do not reject valid WebDriver script timeoutsTimothy Flynn
The spec's text is pretty awkward here, but the way we've currently transcribed it to C++ means we reject valid script timeouts. This meant the following would fail: TimeoutsConfiguration config {}; // Default values. auto json = timeouts_object(config); config = TRY(json_deserialize_as_a_timeouts_configuration(json));
2022-11-16LibWeb+LibWebView+WebContent+WebDriver: Implement Send Alert TextTimothy Flynn