Closed Bug 1325101 Opened 7 years ago Closed 7 years ago

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

Categories

(Core :: DOM: Service Workers, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: bkelly, Assigned: catalinb)

References

Details

Attachments

(2 files)

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)
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!
Somehow, I removed the if('fetch') line when changing from throwing to warning.
Attachment #8820811 - Flags: review?(bkelly)
Tested on https://gauntface.github.io/simple-push-demo/, the patch fixes the issue.
Assignee: nobody → catalin.badea392
Flags: needinfo?(catalin.badea392)
I'll review this afternoon, but can you also update one of the automated test cases to catch this?
Attachment #8820818 - Flags: review?(bkelly)
Attachment #8820811 - Flags: review?(bkelly) → review+
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+
Keywords: checkin-needed
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
https://hg.mozilla.org/mozilla-central/rev/fa14643296e8
https://hg.mozilla.org/mozilla-central/rev/38f5c47acbe1
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Blocks: 1328293
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: