Bug 244408

Summary: navigator.canShare(data) returns true but navigator.share(data) results in Unhandled Promise Rejection when data contains both image and text field.
Product: WebKit Reporter: spreadpando
Component: WebKit Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Blocker CC: marcosc, thorton, tony
Priority: P2    
Version: Safari 15   
Hardware: iPhone / iPad   
OS: iOS 15   
See Also: https://bugs.webkit.org/show_bug.cgi?id=231995

Description spreadpando 2022-08-26 13:52:10 PDT
When passed a data object with both text, and image parameters, navigator.share() produces:

"Unhandled Promise Rejection: NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission."

This occurs even if navigator.canShare returns true when passed the same data object.

This prevents users from sharing image, text and urls at once and negatively impacts iOS users' abilities to share content on the web.


Not a duplicate, but could be related to:

https://bugs.webkit.org/show_bug.cgi?id=231995 


For now the Web Share 2 API remains broken on iOS.

Produced on iPhone X iOS 15.5 (19F77)
Comment 1 Marcos Caceres 2022-08-28 18:07:21 PDT
I'll try to reproduce, but there are a few things that can cause canShare() to return true, but still result in a NotAllowedError:  

1. .share() called multiple times before the first call's promise settles.
2. .share() is not initiated by user activation (or, more unlikely, there is no Window object).
3. Permissions policy violation, but this produces a different error string so we can rule this out.
Comment 2 Marcos Caceres 2022-08-28 18:34:35 PDT
Ok, confirmed. This is indeed being caused by 231995 and it's a result of 1 (because even though shares completes, the promise is not being resolved). Thus, subsequent calls to .share() cause the API to freeze.

*** This bug has been marked as a duplicate of bug 231995 ***