Skip to content

Commit

Permalink
Bug 1667023 [wpt PR 25755] - Web Share: restrict URL scheme to http a…
Browse files Browse the repository at this point in the history
…nd https, a=testonly

Automatic update from web-platform-tests
Web Share: restrict URL scheme to http and https

We now follow the recent spec change limiting the permitted scheme
for shared urls to http and https - see
w3c/web-share#173
w3c/web-share#174
w3c/web-share#177

We make an exception if the page performing the share it itself loaded
from a different scheme (e.g. file) - in that case we allow the same
scheme to be used for the shared url.

Bug: 1131755
Change-Id: I6abf0f9acd40ef79ec49379314e2ef3a81d3467e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2425977
Commit-Queue: Eric Willigers <ericwilligerschromium.org>
Reviewed-by: Glen Robertson <glenrobchromium.org>
Auto-Submit: Eric Willigers <ericwilligerschromium.org>
Cr-Commit-Position: refs/heads/master{#810180}

--

wpt-commits: a28408e23e7cb1e4e8dc070445a51fc2f2d9a4e6
wpt-pr: 25755

UltraBlame original commit: 527027b783378db7e3c1fcdd908e718799400989
  • Loading branch information
marco-c committed Sep 28, 2020
1 parent 897efd7 commit a348c89
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions testing/web-platform/tests/web-share/canShare.tentative.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -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({url: 'data:the url'}));
}, 'canShare with data URL');

test(() => {
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);
}, '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');
</script>
</body>
Expand Down

0 comments on commit a348c89

Please sign in to comment.