Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spec: share now resolves url relative to the document base URL. #35

Merged
merged 4 commits into from
Jun 20, 2017

Conversation

mgiuca
Copy link
Collaborator

@mgiuca mgiuca commented Jun 16, 2017

This is consistent with the current implementation in Chrome.

Closes #34.


Preview | Diff

@mgiuca
Copy link
Collaborator Author

mgiuca commented Jun 16, 2017

@sammc can you look at this?

Note there's a nifty new "Preview" and "Diff" link in the PR which you can use to see the delta on the rendered HTML (but the example code is a bit borked in the Diff view).

index.html Outdated
@@ -118,6 +123,17 @@
"!WEBIDL#securityerror"><code>SecurityError</code></a>, and abort
these steps.
</li>
<li>Let <var>url</var> be the result of running the <a data-cite=
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the URL isn't valid?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. I thought the URL parser was resilient to invalid URLs but it seems it has two levels of failure, "validation error" (a warning which is generally ignored) and "failure" (a parsing error).

One such fatal error is an invalid port number:

navigator.share({url: 'http://localhost:65536'});

In Chrome, this currently fails silently, replacing the URL with the empty string and completing the successful share. Do you think this should cause navigator.share to fail with a new error? (I do.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And if so, I think it should be a TypeError, which is apparently the JavaScript equivalent of Python's ValueError and TypeError combined, not a SyntaxError which is reserved for JavaScript parse errors.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: I've filed a Chrome bug crbug.com/734486 for updating Chrome's behaviour.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TypeError sounds good. It matches fetch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, PTAL.

@mgiuca mgiuca force-pushed the spec-url-relative branch from a9f2eac to 69f29d6 Compare June 20, 2017 00:46
@mgiuca mgiuca merged commit 0be490e into w3c:master Jun 20, 2017
@mgiuca mgiuca mentioned this pull request Jun 20, 2017
5 tasks
@mgiuca mgiuca deleted the spec-url-relative branch July 3, 2017 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants