Bug 1591417: part 1) Assert `EditorDOMPointBase::ToRawRangeBoundary()` uses valid offset. r=masayuki
authorMirko Brodesser <mbrodesser@mozilla.com>
Tue, 12 Nov 2019 15:20:13 +0000
changeset 501716 6ece388605bb8696347d1d4202387ae8b043132f
parent 501715 7ce4cf2b6d61a4241708fec5e22f634192a1fe90
child 501717 34804d1ae0c049bef2003f93e9ffb966a228db3c
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1591417
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1591417: part 1) Assert `EditorDOMPointBase::ToRawRangeBoundary()` uses valid offset. r=masayuki Differential Revision: https://phabricator.services.mozilla.com/D52341
editor/libeditor/EditorDOMPoint.h
--- a/editor/libeditor/EditorDOMPoint.h
+++ b/editor/libeditor/EditorDOMPoint.h
@@ -681,16 +681,17 @@ class EditorDOMPointBase final {
    * e.g., methods of Selection and nsRange.
    */
   operator const RawRangeBoundary() const { return ToRawRangeBoundary(); }
   const RawRangeBoundary ToRawRangeBoundary() const {
     if (!IsSet() || NS_WARN_IF(!mIsChildInitialized && !mOffset.isSome())) {
       return RawRangeBoundary();
     }
     if (!mParent->IsContainerNode()) {
+      MOZ_ASSERT(mOffset.value() <= mParent->Length());
       // If the container is a data node like a text node, we need to create
       // RangeBoundaryBase instance only with mOffset because mChild is always
       // nullptr.
       return RawRangeBoundary(mParent, mOffset.value());
     }
     if (mIsChildInitialized && mOffset.isSome()) {
       // If we've already set both child and offset, we should create
       // RangeBoundary with offset after validation.