-
Notifications
You must be signed in to change notification settings - Fork 39
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
Updates to PR #277 that addresses issues #254, #269, #273 #278
Updates to PR #277 that addresses issues #254, #269, #273 #278
Conversation
…c#269) That used to be the case, but getAvailability now automatically uses the presentation request URL.
Getting the connectionList attribute now returns the same PresentationConnectionList instance, and only resolves the promise when the set of presentation controllers is non empty (as things stood, the use of a Promise was useless). The commit also drops the step that instructed the receiving user agent to start monitoring incomping presentation connections if not already started. This is done in the "starting a presentation" algorithm, no need to repeat it here.
@@ -2282,6 +2283,10 @@ | |||
<a>receiving user agent</a>. | |||
</p> | |||
<p> | |||
A <a>PresentationReceiver</a> object is associated with a | |||
<a>PresentationConnectionList</a> object when it is created. |
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.
The second "it" is a little ambiguous. Suggested rephrasing:
When the PresentationReceiver object is created, a PresentationConnectionList object is also created and associated with that PresentationReceiver object.
Thanks @tidoust I agree with your improvements. One more detail: in the case where there is already at least one PresentationConnection in the list, and connectionList is retrieved twice (without a change in the set of controllers), should we return two Promises? Or the second time should we return the (settled) Promise created by first call? For reference Issue #201 is where the current PresentationReceiver API was hashed out, mostly following the proposal by @sicking. |
I updated the PR based on your feedback. I confess I do not know whether two consecutive retrieval of Trying to find a similar example elsewhere, I bumped into the Battery Status API spec, which seems to reuse the same promise: I would suggest to ask the editors... @anssiko and @mounirlamouri, should getting the |
@@ -2418,14 +2423,22 @@ | |||
</li> | |||
<li>Add <var>S</var> to the <a>set of presentation controllers</a>. | |||
</li> | |||
<li>If there is an unsettled <a>Promise</a> <var>P</var> from a | |||
previous call to get the <a for= | |||
"PresentationReceiver">connectionList</a> attribute for the same |
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.
With the update above, this could be simply "If there is an unsettled Promise P associated with the PresentationReceiver object, ..."
Could there be any difference in API behavior with one choice or the other? For example what does it mean to run the following:
Do we expect to see "first", "second" or just "second"? |
In both cases, you would see both "first" and "second" (a second call to That said, having to think about edge cases typically shows that the design could be improved. Also, come to think about it, developers probably expect an attribute to always return the same object in any case. Last but not least, as pointed out by @schien in #281, the IDL currently requires the attribute to always return the same Promise (due to the presence of I'll update the PR. |
This update should address last Pull Request comments, as well as w3c#281. Note I ended up introducing two new idioms to talk about the Promise and PresentationConnectionList singletons, as I believe it improves the readability of algorithms, and makes the list of objects that user agents need to maintain explicit. However, as usual, finding names for things is hard. I came up with "presentation controllers monitor" and "presentation controllers promise". It may be possible to find better names. For instance, instead of "monitor", we could use "manager", "holder", "wrapper", "container".
I updated the pull request as planned. This should also fix #281 "PresentationReceiver.connectionList doesn't return the same object all the time". As explained in the commit message, I introduced two new idioms: "presentation controllers monitor" (the (FWIW, I'll be out of office for about a week starting tomorrow) |
<li>If the <a>set of presentation controllers</a> contains at least | ||
one <a>presentation connection</a>, then run the following steps: | ||
<ol> | ||
<li>Let the <a>presentation controllers monitor</a> be a new <a> |
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.
We might want to be explicit that the connections property of the new PresentationConnectionList should be populated with the contents of the presentation controllers monitor.
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 note that getting the connections property of the new PresentationConnectionList de facto returns "the non-terminated set of presentation connections in the set of presentation controllers":
https://w3c.github.io/presentation-api/#dom-presentationconnectionlist-connections
That quoted sentence could perhaps be moved here, as the section that describes the PresentationConnectionList interface should probably remain generic and not assume that there is going to be only one PresentationConnectionList instance per browsing context.
@tidoust, overall looks good. I traced through the various possibilities and concluded the following:
Since you'll be out I'll merge in your changes and tweak a few things to make those assumptions clearer, and add a step to populate the PresentationConnectionList. Thanks again! |
This is pull request for the pull request #277...
I have the following comments on PR #277:
availabilityUrl
is the parameter passed togetAvailability()
. That's an old remain of some past version wheregetAvailability()
indeed took a parameter.connectionList
attribute creates a newPresentationConnectionList
instance for each call, whereas I would assume we would rather return the same instance each time.connectionList
attribute always returns a promise that is immediately resolved. I believe the reason why we want a Promise in the first place is to ensure that the app gets aconnectionList
with at least one presentation connection in it (the one that gave birth to the receiving browsing context), so we should wait for that to happen, or we should not return a Promise.connectionList
attribute, since that is now done in the "starting a presentation" stepsThis PR updates the PR #277 to address each of these points:
PresentationReceiver
has an associatedPresentationConnectionList
object, and that getting theconnectionList
attribute resolves the returned promise with that object.connectionList
attribute now only returns a resolved promise if the set of presentation controllers is non empty. The promise is resolved when the firstPresentationConnection
object is added to the list otherwise (note that theconnectionavailable
event is not fired when that happens, which seems to be the right thing to do).For 2., it could be better to find a real
dfn
name for thePresentationConnectionList
object associated with thePresentationReceiver
object, but I could not really come up with a good name (we already have "set of presentation controllers", I tried "incoming connection reporter" but that looked awkwards).