Open Bug 1215120 Opened 9 years ago Updated 2 years ago

Objects logged in a worker come through as [Object object]

Categories

(DevTools :: Console, defect, P2)

defect

Tracking

(firefox44 affected)

Tracking Status
firefox44 --- affected

People

(Reporter: bgrins, Unassigned)

References

(Blocks 2 open bugs)

Details

+++ This bug was initially created as a clone of Bug #1209353 +++

STR:
Open http://bgrins.github.io/devtools-demos/worker/webworker.html
Open console

Expected: see a log that includes the worker global scope (the worker is doing a console.log("Hello from worker", this)

Actual: see a log that's formatted like: Hello from worker [object DedicatedWorkerGlobalScope].
Summary: Errors / objects logged in a worker come through as [Object object] → Objects logged in a worker come through as [Object object]
Filed Bug 1224073 for errors caused during evaluation
See Also: → 1224073
See Also: → 1201962
Depends on: 1240851
See Also: → 1136995
Product: Firefox → DevTools

Fission should fix this.

Priority: -- → P3

Yulia, can you just confirm if the Fission protocol work fixes this; or if there is more work needed?

Flags: needinfo?(ystartsev)

I haven't looked very much into this so I might not be the best person to ask. but we have had work done with service workers to allow target switching, and the bug is still there. Maybe Brian Hackett knows more? He has been working on this.

Flags: needinfo?(ystartsev) → needinfo?(bhackett1024)

console.log(this) in a worker now produces '[object DedicatedWorkerGlobalScope]', though I don't know what fixed this.

Flags: needinfo?(bhackett1024)

(In reply to Brian Hackett (:bhackett) from comment #5)

console.log(this) in a worker now produces '[object DedicatedWorkerGlobalScope]', though I don't know what fixed this.

Oops, I didn't read this bug closely enough, the behavior here is still the same as in comment 0.

The problem here is that when the console tries to encode the global used in the worker for sending to the ConsoleAPIStorage service in the main thread (from which the worker console messages will be retrieved), that encoding fails and we fall back to converting the object to a string. The relevant code is in ConsoleRunnable::CustomWriteHandler() in dom/console/Console.cpp; the UNWRAP_OBJECT() macro produces a NS_ERROR_XPC_BAD_CONVERT_JS error.

Brian, would bug 1252945 help with this?

Flags: needinfo?(bhackett1024)
Priority: P3 → P2

(In reply to :Harald Kirschner :digitarald from comment #8)

Brian, would bug 1252945 help with this?

I think it would be better to look at this again once the related fission work for a multithreaded console is done, as Nicolas refers to in comment 21 of that bug. When console messages do not need to be dispatched from the worker thread to the main thread, it will be a lot easier to show those messages in the console without losing information.

Flags: needinfo?(bhackett1024)

Thanks Brian for clarifying.

Nicolas, could you please mark the right bug as a dependency.

Flags: needinfo?(nchevobbe)
Depends on: 1592584
Flags: needinfo?(nchevobbe)
See Also: → 1613424
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.