-
Notifications
You must be signed in to change notification settings - Fork 22
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
make URLPattern and URLPatternList serializable/structured cloneable #15
Comments
To clarify, yes, you interpreted this right, but I think the current HTML spec terminology (and WebIDL attribute) is serializable, and the term cloneable is legacy but reflected in terminology used in engines. |
I'm not sure I will get to this in the first iteration, so tagging as an enhancement. |
URL is not serializable, why should this be? Can it not be serialized to a string? |
Hmm yeah, see also whatwg/url#370 |
AIUI, the reason for not serializing/cloning URL objects is that they have mutable attributes. Is that true? URLPattern objects are immutable. Are there other reasons why URL is not serializable or structure clonable? |
I think the main reason is that you can use strings already. |
A string isn’t guaranteed to be a valid URL - isn’t this akin to the entire motivation for trusted types? |
A URL instance also isn't guaranteed to be a valid URL (it only guarantees it's parseable). But since the receiver can mutate it I'm not sure if that property really buys you much. |
Again, I'm not sure those URL properties apply to URLPattern. |
URLPattern cannot be serialized? |
Maybe I misunderstood. I thought you were arguing URLPattern should not be serializable/clonable because URL is not serializable/clonable. But AIUI that restriction on URL is because its mutable, but URLPattern is immutable. (Maybe this is only an issue for cloning.) |
I think Anne was arguing that My personal feeling is that this is an argument for deprioritizing the work, but not against the work. My general stance on cloning/serializing is that we should probably do it a lot more across the web platform. But, since we don't today, it can be a bit strange for one API to come out and add serializibility. I can understand the fear that maybe we'll end up with a strange lumpy platform where what's serializable largely depends on the initiative of individual proposal authors. |
This is actually not true; I didn't realize. I think this has been discussed before, but I can't find it... Basically there is currently no algorithm for serializing an arbitrary |
I believe you can I expect @asutherland might prefer something more efficient than this, though. |
Unfortunately this doesn't quite work for at least two reasons:
|
I don't have a concern about efficiency. But I do have 2 different concerns:
|
I don't necessarily disagree, but also whatwg/url#370 had like no demand in a period of five years whereas other URL API features were repeatedly requested over that same time period. Given that we have finite time, I'm not sure I'd invest it here. |
During the call in w3c/ServiceWorker#1535 @asutherland asked if these types will be serializable. I interpreted this as asking if they can be structured cloned. I think it makes sense to so and we should include it in the proposal.
The text was updated successfully, but these errors were encountered: