Open Bug 585161 Opened 14 years ago Updated 2 years ago

Get rid of hashtables in nsPrincipal

Categories

(Core :: Security, defect)

x86
macOS
defect

Tracking

()

People

(Reporter: mrbkap, Unassigned)

References

Details

Once bug 546848 lands, we should be able to get rid of mAnnotations and mCapabilities, as well as a couple of extra fields.

It'd be neat if we could get rid of mutable state in principals altogether. I'm not sure exactly how much of it currently depends on bug 546848, but it seems like most of it should be able to go once that bug lands.
Given document.domain the only way to get rid of mutable state in principals is to have mutable principal pointers in documents...
Proxies can "become" other objects, this is used when "fixing" a proxy due to ES5 Object.{preventExtensions,seal,freeze}. No interior mutability is required, and the object identity-by-reference is preserved, so you don't have to rewrite live refs as if doing a forwarding/copying GC.

The underlying method is JSObject::swap, although not all objects can become other objects. Still, to me this suggests making principals be objects and having document.domain create a new principall for the RHS origin, then swap. Would this work?

/be
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.