Closed Bug 1923648 Opened 19 days ago Closed 10 days ago

Service worker console logs are blank

Categories

(DevTools :: Console, defect)

Firefox 131
defect

Tracking

(firefox-esr115 unaffected, firefox-esr128 unaffected, firefox131 wontfix, firefox132 fixed, firefox133 fixed)

RESOLVED FIXED
133 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr128 --- unaffected
firefox131 --- wontfix
firefox132 --- fixed
firefox133 --- fixed

People

(Reporter: jeffduy, Assigned: jdescottes)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(3 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:130.0) Gecko/20100101 Firefox/130.0

Steps to reproduce:

On Firefox 131, I inspected a running service worker that has console logs.

Actual results:

Console logs are happening but they are all blank. I see a timestamp and they're grouped since they're all blank.

Expected results:

Console logs should log whatever visibly. Reverting to Firefox 130 fixes my issue.

Version: Firefox 130 → Firefox 131

The Bugbug bot thinks this bug should belong to the 'DevTools::Console' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Console
Product: Firefox → DevTools

Need to try and reproduce, maybe with STRs from Bug 1429805

We don't recall any change around service worker debugging between 130 and 131, but maybe something was updated.

There are also some reports on https://discourse.mozilla.org/t/how-to-enable-console-log-from-service-worker/130394/8 for issues with servce worker logs.

Flags: needinfo?(jdescottes)
See Also: → 1429805

I'm actually unable to see any log in the regular devtools console for service workers, in Nightly or in ESR, even after enabling devtools.debugger.features.windowless-service-workers

But they show up in the Browser Console.

jeffduy: do you have a public test page you could share?

Flags: needinfo?(jdescottes) → needinfo?(jeffduy)

Note that also toggling dom.worker.console.dispatch_events_to_main_thread to false (in addition to devtools.debugger.features.windowless-service-workers) helps see the messages.

I also couldn't reproduce "blank" messages. It either show up with the two prefs toggled, or not at all.

The log looks like this

self.addEventListener('activate', function (event) {
    event.waitUntil(
        (async () => {
            console.log('active event: ', event);
           return self.clients.claim();
        })()
    );
});

(In reply to jeffduy from comment #5)

Created attachment 9431247 [details]
Screenshot 2024-10-16 at 10.06.16 AM

The log looks like this

self.addEventListener('activate', function (event) {
    event.waitUntil(
        (async () => {
            console.log('active event: ', event);
           return self.clients.claim();
        })()
    );
});

Maybe we have trouble serializing the event object? What if you try to add another console.log only with a string?

With dom.worker.console.dispatch_events_to_main_thread to true and devtools.debugger.features.windowless-service-workers to false (which I think are the default values? I've never messed with them before at least) I am getting the blank messages.

I don't have a public test page atm, but I can try to get one up for you. In the mean time, I've attached a screenshot of the service worker console with the blank output just trying to log the activate event.

No dice on just logging a string either.

Interestingly enough, even console.logging directly into the service worker console produces blank messages

(In reply to jeffduy from comment #7)

With dom.worker.console.dispatch_events_to_main_thread to true and devtools.debugger.features.windowless-service-workers to false (which I think are the default values? I've never messed with them before at least) I am getting the blank messages.

I don't have a public test page atm, but I can try to get one up for you. In the mean time, I've attached a screenshot of the service worker console with the blank output just trying to log the activate event.

No dice on just logging a string either.

Are you debugging them via about:debugging? I assumed it was done via a regular toolbox debugging a webpage, but your comment probably means are actually using about:debugging?

Ah yes, correct I am debugging them via about:debugging; Sorry I should have made that more explicit.

Ah thanks! I can reproduce on Firefox 131. On Nightly (Firefox 133) it seems "fixed" for live messages, but I still see blank messages for messages retrieved from the cache.

Status: UNCONFIRMED → NEW
Ever confirmed: true

Only seems to affect 131, so either it's a regression specific to this version, or it's something specific to the release channel (eg a preference?)

Edit: Even if live messages work in 132 and 133, I verified on ESR 128 that even cached messages were working back then. So there's definitely still some regression, albeit less severe.

Hi Andrew, do you know if anything changed between Firefox 130 and 131 for service worker log messages? DevTools seems to struggle to retrieve the text for those. In 132 and 133 it works for messages captured live by the toolbox, but cached messages are blank?

Flags: needinfo?(bugmail)

This is probably on DevTools side, I seem to get the messages properly in the client. Sorry for the noise.

Flags: needinfo?(bugmail)

This was regressed when we removed the backward compat code for 131 at Bug 1912237. The compat comment states that console messages are no longer encapsulated in a "message" property but that's wrong, at least for cached worker messages.

Keywords: regression
Regressed by: 1912237

Initial change was done in Bug 1901644, but at that time, the backward compat code helped to make things still work for a while.
Then in 131 it regressed when said code was removed. And the live messages bug was fixed in Bug 1921384. Only cached messages are still broken.

See Also: → 1921384, 1901644

(clearing the ni? the regression was clearly identified, thanks for the answers!)

Flags: needinfo?(jeffduy)
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ced26b8a9ad0 [devtools] Fix logging cached service worker messages in about:debugging r=devtools-reviewers,ochameau
Status: ASSIGNED → RESOLVED
Closed: 10 days ago
Resolution: --- → FIXED
Target Milestone: --- → 133 Branch

The patch landed in nightly and beta is affected.
:jdescottes, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox132 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(jdescottes)

Comment on attachment 9431309 [details]
Bug 1923648 - [devtools] Fix logging cached service worker messages in about:debugging

Beta/Release Uplift Approval Request

  • User impact if declined/Reason for urgency: Cached messages from service workers are blank in DevTools
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): DevTools-only change, which only impacts logging of console messages from service workers. Change itself is trivial and has automated tests.
  • String changes made/needed:
  • Is Android affected?: No
Flags: needinfo?(jdescottes)
Attachment #9431309 - Flags: approval-mozilla-beta?
Flags: in-testsuite+

Comment on attachment 9431309 [details]
Bug 1923648 - [devtools] Fix logging cached service worker messages in about:debugging

Approved for 132.0rc1.

Attachment #9431309 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: