`RangeBoundary` constructor receives negative offsets, but converts them to an unsigned integer
Categories
(Core :: DOM: Selection, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox72 | --- | fixed |
People
(Reporter: mbrodesser, Assigned: mbrodesser)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
STR:
- Add assertion:
RangeBoundaryBase(nsINode* aContainer, int32_t aOffset)
- : mParent(aContainer), mRef(nullptr), mOffset(mozilla::Some(aOffset)) {
+ : mParent(aContainer), mRef(nullptr), mOffset(mozilla::Some<uint32_t>(aOffset)) {
+ MOZ_ASSERT(aOffset >= 0)
- Run ./testing/web-platform/tests/selection/collapse-00.html
Expected: assertion not triggered.
Actual: assertion triggered.
(P2 given that we probably will start working on this in following months, please free feel to change the priority if I misunderstand anything)
Assignee | ||
Comment 2•6 years ago
•
|
||
One problem here is: nsRange::ComparePoint
has a uint32_t
argument, which is required by https://dom.spec.whatwg.org/#interface-range. But it internally calls RangeBoundaryBase::RangeBoundaryBase
, which takes a int32_t
.
Reproducible with dom/base/test/test_bug737565.html.
Another violation of the assertion is triggered after running and successfully finishing editor/libeditor/tests/test_bug1270235.html.
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 3•6 years ago
|
||
uint32_t
, because nsRange::ComparePoints
requires it -- by webidl
interface -- to be unsigned long.
Moreover it makes RangeBoundaryBase
's interface cleaner, because it
already exposes the offset as a uint32_t
.
Comment 5•6 years ago
|
||
bugherder |
Description
•