Closed beaufortfrancois closed 1 year ago
The first set of checks is done synchronously over the MediaStreamTrack. (In Chrome that'd happen in the render process.)
Checks involving the target-element are necessarily asynchronous, because the the target-element may be in an out-of-process iframe[]. The original tests, involving the MediaStreamTrack, are repeated at this stage so as to ensure they still* hold, given that the asynchronicity might have allowed that to change in the intervening time.
-- [*] In Chrome, they'd be carried out in the browser process rather than in the target element's process, btw. But in either case, it can't be done in the MST's own process, except for in those occasions where the Element and the MST are in the same frame.
I wonder if the spec would benefit from a note adding those details as it's not clear immediately why the asynchronousity is needed there. I don't see much details in https://www.w3.org/TR/mediacapture-region/ as well ;(
I think the clarification might only benefit a few very attentive readers such as yourself, and would be distracting for the majority of readers. But I could be wrong. I think it'd be good to reconsider it if someone else raises the same question and suggests a clarification too. Wdyt?
(Or maybe you could cite a precedent of such a clarification?)
I guess this will go away when https://github.com/w3c/mediacapture-region/issues/17 is resolved. I think we can close it then.
I guess this will go away when w3c/mediacapture-region#17 is resolved. I think we can close it then.
I don't think so, because the asynchronicity here is inherent to restrictTo()
, and would not be affected by the asynchronicity of the minting of the token.
You said "Checks involving the target-element are necessarily asynchronous, because the the target-element may be in an out-of-process iframe" which I read as "Checking whether it is a valid CropTarget is necessarily asynchronous". Since "we define a valid CropTarget as one returned by a call to CropTarget.fromElement() in a document that is still active.", I assumed it was tied to https://github.com/w3c/mediacapture-region/issues/17
After minting is done, the underlying target-element may still be detached from the DOM and even garbage-collected. Whether that has happened would not be known to the document calling restrictTo(token)
; not without IPC.
Got it now! Thanks for explaining @eladalon1983
I have two questions in the algorithm below:
Is the "If this is not a restrictable MediaStreamTrack" first check needed as the "If E is not a valid restriction target" second check also verifies that "this" is not a restrictable MediaStreamTrack as well?
Moreover, what are the reasons for invoking "Run the following steps in parallel"? Which parts is actually async?