Diff
Modified: trunk/LayoutTests/ChangeLog (266150 => 266151)
--- trunk/LayoutTests/ChangeLog 2020-08-25 22:26:07 UTC (rev 266150)
+++ trunk/LayoutTests/ChangeLog 2020-08-25 22:46:16 UTC (rev 266151)
@@ -1,3 +1,19 @@
+2020-08-25 Tim Horton <[email protected]>
+
+ 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.
+
+ * 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.
+
2020-08-25 Per Arne Vollan <[email protected]>
[Win] The layout test animations/steps-transform-rendering-updates.html is failing
Added: trunk/LayoutTests/fast/web-share/share-disallows-file-urls-expected.txt (0 => 266151)
--- trunk/LayoutTests/fast/web-share/share-disallows-file-urls-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/web-share/share-disallows-file-urls-expected.txt 2020-08-25 22:46:16 UTC (rev 266151)
@@ -0,0 +1 @@
+PASS: Not allowed to share file URL.
Added: trunk/LayoutTests/fast/web-share/share-disallows-file-urls.html (0 => 266151)
--- trunk/LayoutTests/fast/web-share/share-disallows-file-urls.html (rev 0)
+++ trunk/LayoutTests/fast/web-share/share-disallows-file-urls.html 2020-08-25 22:46:16 UTC (rev 266151)
@@ -0,0 +1,16 @@
+<html>
+<head>
+</head>
+<body>
+<pre id="output"></pre>
+<script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ if (navigator.canShare({ url: "file:///bin/sh" }))
+ output.innerText = "FAIL: Allowed to share file URL.";
+ else
+ output.innerText = "PASS: Not allowed to share file URL.";
+</script>
+</body>
+</html>
Modified: trunk/LayoutTests/fast/web-share/share-transient-activation-expired.html (266150 => 266151)
--- trunk/LayoutTests/fast/web-share/share-transient-activation-expired.html 2020-08-25 22:26:07 UTC (rev 266150)
+++ trunk/LayoutTests/fast/web-share/share-transient-activation-expired.html 2020-08-25 22:46:16 UTC (rev 266151)
@@ -23,7 +23,7 @@
fetch("../files/resources/abe.png").then(() => {
// Cause the transient activation to expire with a setTimeout.
setTimeout(() => {
- navigator.share({ title: "Example Page", url: "url", text: "text" }).then((result) => {
+ navigator.share({ title: "Example Page", url: "http://webkit.org", text: "text" }).then((result) => {
write("FAIL: Share sheet invoked.");
testRunner.notifyDone();
}, (exception) => {
Modified: trunk/LayoutTests/fast/web-share/share-transient-activation.html (266150 => 266151)
--- trunk/LayoutTests/fast/web-share/share-transient-activation.html 2020-08-25 22:26:07 UTC (rev 266150)
+++ trunk/LayoutTests/fast/web-share/share-transient-activation.html 2020-08-25 22:46:16 UTC (rev 266151)
@@ -18,7 +18,7 @@
{
document.getElementById("target").addEventListener("click", () => {
fetch("../files/resources/abe.png").then(() => {
- navigator.share({ title: "Example Page", url: "url", text: "text" }).then((result) => {
+ navigator.share({ title: "Example Page", url: "http://webkit.org", text: "text" }).then((result) => {
write("PASS: Share sheet invoked.");
testRunner.notifyDone();
}, (exception) => {
Modified: trunk/LayoutTests/fast/web-share/share.html (266150 => 266151)
--- trunk/LayoutTests/fast/web-share/share.html 2020-08-25 22:26:07 UTC (rev 266150)
+++ trunk/LayoutTests/fast/web-share/share.html 2020-08-25 22:46:16 UTC (rev 266151)
@@ -17,7 +17,7 @@
function runTest()
{
document.getElementById("target").addEventListener("click", () => {
- navigator.share({ title: "Example Page", url: "url", text: "text" }).then((result) => {
+ navigator.share({ title: "Example Page", url: "http://webkit.org", text: "text" }).then((result) => {
write("PASS: Share sheet invoked.");
testRunner.notifyDone();
});
Modified: trunk/Source/WebCore/ChangeLog (266150 => 266151)
--- trunk/Source/WebCore/ChangeLog 2020-08-25 22:26:07 UTC (rev 266150)
+++ trunk/Source/WebCore/ChangeLog 2020-08-25 22:46:16 UTC (rev 266151)
@@ -1,3 +1,20 @@
+2020-08-25 Tim Horton <[email protected]>
+
+ 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.
+
+ 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.
+
2020-08-25 Brady Eidson <[email protected]>
Font loads quickly followed by navigations may fail indefinitely
Modified: trunk/Source/WebCore/page/Navigator.cpp (266150 => 266151)
--- trunk/Source/WebCore/page/Navigator.cpp 2020-08-25 22:26:07 UTC (rev 266150)
+++ trunk/Source/WebCore/page/Navigator.cpp 2020-08-25 22:46:16 UTC (rev 266151)
@@ -110,6 +110,20 @@
return platformStrategies()->loaderStrategy()->isOnLine();
}
+static Optional<URL> shareableURLForShareData(ScriptExecutionContext& context, const ShareData& data)
+{
+ if (data.url.isNull())
+ return WTF::nullopt;
+
+ auto url = ""
+ if (!url.isValid())
+ return WTF::nullopt;
+ if (!url.protocolIsInHTTPFamily() && !url.protocolIsData())
+ return WTF::nullopt;
+
+ return url;
+}
+
bool Navigator::canShare(ScriptExecutionContext& context, const ShareData& data)
{
auto* frame = this->frame();
@@ -126,12 +140,9 @@
return false;
}
- Optional<URL> url;
- if (!data.url.isNull()) {
- url = ""
- if (!url->isValid())
- return false;
- }
+ if (!data.url.isNull() && !shareableURLForShareData(context, data))
+ return false;
+
return true;
}
@@ -141,11 +152,7 @@
promise->reject(TypeError);
return;
}
-
- Optional<URL> url;
- if (!data.url.isEmpty())
- url = ""
-
+
auto* window = this->window();
// Note that the specification does not indicate we should consume user activation. We are intentionally stricter here.
if (!window || !window->consumeTransientActivation() || m_hasPendingShare) {
@@ -152,7 +159,8 @@
promise->reject(NotAllowedError);
return;
}
-
+
+ Optional<URL> url = "" data);
ShareDataWithParsedURL shareData = {
data,
url,
Modified: trunk/Source/WebKit/ChangeLog (266150 => 266151)
--- trunk/Source/WebKit/ChangeLog 2020-08-25 22:26:07 UTC (rev 266150)
+++ trunk/Source/WebKit/ChangeLog 2020-08-25 22:46:16 UTC (rev 266151)
@@ -1,3 +1,15 @@
+2020-08-25 Tim Horton <[email protected]>
+
+ 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.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::showShareSheet):
+ Ensure that only HTTP family or data: URLs are shared.
+
2020-08-25 Megan Gardner <[email protected]>
Trying to lookup when WebView is in a popover causes process to hang. Fix for Legacy WebView.
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (266150 => 266151)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-08-25 22:26:07 UTC (rev 266150)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-08-25 22:46:16 UTC (rev 266151)
@@ -5944,6 +5944,7 @@
void WebPageProxy::showShareSheet(const ShareDataWithParsedURL& shareData, CompletionHandler<void(bool)>&& completionHandler)
{
+ MESSAGE_CHECK(m_process, !shareData.url || shareData.url->protocolIsInHTTPFamily() || shareData.url->protocolIsData());
pageClient().showShareSheet(shareData, WTFMove(completionHandler));
}