Closed Bug 1386865 Opened 3 years ago Closed 3 years ago

Stylo: DevTools test using XBL triggers "MOZ_ASSERT_UNREACHABLE: We should be able to map a raw rule to a rule"

Categories

(Core :: CSS Parsing and Computation, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox-esr52 --- unaffected
firefox55 --- unaffected
firefox56 --- wontfix
firefox57 --- fixed

People

(Reporter: jryans, Assigned: xidorn)

References

Details

(Keywords: assertion)

Attachments

(2 files)

DevTools test devtools/client/inspector/markup/test/browser_markup_anonymous_04.js triggers[1] an assertion in Stylo debug builds:

Assertion failure: false (MOZ_ASSERT_UNREACHABLE: We should be able to map a raw rule to a rule), at /home/worker/workspace/build/src/layout/inspector/inDOMUtils.cpp:286

[1]: https://treeherder.mozilla.org/logviewer.html#?job_id=120109119&repo=try&lineNumber=3111
Hmmm, suspect it is some XBL rule which may not be covered by ServoStyleRuleMap.
(In reply to Xidorn Quan [:xidorn] UTC+10 from comment #1)
> Hmmm, suspect it is some XBL rule which may not be covered by
> ServoStyleRuleMap.

Sounds likely, the test appears to involve <video> elements.
Had a look at bug 1290276, it seems XBL <stylesheet> uses a separate styleset. Maybe we don't have a separate document for accessing that styleset?

Anyway, we need to get the proper ServoStyleSet in inDOMUtils::GetCSSStyleRules, so that we can create a ServoStyleRuleMap for it.

TYLin, how can we get the styleset of XBL given an element it styles?
Flags: needinfo?(tlin)
On servo side, we can call element's each_xbl_stylist(), which walks the given element's binding chain to the parent, and call the callback f for each stylist. 

This re-implmentes gecko's nsBindingManager::WalkRules(). If we need to call it on gecko side, I think we could replace nsXBLBinding::WalkRules() [2] by nsXBLBinding::GetServoStyleSet(), and do something to each of the elements stylesets.

[1] http://searchfox.org/mozilla-central/rev/f0e4ae5f8c40ba742214e89aba3f554da0b89a33/servo/components/style/gecko/wrapper.rs#1142
[2] http://searchfox.org/mozilla-central/rev/f0e4ae5f8c40ba742214e89aba3f554da0b89a33/dom/xbl/nsBindingManager.cpp#687
Flags: needinfo?(tlin)
So the style rule we failed to map in this case is in toolkit/themes/shared/media/videocontrols.css, which is referenced from toolkit/content/widgets/videocontrols.xml, so it is indeed a rule from XBL binding.
Assignee: nobody → xidorn+moz
Comment on attachment 8893236 [details]
Bug 1386865 part 1 - Have GetServoStyleSet return non-const ServoStyleSet.

https://reviewboard.mozilla.org/r/164278/#review169620

r=me assuming this is needed by part 2.
Attachment #8893236 - Flags: review?(tlin) → review+
Comment on attachment 8893237 [details]
Bug 1386865 part 2 - Collect style rule maps for XBL bindings.

https://reviewboard.mozilla.org/r/164280/#review169628

::: layout/inspector/inDOMUtils.cpp:279
(Diff revision 1)
>      map->EnsureTable();
>  
> +    // Collect style rule maps for bindings.
> +    nsTArray<ServoStyleRuleMap*> bindingMaps;

How about we put `map` in `bindingMaps` so that below we can just look up `bindingMaps` instead of looking at `map` and `bindingMaps` separately.
Attachment #8893237 - Flags: review?(cam) → review+
Pushed by xquan@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7b89f778658e
part 1 - Have GetServoStyleSet return non-const ServoStyleSet. r=TYLin
https://hg.mozilla.org/integration/autoland/rev/28a61ac5f305
part 2 - Collect style rule maps for XBL bindings. r=heycam
https://hg.mozilla.org/mozilla-central/rev/7b89f778658e
https://hg.mozilla.org/mozilla-central/rev/28a61ac5f305
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Summary: Stylo: DevTools test triggers "MOZ_ASSERT_UNREACHABLE: We should be able to map a raw rule to a rule" → Stylo: DevTools test using XBL triggers "MOZ_ASSERT_UNREACHABLE: We should be able to map a raw rule to a rule"
You need to log in before you can comment on or make changes to this bug.