Description
@jan-ivar had an interesting idea in w3c/webrtc-pc#2297 (comment). What if we provided dedicated infrastructure for common comparison operations?
The way I could see this work is that when you serialize your object you annotate it with "serialized.[[EnforceSameOrigin]] is true".
HTML's algorithm would check if that record field is there and if it is, add another record field [[EnforceOrigin]] and set it to the current origin. Then when deserializing if [[EnforceOrigin]] is there we do the check and throw if it fails.
We'd also support [[EnforceSameAgentCluster]] (which HTML would set [[EnforceAgentCluster]] for).
This would help with sharing logic between SharedArrayBuffer
, WebAssembly.Module
and RTCCertificate
(only needs [[EnforceSameOrigin]]).
(I think implementations could eventually also use this to avoid sending data to the wrong process more easily, assuming processes are properly annotated, though @yutakahirano had some concerns here I think. See also #4734 (comment).)