(In reply to Boris Zbarsky [:bzbarsky, bz on IRC] from comment #0) > Jan, any thoughts on this? One option is to add JS_IterateCompartmentsInZone (similar to JS_IterateCompartments) and then use that in SelectZone to look for a compartment with a CompartmentOriginInfo that's same-origin with aPrincipal. That's linear though... A map might be nice. > Need to sort out the lifetime issues around compartments (e.g. can we detect when they go away so we can remove them from the map?). We have a compartment-destroyed callback, we use that destroy the CompartmentPrivate here: https://searchfox.org/mozilla-central/rev/c07aaf12f13037c1f5a343d31f8291549e57373f/js/xpconnect/src/XPCJSRuntime.cpp#696
Bug 1523843 Comment 1 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
(In reply to Boris Zbarsky [:bzbarsky, bz on IRC] from comment #0) > Jan, any thoughts on this? One option is to add JS_IterateCompartmentsInZone (similar to JS_IterateCompartments) and then use that in SelectZone to look for a compartment with a CompartmentOriginInfo that's same-origin with aPrincipal. That's linear though... A map might be nice. > Need to sort out the lifetime issues around compartments (e.g. can we detect when they go away so we can remove them from the map?). We have a compartment-destroyed callback, we use that to destroy the CompartmentPrivate here: https://searchfox.org/mozilla-central/rev/c07aaf12f13037c1f5a343d31f8291549e57373f/js/xpconnect/src/XPCJSRuntime.cpp#696