Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a39a3c616a346bbe57129787c3dfde7dfc457135
      
https://github.com/WebKit/WebKit/commit/a39a3c616a346bbe57129787c3dfde7dfc457135
  Author: Anne van Kesteren <[email protected]>
  Date:   2026-10-06 (Tue, 06 Oct 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/secure-contexts/detached-iframe-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/secure-contexts/detached-iframe.html
    A 
LayoutTests/imported/w3c/web-platform-tests/secure-contexts/sandboxed-iframe-child.https-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/secure-contexts/sandboxed-iframe-child.https.html
    A 
LayoutTests/imported/w3c/web-platform-tests/secure-contexts/support/iframe-with-child.html
    M 
LayoutTests/imported/w3c/web-platform-tests/secure-contexts/support/w3c-import.log
    M LayoutTests/imported/w3c/web-platform-tests/secure-contexts/w3c-import.log
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/dom/DocumentSecurityPolicy.h
    M Source/WebCore/loader/FrameLoader.cpp
    M Source/WebCore/page/LocalFrame.cpp
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/workers/WorkerGlobalScope.cpp
    M Source/WebCore/workers/WorkerGlobalScope.h
    M Source/WebCore/workers/WorkerMessagingProxy.cpp
    M Source/WebCore/workers/WorkerThread.cpp
    M Source/WebCore/workers/WorkerThread.h
    M Source/WebCore/workers/service/context/ServiceWorkerThread.cpp
    M Source/WebCore/workers/shared/context/SharedWorkerThreadProxy.cpp
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/UIProcess/WebFrameProxy.cpp

  Log Message:
  -----------
  Determine whether a document is a secure context when it is created
https://bugs.webkit.org/show_bug.cgi?id=326476
rdar://189268799

Reviewed by Chris Dumez.

Document::isSecureContext() walked the frame tree on every call. With site
isolation it could only see the origin of a frame in another process, which
is opaque for a sandboxed frame, so a frame nested in a sandboxed cross-site
iframe was not a secure context. And a provisional frame is not in the frame
tree yet, which 322838@main worked around by checking the main frame.

A document now determines this once, in initSecurityContext(): it is a secure
context if its parent frame is and its own origin is potentially trustworthy.
A document that inherits its origin inherits this from its owner too, like
COEP and Document-Isolation-Policy. DocumentSecurityPolicy carries the result,
so other processes receive it the same way they receive COEP. The UI process
seeds a new frame with its creator's state for its initial about:blank document.

A document whose frame is removed now keeps its state. Before, it was always a
secure context.

Dedicated workers now inherit their creator's state instead of checking their
top-level origin, as HTML requires. Service workers are always secure contexts.
Shared workers keep checking their top-level origin, which is part of their key.

Tests: imported/w3c/web-platform-tests/secure-contexts/detached-iframe.html
       
imported/w3c/web-platform-tests/secure-contexts/sandboxed-iframe-child.https.html

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



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

Reply via email to