Closed Bug 1714974 Opened 3 years ago Closed 3 years ago

Using the Browser Toolbox in debugging mode with shared console frequently breaks due to "can't access property \"traits\", this.client is null"

Categories

(DevTools :: Console, defect, P2)

defect

Tracking

(firefox-esr78 unaffected, firefox89 wontfix, firefox90 wontfix, firefox91 fixed)

RESOLVED FIXED
91 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox89 --- wontfix
firefox90 --- wontfix
firefox91 --- fixed

People

(Reporter: standard8, Assigned: nchevobbe)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

What were you doing?

  1. Start up a developer build of Firefox (I'm on changeset b8840fca48)
  2. I have about:config, about:preferences open in tabs, as well as https://www.merriam-webster.com/dictionary/test
  3. Start up the Browser Toolbox, switch to the debugger and open the shared console.
  4. Open https://www.merriam-webster.com/dictionary/testing in a new tab.
  5. Reload the merriam-webster pages a bit, and wait a while.

What happened?

The shared console goes blank, can no longer be accessed. Lots of errors on the command line console (see below)

What should have happened?

Shared console and debugger should keep working.

Anything else we should know?

I was testing on Mac. Hitting some breakpoints seemed to make it happen quicker.

Errors on terminal:

console.error: ({})
> console.warn: "Listener for event 'worker' did not return a promise."
> console.warn: "Listener for event 'worker' did not return a promise."
Handler function threw an exception: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIHttpChannelInternal.remoteAddress]"  nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)"  location: "JS frame :: resource://devtools/server/actors/network-monitor/network-observer.js :: _onResponseHeader :: line 1043"  data: no]
Stack: _onResponseHeader@resource://devtools/server/actors/network-monitor/network-observer.js:1043:5
_dispatchActivity@resource://devtools/server/actors/network-monitor/network-observer.js:620:14
NetworkObserver.prototype.observeActivity<@resource://devtools/server/actors/network-monitor/network-observer.js:729:12
exports.makeInfallible/<@resource://devtools/shared/ThreadSafeDevToolsUtils.js:103:22
Line: 1043, column: 0
console.error: ({})
> console.warn: "Listener for event 'worker' did not return a promise."
> console.error: (new TypeError("can't access property \"traits\", this.client is null", "resource://devtools/client/fronts/targets/target-mixin.js", 276))
TypeError: can't access property "traits", this.client is null: getTrait@resource://devtools/client/fronts/targets/target-mixin.js:276:7
get isTopLevel@resource://devtools/client/fronts/targets/target-mixin.js:147:17
_onTargetDestroyed@resource://devtools/client/framework/toolbox.js:732:9
_emit@resource://devtools/shared/event-emitter.js:226:34
emit@resource://devtools/shared/event-emitter.js:172:18
emit@resource://devtools/shared/event-emitter.js:324:18
_onTargetDestroyed@resource://devtools/shared/commands/target/target-command.js:272:28
_workerListChanged@resource://devtools/shared/commands/target/legacy-target-watchers/legacy-workers-watcher.js:104:14

console.error: (new TypeError("can't access property \"traits\", this.client is null", "resource://devtools/client/fronts/targets/target-mixin.js", 276))
TypeError: can't access property "traits", this.client is null: getTrait@resource://devtools/client/fronts/targets/target-mixin.js:276:7
get isTopLevel@resource://devtools/client/fronts/targets/target-mixin.js:147:17
onTargetDestroyed@resource://devtools/client/debugger/src/client/firefox.js:152:7
_emit@resource://devtools/shared/event-emitter.js:226:34
emit@resource://devtools/shared/event-emitter.js:172:18
emit@resource://devtools/shared/event-emitter.js:324:18
_onTargetDestroyed@resource://devtools/shared/commands/target/target-command.js:272:28
_workerListChanged@resource://devtools/shared/commands/target/legacy-target-watchers/legacy-workers-watcher.js:104:14

I think the first couple were probably from the site that I was loading; this.client is null error gets repeated lots.

I can reproduce:

-> console goes blank

I'm taking care of this right now

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED

Bug 1695744 made the WorkerDescriptor extend a DescriptorMixin instead of the TargetMixin, but the descriptor mixin is missing the url getter that the descriptor one had (other changes later on might have caused the issue to show up, as it landed quite a while ago)

Regressed by: 1695744
Has Regression Range: --- → yes

It can happen that the getTrait method is called on a given target after it has
been destroyed, and in such case, this.client is null, which was throwing.

The getter was using this.url , which does not exist in the class,
nor in the descriptor-mixin.
The patch switches to this._url which is the actual property where
the url is stored.

Depends on D117011

Attachment #9225596 - Attachment description: Bug 1714974 - [devtools] Check this.client before accessing traits in TargetMixin#getTrait. r=ochameau. → Bug 1714974 - [devtools] Don't use getTrait from TargetMixin#isTopLevel. r=ochameau.
Severity: -- → S3
Priority: -- → P2
Attachment #9225596 - Attachment description: Bug 1714974 - [devtools] Don't use getTrait from TargetMixin#isTopLevel. r=ochameau. → Bug 1714974 - [devtools] Fix handling of worker target destruction in legacy listener. r=ochameau.
Attachment #9225596 - Attachment description: Bug 1714974 - [devtools] Fix handling of worker target destruction in legacy listener. r=ochameau. → Bug 1714974 - [devtools] Fix BrowserToolbox console going blank when worker target is destroyed. r=ochameau.
Attachment #9225597 - Attachment is obsolete: true
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e370883d9d3b [devtools] Fix BrowserToolbox console going blank when worker target is destroyed. r=ochameau.
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: