Bug 231278

Summary: Add PushSubscription stubs
Product: WebKit Reporter: Ben Nham <nham>
Component: WebCore Misc.Assignee: Ben Nham <nham>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, annulen, beidson, benjamin, calvaris, cdumez, esprehn+autocc, ews-watchlist, gyuyoung.kim, kondapallykalyan, nham, ryuan.choi, sergio, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Ben Nham
Reported 2021-10-05 22:02:42 PDT
Add PushSubscription stubs
Attachments
Patch (77.39 KB, patch)
2021-10-05 22:13 PDT, Ben Nham
no flags
Patch (76.02 KB, patch)
2021-10-05 23:22 PDT, Ben Nham
no flags
Patch (75.36 KB, patch)
2021-10-06 11:07 PDT, Ben Nham
no flags
Patch (75.29 KB, patch)
2021-10-06 12:31 PDT, Ben Nham
no flags
Ben Nham
Comment 1 2021-10-05 22:13:10 PDT
Radar WebKit Bug Importer
Comment 2 2021-10-05 22:15:11 PDT
Alex Christensen
Comment 3 2021-10-05 22:48:48 PDT
Comment on attachment 440330 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=440330&action=review > Source/WebCore/Modules/push-api/PushEncryptionKeyName.h:32 > +enum class PushEncryptionKeyName { : bool > Source/WebCore/Modules/push-api/PushSubscription.cpp:103 > + { "p256dh", base64URLEncodeToString(m_clientECDHPublicKey) }, > + { "auth", base64URLEncodeToString(m_auth) } _s > Source/WebCore/Modules/push-api/PushSubscription.h:48 > + WEBCORE_EXPORT static Ref<PushSubscription> create(String&& endpoint, std::optional<DOMTimeStamp> expirationTime, Ref<PushSubscriptionOptions>&&, Vector<uint8_t>&& clientECDHPublicKey, Vector<uint8_t>&& auth); This might be a good candidate for something like this: template<typename... Args> static Ref<PushSubscription> create(Args&&... args) { return adoptRef(*new PushSubscription(std::forward<Args>(args)...)); } > Source/WebCore/Modules/push-api/PushSubscription.h:66 > + Vector<uint8_t> m_auth; Could you use a whole word to describe what this is instead of an abbreviation? > Source/WebCore/Modules/push-api/PushSubscriptionOptions.cpp:40 > + extra space.
Ben Nham
Comment 4 2021-10-05 23:22:31 PDT
youenn fablet
Comment 5 2021-10-06 07:15:47 PDT
Comment on attachment 440335 [details] Patch Some nits below View in context: https://bugs.webkit.org/attachment.cgi?id=440335&action=review > Source/WebCore/Modules/push-api/PushSubscription.cpp:65 > +Ref<PushSubscriptionOptions> PushSubscription::options() const We can probably return a PushSubscriptionOptions& > Source/WebCore/Modules/push-api/PushSubscription.h:37 > +#include <array> Why do we need this one? > Source/WebCore/Modules/push-api/PushSubscription.h:40 > +#include <wtf/RefCounted.h> PushSubscriptionOptions.h probably has some of these. > Source/WebCore/Modules/push-api/PushSubscriptionOptions.cpp:69 > + return protectedApplicationServerKey; return m_applicationServerKey.copyRef()? > LayoutTests/ChangeLog:14 > + * http/wpt/push-api/pushSubscription.https.any.html: Added. Maybe not needed right now, but it will be good in the future to cover this in service worker context as well. In case this is needed ServiceWorkerInternals can help.
Ben Nham
Comment 6 2021-10-06 11:07:34 PDT
Ben Nham
Comment 7 2021-10-06 11:09:08 PDT
(In reply to youenn fablet from comment #5) > > LayoutTests/ChangeLog:14 > > + * http/wpt/push-api/pushSubscription.https.any.html: Added. > > Maybe not needed right now, but it will be good in the future to cover this > in service worker context as well. > In case this is needed ServiceWorkerInternals can help. For some reason I was having trouble with this--globalThis.internals was null in the service worker context in this test. I plan to change this test soon anyway to not use internals and just create a fake subscription via PushManager.subscribe. Once I do that I'll modify the test to run in the window and worker context.
Ben Nham
Comment 8 2021-10-06 12:31:19 PDT
EWS
Comment 9 2021-10-06 21:15:12 PDT
Committed r283700 (242626@main): <https://commits.webkit.org/242626@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 440414 [details].
Note You need to log in before you can comment on or make changes to this bug.