RESOLVED FIXED 180826
self.importScripts() should obey updateViaCache inside service workers
https://bugs.webkit.org/show_bug.cgi?id=180826
Summary self.importScripts() should obey updateViaCache inside service workers
Chris Dumez
Reported 2017-12-14 12:10:11 PST
self.importScripts() should obey updateViaCache inside service workers: - https://html.spec.whatwg.org/multipage/workers.html#dom-workerglobalscope-importscripts
Attachments
Patch (25.81 KB, patch)
2017-12-14 13:18 PST, Chris Dumez
no flags
Patch (26.98 KB, patch)
2017-12-14 15:08 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2017-12-14 13:18:32 PST
youenn fablet
Comment 2 2017-12-14 14:44:43 PST
Comment on attachment 329390 [details] Patch r=me. These tests would also be handy as WPT tests. It would be good for future service worker tests that do not require any internals to be in LayoutTests/wpt/service-workers. That will make it easy to upload them to WPT if we are in hurry right now. View in context: https://bugs.webkit.org/attachment.cgi?id=329390&action=review > Source/WebCore/workers/service/SWClientConnection.cpp:213 > + This dual-pattern is handy but at the same time somehow wrong: - In ServiceWorkerProcess, we will iterate through SWContextManager (good) and all dummy documents (useless) - In WebProcess, we will iterate through documents (good) and SWContextManager (useless and we will create one for that reason). Wonder whether there would be a better pattern here. > Source/WebCore/workers/service/server/SWServerRegistration.h:63 > + void setLastUpdateTime(WallTime); It seems SWServerRegistration m_lastUpdateTime is only set when we install a context. If so, there might be a bug since it should also be set when creating a SWServerRegistration from the database. I wonder how we can test such things without waiting 24 hours. This would probably require having internals API to reload a SWServer from database and another to tweak SWServer registrations.
Chris Dumez
Comment 3 2017-12-14 14:49:46 PST
Comment on attachment 329390 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=329390&action=review >> Source/WebCore/workers/service/SWClientConnection.cpp:213 >> + > > This dual-pattern is handy but at the same time somehow wrong: > - In ServiceWorkerProcess, we will iterate through SWContextManager (good) and all dummy documents (useless) > - In WebProcess, we will iterate through documents (good) and SWContextManager (useless and we will create one for that reason). > Wonder whether there would be a better pattern here. Not a new issue but I agree it'd be nice to find a better pattern. >> Source/WebCore/workers/service/server/SWServerRegistration.h:63 >> + void setLastUpdateTime(WallTime); > > It seems SWServerRegistration m_lastUpdateTime is only set when we install a context. > If so, there might be a bug since it should also be set when creating a SWServerRegistration from the database. > > I wonder how we can test such things without waiting 24 hours. > This would probably require having internals API to reload a SWServer from database and another to tweak SWServer registrations. This is not true, lastUpdateTime is saved to disk and restored from disk.
Chris Dumez
Comment 4 2017-12-14 14:57:32 PST
Comment on attachment 329390 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=329390&action=review >>> Source/WebCore/workers/service/server/SWServerRegistration.h:63 >>> + void setLastUpdateTime(WallTime); >> >> It seems SWServerRegistration m_lastUpdateTime is only set when we install a context. >> If so, there might be a bug since it should also be set when creating a SWServerRegistration from the database. >> >> I wonder how we can test such things without waiting 24 hours. >> This would probably require having internals API to reload a SWServer from database and another to tweak SWServer registrations. > > This is not true, lastUpdateTime is saved to disk and restored from disk. Actually, it looks like even though we save it to the database, it is not properly restored. I'll look into fixing this in a follow-up.
Chris Dumez
Comment 5 2017-12-14 15:08:05 PST
Chris Dumez
Comment 6 2017-12-14 15:59:46 PST
Comment on attachment 329406 [details] Patch Clearing flags on attachment: 329406 Committed r225940: <https://trac.webkit.org/changeset/225940>
Chris Dumez
Comment 7 2017-12-14 15:59:48 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 8 2017-12-14 16:00:39 PST
Note You need to log in before you can comment on or make changes to this bug.