Closed Bug 2007697 Opened 11 months ago Closed 3 months ago

Assertion failure: false (Unexpected type of content node is iterated by RangeSubtreeIterator), at /builds/worker/checkouts/gecko/dom/base/nsRange.cpp:2131

Categories

(Core :: DOM: Selection, defect)

defect

Tracking

()

VERIFIED FIXED
155 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- unaffected
firefox-esr153 --- wontfix
firefox146 --- unaffected
firefox147 --- unaffected
firefox148 --- wontfix
firefox154 --- wontfix
firefox155 --- verified

People

(Reporter: tsmith, Assigned: masayuki)

References

(Blocks 1 open bug, Regression)

Details

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

Crash Data

Attachments

(1 file, 1 external file)

Attached file testcase.html —

Found while fuzzing m-c 20251219-739c12f204f1 (--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: false (Unexpected type of content node is iterated by RangeSubtreeIterator), at /builds/worker/checkouts/gecko/dom/base/nsRange.cpp:2131

#0 0x72c2a8baa033 in MOZ_CrashSequence /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:237:3
#1 0x72c2a8baa033 in nsRange::CutContents(mozilla::dom::DocumentFragment**, void (*)(mozilla::dom::Element*), mozilla::ErrorResult&) /builds/worker/checkouts/gecko/dom/base/nsRange.cpp:2129:9
#2 0x72c2a96c2146 in mozilla::dom::Range_Binding::deleteContents(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/./RangeBinding.cpp:768:24
#3 0x72c2aa106d6d in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /builds/worker/checkouts/gecko/dom/bindings/BindingUtils.cpp:3306:13
#4 0x72c2aeca5734 in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:490:13
#5 0x72c2aeca4fdf in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:586:12
#6 0x72c2ae2b7ed3 in js::jit::DoCallFallback(JSContext*, js::jit::BaselineFrame*, js::jit::ICFallbackStub*, unsigned int, JS::Value*, JS::MutableHandle<JS::Value>) /builds/worker/checkouts/gecko/js/src/jit/BaselineIC.cpp:1698:10
#7 0x338f5fe35c5e  ([anon:js-executable-memory]+0x1bc5e)
Flags: in-testsuite?

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

Start: c2f05ce0b22bedaac3196ad052bc7d47717e1d9c (20251209065918)
End: 4c2e2f108dd68e67c4f04a50f9e953edfb0febec (20251209072250)
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=c2f05ce0b22bedaac3196ad052bc7d47717e1d9c&tochange=4c2e2f108dd68e67c4f04a50f9e953edfb0febec

Keywords: regression
Whiteboard: [bugmon:bisected,confirmed]
Crash Signature: [@ nsRange::CutContents ]
Keywords: crash
See Also: → 2005101

Yep, this is almost same as bug 2005101 but this is triggered with the normal shadow DOM.

Severity: -- → S3
Assignee: nobody → masayuki
Status: NEW → ASSIGNED

Oh? not reproducible in current m-c?

Whiteboard: [bugmon:bisected,confirmed] → [bugmon:bisected,confirmed,analyze]

Sorry for the spam. Accidentally I built with old commit.

Whiteboard: [bugmon:bisected,confirmed,analyze] → [bugmon:bisected,confirmed]

RangeSubtreeIterator may return a ShadowRoot or DocumentFragment
if all children of them is selected by the range. Therefore, if it's
listed up, nsRange::CutContents() needs to delete or move all children
of the node.

See Also: → 2053997
Pushed by masayuki@d-toybox.com: https://github.com/mozilla-firefox/firefox/commit/554465a7db3b https://hg.mozilla.org/integration/autoland/rev/37f3ba2e4786 Make `nsRange::CutContents()` handle `ShadowRoot` and `DocumentFragment` r=smaug,dom-core-reviewers

Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/61881 for changes under testing/web-platform/tests

Whiteboard: [bugmon:bisected,confirmed] → [bugmon:bisected,confirmed], [wptsync upstream]
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 155 Branch

Upstream PR merged by moz-wptsync-bot

OS: Unspecified → All
Hardware: Unspecified → All

Verified bug as fixed on rev mozilla-central 20260812202037-5d8f92a89915.
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.

Status: RESOLVED → VERIFIED
Keywords: bugmon
Flags: in-testsuite? → in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: