mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:37:36 +00:00
WebContent: Add $_
variable to browser console
This holds the return value of the expression that was last entered into the browser console. If that last expression returned an error of some kind, `$_` will be `undefined`. This matches the behaviour in Firefox.
This commit is contained in:
parent
3ec13fdb86
commit
c793beb0cc
3 changed files with 15 additions and 1 deletions
|
@ -33,13 +33,18 @@ public:
|
|||
virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyKey const& name) override;
|
||||
virtual JS::ThrowCompletionOr<JS::MarkedVector<JS::Value>> internal_own_property_keys() const override;
|
||||
|
||||
void set_most_recent_result(JS::Value result) { m_most_recent_result = move(result); }
|
||||
|
||||
private:
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
// $0, the DOM node currently selected in the inspector
|
||||
JS_DECLARE_NATIVE_FUNCTION($0_getter);
|
||||
// $_, the value of the most recent expression entered into the console
|
||||
JS_DECLARE_NATIVE_FUNCTION($__getter);
|
||||
|
||||
Web::HTML::Window* m_window_object;
|
||||
JS::Value m_most_recent_result { JS::js_undefined() };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue