Skip to content

REGRESSION (255315@main): "Save X images" and "Print" options are missing when sharing image files using Web Share#13111

Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
pxlcoder:eng/255641
Apr 24, 2023
Merged

REGRESSION (255315@main): "Save X images" and "Print" options are missing when sharing image files using Web Share#13111
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
pxlcoder:eng/255641

Conversation

@pxlcoder
Copy link
Copy Markdown
Member

@pxlcoder pxlcoder commented Apr 24, 2023

e58872a

REGRESSION (255315@main): "Save X images" and "Print" options are missing when sharing image files using Web Share
https://bugs.webkit.org/show_bug.cgi?id=255641
rdar://108242255

Reviewed by Wenson Hsieh.

255315@main made the behavior change to display document icons rather than
thumbnail previews when files are shared using the Web Share API, as part of
IPC hardening.

To achieve this behavior, a placeholder URL using a `UIActivityItemProvider`
was provided, rather than the actual file URL. However, a URL with empty data
does not provide the Share Sheet with enough information to display the right
set of actions for the file. Additionally, file size information is also lost.

To fix, provide placeholder `NSData` and a type identifier, rather than a
placeholder URL, so that Share Sheet has the information necessary to display
the correct actions. Additionally, generate `LPLinkMetadata` using the original
URL to ensure the Share Sheet header is correctly populated.

* Source/WebKit/Platform/spi/Cocoa/LinkPresentationSPI.h: Added.
* Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm:
(-[WKShareSheetFileItemProvider initWithURL:]):

Provide empty `NSData` rather than a placeholder URL so that Share Sheet
requests a type identifier for the file.

Use `-[LPMetadataProvider setShouldFetchSubresources:]` to fetch metadata for
the header, without generating a thumbnail preview.

(-[WKShareSheetFileItemProvider activityViewController:dataTypeIdentifierForActivityType:]):

Provide a type identifier for the file.

(-[WKShareSheetFileItemProvider activityViewControllerLinkMetadata:]):
(-[WKShareSheetURLItemProvider initWithURL:]):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

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

066a1bd

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 wincairo
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🛠 gtk
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 🧪 gtk-wk2
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🧪 api-gtk
✅ 🛠 tv ✅ 🧪 mac-AS-debug-wk2
✅ 🛠 tv-sim ✅ 🧪 mac-wk2-stress
✅ 🛠 🧪 merge 🛠 watch
✅ 🛠 watch-sim

@pxlcoder pxlcoder requested a review from cdumez as a code owner April 24, 2023 18:41
@pxlcoder pxlcoder self-assigned this Apr 24, 2023
@pxlcoder pxlcoder added the New Bugs Unclassified bugs are placed in this component until the correct component can be determined. label Apr 24, 2023
@pxlcoder
Copy link
Copy Markdown
Member Author

Thanks for the review!

@pxlcoder pxlcoder added merge-queue Applied to send a pull request to merge-queue and removed merge-queue Applied to send a pull request to merge-queue labels Apr 24, 2023
…sing when sharing image files using Web Share

https://bugs.webkit.org/show_bug.cgi?id=255641
rdar://108242255

Reviewed by Wenson Hsieh.

255315@main made the behavior change to display document icons rather than
thumbnail previews when files are shared using the Web Share API, as part of
IPC hardening.

To achieve this behavior, a placeholder URL using a `UIActivityItemProvider`
was provided, rather than the actual file URL. However, a URL with empty data
does not provide the Share Sheet with enough information to display the right
set of actions for the file. Additionally, file size information is also lost.

To fix, provide placeholder `NSData` and a type identifier, rather than a
placeholder URL, so that Share Sheet has the information necessary to display
the correct actions. Additionally, generate `LPLinkMetadata` using the original
URL to ensure the Share Sheet header is correctly populated.

* Source/WebKit/Platform/spi/Cocoa/LinkPresentationSPI.h: Added.
* Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm:
(-[WKShareSheetFileItemProvider initWithURL:]):

Provide empty `NSData` rather than a placeholder URL so that Share Sheet
requests a type identifier for the file.

Use `-[LPMetadataProvider setShouldFetchSubresources:]` to fetch metadata for
the header, without generating a thumbnail preview.

(-[WKShareSheetFileItemProvider activityViewController:dataTypeIdentifierForActivityType:]):

Provide a type identifier for the file.

(-[WKShareSheetFileItemProvider activityViewControllerLinkMetadata:]):
(-[WKShareSheetURLItemProvider initWithURL:]):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

Canonical link: https://commits.webkit.org/263341@main
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 263341@main (e58872a): https://commits.webkit.org/263341@main

Reviewed commits have been landed. Closing PR #13111 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit e58872a into WebKit:main Apr 24, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Bugs Unclassified bugs are placed in this component until the correct component can be determined.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants