-
Notifications
You must be signed in to change notification settings - Fork 12
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
IPC calls for promise #35
Comments
There are two potential races here:
Promises would let developers manage the first, though we could get into a similar situation if they didn't wait for the promise to resolve. I don't think this buys us much we couldn't get with some kind of batching on the renderer side of the IPC pipe (wait for a response from the browser before sending the next value, only store the most recently 'set'd' value). I don't think promises help us at all with 2), though I'm not sure we need to worry about it. I suspect most of the time both pages will be setting the same value (in the case of a new message) and if they aren't, they have bigger problems (there's only one place to display a badge and how do they know which one badged first?).
I kind of like the idea of this, but I'm a bit less clear on how it should work. For example, how do we determine the scope of what to badge, without a web app manifest? We could require that all
Agreed. Do you think the same origin iframes are required?
I'm leaning towards no. If we change our minds, I imagine we can add a feature policy in the future. |
Yeah, something like that could work... run to completion; take the last synchronously set value; send it over the IPC pipe. Rinse and repeat. My working assumption is independent of app installation, so could be racy across multiple browser tabs (and workers, as you point out). I guess this might be worth prototyping a bit.
Yeah, that's a good question... I wonder if it should be origin bound, and "scoped" if the app is installed. |
Perhaps we should be per-tab (client?) scoping things by default? I feel like origin scoping could be a bit restrictive as a default. Consider Github PRs I feel like there are really two APIs here. I had a bit of a look at #1, where we discuss some stuff that seems pretty similar. Another potential problem is that we have a lot more control over what gets badged in the favicon than what gets badged in the OS. It would be a shame to introduce a new API for badging the favicon that's limited because we want something consistent with badging the OS. |
I agree that there are 2 different use cases
I think this API is really solving (1). We could extend it to solve (2) but it's unclear that there is a need. If a site isn't installed, we could possibly still use the manifest linked to the page to determine app scope? |
@fallaciousreasoning that makes sense to me. Fire and forget seems best here. |
Random thought: If we are going to use the "origin scope model", and if we have N tabs calling |
If the pages want to ensure synchronization, they can go through a service worker. In addition, if there are multiple pages setting different badges for the same I don't think we need to worry too much, but definitely good to think about :) |
closed based on discussion in #35.... we are returning promises. |
Because there is much IPC going on when setting a badge, I think this API might need to return promises and only allow setting the badge “one at a time”... so more like a request to set the badge. We might need to retain state, and only allow setting once a setting operation has completed. Clear()ing would probably want to abort ongoing set() operations, then behave as set()ing to 0.
Also, as already stated in another bug, we need to disassociate this API from installation IMO (and “Web Applications”, as that’s fairly meaningless). And we definitely need to restrict this to top level browsing contexts only and same origin iframes. Would third party contexts ever be allowed to set the badge? Do we need a feature policy?
The text was updated successfully, but these errors were encountered: