Crash in mozilla::ShouldClearTargets

VERIFIED FIXED in Firefox 62



a year ago
2 months ago


(Reporter: marcia, Assigned: smaug)


({crash, regression})


Firefox Tracking Flags

(firefox-esr52 unaffected, firefox-esr60 unaffected, firefox60 unaffected, firefox61 unaffected, firefox62 verified)


(crash signature)


(1 attachment, 1 obsolete attachment)

This bug was filed from the Socorro interface and is
report bp-952bf2b4-d13d-43c1-9071-e51e60180514.

Seen while looking at Mac crash stats: 11 crashes/9 installs on Mac in the last 7 days. Crashes seemed to have started with Build 20180512220039

Possible regression range based on Build ID:

Top 10 frames of crashing thread:

0 XUL mozilla::ShouldClearTargets dom/base/nsWrapperCache.h:264
1 XUL mozilla::EventDispatcher::Dispatch dom/events/EventDispatcher.cpp:955
2 XUL mozilla::EventDispatcher::DispatchDOMEvent dom/events/EventDispatcher.cpp
3 XUL nsINode::DispatchEvent dom/base/nsINode.cpp:1079
4 XUL nsContentUtils::DispatchEvent dom/base/nsContentUtils.cpp:4471
5 XUL nsContentUtils::DispatchTrustedEvent dom/base/nsContentUtils.cpp:4439
6 XUL mozilla::dom::HTMLSlotElement::FireSlotChangeEvent dom/html/HTMLSlotElement.cpp:241
7 XUL nsDOMMutationObserver::HandleMutationsInternal dom/base/nsDOMMutationObserver.cpp:949
8 XUL mozilla::CycleCollectedJSContext::PerformMicroTaskCheckPoint xpcom/base/CycleCollectedJSContext.cpp:543
9 XUL mozilla::CycleCollectedJSContext::AfterProcessTask xpcom/base/CycleCollectedJSContext.cpp:374

Recent crasher regression, needs an owner.
Flags: needinfo?(overholt)
Priority: -- → P1

Comment 2

a year ago
clearly my stuff.
Assignee: nobody → bugs
Flags: needinfo?(overholt)


a year ago
Duplicate of this bug: 1465357

Comment 4

a year ago
Posted patch shadow_subtree_root.diff (obsolete) — Splinter Review
I'm investigating whether shadow DOM could easily use mSubtreeRoot, but since QA is seeing this crash while testing shadow DOM, better to fix to asap.
Attachment #8981827 - Flags: review?(mrbkap)

Comment 5

a year ago
remote: Follow the progress of your build on Treeherder:
remote: recorded changegroup in replication log in 0.104s
Added another signature.
Crash Signature: [@ mozilla::ShouldClearTargets] → [@ mozilla::ShouldClearTargets] [@ static bool mozilla::ShouldClearTargets]
Comment on attachment 8981827 [details] [diff] [review]

Review of attachment 8981827 [details] [diff] [review]:

::: dom/base/nsINode.cpp
@@ +300,5 @@
> +      // method, which isn't supposed to return null.
> +      // So, fallback to slow path.
> +      node = const_cast<nsINode*>(this);
> +      nsINode* iter = node;
> +      while ((iter = iter->GetParentNode())) {

It's small, but would you mind taking this loop out into a common function? It's duplicated exactly a few lines below. Even a local:

auto RootOfNode = [](nsINode* iter) { ... };

would get rid of the duplication.
Attachment #8981827 - Flags: review?(mrbkap) → review+

Comment 8

a year ago
it is not exactly the same below, but ok, let me do something like that.

Comment 9

a year ago
haahaa, the NS_ASSERTION -> MOZ_ASSERT change revealed some other existing issue.

Comment 10

a year ago
Posted patch v2Splinter Review
You can blame me on the bad review for the LabelsList.
MaybeResetRoot really needs to be called after nsStyledElement::UnbindFromTree so that SubtreeRoot points to the right place again. Currently mSubtreeRoot points to somewhere higher up in the tree, and parentNode chain is possibly already cut.

And there was an invalid wpt test for that too (coming from the initial .labels commit). If the label and control stay in the same tree, .labels should still contain the label element.
From the spec
"If the for attribute is not specified, but the label element has a labelable element descendant, then the first such descendant in tree order is the label element's labeled control."
So, no need to be in document or anything like that.

Looks like we've got couple of NS_ASSERTIONs from the .labels stuff.
Attachment #8981827 - Attachment is obsolete: true
Attachment #8982060 - Flags: review?(mrbkap)

Comment 11

a year ago
remote: View your change here:
remote: Follow the progress of your build on Treeherder:
remote: recorded changegroup in replication log in 0.110s
Comment on attachment 8982060 [details] [diff] [review]

Review of attachment 8982060 [details] [diff] [review]:

::: dom/html/nsGenericHTMLElement.cpp
@@ +478,2 @@
>    // We need to consider a labels element is removed from tree,
>    // it needs to update labels list and its root as well.

Per IRC, please fix the grammar in this comment.
Attachment #8982060 - Flags: review?(mrbkap) → review+

Comment 13

a year ago
Pushed by
ensure SubtreeRoot always returns non-null value, r=mrbkap

Comment 14

a year ago
Last Resolved: a year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62

Comment 15

a year ago
Timea, want to re-test ?
Flags: needinfo?(timea.babos)

Comment 16

a year ago
I guess one may need to wait a bit to get new Nightly build.

Comment 17

a year ago
Hey everyone,

I tried to reproduce the issue based on the steps provided in Bug 1465357 without any success in reproducing it. 
Same goes for the second site that uses shadowDOM (, the issue could not be reproduced anymore on the latest Nightly 62.0a1 (2018-06-03) on Windows 10 x64.
Flags: needinfo?(timea.babos)

Comment 18

a year ago
Just to be sure, are the two crash signatures caused by the same issue?
I'm asking in order to know if the way I verified the fix (as mentioned above)is enough or further testing is needed.
Flags: needinfo?(bugs)

Comment 19

a year ago
Based on the stack trace, they are about the same issue.

Thanks for testing!
Flags: needinfo?(bugs)

Comment 20

a year ago
Based on Comment 17 and Comment 19 I will close this issue as Verified - Fixed.
Created web-platform-tests PR for changes under testing/web-platform/tests
Upstream PR merged
Component: DOM → DOM: Core & HTML
Product: Core → Core
You need to log in before you can comment on or make changes to this bug.