-
Notifications
You must be signed in to change notification settings - Fork 312
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
service worker client definition is redundant #1046
Comments
I'm not sure if we can assume that kind of a polymorphic behavior in the spec language. I'm actually curious if we can make a service worker client just be a type alias to the environment (i.e the base type) and use it to dynamically reference the states depending on the actual type (either environment or environment settings object) in runtime. @annevk, @domenic, would it make sense? |
Note that we have some places in the algorithms where the logic branches depending on the types: 4ce01b5#diff-27b79860afe28f01aed4f1f6228367faR1278. (In this particular case, an environment doesn't make sense for checking of the secure context.) To deal with this sort of requirements with polymorphic approach, we'd have to define the algorithms on the base type and override them on the sub type (assuming the polymorphic behavior works for the specs in the first place.) |
Like @annevk said in #1045 (comment) that's already endemic to the specs.
Except you don't really need virtual function esque overrides to do that at all. Just do the equivalent of |
This changes the definition of the service worker client from type of an environment or an environment settings object to just an environment. As an environment settings object *is-a* environment, this rewrites the references to those objects without using the explicit *type of* language. Instead, this changes to use if-else statments that check types from most-specialized to most-general order. Fixes #1045 #1046
@jungkees we credit isonmad as "isonmad" in various WHATWG standards. I think that's their preference. |
I added "isonmad" to the acknowledgements. Thanks for help! |
8b483b0 changed the definition of a service worker client to "
a type of <a>environment</a> or <a>environment settings object</a>
" which is redundant, since every environment settings object is itself also an environment, so this confusingly implies they don't have an is-a relationship. Also, the 'type of' wording from #832 (comment) c11942b seems redundant and potentially confusing, isn't it more straightforward to just say "a service worker client is an environment [that...]"?The text was updated successfully, but these errors were encountered: