Open Bug 2075748 Opened 1 month ago Updated 4 days ago

Assertion failure: IsValidParent(mParent, mRef) (Initializing RangeBoundary with invalid value), at /builds/worker/workspace/obj-build/dist/include/mozilla/RangeBoundary.h:248

Categories

(Core :: DOM: Selection, defect)

defect

Tracking

()

ASSIGNED
Tracking Status
firefox-esr115 --- unaffected
firefox-esr153 --- unaffected
firefox159 --- wontfix
firefox160 --- wontfix
firefox161 --- wontfix
firefox162 --- wontfix
firefox163 --- fix-optional

People

(Reporter: tsmith, Assigned: uncleruc2075)

References

(Blocks 2 open bugs, Regression, )

Details

(4 keywords, Whiteboard: [bugmon:bisected,confirmed])

Attachments

(2 files, 1 external file)

Attached file testcase.html —

Found while fuzzing m-c 20260917-3b08ff1879d5 (--enable-debug --enable-fuzzing)

To reproduce via Grizzly Replay:

$ pip install fuzzfetch grizzly-framework --upgrade
$ python -m fuzzfetch -d --fuzzing -n firefox
$ python -m grizzly.replay.bugzilla ./firefox/firefox <bugid>

Assertion failure: IsValidParent(mParent, mRef) (Initializing RangeBoundary with invalid value), at /builds/worker/workspace/obj-build/dist/include/mozilla/RangeBoundary.h:248

#0 0x757b46a6f96f in MOZ_CrashSequence /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:261:3
#1 0x757b46a6f96f in mozilla::RangeBoundaryBase<nsCOMPtr<nsINode>, nsCOMPtr<nsIContent>>::RangeBoundaryBase(nsINode*, nsIContent*, TreeKind) /builds/worker/workspace/obj-build/dist/include/mozilla/RangeBoundary.h:247:7
#2 0x757b46a6ee75 in mozilla::RangeBoundaryBase<nsCOMPtr<nsINode>, nsCOMPtr<nsIContent>>::EndOfParent(nsINode&, mozilla::RangeBoundarySetBy, TreeKind) /builds/worker/workspace/obj-build/dist/include/mozilla/RangeBoundary.h:223:14
#3 0x757b46a60a9d in mozilla::RangeBoundaryBase<nsCOMPtr<nsINode>, nsCOMPtr<nsIContent>>::AsRangeBoundaryInFlatTreeOrNonFlattenedNode(mozilla::RangeBoundaryFor) const /builds/worker/workspace/obj-build/dist/include/mozilla/RangeBoundary.h:431:12
#4 0x757b46d39568 in CompareToRangeStart<const nsINode *, const nsIContent *> /builds/worker/workspace/obj-build/dom/base/./../../../../checkouts/gecko/dom/base/Selection.cpp:989:20
#5 0x757b46d39568 in int CompareToRangeStart<nsINode const*, nsIContent const*>(mozilla::RangeBoundaryBase<nsINode const*, nsIContent const*> const&, mozilla::RangeBoundaryFor, mozilla::dom::AbstractRange const&) /builds/worker/workspace/obj-build/dom/base/./../../../../checkouts/gecko/dom/base/Selection.cpp:1013:10
#6 0x757b46d391c3 in unsigned long mozilla::dom::Selection::StyledRanges::FindInsertionPoint<nsINode const*, nsIContent const*, mozilla::Span<RefPtr<mozilla::dom::AbstractRange>, 18446744073709551615ul>>(mozilla::Span<RefPtr<mozilla::dom::AbstractRange>, 18446744073709551615ul> const&, mozilla::RangeBoundaryBase<nsINode const*, nsIContent const*> const&, mozilla::RangeBoundaryFor, int (*)(mozilla::RangeBoundaryBase<nsINode const*, nsIContent const*> const&, mozilla::RangeBoundaryFor, mozilla::dom::AbstractRange const&)) /builds/worker/workspace/obj-build/dom/base/./../../../../checkouts/gecko/dom/base/Selection.cpp:1095:19
#7 0x757b46d34647 in mozilla::dom::Selection::StyledRanges::GetIndicesForInterval(nsINode const*, unsigned int, nsINode const*, unsigned int, bool, mozilla::Maybe<unsigned long>&, mozilla::Maybe<unsigned long>&) /builds/worker/workspace/obj-build/dom/base/./../../../../checkouts/gecko/dom/base/Selection.cpp:1824:28
#8 0x757b46d37a5d in mozilla::dom::Selection::GetAbstractRangesForIntervalArray(nsINode*, unsigned int, nsINode*, unsigned int, bool, nsTArray<mozilla::dom::AbstractRange*>*) /builds/worker/workspace/obj-build/dom/base/./../../../../checkouts/gecko/dom/base/Selection.cpp:1658:32
#9 0x757b46d452f9 in mozilla::dom::Selection::ContainsNode(nsINode&, bool, mozilla::ErrorResult&) /builds/worker/workspace/obj-build/dom/base/./../../../../checkouts/gecko/dom/base/Selection.cpp:3729:8
#10 0x757b477b9db4 in mozilla::dom::Selection_Binding::containsNode(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/./SelectionBinding.cpp:1720:36
#11 0x757b480a1a55 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/obj-build/dom/bindings/./../../../../checkouts/gecko/dom/bindings/BindingUtils.cpp:3212:13
#12 0x757b4d0575e4 in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:526:13
#13 0x757b4d056ebc in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:622:12
#14 0x757b4c5c9aa6 in js::jit::DoCallFallback(JSContext*, js::jit::BaselineFrame*, js::jit::ICFallbackStub*, unsigned int, JS::Value*, JS::MutableHandle<JS::Value>) /builds/worker/workspace/obj-build/js/src/jit/./../../../../../checkouts/gecko/js/src/jit/BaselineIC.cpp:1717:10
#15 0x38f2391c500e  ([anon:js-executable-memory]+0xc00e)

