Closed Bug 1517434 Opened Last year Closed Last year

Use principal->GetIsSystemPrincipal() in xpc::CreateSandboxObject

Categories

(Core :: XPConnect, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: jandem, Assigned: bzbarsky)

References

Details

Attachments

(3 files)

Boris suggested this in bug 1512029:

> Maybe file a followup to use principal->GetIsSystemPrincipal() here? Right now it's not very fast, but it could be made better....

We currently do:

  principal == nsXPConnect::SystemPrincipal()

(FWIW nsContentUtils::IsSystemPrincipal doesn't work here because nsContentUtils hasn't been initialized when we create the singleton scopes.)
Priority: -- → P3
We could add a convenience helper on BasePrincipal that does Kind() == eSystemPrincipal. That would be fastest and cleanest.
Yes, I have that implemented already.  Just waiting on try, because my first attempt discovered some places that had null nsIPrincipal* in non-obvious ways.  ;)
Assignee: nobody → bzbarsky
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/417769fb3f0f
part 1.  Add a fast inline nsIPrincipal::IsSystemPrincipal.  r=mccr8
https://hg.mozilla.org/integration/autoland/rev/840ea11d3b3e
part 2.  Convert existing callers of GetIsSystemPrincipal() to IsSystemPrincipal().  r=mccr8
https://hg.mozilla.org/integration/autoland/rev/1853f95c94b1
part 3.  Get rid of pointer compares to nsXPConnect::SystemPrincipal.  r=mccr8
You need to log in before you can comment on or make changes to this bug.