If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

[ServiceWorkers] We need a more seamless way of falling through the route rather than forcing middleware developers to add the "work-only-if-no-response-yet" code pattern at the beginning of its code

RESOLVED FIXED in Firefox OS master

Status

Firefox OS
Gaia
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: arcturus, Assigned: salva)

Tracking

unspecified
NGA S2 (12Jun)
Dependency tree / graph

Firefox Tracking Flags

(b2g-master fixed)

Details

(Whiteboard: [s3])

Attachments

(1 attachment)

Comment hidden (empty)
Whiteboard: [s2]
Get to a consensus on how we want to do this and implement this :)

Updated

2 years ago
Blocks: 1153312

Updated

2 years ago
Summary: [serviworkers] We need a more seamless way of falling through the route rather than forcing middleware developers to add the "work-only-if-no-response-yet" code pattern at the beginning of its code. → [serviceworkers] We need a more seamless way of falling through the route rather than forcing middleware developers to add the "work-only-if-no-response-yet" code pattern at the beginning of its code.

Updated

2 years ago
Summary: [serviceworkers] We need a more seamless way of falling through the route rather than forcing middleware developers to add the "work-only-if-no-response-yet" code pattern at the beginning of its code. → [ServiceWorkers] We need a more seamless way of falling through the route rather than forcing middleware developers to add the "work-only-if-no-response-yet" code pattern at the beginning of its code
Assignee: nobody → salva
Status: NEW → ASSIGNED

Updated

2 years ago
Whiteboard: [s2] → [s3]
Target Milestone: --- → NGA S2 (12Jun)
Created attachment 8615166 [details] [review]
Implement the new onFetch() workflow and API for middlewares

Hi Francisco. Long but fully tested and working. Can you review, please?
Attachment #8615166 - Flags: review?(francisco)
Notice I stop to clone request and responses. I prefer the user to crash rather than perform unneeded operations if goals for SWW are "lean and fast".
Blocks: 1161494
Comment on attachment 8615166 [details] [review]
Implement the new onFetch() workflow and API for middlewares

Just left some comments, tiny ones, but this work looks amazing :)

Amazing that we keep the compatibility and have the new mechanism. We should think in the future if we remove the compatibility, but so far looks like a win.

Thanks a lot for the fantastic work!
Attachment #8615166 - Flags: review?(francisco) → review+
Blocks: 1160135
Comment on attachment 8615166 [details] [review]
Implement the new onFetch() workflow and API for middlewares

I've updated the specification and implementation in separated commits. Can you double-check the implementation, please?
Attachment #8615166 - Flags: review+ → review?(francisco)
I added three commits more about warning the developer about errors in the middleware pipeline. Problem is that according with the specification [1], if `.respondWith()` is passed with a rejecting promise or a promise resolving in a thing different than a Response instance, the client's fetch will fail with network error. I would want to give an opportunity for the developer to see the error in the console as well.

[1] http://www.w3.org/TR/service-workers/#respond-with-method
Comment on attachment 8615166 [details] [review]
Implement the new onFetch() workflow and API for middlewares

Excellent job, everything pretty clear and well documented.

I really like the flexibility but everything is looking quite consistent.

Just one thing before merging, we should bump the version both for npm package and bower to 0.1.0, wdyt?
Attachment #8615166 - Flags: review?(francisco) → review+
master: f31ce642b4b68307602c4b8f1cbb3d0a1465c07b
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED

Updated

2 years ago
status-b2g-master: --- → fixed
Duplicate of this bug: 1155612
You need to log in before you can comment on or make changes to this bug.