Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4d90d6f12000158908e404e90adc2225a8671a62
      
https://github.com/WebKit/WebKit/commit/4d90d6f12000158908e404e90adc2225a8671a62
  Author: Sihui Liu <[email protected]>
  Date:   2025-10-08 (Wed, 08 Oct 2025)

  Changed paths:
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/editing/cocoa/EditorCocoa.mm
    M Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp
    M Source/WebCore/loader/archive/cf/LegacyWebArchive.h
    M Source/WebCore/platform/Pasteboard.h
    M Source/WebCore/platform/PasteboardStrategy.h
    M Source/WebCore/platform/mac/PasteboardMac.mm
    M Source/WebKit/Shared/APIWebArchive.mm
    M Source/WebKit/Shared/Pasteboard.serialization.in
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    A Source/WebKit/UIProcess/Cocoa/LegacyWebArchiveCallbackAggregator.h
    M Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm
    M Source/WebKit/UIProcess/WebPasteboardProxy.h
    M Source/WebKit/UIProcess/WebPasteboardProxy.messages.in
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h
    M Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h
    M Source/WebKitLegacy/mac/WebView/WebArchive.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm

  Log Message:
  -----------
  [Site Isolation] Add support for copying web content in webarchive format
rdar://161923006
https://bugs.webkit.org/show_bug.cgi?id=300138

Reviewed by Ryosuke Niwa.

In existing implementation, when selecting and copying web content, web process 
creates webarchive for the selected
range (which might include subframe's content) and send the webarchive data to 
UI process. When UI process receives the
data it will add it to pasteboard. With site isolation on, web process only has 
access to local frame content, so
the data web process sends to UI process is missing content for remote 
subframes.

To fix it, this patch makes web process not only send selected frame webarchive 
to UI process, but also remote subframe
identifiers and local subframe webarchives. On receiving the message 
(WebPasteboardProxy::WriteWebArchiveToPasteBoard),
UI process will collect remote subframe archives from other web processes. 
After collection, UI process combines all
webarchvies to get a full webarchive for the selected content (the same content 
it will get wihout site isolaiton).

API Test: SiteIsolation.CreateWebArchiveForCopy
              SiteIsolation.CreateWebArchiveNestedFrameForCopy

Test: Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::writeSelectionToPasteboard):
* Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::LegacyWebArchive):
(WebCore::LegacyWebArchive::create):
(WebCore::LegacyWebArchive::createInternal):
(WebCore::LegacyWebArchive::createFromSelection):
* Source/WebCore/loader/archive/cf/LegacyWebArchive.h:
* Source/WebCore/platform/Pasteboard.h:
* Source/WebCore/platform/PasteboardStrategy.h:
* Source/WebCore/platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::write):
* Source/WebKit/Shared/APIWebArchive.mm:
(API::WebArchive::WebArchive):
* Source/WebKit/Shared/Pasteboard.serialization.in:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/Cocoa/LegacyWebArchiveCallbackAggregator.h: Added.
* Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::writeWebContentToPasteboardInternal):
(WebKit::WebPasteboardProxy::writeWebContentToPasteboard):
(WebKit::WebPasteboardProxy::writeWebArchiveToPasteBoard):
(WebKit::WebPasteboardProxy::createOneWebArchiveFromFrames):
* Source/WebKit/UIProcess/WebPasteboardProxy.h:
* Source/WebKit/UIProcess/WebPasteboardProxy.messages.in:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::collectFrameWebArchives):
(WebKit::WebPlatformStrategies::writeWebArchive):
(WebKit::updateContentForWebArchive):
(WebKit::WebPlatformStrategies::writeToPasteboard):
* Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h:
* Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h:
* Source/WebKitLegacy/mac/WebView/WebArchive.mm:
(-[WebArchive initWithMainResource:subresources:subframeArchives:]):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::(SiteIsolation, CreateWebArchiveForCopy)):
(TestWebKitAPI::(SiteIsolation, CreateWebArchiveNestedFrameForCopy)):
(TestWebKitAPI::(SiteIsolation, DoAfterNextPresentationUpdate)):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to