Closed Bug 1225470 Opened 9 years ago Closed 9 years ago

waitUntil() promise rejection still not reported to console

Categories

(Core :: DOM: Service Workers, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox43 --- wontfix
firefox44 --- fixed
firefox45 --- fixed
b2g-v2.5 --- fixed

People

(Reporter: bkelly, Assigned: bkelly)

References

Details

Attachments

(1 file)

We still have issues where we don't report anything to the console when a waitUntil() promise rejects.  In some cases, like install event, this is a fatal error and blocks the service worker from going forward.  In other cases, like activate and fetch events, there is no negative side effect of the rejection, but the developer should still probably know about it.

We should report these rejections.

I'd like to get this into 44 aurora, but I'm not going to block the release on it.
Tested locally.  Note, I plan to improve the message in 45, but I can't uplift l10n string changes to 44 any more.
Attachment #8689288 - Flags: review?(amarchesini)
Comment on attachment 8689288 [details] [diff] [review]
Report a message to the console when a service worker waitUntil() is rejected. r=baku

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

::: dom/workers/ServiceWorkerEvents.cpp
@@ +759,5 @@
> +public:
> +  NS_DECL_THREADSAFE_ISUPPORTS
> +
> +  explicit WaitUntilHandler(JSContext* aCx)
> +    : mWorkerPrivate(GetCurrentThreadWorkerPrivate())

This should be received the the callee.

@@ +768,5 @@
> +    mWorkerPrivate->AssertIsOnWorkerThread();
> +
> +    // Save the location of the waitUntil() call itself as a fallback
> +    // in case the rejection value does not contain any location info.
> +    nsJSUtils::GetCallingLocation(aCx, mSourceSpec, &mLine, &mColumn);

this can fail.. in theory.

@@ +847,2 @@
>  {
>    MOZ_ASSERT(!NS_IsMainThread());

Then we are in a worker thread. Can you take WorkerPrivate here, add an assertion, and pass the workerPrivate to the WaitUntilHandler?
Attachment #8689288 - Flags: review?(amarchesini) → review+
(In reply to Andrea Marchesini (:baku) from comment #2)
> @@ +768,5 @@
> > +    mWorkerPrivate->AssertIsOnWorkerThread();
> > +
> > +    // Save the location of the waitUntil() call itself as a fallback
> > +    // in case the rejection value does not contain any location info.
> > +    nsJSUtils::GetCallingLocation(aCx, mSourceSpec, &mLine, &mColumn);
> 
> this can fail.. in theory.

If it does, then the location info will be empty.  If the rejection value does not contain any location info either, then the console report is not shown.  I think this is the best we can do.
Comment on attachment 8689288 [details] [diff] [review]
Report a message to the console when a service worker waitUntil() is rejected. r=baku

Approval Request Comment
[Feature/regressing bug #]: Service workers
[User impact if declined]: This ensures certain script errors are reported to the console for developers trying to use service workers.
[Describe test coverage new/current, TreeHerder]: Local testing.
[Risks and why]: Minimal.  Only affects service workers.
[String/UUID change made/needed]: None.
Attachment #8689288 - Flags: approval-mozilla-aurora?
https://hg.mozilla.org/mozilla-central/rev/c18e0cc2b208
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
Ben, normally the SW patches you request for uplift have new tests in them. Just wondering, whether you plan to add automated tests for this one later. Thanks!
Flags: needinfo?(bkelly)
Comment on attachment 8689288 [details] [diff] [review]
Report a message to the console when a service worker waitUntil() is rejected. r=baku

SW is planned for 44, taking it.
Attachment #8689288 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
I wrote a follow-on bug to add a test.  See bug 1229156.
Flags: needinfo?(bkelly)
(In reply to Ben Kelly [:bkelly] from comment #12)
> I wrote a follow-on bug to add a test.  See bug 1229156.

Nice! That's awesome. Thank you for keeping the quality bar high.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: