mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:47:35 +00:00
LibWeb: Don't allow setting Range start/end to document being destroyed
This commit is contained in:
parent
3b6323340a
commit
ac8a8459d0
2 changed files with 9 additions and 0 deletions
|
@ -338,6 +338,8 @@ public:
|
|||
bool needs_full_style_update() const { return m_needs_full_style_update; }
|
||||
void set_needs_full_style_update(bool b) { m_needs_full_style_update = b; }
|
||||
|
||||
bool in_removed_last_ref() const { return m_in_removed_last_ref; }
|
||||
|
||||
private:
|
||||
explicit Document(const AK::URL&);
|
||||
|
||||
|
|
|
@ -129,6 +129,13 @@ static RelativeBoundaryPointPosition position_of_boundary_point_relative_to_othe
|
|||
|
||||
ExceptionOr<void> Range::set_start_or_end(Node& node, u32 offset, StartOrEnd start_or_end)
|
||||
{
|
||||
// FIXME: If the incoming node is part of a document that's in the process of being destroyed,
|
||||
// we just ignore this. This prevents us from trying to re-ref a document during its
|
||||
// destruction process. This is a hack and should be replaced with some smarter form
|
||||
// of lifetime management.
|
||||
if (node.document().in_removed_last_ref())
|
||||
return {};
|
||||
|
||||
// To set the start or end of a range to a boundary point (node, offset), run these steps:
|
||||
|
||||
// 1. If node is a doctype, then throw an "InvalidNodeTypeError" DOMException.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue