WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
179253
Implement ServiceWorkerContainer.getRegistration
https://bugs.webkit.org/show_bug.cgi?id=179253
Summary
Implement ServiceWorkerContainer.getRegistration
youenn fablet
Reported
2017-11-03 11:54:56 PDT
Implement ServiceWorkerContainer.getRegistration
Attachments
Patch
(26.74 KB, patch)
2017-11-03 12:20 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews106 for mac-elcapitan-wk2
(1.41 MB, application/zip)
2017-11-03 13:10 PDT
,
Build Bot
no flags
Details
Archive of layout-test-results from ews123 for ios-simulator-wk2
(1.12 MB, application/zip)
2017-11-03 13:32 PDT
,
Build Bot
no flags
Details
Patch
(28.63 KB, patch)
2017-11-03 13:42 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Moving the map
(36.13 KB, patch)
2017-11-03 15:22 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(36.22 KB, patch)
2017-11-03 15:56 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(36.21 KB, patch)
2017-11-03 16:08 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(37.73 KB, patch)
2017-11-03 17:19 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(37.64 KB, patch)
2017-11-03 18:25 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Show Obsolete
(8)
View All
Add attachment
proposed patch, testcase, etc.
youenn fablet
Comment 1
2017-11-03 12:20:23 PDT
Created
attachment 325932
[details]
Patch
Build Bot
Comment 2
2017-11-03 13:10:44 PDT
Comment on
attachment 325932
[details]
Patch
Attachment 325932
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
http://webkit-queues.webkit.org/results/5093772
New failing tests: imported/w3c/web-platform-tests/service-workers/service-worker/getregistration.https.html imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register.https.html
Build Bot
Comment 3
2017-11-03 13:10:45 PDT
Created
attachment 325940
[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-03 13:32:28 PDT
Comment on
attachment 325932
[details]
Patch
Attachment 325932
[details]
did not pass ios-sim-ews (ios-simulator-wk2): Output:
http://webkit-queues.webkit.org/results/5093944
New failing tests: imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register.https.html imported/w3c/web-platform-tests/service-workers/service-worker/getregistration.https.html
Build Bot
Comment 5
2017-11-03 13:32:30 PDT
Created
attachment 325948
[details]
Archive of layout-test-results from ews123 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews123 Port: ios-simulator-wk2 Platform: Mac OS X 10.12.6
youenn fablet
Comment 6
2017-11-03 13:42:16 PDT
Created
attachment 325952
[details]
Patch
youenn fablet
Comment 7
2017-11-03 15:22:55 PDT
Created
attachment 325972
[details]
Moving the map
Chris Dumez
Comment 8
2017-11-03 15:44:01 PDT
Comment on
attachment 325972
[details]
Moving the map View in context:
https://bugs.webkit.org/attachment.cgi?id=325972&action=review
> Source/WebCore/workers/service/ServiceWorkerContainer.cpp:179 > +void ServiceWorkerContainer::getRegistration(ScriptExecutionContext& context, const String& clientURL, Ref<DeferredPromise>&& promise)
I believe this is the caller's scriptExecutionContext, which is likely not what we want. You likely want ServiceWorkerContainer::scriptExecutionContext(), i.e. the context object's script execution context.
> Source/WebCore/workers/service/ServiceWorkerContainer.cpp:190 > + setPendingActivity(this);
You made me add makePendingActivity() for lambda like these and you're not even using it :P
> Source/WebCore/workers/service/ServiceWorkerContainer.cpp:192 > + auto protectedThis = makeRef(*this);
Why don't we just do this in the lambda capture?
> Source/WebCore/workers/service/ServiceWorkerContainer.cpp:203 > + auto& context = *scriptExecutionContext();
This looks like the right script execution context.
> LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-without-using-registration.https-expected.txt:2 > +Harness Error (TIMEOUT), message = null
New timeout but no new TestExpection?
youenn fablet
Comment 9
2017-11-03 15:56:57 PDT
Created
attachment 325980
[details]
Patch
youenn fablet
Comment 10
2017-11-03 16:08:45 PDT
Created
attachment 325981
[details]
Patch
Chris Dumez
Comment 11
2017-11-03 16:35:38 PDT
Comment on
attachment 325981
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=325981&action=review
> Source/WebCore/workers/service/ServiceWorkerContainer.cpp:181 > + ScriptExecutionContext& context = *scriptExecutionContext();
This is unsafe. scriptExecutionContext() can return null.
> Source/WebCore/workers/service/ServiceWorkerContainer.cpp:192 > + return m_swConnection->matchRegistration(context.topOrigin(), parsedURL, [promise = WTFMove(promise), protectedThis = makeRef(*this), this] (auto&& result) mutable {
I think we should take a PendingActivity here.
> Source/WebCore/workers/service/ServiceWorkerContainer.cpp:201 > + auto& context = *scriptExecutionContext();
scriptExecutionContext() can return null.
youenn fablet
Comment 12
2017-11-03 16:41:16 PDT
Comment on
attachment 325981
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=325981&action=review
>> Source/WebCore/workers/service/ServiceWorkerContainer.cpp:192 >> + return m_swConnection->matchRegistration(context.topOrigin(), parsedURL, [promise = WTFMove(promise), protectedThis = makeRef(*this), this] (auto&& result) mutable { > > I think we should take a PendingActivity here.
OK, will do and change canSuspend implementation.
>> Source/WebCore/workers/service/ServiceWorkerContainer.cpp:201 >> + auto& context = *scriptExecutionContext(); > > scriptExecutionContext() can return null.
We actually checked whether we were stopped above, so we are fine.
Chris Dumez
Comment 13
2017-11-03 16:44:14 PDT
Comment on
attachment 325981
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=325981&action=review
> Source/WebCore/workers/service/ServiceWorkerContainer.h:106 > + HashMap<ServiceWorkerRegistrationKey, RefPtr<ServiceWorkerRegistration>> m_registrations;
Oh, and I think the value should be a Ref<>
youenn fablet
Comment 14
2017-11-03 17:03:21 PDT
> > Source/WebCore/workers/service/ServiceWorkerContainer.cpp:181 > > + ScriptExecutionContext& context = *scriptExecutionContext(); > > This is unsafe. scriptExecutionContext() can return null.
I don't think that this case can happen when being called from JS binding since there we just created a promise. I guess this might happen when being called from other C++ code but this is clearly not the intent. Adding an extra if might not be that bad.
youenn fablet
Comment 15
2017-11-03 17:07:27 PDT
I will keep the patch with the current registration lifetime model. I think we will need to change it so that ServiceWorkerContainer owns registrations objects. Management will then be based on orders from the StorageProcess. Not keeping refs is observable from pages when keeping JS workers references but not JS registrations.
youenn fablet
Comment 16
2017-11-03 17:19:54 PDT
Created
attachment 325993
[details]
Patch
youenn fablet
Comment 17
2017-11-03 18:25:00 PDT
Created
attachment 325997
[details]
Patch
Chris Dumez
Comment 18
2017-11-03 18:45:42 PDT
Comment on
attachment 325997
[details]
Patch r=me if the bots are happy.
Chris Dumez
Comment 19
2017-11-03 19:12:11 PDT
Comment on
attachment 325997
[details]
Patch Clearing flags on attachment: 325997 Committed
r224453
: <
https://trac.webkit.org/changeset/224453
>
Chris Dumez
Comment 20
2017-11-03 19:12:13 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 21
2017-11-15 12:17:17 PST
<
rdar://problem/35567260
>
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