Open Bug 1486382 Opened 6 years ago Updated 2 years ago

this.rawNode.ownerGlobal is null, can't access property "customElements" of it

Categories

(DevTools :: Inspector, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: jdescottes, Unassigned)

References

(Blocks 1 open bug)

Details

We should guard the following line https://searchfox.org/mozilla-central/rev/e126996d9b0a3d7653de205898517f4f5b632e7f/devtools/server/actors/inspector/node.js#363

It was mentioned on slack by jlast, I could find some hits on sentry as well.

Trying to reproduce it is a bit tricky, but it seems to happen from time to time when navigating from one page to another, with the following stack trace:

  TypeError: this.rawNode.ownerGlobal is null, can't access property "customElements" of it: getCustomElementLocation@resource://devtools/shared/base-loader.js -> resource://devtools/server/actors/inspector/node.js:363:11
  form@resource://devtools/shared/base-loader.js -> resource://devtools/server/actors/inspector/node.js:129:30
  form@resource://devtools/shared/base-loader.js -> resource://devtools/server/actors/inspector/node.js:120:42
  write@resource://devtools/shared/base-loader.js -> resource://devtools/shared/protocol.js:353:44
  write/<@resource://devtools/shared/base-loader.js -> resource://devtools/shared/protocol.js:228:25
  write@resource://devtools/shared/base-loader.js -> resource://devtools/shared/protocol.js:228:14
  write@resource://devtools/shared/base-loader.js -> resource://devtools/shared/protocol.js:514:12
  write@resource://devtools/shared/base-loader.js -> resource://devtools/shared/protocol.js:696:20
  _sendEvent@resource://devtools/shared/base-loader.js -> resource://devtools/shared/protocol.js:991:16
  Actor/<@resource://devtools/shared/base-loader.js -> resource://devtools/shared/protocol.js:971:9
  emit@resource://devtools/shared/base-loader.js -> resource://devtools/shared/event-emitter.js:178:15
  emit@resource://devtools/shared/base-loader.js -> resource://devtools/shared/event-emitter.js:255:5
  _onReflows@resource://devtools/shared/base-loader.js -> resource://devtools/server/actors/inspector/walker.js:385:7
  emit@resource://devtools/shared/base-loader.js -> resource://devtools/shared/event-emitter.js:178:15
  emit@resource://devtools/shared/base-loader.js -> resource://devtools/shared/event-emitter.js:255:5
  _startEventLoop@resource://devtools/shared/base-loader.js -> resource://devtools/server/actors/reflow.js:312:7

It seems to only happen if you navigate away from a page where the inspector had rendered a node which was not actually included in the DOM tree, such as:
- content of a <template>
- unslotted shadow host child

For instance
- go to https://juliandescottes.github.io/webcomponents-playground/template/
- open inspector and select the <p> child of the <template>
- go to https://juliandescottes.github.io/webcomponents-playground/

You should see the error. For some reasons for those elements, ownerGlobal becomes null when navigating while it doesn't seem to happen for others. Maybe such globals are destroyed earlier since they are not needed in the page? In any case we should prevent this exception.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.