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

RESOLVED FIXED in Firefox 57

Status

()

P2
normal
RESOLVED FIXED
a year ago
a year ago

People

(Reporter: jryans, Assigned: xidorn)

Tracking

({assertion})

unspecified
mozilla57
assertion
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox-esr52 unaffected, firefox55 unaffected, firefox56 wontfix, firefox57 fixed)

Details

Attachments

(2 attachments)

(Reporter)

Description

a year ago
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
(Reporter)

Updated

a year ago
Priority: -- → P2
(Assignee)

Comment 1

a year ago
Hmmm, suspect it is some XBL rule which may not be covered by ServoStyleRuleMap.
(Reporter)

Comment 2

a year ago
(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.
(Assignee)

Comment 3

a year ago
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)
(Assignee)

Comment 5

a year ago
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)

Updated

a year ago
Assignee: nobody → xidorn+moz
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)

Comment 8

a year ago
mozreview-review
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 9

a year ago
mozreview-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+
Comment hidden (mozreview-request)

Comment 11

a year ago
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

Comment 12

a year ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/7b89f778658e
https://hg.mozilla.org/mozilla-central/rev/28a61ac5f305
Status: NEW → RESOLVED
Last Resolved: a year ago
status-firefox57: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
status-firefox55: --- → unaffected
status-firefox56: --- → wontfix
status-firefox-esr52: --- → unaffected
(Reporter)

Updated

a year ago
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"
(Reporter)

Updated

a year ago
Blocks: 1388165

Comment 13

a year ago
https://hg.mozilla.org/projects/date/rev/7b89f778658ef54fc9e8aa2478aee1fd51432555
Bug 1386865 part 1 - Have GetServoStyleSet return non-const ServoStyleSet. r=TYLin

https://hg.mozilla.org/projects/date/rev/28a61ac5f3056b32b107e2bb94858be345b09055
Bug 1386865 part 2 - Collect style rule maps for XBL bindings. r=heycam
You need to log in before you can comment on or make changes to this bug.