Bug 236739

Summary: Hook up PushManager to notification permission state
Product: WebKit Reporter: Ben Nham <nham>
Component: New BugsAssignee: Ben Nham <nham>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, cdumez, nham, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch for landing
none
Patch for landing none

Ben Nham
Reported 2022-02-16 15:12:03 PST
Hook up PushManager to notification permission state
Attachments
Patch (24.06 KB, patch)
2022-02-16 15:24 PST, Ben Nham
no flags
Patch (26.01 KB, patch)
2022-02-16 20:40 PST, Ben Nham
no flags
Patch (32.50 KB, patch)
2022-02-17 00:56 PST, Ben Nham
no flags
Patch (21.44 KB, patch)
2022-02-17 00:58 PST, Ben Nham
no flags
Patch (32.84 KB, patch)
2022-02-17 01:00 PST, Ben Nham
no flags
Patch (33.43 KB, patch)
2022-02-17 07:57 PST, Ben Nham
no flags
Patch (34.60 KB, patch)
2022-02-17 23:02 PST, Ben Nham
no flags
Patch for landing (34.54 KB, patch)
2022-02-18 15:48 PST, Ben Nham
no flags
Patch for landing (34.48 KB, patch)
2022-02-18 19:44 PST, Ben Nham
no flags
Ben Nham
Comment 1 2022-02-16 15:24:28 PST
Radar WebKit Bug Importer
Comment 2 2022-02-16 16:52:50 PST
Ben Nham
Comment 3 2022-02-16 20:40:56 PST
Brady Eidson
Comment 4 2022-02-16 22:52:16 PST
Comment on attachment 452302 [details] Patch This seems fine. Ping me when the bots are green and I'll give it the nit-pick look, but it'll be r+
Ben Nham
Comment 5 2022-02-17 00:56:19 PST
Ben Nham
Comment 6 2022-02-17 00:58:30 PST
Ben Nham
Comment 7 2022-02-17 01:00:06 PST
Ben Nham
Comment 8 2022-02-17 07:57:51 PST
Ben Nham
Comment 9 2022-02-17 23:02:31 PST
Chris Dumez
Comment 10 2022-02-18 09:08:25 PST
Comment on attachment 452486 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=452486&action=review > Source/WebCore/Modules/push-api/PushManager.cpp:134 > + promise.reject(Exception { NotAllowedError, "User denied push permission"_s }); We may want to provide a clearer explanation here of WHY this is failing. > Source/WebCore/Modules/push-api/PushManager.cpp:139 > + // Ref { *this } triggers a compiler bug on wincairo where it tries to ref the lambda instead of PushManager. MSVC has trouble with nested lambdas. I think the trick to get this building in MSVC is to capture `protectedThis = WTFMove(protectedThis)` below instead of `protectedThis = Ref { *this }`. > Source/WebCore/Modules/push-api/PushManager.cpp:170 > + if (permission == NotificationPermission::Default) This screams for a switch statement IMO.
Brady Eidson
Comment 11 2022-02-18 13:33:20 PST
Comment on attachment 452486 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=452486&action=review R+ with review feedback addressed >> Source/WebCore/Modules/push-api/PushManager.cpp:139 >> + // Ref { *this } triggers a compiler bug on wincairo where it tries to ref the lambda instead of PushManager. > > MSVC has trouble with nested lambdas. I think the trick to get this building in MSVC is to capture `protectedThis = WTFMove(protectedThis)` below instead of `protectedThis = Ref { *this }`. I think the bot bubbles are all green, which is good. >> Source/WebCore/Modules/push-api/PushManager.cpp:170 >> + if (permission == NotificationPermission::Default) > > This screams for a switch statement IMO. Agreed: Switch plz
Chris Dumez
Comment 12 2022-02-18 13:34:02 PST
Comment on attachment 452486 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=452486&action=review >>> Source/WebCore/Modules/push-api/PushManager.cpp:139 >>> + // Ref { *this } triggers a compiler bug on wincairo where it tries to ref the lambda instead of PushManager. >> >> MSVC has trouble with nested lambdas. I think the trick to get this building in MSVC is to capture `protectedThis = WTFMove(protectedThis)` below instead of `protectedThis = Ref { *this }`. > > I think the bot bubbles are all green, which is good. Well, they are all green because of an ugly #if !PLATFORM(WIN_CAIRO)
Ben Nham
Comment 13 2022-02-18 15:48:44 PST
Created attachment 452590 [details] Patch for landing
EWS
Comment 14 2022-02-18 19:25:13 PST
Found 1 new test failure: http/wpt/push-api/onpush-disabled.html
Ben Nham
Comment 15 2022-02-18 19:44:36 PST
Created attachment 452617 [details] Patch for landing
EWS
Comment 16 2022-02-18 21:27:58 PST
Committed r290198 (247526@main): <https://commits.webkit.org/247526@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 452617 [details].
Note You need to log in before you can comment on or make changes to this bug.