Open Bug 1618072 Opened 4 years ago Updated 3 months ago

Improve the error message generated for network errors

Categories

(Core :: DOM: Service Workers, enhancement, P2)

enhancement

Tracking

()

People

(Reporter: ehsan.akhgari, Assigned: jmarshall)

References

Details

Here we convert a network error which we have semantic information about (e.g., that it's a 404) into an NS_ERROR_FAILURE, which later on is turned into a type error with a message like this: TypeError: ServiceWorker script at http://example.com/extensions/permissions/test/notification-test-sw.js for scope http://example.com/extensions/permissions/test/sw-test/ encountered an error during installation.

It would be nice to improve this error message, for example: TypeError: ServiceWorker script at http://example.com/extensions/permissions/test/notification-test-sw.js could not be fetched successfully (error HTTP 404), so the installation for http://example.com/extensions/permissions/test/sw-test/ was aborted..

Priority: -- → P2
Assignee: nobody → jmarshall
Severity: normal → S3

I think the idea here isn't to make ServiceWorkerCache be intercepted by DevTools directly.
I suspect that this code runs in the parent process, or at least a process other than the Web Page currently debugged by the DevTools.
It may be a performance burden to make DevTools go listen into that distinct process. Most error would be ignored except a couple of ServiceWorker exceptions.

I believe the idea is that this ServiceWorkerCache code somehow pass around more information down to ServiceWorkerJob so that it also mention more details about the actual network error that we see happend in ServiceWorkerCache.
Note that I have no idea if there is actually a relationship between ServiceWorkerCache and ServiceWorkerJob, nor how they might be wired.

Also, I would like to mention that a method might be misnamed.
ServiceWorkerManager::ReportToAllClients doesn't seem to be dispatching to "all clients".
I don't know what clients really are, but I imagine we might have one per BrowsingContext -or- Worker?
Instead this method will only notify the parent process console listeners.
Tweaking this method to actually dispatch the error message into content processes, might actually help having devtools being able to catch the console messages.

You need to log in before you can comment on or make changes to this bug.