[webkit-changes] [WebKit/WebKit] a8ed18: Preserve microphone and camera permissions in case...

youennf noreply at github.com
Thu Oct 31 06:09:01 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a8ed1887e6b234660829c3d6f8978149b276a1b5
      https://github.com/WebKit/WebKit/commit/a8ed1887e6b234660829c3d6f8978149b276a1b5
  Author: Youenn Fablet <youenn at apple.com>
  Date:   2024-10-31 (Thu, 31 Oct 2024)

  Changed paths:
    M Source/WebCore/loader/FrameLoader.cpp
    M Source/WebCore/loader/FrameLoader.h
    M Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp
    M Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.messages.in
    M Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Tools/TestWebKitAPI/Tests/WebKit/GetUserMedia.mm

  Log Message:
  -----------
  Preserve microphone and camera permissions in case of same-origin web application initiated navigations
rdar://138122655
https://bugs.webkit.org/show_bug.cgi?id=282339

Reviewed by Eric Carlson.

Before the patch, camnera/microphone permissions are reset for every navigation.

When a web application navigates directly without the user involvement, the user may not notice the navigation.
And user may be annoyed by being asked again for microphone/camera prompts.

We change the heuristic to keep resetting camnera/microphone permissions in case:
- User decided for the navigation (whether sameo origin or not) or the reload
- Navigation is cross-origin.
Othewrwise, we no longer reset these permissions.

To do so, within WebPageProxy::didChangeMainDocument, we check whether the navigation is user initiated or not.
We fix a case where reload triggered by a user was not always marked as user initiated by updating WebPage::reload and FrameLoader::reload.

We make WebLocalFrameLoaderClient::dispatchDidChangeMainDocument pass the navigation ID so that WebPageProxy::didChangeMainDocument can get the navigation information.

Covered by API test.

* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::reload):
* Source/WebCore/loader/FrameLoader.h:
* Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::resetAccess):
* Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didChangeMainDocument):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:
(WebKit::WebLocalFrameLoaderClient::dispatchDidChangeMainDocument):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::reload):
* Tools/TestWebKitAPI/Tests/WebKit/GetUserMedia.mm:
(TestWebKitAPI::(WebKit, KeepPermissionForWebAppSameOriginNavigations)):
(TestWebKitAPI::InterruptionBetweenGetDisplayMediaAndGetUserMedia)): Deleted.

Canonical link: https://commits.webkit.org/285950@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list