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
Rewrite the createOffer algorithm to eliminate race conditions. #874
Rewrite the createOffer algorithm to eliminate race conditions. #874
Conversation
First step in addressing w3c#782. Though the resulting algorithm is pretty ugly and could probably use some restructuring.
@jan-ivar, can you take a look? A couple things to note: This only covers And as mentioned in the description, the algorithm ends up pretty ugly. It's essentially 4 levels of nesting, with GOTOs. If it was source code, I wouldn't "lgtm" it myself. Do you think it would be appropriate to restructure it, creating multiple "steps to do X", "steps to do Y" etc. subsections? Something like this: To obtain an identity assertion before running steps s, given promise p:
To prepare to create an offer given promise p:
The final steps to create an offer given promise p are as follows:
I've noticed the "web APIs" section of the HTML spec (for example) does this kind of thing all the time. It very rarely has more than 2 levels of nested tasks. |
I'm not sure how the PR text works with the two returns of I think we should give the approach with subsections a try. I'm not sure where the execution in the above description starts and what |
That was something I noticed, but I thought maybe the extra return wouldn't hurt anything. In any case, I'll work on the alternate flavor of this PR. Also, I got to thinking, maybe the identity assertion race condition (calling setIdentityProvider after createOffer) should be handled in some other way? Using two identity providers would be terrible user experience anyway (I assume) so this is something that should never happen. I'll try moving "begin identity assertion request process" to the synchronous section for this PR. |
This simplifies the algorithm a bit, and ignores the case of: `pc.createOffer()` `setIdentityProvider(idp)` Only the identity provider set at the time `createOffer` was called will be used. And the identity assertion request process will begin as soon as `createOffer` is called, rather than when the operation is taken off the queue.
See alternate PR above. I think the identity provider part still needs to be formalized better, but that can probably happen separately. |
I think we can close this PR in favor of #875. |
Closing as it is superseded by #875 . |
First step in addressing #782. Though the resulting algorithm is pretty
ugly and could probably use some restructuring.