-
Notifications
You must be signed in to change notification settings - Fork 66
Handle documents not being fully active #218
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
Comments
Is TypeError conventional for this kind of failure? Something like InvalidStateError makes more sense to me 🤔 |
When it comes to exceptions related to this, it's a bit all over the place to be honest... and having multiple exception types gets unnecessarily messy/complicated, IMO. Safari actually does the check during share data validation, which is why it results with a |
Actually, I forgot that we already use a bunch of different exception types in this spec. |
That means Edit: What does Chrome do for canShare? |
What use case where you thinking whereby someone would call .canShare() on a non-fully active document? |
On a second thought, I agree that following WebKit and making canShare fail (return false) makes the most sense since share() will anyway fail. |
Spoke to some folks over on the webkit side and they also suggested we use |
Given a nested content (iframe), it's possible to capture a click event, have the click event remove the iframe, and then call one of the methods.
https://github.com/marcoscaceres/playground/blob/83a28912a59b6f87cec4627536450eaf1a5db8a5/share-parent.html#L6-L18
Accessible from:
https://marcoscaceres.github.io/playground/share-parent.html
In Safari,
.share()
rejects with aTypeError
.in Firefox,
.share()
rejects with aNS_ERROR_UNEXPECTED
(Gecko code).In Chrome,
share()
rejects withNotAllowedError
: "Must be handling a user gesture to perform a share request."Not sure why Chrome thinks that the click handler is not happening inside a user gesture (technically, not incorrect as the iframe has been removed, but still a weird).
I think we should align align with Safari here and just reject with a TypeError. @saschanaz, wdyt?
The text was updated successfully, but these errors were encountered: