Closed Bug 1451037 Opened 6 years ago Closed 6 years ago

Empty <body> in markup view with shadow dom enabled when loading http://bgrins.github.io/devtools-demos/inspector/shadowdom.html

Categories

(DevTools :: Inspector, defect)

defect
Not set
normal

Tracking

(firefox61 fixed)

RESOLVED FIXED
Firefox 61
Tracking Status
firefox61 --- fixed

People

(Reporter: bgrins, Assigned: jdescottes)

References

Details

Attachments

(1 file)

One liner: `./mach run --devtools --setpref dom.webcomponents.shadowdom.enabled=true http://bgrins.github.io/devtools-demos/inspector/shadowdom.html`

I see only <body></body> and the following error:

console.error: (new TypeError("node is null", "resource://devtools/shared/base-loader.js -> resource://devtools/server/actors/inspector/walker.js", 309))
_ref@resource://devtools/shared/base-loader.js -> resource://devtools/server/actors/inspector/walker.js:309:1
_getBeforeAfterElements@resource://devtools/shared/base-loader.js -> resource://devtools/server/actors/inspector/walker.js:727:18
children@resource://devtools/shared/base-loader.js -> resource://devtools/server/actors/inspector/walker.js:709:29
get numChildren@resource://devtools/shared/base-loader.js -> resource://devtools/server/actors/inspector/node.js:241:21
form@resource://devtools/shared/base-loader.js -> resource://devtools/server/actors/inspector/node.js:110:7
write@resource://devtools/shared/base-loader.js -> resource://devtools/shared/protocol.js:317:44
It turns out v0 is going away in Bug 1426605. We don't really need to support this page, but after talking with Julian we should at least prevent throwing to be safe.
See Also: → 1426605
So far it looks like the implementation fails severely on shadow roots created via the deprecated createShadowRoot().

Platform support should be removed soon-ish, so the main thing we should do here is to make sure we don't throw, since this highlighted weaknesses in our code. I guess walking the children of the old-style shadow root objects returned null nodes, and some spots in the code did not handle that correctly.

Mostly:
- walker.js _getBeforeAfterElements (calling _ref on null nodes)
- walker.js _onReflows (calling Cu.isDeadWrapper on null objects)
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Wrong analysis on my end. The root cause of the issue is actually with completely empty host components. The code fetching before/after pseudos can easily fail. This can happen with regular web components as well. Adding a fix and a test case.
Comment on attachment 8964815 [details]
Bug 1451037 - check if shadow host has children when fetching before/after pseudos;

https://reviewboard.mozilla.org/r/233538/#review239372
Attachment #8964815 - Flags: review?(bgrinstead) → review+
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f68f2c031f58
check if shadow host has children when fetching before/after pseudos;r=bgrins
https://hg.mozilla.org/mozilla-central/rev/f68f2c031f58
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 61
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: