mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 19:59:17 +00:00
LibWebView+WebContent: Begin supporting the DevTools JavaScript console
This supports evaluating the script and replying with the result. We currently serialize JS objects to a string, but we will need to support dynamic interaction with the objects over IPC. This does not yet support sending console messages to DevTools.
This commit is contained in:
committed by
Andreas Kling
parent
6d33b70e61
commit
32bc2dc7b6
@@ -417,4 +417,20 @@ void Application::clear_highlighted_dom_node(DevTools::TabDescription const& des
|
||||
view->clear_highlighted_dom_node();
|
||||
}
|
||||
|
||||
void Application::evaluate_javascript(DevTools::TabDescription const& description, String script, OnScriptEvaluationComplete on_complete) const
|
||||
{
|
||||
auto view = ViewImplementation::find_view_by_id(description.id);
|
||||
if (!view.has_value()) {
|
||||
on_complete(Error::from_string_literal("Unable to locate tab"));
|
||||
return;
|
||||
}
|
||||
|
||||
view->on_received_js_console_result = [&view = *view, on_complete = move(on_complete)](JsonValue result) {
|
||||
view.on_received_js_console_result = nullptr;
|
||||
on_complete(move(result));
|
||||
};
|
||||
|
||||
view->js_console_input(move(script));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user