WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 179480
matchRegistration does not need to go to StorageProcess if no service worker is registered
https://bugs.webkit.org/show_bug.cgi?id=179480
Summary
matchRegistration does not need to go to StorageProcess if no service worker ...
youenn fablet
Reported
2017-11-09 08:41:27 PST
This is a small optimization
Attachments
Patch
(2.09 KB, patch)
2017-11-09 08:42 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews106 for mac-elcapitan-wk2
(2.86 MB, application/zip)
2017-11-09 09:56 PST
,
Build Bot
no flags
Details
Archive of layout-test-results from ews122 for ios-simulator-wk2
(2.24 MB, application/zip)
2017-11-09 10:06 PST
,
Build Bot
no flags
Details
Patch
(11.01 KB, patch)
2017-11-09 16:15 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(16.09 KB, patch)
2017-11-09 17:20 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(21.12 KB, patch)
2017-11-12 22:38 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(21.14 KB, patch)
2017-11-13 09:55 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(24.39 KB, patch)
2017-11-13 13:19 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(32.63 KB, patch)
2017-11-13 14:45 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(32.62 KB, patch)
2017-11-13 14:47 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch for landing
(32.35 KB, patch)
2017-11-13 15:26 PST
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Show Obsolete
(10)
View All
Add attachment
proposed patch, testcase, etc.
youenn fablet
Comment 1
2017-11-09 08:42:39 PST
Created
attachment 326451
[details]
Patch
Build Bot
Comment 2
2017-11-09 09:56:45 PST
Comment on
attachment 326451
[details]
Patch
Attachment 326451
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
http://webkit-queues.webkit.org/results/5164498
New failing tests: imported/w3c/web-platform-tests/service-workers/service-worker/claim-with-redirect.https.html http/tests/workers/service/service-worker-getRegistration.html imported/w3c/web-platform-tests/service-workers/service-worker/registration-iframe.https.html imported/w3c/web-platform-tests/service-workers/service-worker/activation.https.html
Build Bot
Comment 3
2017-11-09 09:56:46 PST
Created
attachment 326460
[details]
Archive of layout-test-results from ews106 for mac-elcapitan-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-elcapitan-wk2 Platform: Mac OS X 10.11.6
Build Bot
Comment 4
2017-11-09 10:06:13 PST
Comment on
attachment 326451
[details]
Patch
Attachment 326451
[details]
did not pass ios-sim-ews (ios-simulator-wk2): Output:
http://webkit-queues.webkit.org/results/5164515
New failing tests: http/tests/workers/service/service-worker-getRegistration.html imported/w3c/web-platform-tests/service-workers/service-worker/claim-with-redirect.https.html imported/w3c/web-platform-tests/service-workers/service-worker/registration-iframe.https.html imported/w3c/web-platform-tests/service-workers/service-worker/activation.https.html
Build Bot
Comment 5
2017-11-09 10:06:14 PST
Created
attachment 326462
[details]
Archive of layout-test-results from ews122 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews122 Port: ios-simulator-wk2 Platform: Mac OS X 10.12.6
Chris Dumez
Comment 6
2017-11-09 10:53:14 PST
Comment on
attachment 326451
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=326451&action=review
> Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp:111 > + if (!hasServiceWorkerRegisteredForOrigin(SecurityOrigin::create(clientURL))) {
I think we currently use topOrigin in the store.
youenn fablet
Comment 7
2017-11-09 16:15:40 PST
Created
attachment 326505
[details]
Patch
Chris Dumez
Comment 8
2017-11-09 16:28:35 PST
Comment on
attachment 326505
[details]
Patch The new test results look like regression to me. I think we need to investigate them.
youenn fablet
Comment 9
2017-11-09 17:20:30 PST
Created
attachment 326516
[details]
Patch
youenn fablet
Comment 10
2017-11-12 22:38:00 PST
Created
attachment 326745
[details]
Patch
youenn fablet
Comment 11
2017-11-13 09:55:18 PST
Created
attachment 326765
[details]
Patch
Chris Dumez
Comment 12
2017-11-13 12:13:04 PST
Comment on
attachment 326765
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=326765&action=review
> Source/WebCore/workers/service/server/SWServer.cpp:87 > + if (!m_registrations.set(key, WTFMove(registration)).isNewEntry)
How can it not be a new registration? I think this should be an assertion, not an if check.
> Source/WebCore/workers/service/server/SWServer.cpp:91 > + ++m_originCounts.ensure(topOrigin->toString(), [&] {
Can we move the originCount to the ServiceWorkerOriginStore for better encapsulation? The server should not have to deal with counts.
> Source/WebCore/workers/service/server/SWServer.cpp:100 > + if (!m_registrations.remove(key))
I don't think this should happen. Should probably be an assertion instead of an if check.
> Source/WebCore/workers/service/server/SWServer.cpp:120 > + m_originStore->clear();
I think moving the originStore to SWServer is indeed a good idea.
> LayoutTests/imported/w3c/ChangeLog:8 > + Updating tests as otherwise they would fail trying to access to document.body which would be null.
How is this related to your code change? You code change is not supposed to cause web-facing behavior change AFAICT. Therefore, no test update should be needed.
youenn fablet
Comment 13
2017-11-13 12:44:29 PST
(In reply to Chris Dumez from
comment #12
)
> Comment on
attachment 326765
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=326765&action=review
> > > Source/WebCore/workers/service/server/SWServer.cpp:87 > > + if (!m_registrations.set(key, WTFMove(registration)).isNewEntry) > > How can it not be a new registration? I think this should be an assertion, > not an if check. > > > Source/WebCore/workers/service/server/SWServer.cpp:91 > > + ++m_originCounts.ensure(topOrigin->toString(), [&] { > > Can we move the originCount to the ServiceWorkerOriginStore for better > encapsulation? The server should not have to deal with counts. > > > Source/WebCore/workers/service/server/SWServer.cpp:100 > > + if (!m_registrations.remove(key)) > > I don't think this should happen. Should probably be an assertion instead of > an if check. > > > Source/WebCore/workers/service/server/SWServer.cpp:120 > > + m_originStore->clear(); > > I think moving the originStore to SWServer is indeed a good idea. > > > LayoutTests/imported/w3c/ChangeLog:8 > > + Updating tests as otherwise they would fail trying to access to document.body which would be null. > > How is this related to your code change? You code change is not supposed to > cause web-facing behavior change AFAICT. Therefore, no test update should be > needed.
I think there is some race condition between the type document.body is populated and the time the code using document.body is executed. With this additional optimization, we remove an additional IPC call which makes this issue more visible.
youenn fablet
Comment 14
2017-11-13 13:19:19 PST
Created
attachment 326786
[details]
Patch
youenn fablet
Comment 15
2017-11-13 13:22:36 PST
> I think there is some race condition between the type document.body is > populated and the time the code using document.body is executed. With this > additional optimization, we remove an additional IPC call which makes this > issue more visible.
I wrapped one of the test with a setTimeout and removed the html body element. The test then works.
Chris Dumez
Comment 16
2017-11-13 13:27:36 PST
Comment on
attachment 326786
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=326786&action=review
> Source/WebCore/workers/service/server/SWServer.h:113 > + HashMap<String, uint64_t> m_originCounts;
OriginStore was just supposed to be an interface. We want as much of the store complexity/logic as possible out of SWServer. For this reason, I still believe the counts should be handled at WebSWOriginStore level. WebSWOriginStore basically becomes a HashCountedSet, which is fine.
> LayoutTests/imported/w3c/ChangeLog:7 > +
What's the upstream PR for this change? why is this needed? Where is document.body used? Could not find body being used in activation.https.html, is it used from an imported script or iframe?
Chris Dumez
Comment 17
2017-11-13 13:28:34 PST
(In reply to Chris Dumez from
comment #16
)
> Comment on
attachment 326786
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=326786&action=review
> > > Source/WebCore/workers/service/server/SWServer.h:113 > > + HashMap<String, uint64_t> m_originCounts; > > OriginStore was just supposed to be an interface. We want as much of the > store complexity/logic as possible out of SWServer. For this reason, I still > believe the counts should be handled at WebSWOriginStore level. > WebSWOriginStore basically becomes a HashCountedSet, which is fine. > > > LayoutTests/imported/w3c/ChangeLog:7 > > + > > What's the upstream PR for this change? why is this needed? Where is > document.body used? Could not find body being used in activation.https.html, > is it used from an imported script or iframe?
Note that presumably, those tests are passing in Chrome so this may indicate we have a bug?
youenn fablet
Comment 18
2017-11-13 14:45:47 PST
Created
attachment 326805
[details]
Patch
youenn fablet
Comment 19
2017-11-13 14:46:08 PST
There is also the case that WebSWOriginTable::contains return false if its origin table shared memory is not yet initialized. We should probably go to the StorageProcess in that case. Just trying to tweak it locally and it helps fixing one test, not the other. But then it makes basic-register.html fail. I'll fix that as a follow-up.
youenn fablet
Comment 20
2017-11-13 14:47:08 PST
Created
attachment 326806
[details]
Patch
Chris Dumez
Comment 21
2017-11-13 15:15:59 PST
Comment on
attachment 326806
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=326806&action=review
r=me with changes.
> Source/WebCore/workers/service/server/SWServer.cpp:88 > + auto result = m_registrations.set(key, WTFMove(registration));
Should be an add(), not a set(). We should never overwrite.
> Source/WebCore/workers/service/server/SWServer.cpp:115 > + m_registrations.removeIf([&] (auto& entry) {
We should not make this change unless we also clear the right jobQueues. otherwise, we will end up with jobQueues that are out of sync with the server (expect a registration to be there but isn't). Let's clear the jobQueues: m_jobQueues.removeIf([&] (auto& entry) { return entry.key.topOrigin() == originData; });
youenn fablet
Comment 22
2017-11-13 15:26:48 PST
Created
attachment 326813
[details]
Patch for landing
WebKit Commit Bot
Comment 23
2017-11-13 16:20:29 PST
Comment on
attachment 326813
[details]
Patch for landing Clearing flags on attachment: 326813 Committed
r224792
: <
https://trac.webkit.org/changeset/224792
>
WebKit Commit Bot
Comment 24
2017-11-13 16:20:31 PST
All reviewed patches have been landed. Closing bug.
youenn fablet
Comment 25
2017-11-14 06:43:05 PST
W3C PR is at
https://github.com/w3c/web-platform-tests/pull/8177
Radar WebKit Bug Importer
Comment 26
2017-11-15 09:38:13 PST
<
rdar://problem/35562119
>
Chris Dumez
Comment 27
2017-12-03 14:48:55 PST
Comment on
attachment 326813
[details]
Patch for landing View in context:
https://bugs.webkit.org/attachment.cgi?id=326813&action=review
> LayoutTests/imported/w3c/ChangeLog:9 > + * web-platform-tests/service-workers/service-worker/activation.https.html:
Is there a PR for this? I could not find it.
youenn fablet
Comment 28
2017-12-03 21:00:26 PST
(In reply to Chris Dumez from
comment #27
)
> Comment on
attachment 326813
[details]
> Patch for landing > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=326813&action=review
> > > LayoutTests/imported/w3c/ChangeLog:9 > > + * web-platform-tests/service-workers/service-worker/activation.https.html: > > Is there a PR for this? I could not find it.
This should be
https://github.com/w3c/web-platform-tests/pull/8177
Chris Dumez
Comment 29
2017-12-04 07:59:05 PST
(In reply to youenn fablet from
comment #28
)
> (In reply to Chris Dumez from
comment #27
) > > Comment on
attachment 326813
[details]
> > Patch for landing > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=326813&action=review
> > > > > LayoutTests/imported/w3c/ChangeLog:9 > > > + * web-platform-tests/service-workers/service-worker/activation.https.html: > > > > Is there a PR for this? I could not find it. > > This should be
https://github.com/w3c/web-platform-tests/pull/8177
I see. I got confused because the body is at a different place upstream and downstream.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug