[Webkit-unassigned] [Bug 238713] New: Web Share API: share() result promise never resolved if I save an image to the gallery

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Apr 3 08:14:05 PDT 2022


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

            Bug ID: 238713
           Summary: Web Share API: share() result promise never resolved
                    if I save an image to the gallery
           Product: WebKit
           Version: Safari 15
          Hardware: iPhone / iPad
                OS: iOS 15
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: New Bugs
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: perrariccardo0 at gmail.com

With share api, when the share() method is triggered, iOS provide several ways to share your data.

There is an unexpected behavior when the data parameter of the share() has an image file as a `files` property:
```
  const response = await fetch('500x500.png');
  const blob = await response.blob();
  const shareData = {files: [
    new File([blob], 'meme.png', {type: "image/png", lastModified: new Date().getTime()}),
  ]};
  navigator.share(shareData).then(() => {
    // never called if I save the image on the gallery
  }).catch((err) => [..]) 
```

- If the user click on "Save image" button to save the file in the gallery, the Promise will never be resolved
- If the user press again the button that trigger the share() method, the Promise will be rejected with this error:
"Not allowed error: The reequset is not allowed by the user agent or the platform in the current context, possibly because the user denied permission."

I published a github repo with the source code and reproducible example:


Demo: https://riccardoperra.github.io/webkit-save-image-broken-web-share-api/
Implementation: https://github.com/riccardoperra/webkit-save-image-broken-web-share-api/blob/main/src/main.ts

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220403/f4c0b815/attachment.htm>


More information about the webkit-unassigned mailing list