Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 20b974894559bf8f27d9d44d106f0e72af028246
      
https://github.com/WebKit/WebKit/commit/20b974894559bf8f27d9d44d106f0e72af028246
  Author: Cole Carley <[email protected]>
  Date:   2026-05-16 (Sat, 16 May 2026)

  Changed paths:
    M LayoutTests/platform/ios-site-isolation/TestExpectations
    M Source/WebCore/dom/DeviceMotionEvent.cpp
    M Source/WebCore/dom/DeviceOrientationAndMotionAccessController.cpp
    M Source/WebCore/dom/DeviceOrientationAndMotionAccessController.h
    M Source/WebCore/dom/DeviceOrientationEvent.cpp
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/page/LocalDOMWindow.cpp
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/Page.h
    M Source/WebKit/UIProcess/RemotePageProxy.cpp
    M Source/WebKit/UIProcess/RemotePageProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/WebPage.messages.in

  Log Message:
  -----------
  [Site Isolation] 
http/tests/device-orientation/device-orientation-permission-granted-in-other-iframes-from-same-origin.html
 fails
https://bugs.webkit.org/show_bug.cgi?id=314675
rdar://176924464

Reviewed by Sihui Liu and Charlie Wolfe.

Under site isolation, Document::deviceOrientationAndMotionAccessController()
gave every iframe its own per-Document controller when the top frame lived
in another process, so same-origin sibling iframes did not share a permission
cache and re-prompted after the UI-process cache was cleared.

To fix this, I moved the ownership of the 
DeviceOrientationAndMotionAccessController
to the Page. Same-origin iframes on the same Page now share a single
per-origin cache. accessState() consults Page::localTopDocument() for the
per-site-setting lookup when the top frame is local and prompts otherwise.

The per-origin cache on the Page-level controller persists across navigations,
unlike the old per-Document controller which was naturally reset each time a
new Document was created. I fixed this by clearing the cache in
Page::didChangeMainDocument(). For site-isolated processes hosting cross-origin
iframes, WebPageProxy::didChangeMainDocument() propagates the reset to all
remote web processes using a new ClearDeviceOrientationAndMotionPermissions IPC
message.

There was also a subtle bug in the previous implementation of
DeviceOrientationAndMotionAccessController::shouldAllowAccess. The loop to
start listening for device orientation and motion would prematurely stop
looping when finding a local frame with a null window. I fixed this by skipping
local frames with a null window and continuing.

* LayoutTests/platform/ios-site-isolation/TestExpectations:
* Source/WebCore/dom/DeviceMotionEvent.cpp:
(WebCore::DeviceMotionEvent::requestPermission):
* Source/WebCore/dom/DeviceOrientationAndMotionAccessController.cpp:
(WebCore::DeviceOrientationAndMotionAccessController::DeviceOrientationAndMotionAccessController):
(WebCore::DeviceOrientationAndMotionAccessController::accessState const):
(WebCore::DeviceOrientationAndMotionAccessController::shouldAllowAccess):
* Source/WebCore/dom/DeviceOrientationAndMotionAccessController.h:
* Source/WebCore/dom/DeviceOrientationEvent.cpp:
(WebCore::DeviceOrientationEvent::requestPermission):
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::deviceOrientationAndMotionAccessController):
* Source/WebCore/dom/Document.h:
* Source/WebCore/page/LocalDOMWindow.cpp:
(WebCore::LocalDOMWindow::hasPermissionToReceiveDeviceMotionOrOrientationEvents 
const):
* Source/WebCore/page/Page.cpp:
(WebCore::Page::didChangeMainDocument):
(WebCore::Page::deviceOrientationAndMotionAccessController):
(WebCore::Page::clearDeviceOrientationAndMotionPermissions):
* Source/WebCore/page/Page.h:
* Source/WebKit/UIProcess/RemotePageProxy.cpp:
(WebKit::RemotePageProxy::clearDeviceOrientationAndMotionPermissions):
* Source/WebKit/UIProcess/RemotePageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didChangeMainDocument):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::clearDeviceOrientationAndMotionPermissions):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:

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



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

Reply via email to