Closed Bug 1202001 Opened 9 years ago Closed 9 years ago

Syntax errors in service workers aren't logged to the web console

Categories

(Core :: DOM: Service Workers, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox43 --- affected
firefox44 --- fixed

People

(Reporter: marco, Assigned: ehsan.akhgari)

References

Details

Attachments

(1 file)

They are logged in the browser console.
Even with the service workers logging option turned on in the web console?
(In reply to Josh Matthews [:jdm] from comment #1)
> Even with the service workers logging option turned on in the web console?

Yes.
In the fetch event handler, I've added:
> console.log("HERE");
> var prova;
> prova.asdasd = 4;

In the web console I only see the "HERE" message.
In the browser console I see the "HERE" message followed by "TypeError: prova is undefined".
Blocks: ServiceWorkers-v1
No longer blocks: ServiceWorkers-postv1
Assignee: nobody → ehsan
Comment on attachment 8678612 [details] [diff] [review]
Log errors emitted during service worker lifecycle events to the Web Console

Review of attachment 8678612 [details] [diff] [review]:
-----------------------------------------------------------------

r=me not to use ID 0 any more.  It seems its preferred to use UINT64_MAX for invalid window ID.

That being said, I don't think WorkerPrivate::WindowID() will ever return a real window for a service worker.

So I don't think this will actually fix the problem described in this bug.  Did you see it work for you?
Attachment #8678612 - Flags: review?(bkelly) → review+
So, I am adding an nsILogCollector interface in bug 1215140.  The purpose is to let us save console messages OMT, and then later log them to the correct window.  We could possibly make WorkerPrivate implement this interface and then have SWM log the messages to the window calling .register().
I definitely am seeing an error reported to the web console after this patch on https://ehsan.github.io/sw-versioning/index2.html.  That's a simple test case where we register a SW containing a syntax error ("for(;;;;){}").
https://hg.mozilla.org/mozilla-central/rev/b1095ad5a4b8
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: