Skip to content
Permalink
Browse files
[Web share] Disallow sharing data: URLs
https://bugs.webkit.org/show_bug.cgi?id=242587

Reviewed by Tim Horton.

* LayoutTests/imported/w3c/web-platform-tests/web-share/canShare.tentative.https-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/web-share/canShare.tentative.https.html: Removed.
* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/web-share/canShare.https-expected.txt:
* LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/web-share/canShare.https-expected.txt:
* LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/web-share/share-url-invalid.https-expected.txt:
* Source/WebCore/page/Navigator.cpp:
(WebCore::shareableURLForShareData):

Canonical link: https://commits.webkit.org/252398@main
  • Loading branch information
marcoscaceres authored and alanbujtas committed Jul 12, 2022
1 parent 482ec92 commit 2465fcd9300b7f4635d6eaa41a2d51606b377e87
Showing 6 changed files with 4 additions and 108 deletions.

This file was deleted.

This file was deleted.

@@ -1,6 +1,6 @@

PASS canShare() empty and default dictionary
FAIL canShare() url member assert_false: data URL is not allowed expected false got true
PASS canShare() url member
PASS canShare() title member
PASS canShare() text member
FAIL canShare() files member assert_false: invalid URL invalidates the share expected false got true
@@ -1,6 +1,6 @@

PASS canShare() empty and default dictionary
FAIL canShare() url member assert_false: data URL is not allowed expected false got true
PASS canShare() url member
PASS canShare() title member
PASS canShare() text member
FAIL canShare() files member assert_false: invalid URL invalidates the share expected false got true
@@ -6,5 +6,5 @@ PASS share() rejects about: URLs
PASS share() rejects chrome: URLs
PASS share() rejects javascript: URLs
PASS share() rejects blob: URLs
FAIL share() rejects data: URLs assert_unreached: Should have rejected: undefined Reached unreachable code
PASS share() rejects data: URLs

@@ -121,7 +121,7 @@ static std::optional<URL> shareableURLForShareData(ScriptExecutionContext& conte
auto url = context.completeURL(data.url);
if (!url.isValid())
return std::nullopt;
if (!url.protocolIsInHTTPFamily() && !url.protocolIsData())
if (!url.protocolIsInHTTPFamily())
return std::nullopt;

return url;

0 comments on commit 2465fcd

Please sign in to comment.