-
Notifications
You must be signed in to change notification settings - Fork 17
Public domain sw #188
Public domain sw #188
Conversation
|
You bet! Looking at this now…
That's a good idea, since we're about to release v1, and using sw-precache with a custom template is a smaller set of changes, so it should be less risky. (We'll probably still remove sw-precache eventually, so I would keep this PR open and rebase it once we land that one.) |
lib/offline.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: with this change, I'd also modify the sentence to read, "so the worker doesn't include itself in the list of files to cache."
256d731 to
62cdd06
Compare
|
All done, @mykmelez do you mind to take a second look? I also changed how the worker prepares the new cache to be populated: before adding content, it deletes it in case the last installation failed and we would have a partially populated cache. |
lib/offline.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: no need to define another function, simply do stream.on('finish', resolve);
|
@delapuente Is this still a work-in-progress? It seems pretty ready, but the issue summary still has a WIP tag. |
lib/offline.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: you could avoid defining these two variables (data and hash) and directly do `hash: getHash(fs.readFileSync(filepath));', to make the function cleaner.
|
I did a second pass today, it looks good to me. I wish we had tests that actually executed the service worker code, but the changes look safe enough to land to me. |
|
My onboarding session finished. I'm going to remove the WIP tag, fix all the nits and I will open a follow up for testing the service worker, how do you want to test the service worker? We can use karma-sw-mocha as a testing environment if you want. It's being used in ServiceWorkerWare. |
62cdd06 to
70ca62a
Compare
|
@mykmelez for some reason, this is not working in the latest Nightly but it's doing perfectly in Chrome. I'm going to review the worker because I don't know what's happening. |
Sounds good. I guess you can set it up pretty easily since you wrote it 😄 |
|
Well, what does not work is controlled updating. The service worker got updated and installed but there is no After some research, it turns out the sw-precache version is not working either. I think it could be related with bug 1189659. I have some test cases (very simple workers) where I got it to run in Nightly but I fail making the oghliner version to work. I will be talking to bkelly or baku to solve this mistery. Anyway, I think the new service worker is ready enough. What do you think @marco-c @mykmelez ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd still like to understand what this comment is suggesting, but I'm not going to block landing the branch on this.
This PR removes the dependency with sw-precache at the same time it provides a basic servie worker.