service worker no-fetch optimization doesn't seem to work

RESOLVED FIXED in Firefox 53

Status

()

Core
DOM: Service Workers
RESOLVED FIXED
a year ago
a year ago

People

(Reporter: bkelly, Assigned: catalinb)

Tracking

unspecified
mozilla53
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox53 fixed)

Details

Attachments

(2 attachments)

(Reporter)

Description

a year ago
I tried testing the latest nightly on some sites I know only use push notifications.  AFAICT, the service worker is still starting up.  For example, try this site:

  https://gauntface.github.io/simple-push-demo/

I opened up the serviceworkers.txt file to see if I was running the version with the new info and it appears I am:

https://gauntface.github.io/simple-push-demo/
https://gauntface.github.io/simple-push-demo/service-worker.js
true
{3280b85a-c2ae-4f7f-b005-abd4fe3ca9d2}

We're just selecting true for the fetch handler boolean for some reason.

Catalin, can you take a look?
Flags: needinfo?(catalin.badea392)
(Reporter)

Comment 1

a year ago
It seems we should only do this for `addEventListener('fetch')`:

https://dxr.mozilla.org/mozilla-central/source/dom/workers/WorkerScope.cpp#693

I think right now we set the flag if there are any event handlers.  Sorry I missed this in review!
(Assignee)

Comment 2

a year ago
Created attachment 8820811 [details] [diff] [review]
Don't set fetch handler flag for events other than 'fetch'.

Somehow, I removed the if('fetch') line when changing from throwing to warning.
Attachment #8820811 - Flags: review?(bkelly)
(Assignee)

Comment 3

a year ago
Tested on https://gauntface.github.io/simple-push-demo/, the patch fixes the issue.
Assignee: nobody → catalin.badea392
Flags: needinfo?(catalin.badea392)
(Reporter)

Comment 4

a year ago
I'll review this afternoon, but can you also update one of the automated test cases to catch this?
(Assignee)

Comment 5

a year ago
Created attachment 8820818 [details] [diff] [review]
Update nofetch handler mochitest.
Attachment #8820818 - Flags: review?(bkelly)
(Reporter)

Updated

a year ago
Attachment #8820811 - Flags: review?(bkelly) → review+
(Reporter)

Comment 6

a year ago
Comment on attachment 8820818 [details] [diff] [review]
Update nofetch handler mochitest.

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

Thanks!
Attachment #8820818 - Flags: review?(bkelly) → review+
(Assignee)

Updated

a year ago
Keywords: checkin-needed

Comment 8

a year ago
Pushed by ihsiao@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/fa14643296e8
Don't set fetch handler flag for events other than 'fetch'. r=bkelly
https://hg.mozilla.org/integration/mozilla-inbound/rev/38f5c47acbe1
Update nofetch handler mochitest. r=bkelly
Keywords: checkin-needed

Comment 9

a year ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/fa14643296e8
https://hg.mozilla.org/mozilla-central/rev/38f5c47acbe1
Status: NEW → RESOLVED
Last Resolved: a year ago
status-firefox53: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
(Reporter)

Updated

a year ago
Blocks: 1328293
You need to log in before you can comment on or make changes to this bug.