Closed Bug 1438996 Opened 3 years ago Closed 2 years ago

461,000 instances of "Constructing RangeBoundary with invalid value: 'mRef || aOffset == 0'" emitted from obj-firefox/dist/include/mozilla/RangeBoundary.h during linux64 debug testing

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: erahm, Assigned: tnikkel, NeedInfo)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

> 3951 WARNING: Constructing RangeBoundary with invalid value: 'mRef || aOffset == 0', file obj-firefox/dist/include/mozilla/RangeBoundary.h, line 84

This warning [1] shows up in the following test suites:

>   1970 - test-linux64/debug-web-platform-tests-e10s-4 wpt4
>   1900 - test-linux64/debug-web-platform-tests-e10s-9 wpt9
>     30 - test-linux64/debug-mochitest-plain-headless-e10s-3 h3
>     30 - test-linux64/debug-mochitest-e10s-3 3
>      8 - test-linux64/debug-mochitest-chrome-2 c2
>      6 - test-linux64/debug-mochitest-clipboard-e10s cl
>      5 - test-linux64/debug-crashtest-e10s C
>      1 - test-linux64/debug-mochitest-e10s-12 12
>      1 - test-linux64/debug-mochitest-plain-headless-e10s-12 h12

It shows up in 20 tests. A few of the most prevalent:

>    760 - [e10s] /dom/ranges/Range-set.html
>    610 - [e10s] /dom/ranges/Range-isPointInRange.html
>    600 - [e10s] /dom/ranges/Range-comparePoint.html
>    580 - [e10s] /selection/collapse-30.html
>    300 - [e10s] /selection/collapse-45.html
>    300 - [e10s] /selection/collapse-00.html
>    300 - [e10s] /selection/collapse-15.html
>    216 - [e10s] /selection/extend-20.html
>    184 - [e10s] /selection/extend-00.html
>     60 - [e10s] dom/base/test/test_bug737565.html

[1] https://hg.mozilla.org/mozilla-central/annotate/928f0f09172f/obj-firefox/dist/include/mozilla/RangeBoundary.h#l84
Sorry my script messed up the link [1], Masayuki, can you take a look?

[1] https://searchfox.org/mozilla-central/rev/cac28623a15ace458a8f4526e107a71db1519daf/dom/base/RangeBoundary.h#83-84
Flags: needinfo?(masayuki)
The warning detects a bug of each caller. So, please get stack trace with rewriting NS_WARNING_ASSERTION with NS_ASSERT and file for each stack trace as a blocker bug of this bug.
Flags: needinfo?(masayuki)
This issue shows up in triage due to a lack of priority. Nominating Eric to take care of it.
Flags: needinfo?(erahm)
(In reply to Anne (:annevk) from comment #3)
> This issue shows up in triage due to a lack of priority. Nominating Eric to
> take care of it.

Masayuki probably has a better idea of the priority.
Flags: needinfo?(erahm) → needinfo?(masayuki)
Hmm, some stack indicate that this warning may not make sense since the pair of container node and offset in it comes from JS.

On the other hand, in some cases, this warning indicates actual bug although they must be minor.

So, the priority of this bug should be low.
Flags: needinfo?(masayuki)
Priority: -- → P3
Component: DOM → DOM: Core & HTML

Hi, I would like to work on this. Could you guide me a little?

Flags: needinfo?(erahm)

(In reply to Khyati Agarwal from comment #7)

Hi, I would like to work on this. Could you guide me a little?

We found that this [1] warning is showing up a fair amount during testing. Masayuki thinks it's invalid in some cases but might also point to real bugs in other cases. I've started another try push [2] (the one from comment 5 is no longer available) to dump the stacks. You'll need to go through the logs to get some sample stacks and then work with Masayuki to determine if they indicate a bug or not.

Masayuki, do you think it's worth the effort to look into the warning stacks again, or should we just delete the warning?

[1] https://searchfox.org/mozilla-central/rev/201450283cddc9e409cec707acb65ba6cf6037b1/dom/base/RangeBoundary.h#78-79
[2] https://treeherder.mozilla.org/#/jobs?repo=try&revision=6cdad5a259693a4db2aa0650edd75b47c08e7d0a

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

I think we should investigate it first. The trybuild uses NS_ASSERTION(), but the stacks are not logged :-(

I kicked mochitests now. Let's see the result later...

The verbosity of this warning has increased 100X

461008 WARNING: Constructing RangeBoundary with invalid value: 'mRef || aOffset == 0', file obj-firefox/dist/include/mozilla/RangeBoundary.h, line 79

This warning [1] shows up in the following test suites:

 13464 - test-linux64/debug-web-platform-tests-sw-e10s-4 wpt4
 13464 - test-linux64/debug-web-platform-tests-e10s-4 wpt4
 12170 - test-linux64/debug-web-platform-tests-e10s-14 wpt14
 12126 - test-linux64/debug-web-platform-tests-sw-e10s-14 wpt14
 11070 - test-linux64/debug-web-platform-tests-e10s-10 wpt10
 11070 - test-linux64/debug-web-platform-tests-sw-e10s-10 wpt10
 10468 - test-linux64/debug-web-platform-tests-sw-e10s-15 wpt15
 10468 - test-linux64/debug-web-platform-tests-e10s-15 wpt15
  9959 - test-linux64/debug-web-platform-tests-sw-e10s-16 wpt16
  9959 - test-linux64/debug-web-platform-tests-e10s-16 wpt16
  9558 - test-linux64/debug-web-platform-tests-sw-e10s-9 wpt9
  9558 - test-linux64/debug-web-platform-tests-e10s-9 wpt9
  9448 - test-linux64/debug-web-platform-tests-sw-e10s-18 wpt18
  9448 - test-linux64/debug-web-platform-tests-e10s-18 wpt18
  9094 - test-linux64/debug-web-platform-tests-e10s-11 wpt11
  9094 - test-linux64/debug-web-platform-tests-sw-e10s-11 wpt11
  8962 - test-linux64/debug-web-platform-tests-e10s-2 wpt2
  8962 - test-linux64/debug-web-platform-tests-sw-e10s-2 wpt2
  8570 - test-linux64/debug-mochitest-browser-chrome-e10s-11 bc11
  8490 - test-linux64/debug-web-platform-tests-sw-e10s-7 wpt7
  8490 - test-linux64/debug-web-platform-tests-e10s-7 wpt7
  8295 - test-linux64/debug-web-platform-tests-e10s-1 wpt1
  8295 - test-linux64/debug-web-platform-tests-sw-e10s-1 wpt1
  8280 - test-linux64/debug-web-platform-tests-sw-e10s-5 wpt5
  8280 - test-linux64/debug-web-platform-tests-e10s-5 wpt5
  8142 - test-linux64/debug-web-platform-tests-sw-e10s-3 wpt3
  8142 - test-linux64/debug-web-platform-tests-e10s-3 wpt3
  7741 - test-linux64/debug-web-platform-tests-e10s-8 wpt8
  7741 - test-linux64/debug-web-platform-tests-sw-e10s-8 wpt8
  7684 - test-linux64/debug-web-platform-tests-sw-e10s-13 wpt13
  7684 - test-linux64/debug-web-platform-tests-e10s-13 wpt13
  6770 - test-linux64/debug-web-platform-tests-sw-e10s-17 wpt17
  6770 - test-linux64/debug-web-platform-tests-e10s-17 wpt17
  6554 - test-linux64/debug-mochitest-browser-chrome-e10s-7 bc7
  6144 - test-linux64/debug-mochitest-browser-chrome-sw-e10s-8 bc8
  5902 - test-linux64/debug-mochitest-browser-chrome-sw-e10s-11 bc11
  5622 - test-linux64/debug-mochitest-browser-chrome-sw-e10s-6 bc6
  5244 - test-linux64/debug-web-platform-tests-sw-e10s-12 wpt12
  5244 - test-linux64/debug-web-platform-tests-e10s-12 wpt12
  4878 - test-linux64/debug-mochitest-browser-chrome-e10s-2 bc2
  4084 - test-linux64/debug-web-platform-tests-e10s-6 wpt6
  4084 - test-linux64/debug-web-platform-tests-sw-e10s-6 wpt6
  3980 - test-linux64/debug-mochitest-browser-chrome-sw-e10s-9 bc9
  3926 - test-linux64/debug-mochitest-browser-chrome-e10s-10 bc10
  3612 - test-linux64/debug-mochitest-browser-chrome-sw-e10s-4 bc4
  3546 - test-linux64/debug-mochitest-browser-chrome-sw-e10s-1 bc1
  2740 - test-linux64/debug-mochitest-browser-chrome-e10s-4 bc4
  2698 - test-linux64/debug-mochitest-e10s-15 15
  2696 - test-linux64/debug-mochitest-sw-e10s-15 15
  2632 - test-linux64/debug-mochitest-browser-chrome-e10s-1 bc1
  2458 - test-linux64/debug-mochitest-browser-chrome-e10s-6 bc6
  2294 - test-linux64/debug-mochitest-browser-chrome-e10s-9 bc9
  2250 - test-linux64/debug-mochitest-browser-chrome-sw-e10s-2 bc2
  2214 - test-linux64/debug-mochitest-browser-chrome-sw-e10s-7 bc7
  2130 - test-linux64/debug-mochitest-browser-chrome-e10s-3 bc3
  2112 - test-linux64/debug-mochitest-devtools-chrome-sw-e10s-12 dt12
  2112 - test-linux64/debug-mochitest-devtools-chrome-e10s-12 dt12
  2096 - test-linux64/debug-mochitest-browser-chrome-e10s-8 bc8
  2010 - test-linux64/debug-mochitest-browser-chrome-sw-e10s-10 bc10
  2002 - test-linux64/debug-marionette-e10s Mn
  1966 - test-linux64/debug-mochitest-browser-chrome-sw-e10s-3 bc3
  1714 - test-linux64/debug-mochitest-browser-chrome-e10s-5 bc5
  1668 - test-linux64/debug-mochitest-devtools-chrome-sw-e10s-8 dt8
  1664 - test-linux64/debug-mochitest-devtools-chrome-e10s-8 dt8
  1640 - test-linux64/debug-mochitest-browser-chrome-sw-e10s-15 bc15
  1636 - test-linux64/debug-mochitest-browser-chrome-e10s-16 bc16
  1636 - test-linux64/debug-mochitest-browser-chrome-e10s-15 bc15
  1632 - test-linux64/debug-mochitest-browser-chrome-sw-e10s-16 bc16
  1512 - test-linux64/debug-mochitest-browser-chrome-sw-e10s-12 bc12
  1512 - test-linux64/debug-mochitest-browser-chrome-e10s-12 bc12
  1450 - test-linux64/debug-mochitest-browser-chrome-e10s-13 bc13
  1446 - test-linux64/debug-mochitest-browser-chrome-sw-e10s-5 bc5
  1444 - test-linux64/debug-mochitest-browser-chrome-sw-e10s-13 bc13
  1266 - test-linux64/debug-mochitest-devtools-chrome-e10s-3 dt3
  1258 - test-linux64/debug-mochitest-devtools-chrome-sw-e10s-4 dt4
  1250 - test-linux64/debug-web-platform-tests-wdspec-e10s-1 Wd1
  1250 - test-linux64/debug-web-platform-tests-wdspec-sw-e10s-1 Wd1
  1110 - test-linux64/debug-mochitest-devtools-chrome-e10s-7 dt7
  1094 - test-linux64/debug-mochitest-devtools-chrome-sw-e10s-7 dt7
   994 - test-linux64/debug-mochitest-chrome-1proc-3 c3
   994 - test-linux64/debug-mochitest-chrome-sw-1proc-3 c3
   964 - test-linux64/debug-mochitest-devtools-chrome-e10s-5 dt5
   930 - test-linux64/debug-mochitest-devtools-chrome-sw-e10s-6 dt6
   914 - test-linux64/debug-mochitest-devtools-chrome-sw-e10s-10 dt10
   914 - test-linux64/debug-mochitest-devtools-chrome-e10s-10 dt10
   910 - test-linux64/debug-mochitest-e10s-9 9
   910 - test-linux64/debug-mochitest-sw-e10s-9 9
   900 - test-linux64/debug-web-platform-tests-wdspec-sw-e10s-2 Wd2
   900 - test-linux64/debug-web-platform-tests-wdspec-e10s-2 Wd2
   861 - test-linux64/debug-mochitest-e10s-12 12
   861 - test-linux64/debug-mochitest-sw-e10s-12 12
   714 - test-linux64/debug-mochitest-browser-chrome-sw-e10s-14 bc14
   710 - test-linux64/debug-mochitest-browser-chrome-e10s-14 bc14
   684 - test-linux64/debug-mochitest-sw-e10s-4 4
   682 - test-linux64/debug-mochitest-e10s-4 4
   662 - test-linux64/debug-mochitest-devtools-chrome-e10s-11 dt11
   662 - test-linux64/debug-mochitest-devtools-chrome-sw-e10s-11 dt11
   658 - test-linux64/debug-mochitest-devtools-chrome-e10s-1 dt1
   658 - test-linux64/debug-mochitest-devtools-chrome-sw-e10s-2 dt2
   604 - test-linux64/debug-mochitest-devtools-chrome-sw-e10s-9 dt9
   604 - test-linux64/debug-mochitest-devtools-chrome-e10s-9 dt9
   518 - test-linux64/debug-firefox-ui-functional-local-e10s en-US
   508 - test-linux64/debug-mochitest-chrome-sw-1proc-1 c1
   508 - test-linux64/debug-mochitest-chrome-1proc-1 c1
   504 - test-linux64/debug-mochitest-devtools-chrome-e10s-4 dt4
   494 - test-linux64/debug-firefox-ui-functional-remote-e10s en-US
   494 - test-linux64/debug-mochitest-e10s-8 8
   492 - test-linux64/debug-mochitest-devtools-chrome-sw-e10s-5 dt5
   490 - test-linux64/debug-mochitest-sw-e10s-8 8
   466 - test-linux64/debug-mochitest-e10s-2 2
   466 - test-linux64/debug-mochitest-sw-e10s-2 2
   448 - test-linux64/debug-mochitest-devtools-chrome-sw-e10s-1 dt1
   444 - test-linux64/debug-mochitest-sw-e10s-14 14
   444 - test-linux64/debug-mochitest-e10s-14 14
   442 - test-linux64/debug-mochitest-devtools-chrome-e10s-6 dt6
   360 - test-linux64/debug-mochitest-sw-e10s-1 1
   360 - test-linux64/debug-mochitest-e10s-1 1
   330 - test-linux64/debug-mochitest-chrome-1proc-2 c2
   330 - test-linux64/debug-mochitest-chrome-sw-1proc-2 c2
   296 - test-linux64/debug-mochitest-devtools-chrome-sw-e10s-3 dt3
   292 - test-linux64/debug-mochitest-devtools-chrome-e10s-2 dt2
   214 - test-linux64/debug-mochitest-sw-e10s-7 7
   214 - test-linux64/debug-mochitest-e10s-7 7
   154 - test-linux64/debug-mochitest-sw-e10s-13 13
   154 - test-linux64/debug-mochitest-e10s-13 13
   146 - test-linux64/debug-mochitest-e10s-11 11
   146 - test-linux64/debug-mochitest-sw-e10s-11 11
   130 - test-linux64/debug-mochitest-sw-e10s-5 5
   130 - test-linux64/debug-mochitest-e10s-3 3
   130 - test-linux64/debug-mochitest-sw-e10s-3 3
   130 - test-linux64/debug-mochitest-e10s-5 5
   120 - test-linux64/debug-mochitest-media-spi-e10s-1 mda1
   120 - test-linux64/debug-mochitest-media-sw-e10s-1 mda1
   120 - test-linux64/debug-mochitest-media-e10s-1 mda1
   108 - test-linux64/debug-mochitest-e10s-16 16
   108 - test-linux64/debug-mochitest-sw-e10s-16 16
    98 - test-linux64/debug-mochitest-e10s-6 6
    98 - test-linux64/debug-mochitest-sw-e10s-6 6
    96 - test-linux64/debug-telemetry-tests-client-e10s c
    90 - test-linux64/debug-mochitest-remote-e10s remote
    90 - test-linux64/debug-mochitest-remote-sw-e10s remote
    68 - test-linux64/debug-mochitest-a11y-sw-1proc a11y
    68 - test-linux64/debug-mochitest-a11y-1proc a11y
    58 - test-linux64/debug-mochitest-sw-e10s-10 10
    58 - test-linux64/debug-mochitest-e10s-10 10
    48 - test-linux64/debug-test-verify-e10s TV
    44 - test-linux64/debug-reftest-no-accel-sw-e10s-4 Ru4
    44 - test-linux64/debug-mochitest-media-spi-e10s-2 mda2
    44 - test-linux64/debug-reftest-no-accel-e10s-4 Ru4
    44 - test-linux64/debug-reftest-sw-e10s-4 R4
    44 - test-linux64/debug-reftest-e10s-4 R4
    44 - test-linux64/debug-mochitest-media-e10s-2 mda2
    44 - test-linux64/debug-mochitest-media-sw-e10s-2 mda2
    38 - test-linux64/debug-mochitest-media-sw-e10s-3 mda3
    38 - test-linux64/debug-mochitest-media-e10s-3 mda3
    38 - test-linux64/debug-mochitest-media-spi-e10s-3 mda3
    27 - test-linux64/debug-crashtest-e10s C
    27 - test-linux64/debug-crashtest-sw-e10s C
    18 - test-linux64/debug-mochitest-gpu-sw-e10s gpu
    18 - test-linux64/debug-mochitest-gpu-e10s gpu
    16 - test-linux64/debug-marionette-media-e10s MnM
    10 - test-linux64/debug-mochitest-webgl1-core-sw-e10s gl1c
    10 - test-linux64/debug-mochitest-webgl1-core-e10s gl1c
     8 - test-linux64/debug-reftest-e10s-2 R2
     8 - test-linux64/debug-reftest-no-accel-e10s-2 Ru2
     8 - test-linux64/debug-reftest-no-accel-sw-e10s-2 Ru2
     8 - test-linux64/debug-reftest-sw-e10s-2 R2
     4 - test-linux64/debug-reftest-e10s-5 R5
     4 - test-linux64/debug-reftest-sw-e10s-5 R5
     4 - test-linux64/debug-reftest-no-accel-sw-e10s-5 Ru5
     4 - test-linux64/debug-reftest-no-accel-e10s-5 Ru5
     2 - test-linux64/debug-reftest-no-accel-sw-e10s-3 Ru3
     2 - test-linux64/debug-mochitest-webgl1-ext-sw-e10s gl1e
     2 - test-linux64/debug-mochitest-webgl1-ext-e10s gl1e
     2 - test-linux64/debug-reftest-sw-e10s-3 R3
     2 - test-linux64/debug-reftest-e10s-3 R3
     2 - test-linux64/debug-reftest-no-accel-e10s-3 Ru3

It shows up in 21858 tests. A few of the most prevalent:

  4116 - [e10s] /html/semantics/forms/textfieldselection/selection.html
  3128 - [e10s] browser/components/urlbar/tests/browser/browser_UrlbarInput_formatValue.js
  2400 - [e10s] dom/tests/browser/browser_noopener.js
  1228 - [e10s] /dom/ranges/Range-set.html
  1120 - [e10s] browser/base/content/test/siteIdentity/browser_bug906190.js
  1116 - [e10s] /worklets/audio-worklet-csp.https.html
  1100 - [e10s] /worklets/animation-worklet-csp.https.html
  1100 - [e10s] /worklets/layout-worklet-csp.https.html
  1100 - [e10s] /worklets/paint-worklet-csp.https.html
  1008 - [e10s] Shutdown

[1] https://hg.mozilla.org/mozilla-central/annotate/a6fa09658817e99eb52335a0773f567ab20a34aa/obj-firefox/dist/include/mozilla/RangeBoundary.h#l79

Summary: 4,000 instances of "Constructing RangeBoundary with invalid value: 'mRef || aOffset == 0'" emitted from obj-firefox/dist/include/mozilla/RangeBoundary.h during linux64 debug testing → 461,000 instances of "Constructing RangeBoundary with invalid value: 'mRef || aOffset == 0'" emitted from obj-firefox/dist/include/mozilla/RangeBoundary.h during linux64 debug testing

The problems comes from RangeUtils::CompareNodeToRange when aNode is the root of an anonymous subtree (it's the anonymous div inside of an input). We try to get the index of aNode in it's parent's child list here

https://searchfox.org/mozilla-central/rev/b38e3beb658b80e1ed03e0fdf64d225bd4a40327/dom/base/RangeUtils.cpp#136

but that returns -1 because it's not in it's parents normal child list. I tried treating roots of anonymous subtrees like root nodes are treated in RangeUtils::CompareNodeToRange (that is represent it as "(node,0) and (node,numChildren)" instead of "(parent, index of node) and (parent, index of node + 1)").

https://treeherder.mozilla.org/#/jobs?repo=try&revision=a387d338b8d3dc27b006206dda6addd62ee3ad19

That fails dom/events/test/test_bug328885.html
We fail calling deleteContents on a range that only includes a text input on this line

https://searchfox.org/mozilla-central/rev/b38e3beb658b80e1ed03e0fdf64d225bd4a40327/dom/events/test/test_bug328885.html#58

That calls fails because of this line

https://searchfox.org/mozilla-central/rev/b38e3beb658b80e1ed03e0fdf64d225bd4a40327/dom/base/nsRange.cpp#1859

where parent is the input and node is the anonymous div child.

Any idea how to handle this?

It seems like all the code is just carefully constructed (by accident) to handle this and do the right thing. It seems like we should find a way to silence the warning when we try to construct a range boundary for a native anonymous content if we can't fix it properly.

nsContentUtils::ComparePoints just immediately deconstructs the range boundary into container and offset and calls a version of nsContentUtils::ComparePoints that takes containers/offsets instead of range boundaries.

This also avoids a warning in the RangeBoundary constructor.

Attachment #9085663 - Attachment description: Bug 1438996. Don't construct a unneeded temporary range object in RangeUtils::CompareNodeToRange. r?masayuki → Bug 1438996. Don't construct a unneeded temporary range object in RangeUtils::CompareNodeToRange. r=masayuki
Pushed by tnikkel@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2fce06fd642b
Don't construct a unneeded temporary range object in RangeUtils::CompareNodeToRange. r=masayuki
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
Assignee: nobody → tnikkel
You need to log in before you can comment on or make changes to this bug.