Bug 236739 - Hook up PushManager to notification permission state
Summary: Hook up PushManager to notification permission state
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ben Nham
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-02-16 15:12 PST by Ben Nham
Modified: 2022-02-18 21:28 PST (History)
4 users (show)

See Also:


Attachments
Patch (24.06 KB, patch)
2022-02-16 15:24 PST, Ben Nham
no flags Details | Formatted Diff | Diff
Patch (26.01 KB, patch)
2022-02-16 20:40 PST, Ben Nham
no flags Details | Formatted Diff | Diff
Patch (32.50 KB, patch)
2022-02-17 00:56 PST, Ben Nham
no flags Details | Formatted Diff | Diff
Patch (21.44 KB, patch)
2022-02-17 00:58 PST, Ben Nham
no flags Details | Formatted Diff | Diff
Patch (32.84 KB, patch)
2022-02-17 01:00 PST, Ben Nham
no flags Details | Formatted Diff | Diff
Patch (33.43 KB, patch)
2022-02-17 07:57 PST, Ben Nham
no flags Details | Formatted Diff | Diff
Patch (34.60 KB, patch)
2022-02-17 23:02 PST, Ben Nham
no flags Details | Formatted Diff | Diff
Patch for landing (34.54 KB, patch)
2022-02-18 15:48 PST, Ben Nham
no flags Details | Formatted Diff | Diff
Patch for landing (34.48 KB, patch)
2022-02-18 19:44 PST, Ben Nham
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Nham 2022-02-16 15:12:03 PST
Hook up PushManager to notification permission state
Comment 1 Ben Nham 2022-02-16 15:24:28 PST
Created attachment 452257 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2022-02-16 16:52:50 PST
<rdar://problem/89056721>
Comment 3 Ben Nham 2022-02-16 20:40:56 PST
Created attachment 452302 [details]
Patch
Comment 4 Brady Eidson 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+
Comment 5 Ben Nham 2022-02-17 00:56:19 PST
Created attachment 452334 [details]
Patch
Comment 6 Ben Nham 2022-02-17 00:58:30 PST
Created attachment 452335 [details]
Patch
Comment 7 Ben Nham 2022-02-17 01:00:06 PST
Created attachment 452336 [details]
Patch
Comment 8 Ben Nham 2022-02-17 07:57:51 PST
Created attachment 452366 [details]
Patch
Comment 9 Ben Nham 2022-02-17 23:02:31 PST
Created attachment 452486 [details]
Patch
Comment 10 Chris Dumez 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.
Comment 11 Brady Eidson 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
Comment 12 Chris Dumez 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)
Comment 13 Ben Nham 2022-02-18 15:48:44 PST
Created attachment 452590 [details]
Patch for landing
Comment 14 EWS 2022-02-18 19:25:13 PST
Found 1 new test failure: http/wpt/push-api/onpush-disabled.html
Comment 15 Ben Nham 2022-02-18 19:44:36 PST
Created attachment 452617 [details]
Patch for landing
Comment 16 EWS 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].