mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:37:36 +00:00
LibWeb+LibWebView+WebContent: Add an Inspector IPC to execute JavaScript
The Inspector will have an <input> element to execute user-provided JS. This adds an IDL method and IPC to forward that JS from the Inspector WebView to the Inspector client.
This commit is contained in:
parent
060807e3da
commit
9f374a5d2a
10 changed files with 26 additions and 0 deletions
|
@ -47,4 +47,10 @@ void Inspector::inspect_dom_node(i32 node_id, Optional<i32> const& pseudo_elemen
|
|||
}
|
||||
}
|
||||
|
||||
void Inspector::execute_console_script(String const& script)
|
||||
{
|
||||
if (auto* page = global_object().browsing_context()->page())
|
||||
page->client().inspector_did_execute_console_script(script);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ public:
|
|||
void inspector_loaded();
|
||||
void inspect_dom_node(i32 node_id, Optional<i32> const& pseudo_element);
|
||||
|
||||
void execute_console_script(String const& script);
|
||||
|
||||
private:
|
||||
explicit Inspector(JS::Realm&);
|
||||
|
||||
|
|
|
@ -3,4 +3,6 @@
|
|||
undefined inspectorLoaded();
|
||||
undefined inspectDOMNode(long nodeID, optional long pseudoElement);
|
||||
|
||||
undefined executeConsoleScript(DOMString script);
|
||||
|
||||
};
|
||||
|
|
|
@ -265,6 +265,7 @@ public:
|
|||
|
||||
virtual void inspector_did_load() { }
|
||||
virtual void inspector_did_select_dom_node([[maybe_unused]] i32 node_id, [[maybe_unused]] Optional<CSS::Selector::PseudoElement> const& pseudo_element) { }
|
||||
virtual void inspector_did_execute_console_script([[maybe_unused]] String const& script) { }
|
||||
|
||||
protected:
|
||||
virtual ~PageClient() = default;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue