1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:27:46 +00:00

LibWeb: Wait until new document becomes active before running scripts

Fixes https://github.com/SerenityOS/serenity/issues/22485

With this change WebContent does not crash when `location.reload()` is
invoked but `Navigable::reload()` still not working because of spec
issue (https://github.com/whatwg/html/issues/9869) so we can't add a
test yet.
This commit is contained in:
Aliaksandr Kalenik 2023-12-30 15:45:10 +01:00 committed by Andreas Kling
parent 7e8d3e370f
commit 07928129dd
3 changed files with 13 additions and 1 deletions

View file

@ -551,6 +551,8 @@ public:
};
void append_pending_animation_event(PendingAnimationEvent const&);
bool ready_to_run_scripts() const { return m_ready_to_run_scripts; }
protected:
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
@ -769,6 +771,9 @@ private:
Vector<PendingAnimationEvent> m_pending_animation_event_queue;
bool m_needs_to_call_page_did_load { false };
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#scripts-may-run-for-the-newly-created-document
bool m_ready_to_run_scripts { false };
};
template<>