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/LayoutTests/fast/web-share/share.html

    r264834 r266151  
    1818        {
    1919            document.getElementById("target").addEventListener("click", () => {
    20                 navigator.share({ title: "Example Page", url: "url", text: "text" }).then((result) => {
     20                navigator.share({ title: "Example Page", url: "", text: "text" }).then((result) => {
    2121                    write("PASS: Share sheet invoked.");
    2222                    testRunner.notifyDone();
Note: See TracChangeset for help on using the changeset viewer.