Re: [mediacapture-region] Why expose produceCropTarget at MediaDevices level? (#11)

> Using element.id would requre the capturer and the capturee to share information about event.source, which it otherwise does not need to know (as far as I can tell).

I mean, the information already exists and is passed anyway. That seems OK.

> What about a single page with multiple third party iframes?

The ID is scoped to a single frame, so iframes do not interfere.

> I am not sure how event.source would actually work in all cases, for instance if source is a MessagePort, or if there is no source (post message to a dedicated worker) or in case of double post messaging.

Yes, this is a fair point. You could make MessagePort work if the other side is a Window, and just say that if you get a message from a DedicatedWorker, or if the message passes through multiple windows, it doesn't work. But this starts to make it all less elegant.

As you say, to solve the problem in full generality you need some sort of serializable weak reference (or ID) for the original window itself. So if that kind of full generality is the goal then using a (new window weak reference concept, element's ID) tuple is redundant, and you could just do (new element+window weak reference concept).

On the question of "ID" vs. "weak reference": I think the distinguishing factor is that an ID is a string whereas a weak reference is some sort of opaque object or handle. Probably weak reference is the best default in general. It's just nice that elements already have a string ID so it's worth reusing that if possible.

My summary:

- (Window/MessagePort-from-Window object, element ID string): does not work in full generality, but is nice and simple and reuses existing primitives
- element+window weak reference opaque object: works in full generality. (This is basically @jan-ivar's proposal IIUC.)
- Other options, e.g. (window weak reference, element ID string): IMO this is extra complexity for little gain, but it sounds like other people might be interested in some of the things the ID string could enable.

-- 
GitHub Notification of comment by domenic
Please view or discuss this issue at https://github.com/w3c/mediacapture-region/issues/11#issuecomment-1113600941 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 29 April 2022 18:27:53 UTC