Timestamp:
Aug 25, 2020, 3:46:16 PM (5 years ago)
Author:
timothy_horton@apple.com
Message:

Web Share API can share non-HTTP(S) URLs
https://bugs.webkit.org/show_bug.cgi?id=215823
<rdar://problem/62083130>

Reviewed by Wenson Hsieh.

Source/WebCore:

Test: fast/web-share/share-disallows-file-urls.html

  • page/Navigator.cpp:

(WebCore::shareableURLForShareData):
(WebCore::Navigator::canShare):
(WebCore::Navigator::share):
Factor out the code to complete and check the scheme of the URL.
Make canShare() return NO and share() fail for non-HTTP(S) or data: URLs.

Source/WebKit:

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::showShareSheet):
Ensure that only HTTP family or data: URLs are shared.

LayoutTests:

  • fast/web-share/share-disallows-file-urls-expected.txt: Added.
  • fast/web-share/share-disallows-file-urls.html: Added.
  • fast/web-share/share-transient-activation-expired.html:
  • fast/web-share/share-transient-activation.html:
  • fast/web-share/share.html:

Add a test that ensures that sharing a non-HTTP-family URL fails,
and fix the existing tests to share HTTP-family URLs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r266063 r266151  
    59455945void WebPageProxy::showShareSheet(const ShareDataWithParsedURL& shareData, CompletionHandler<void(bool)>&& completionHandler)
    59465946{
     5947
    59475948    pageClient().showShareSheet(shareData, WTFMove(completionHandler));
    59485949}
Note: See TracChangeset for help on using the changeset viewer.