This has also been reported via live site testing.

sorry for the potentially arbitrary NI jan, but you've been poking around ranges recently, right? otherwise feel free to forward the NI where appropriate

Flags: needinfo?(jjaschke)

I couldn't repro locally, and bugmon neither? I don't know if this is an issue, but maybe Masayuki knows.

Flags: needinfo?(jjaschke) → needinfo?(masayuki)

Yeah, I cannot reproduce this too. I guess it tries to move selection into the <marquee> and the boundary may be around the shadow host. So, perhaps, creating or re-creating the UA shadow of the <marquee> might cause unexpected situation maybe with a race? Anyway, I guess we can fix this with making CrossShadowBoundaryRange handle all mutations.

Flags: needinfo?(masayuki)
Severity: -- → S3
Duplicate of this bug: 2084497
Attached file prefs.js —

prefs.js for bugmon

Keywords: bugmon

Verified bug as reproducible on mozilla-central 20261112215226-aeba22d2efdd.
The bug appears to have been introduced in the following build range:

Start: 2cf4824879e0a52b7d74a4e1b9aebfabada3fa67 (20260705204834)
End: ba2351b8401a8d220d8ce522ef535f939a362313 (20260706094132)
Pushlog: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=2cf4824879e0a52b7d74a4e1b9aebfabada3fa67&tochange=ba2351b8401a8d220d8ce522ef535f939a362313

Keywords: regression
Whiteboard: [bugmon:bisected,confirmed]
ruslan@debian:~/firefox$ git diff -- dom/base/nsINode.h
diff --git a/dom/base/nsINode.h b/dom/base/nsINode.h
index 873578f6c342..7f0d25896062 100644
--- a/dom/base/nsINode.h
+++ b/dom/base/nsINode.h
@@ -787,7 +787,7 @@ class nsINode : public mozilla::dom::EventTarget {
   template <TreeKind aKind>
   [[nodiscard]] const mozilla::dom::HTMLSlotElement*
   GetAsHTMLSlotElementIfFilled() const {
-    return const_cast<nsINode*>(this)->GetAsHTMLSlotElementIfFilled();
+    return const_cast<nsINode*>(this)->GetAsHTMLSlotElementIfFilled<aKind>();
   }
 
   /*
ruslan@debian:~/firefox$ 

I think such a fix is ​​ needed. Your test case did not reproduce the assertion, so I took my own.

Assignee: nobody → uncleruc2075
Attachment #9682593 - Attachment description: WIP: Bug 2075748 - Forward aKind in const nsINode::GetAsHTMLSlotElementIfFilled<aKind>(). → Bug 2075748 - Forward aKind in const nsINode::GetAsHTMLSlotElementIfFilled<aKind>().
Status: NEW → ASSIGNED

Based on comment #8, this bug contains a bisection range found by bugmon. However, the Regressed by field is still not filled.

:uncleruc2075, if possible, could you fill the Regressed by field and investigate this regression?

For more information, please visit BugBot documentation.

Flags: needinfo?(uncleruc2075)
Flags: needinfo?(uncleruc2075)
Regressed by: 2012637

Regressed by Bug 2012637 part 3:
https://hg.mozilla.org/mozilla-central/rev/80f9babffc27d60615c70aa2b893bb1bc83e867a

It added the const overload of nsINode::GetAsHTMLSlotElementIfFilled<aKind>() which calls the non-template GetAsHTMLSlotElementIfFilled() instead of forwarding aKind. Fix is in D342619.

Set release status flags based on info from the regressing bug 2012637

Attachment #9682593 - Attachment description: Bug 2075748 - Forward aKind in const nsINode::GetAsHTMLSlotElementIfFilled<aKind>(). → Bug 2075748 - Forward aKind in const nsINode::GetAsHTMLSlotElementIfFilled<aKind>(). r=masayuki

Set release status flags based on info from the regressing bug 2012637

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: