Bug 238369 - navigator.share does not trigger TypeError even if the url is invalid.
Summary: navigator.share does not trigger TypeError even if the url is invalid.
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: Safari 15
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-03-25 04:02 PDT by Takao Baba
Modified: 2022-03-28 06:40 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Takao Baba 2022-03-25 04:02:15 PDT
# Steps to reproduce:

1. Open https://jsbin.com/yevuhebadu/edit?html,js,output
2. Click "share" button

# Expected behavior:

"TypeError: Failed to execute 'share' on 'Navigator': Invalid URL" should be shown.

As the spec described in here (https://w3c.github.io/web-share/#share-method https://w3c.github.io/web-share/#dfn-validate-share-data), if the "url" is present and it is invalid, "validate share data" must return false. Thus, "share()" should return a promise rejected with a TypeError.

# Actual behavior:

Sharing succeeded with text "foo". The invalid URL was just ignored.

# Note

Chrome 99 works correctly (returns TypeError). I've confirmed this issue on Safari (15.4 on mac and 14.7 on iPad).
Comment 1 Radar WebKit Bug Importer 2022-03-28 06:40:47 PDT
<rdar://problem/90919392>