From 1d965879acebd7027fde909e19c7fdcf33875056 Mon Sep 17 00:00:00 2001 From: Eric Willigers Date: Wed, 23 Sep 2020 20:21:53 -0700 Subject: [PATCH] Web Share: Only allow one share() call at a time Spec: https://w3c.github.io/web-share/#share-method If a share() request is active when share() is called again, the new share request fails immediately. https://github.com/w3c/web-share/pull/113 In content shell, the OS-integration for the share service is not present. Instead of crashing in tests, we report a not implemented error. WPT web-share/share-sharePromise-internal-slot.https.html now passes - it previously crashed. https://github.com/w3c/web-share/pull/183 improves consistency between the test and the spec. Protocols other that http and https are no longer supported by share() or canShare(). https://github.com/w3c/web-share/pull/174 canShare is being discussed in https://github.com/w3c/web-share/pull/177 Bug: 1002337, 1002514, 1131755 Change-Id: I4ec9f6eb03373fd5c6db1881df906a8df36ca4ff --- web-share/canShare.tentative.https.html | 34 ++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/web-share/canShare.tentative.https.html b/web-share/canShare.tentative.https.html index bb263e542559d8..f89ec82ec7823f 100644 --- a/web-share/canShare.tentative.https.html +++ b/web-share/canShare.tentative.https.html @@ -11,74 +11,74 @@ 'use strict'; test(() => { - assert_equals(navigator.canShare(), false); + assert_false(navigator.canShare()); }, 'canShare with no arguments (same as empty dictionary)'); test(() => { - assert_equals(navigator.canShare({}), false); + assert_false(navigator.canShare({})); }, 'canShare with an empty dictionary'); test(() => { - assert_equals(navigator.canShare(undefined), false); + assert_false(navigator.canShare(undefined)); }, 'canShare with a undefined argument (same as empty dictionary)'); test(() => { - assert_equals(navigator.canShare(null), false); + assert_false(navigator.canShare(null)); }, 'canShare with a null argument (same as empty dictionary)'); test(() => { - assert_equals(navigator.canShare({unused: 'unexpected field'}), false); + assert_false(navigator.canShare({unused: 'unexpected field'})); }, 'canShare with a dictionary containing only surplus fields'); test(() => { // URL is invalid in that the URL Parser returns failure (port is too // large). const url = 'http://example.com:65536'; - assert_equals(navigator.canShare({url}), false); + assert_false(navigator.canShare({url})); }, 'canShare with an invalid URL'); test(() => { - assert_equals(navigator.canShare({title: undefined}), false); + assert_false(navigator.canShare({title: undefined})); }, 'canShare with attribute undefined is equivalent to omitting the attribute'); test(() => { - assert_equals(navigator.canShare({title: 'subject'}), true); + assert_true(navigator.canShare({title: 'subject'})); }, 'canShare with title'); test(() => { - assert_equals(navigator.canShare({text: 'body'}), true); + assert_true(navigator.canShare({text: 'body'})); }, 'canShare with text'); test(() => { - assert_equals(navigator.canShare({url: 'https://www.example.com/some/path?some_query#some_fragment'}), true); + assert_true(navigator.canShare({url: 'https://www.example.com/some/path?some_query#some_fragment'})); }, 'canShare with URL'); test(() => { - assert_equals(navigator.canShare({title: null}), true); + assert_true(navigator.canShare({title: null})); }, 'canShare with null attribute'); test(() => { - assert_equals(navigator.canShare({text: 123}), true); + assert_true(navigator.canShare({text: 123})); }, 'canShare with number'); test(() => { - assert_equals(navigator.canShare({url: {toString() { return 'https://example.com/'; }}}), true); + assert_true(navigator.canShare({url: {toString() { return 'https://example.com/'; }}})); }, 'canShare with object'); test(() => { - assert_equals(navigator.canShare({title: 'subject', text: 'body', url: 'https://example.com/', unused: 'unexpected field'}), true); + assert_true(navigator.canShare({title: 'subject', text: 'body', url: 'https://example.com/', unused: 'unexpected field'})); }, 'canShare with unexpected field'); test(() => { - assert_equals(navigator.canShare({url: 'data:the url'}), true); + assert_false(navigator.canShare({url: 'data:the url'})); }, 'canShare with data URL'); test(() => { - assert_equals(navigator.canShare({url: ''}), true); + assert_true(navigator.canShare({url: ''})); }, 'canShare with empty URL'); test(() => { - assert_equals(navigator.canShare({url: '//www.example.com/some/path?some_query#some_fragment'}), true); + assert_true(navigator.canShare({url: '//www.example.com/some/path?some_query#some_fragment'})); }, 'canShare with URL having no scheme');