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
Multiple icon definitions #76
Conversation
notifications.bs
Outdated
|
||
<li><p>For each <var>icon</var> in <var>icons</var> run these substeps: | ||
|
||
<ol> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we have this indentation elsewhere, but if the <p>
is not the sole child of an <li>
it really should go on its own line and get indented. And this <ol>
too.
I think it would be nicer if |
(And we'd do away with |
Thanks Anne, I've cleaned it up a bit as discussed. Of note:
|
notifications.bs
Outdated
<ol> | ||
<li><p>Let <var>selectedURL</var> and <var>selectedIcon</var> be null. | ||
|
||
<li><p>For each <var>icon</var> in <var>icons</var> run these substeps: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<p>
needs to be on a new line.
This looks pretty good I think. Who else should we ask for review? |
CC @beverloo @foolip @mounirlamouri @xxyzzzq in case there's something really crazy in here. If necessary we can probably align a detail or two as needed in a followup change. |
I'll aim to land this Friday (maybe ping me during the day just in case) unless someone has major concerns. |
There's definitely some similarity here with w3c/mediasession#129 Feedback on that PR appreciated, and is there a good place to put the common bits? Looks to me at first glace like the whole "list of images" concept that uses the |
notifications.bs
Outdated
immutable. But FrozenArray reifies the dictionaries to mutable JS | ||
objects accessed by reference, so we explicitly freeze them. | ||
It would be better to do this with IDL primitives instead of JS - see | ||
https://www.w3.org/Bugs/Public/show_bug.cgi?id=29004 --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the conclusion of this? Looks like the issue was side-stepped by not exposing an icons
member on NotificationAction
, is that a permanent situation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only exposing the selected URL seems much easier to understand. I don't see a strong use case for reflecting all the exact input of the options dictionaries, so I don't expect us to add that. Note that we already didn't expose the exact input of the icon urls, we reflected the result of resolving with baseURL.
Also, by using an interface with readonly attributes, I don't think we need to freeze the object anymore, which was a strange wrinkle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So is the resource chosen synchronously so that it can be immediately reflected through a single icon
attribute? Doesn't that mean that the bits implementing the notification API need to know quite a bit about the UI of the platform its running on?
AFACIT, the thing that was frozen here wasn't the value returned by the attribute (which is readonly), but the NotificationAction
objects in that array. Otherwise one can do things like notification.actions[0].icon = 'newicon.png'
which would have no effect. Exact same problem as discussed for Media Session artwork, in other words.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question about synchronously reflecting the selected URL... that might require an async IPC message in Chrome. I'll have to think about that one.
The general solution to avoid having to freeze dictionaries seems to be to instead return interfaces with readonly attributes. NotificationAction now is an interface that only has readonly attributes, and assigning a new value to icon
has no effect, intentionally. The property value does not change, and internally nothing changes. No exception is thrown.
Closing this due to lack of activity. If there's still interest let's discuss in #28. |
I think the initial patch has the general shape of what I want to do for #28.
I did find there's two ways we could go with the attribute getters on a notification, for example for the icon. To me it's not clear whether we need a single
icon
getter that reflects the selected url, or bothicon
andicons
which reflect the exact input from options.Previously
icon
reflected a serialization of the optionsicon
input that was parsed with baseURL, not the exact original input. That means, for example, that if parsing fails, the getter returns the empty string. The implications forNotificationIcon
are not clear to me: would invalid input such as fortype
orsizes
need to be dropped in the same way? That might surprise developers.Preview | Diff