Bug 238372 - Add support for focused and visible ServiceWorkerWindowClient states
Summary: Add support for focused and visible ServiceWorkerWindowClient states
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Service Workers (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-03-25 05:42 PDT by youenn fablet
Modified: 2022-03-29 09:49 PDT (History)
9 users (show)

See Also:


Attachments
Patch (22.56 KB, patch)
2022-03-25 06:32 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (23.54 KB, patch)
2022-03-25 07:21 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2022-03-25 05:42:32 PDT
Add support for focused and visible ServiceWorkerWindowClient states
Comment 1 Radar WebKit Bug Importer 2022-03-25 06:07:53 PDT
<rdar://problem/90833197>
Comment 2 youenn fablet 2022-03-25 06:32:07 PDT
Created attachment 455755 [details]
Patch
Comment 3 youenn fablet 2022-03-25 07:21:24 PDT
Created attachment 455756 [details]
Patch
Comment 4 EWS 2022-03-25 14:20:48 PDT
Committed r291888 (248887@main): <https://commits.webkit.org/248887@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 455756 [details].
Comment 5 Darin Adler 2022-03-29 09:49:49 PDT
Comment on attachment 455756 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=455756&action=review

> Source/WebCore/page/FocusController.cpp:371
> +        auto* frame = oldFrame.get();
> +        do {
> +            frame->document()->updateServiceWorkerClientData();
> +            frame = frame->tree().parent();
> +        } while (frame);

I like this better as a for loop, although that gives us one additional null check, but also, would be nice to use RefPtr, so:

    for (auto frame = oldFrame; frame; frame = frame->tree().parent())
        frame->document()->updateServiceWorkerClientData();

> Source/WebCore/page/FocusController.cpp:383
> +        auto* frame = newFrame.get();
> +        do {
> +            frame->document()->updateServiceWorkerClientData();
> +            frame = frame->tree().parent();
> +        } while (frame);

Ditto. Also maybe we can use a shared function so we don’t have to repeat #if ENABLE and don’t have to repeat the code either.