mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:37:45 +00:00
Browser+WebContent+WebDriver: Move Get Page Source to WebContent
This commit is contained in:
parent
561f9f36f7
commit
88dcdf681f
16 changed files with 26 additions and 61 deletions
|
@ -726,8 +726,7 @@ Web::WebDriver::Response Client::handle_get_source(Vector<StringView> const& par
|
|||
{
|
||||
dbgln_if(WEBDRIVER_DEBUG, "Handling GET /session/<session_id>/source");
|
||||
auto* session = TRY(find_session_with_id(parameters[0]));
|
||||
auto result = TRY(session->get_source());
|
||||
return make_json_value(result);
|
||||
return session->web_content_connection().get_source();
|
||||
}
|
||||
|
||||
// 13.2.1 Execute Script, https://w3c.github.io/webdriver/#dfn-execute-script
|
||||
|
|
|
@ -297,23 +297,6 @@ Web::WebDriver::Response Session::get_window_handles() const
|
|||
return JsonValue { handles };
|
||||
}
|
||||
|
||||
// 13.1 Get Page Source, https://w3c.github.io/webdriver/#dfn-get-page-source
|
||||
Web::WebDriver::Response Session::get_source()
|
||||
{
|
||||
// 1. If the current browsing context is no longer open, return error with error code no such window.
|
||||
TRY(check_for_open_top_level_browsing_context_or_return_error());
|
||||
|
||||
// FIXME: 2. Handle any user prompts and return its value if it is an error.
|
||||
|
||||
// 3. Let source be the result of invoking the fragment serializing algorithm on a fictional node whose only child is the document element providing true for the require well-formed flag. If this causes an exception to be thrown, let source be null.
|
||||
// 4. Let source be the result of serializing to string the current browsing context active document, if source is null.
|
||||
// NOTE: Both of the above cases are handled in the remote WebContent process.
|
||||
auto source = m_browser_connection->serialize_source();
|
||||
|
||||
// 5. Return success with data source.
|
||||
return JsonValue { source };
|
||||
}
|
||||
|
||||
struct ScriptArguments {
|
||||
String script;
|
||||
JsonArray const& arguments;
|
||||
|
|
|
@ -58,7 +58,6 @@ public:
|
|||
Web::WebDriver::Response get_window_handle();
|
||||
ErrorOr<void, Variant<Web::WebDriver::Error, Error>> close_window();
|
||||
Web::WebDriver::Response get_window_handles() const;
|
||||
Web::WebDriver::Response get_source();
|
||||
Web::WebDriver::Response execute_script(JsonValue const& payload);
|
||||
Web::WebDriver::Response execute_async_script(JsonValue const& payload);
|
||||
Web::WebDriver::Response get_all_cookies();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue