Make it easier to tell what kind of principal you have

RESOLVED FIXED in Firefox 44

Status

()

defect
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: bholley, Assigned: bholley)

Tracking

unspecified
mozilla44
Points:
---

Firefox Tracking Flags

(firefox44 fixed)

Details

Attachments

(1 attachment)

Right now there are various roundabout ways to do this, but we should just expose something obvious on nsIPrincipal. I've got a patch.
Comment on attachment 8678406 [details] [diff] [review]
Add a nice interface for both C++ and JS to access the principal kind. v1

Review of attachment 8678406 [details] [diff] [review]:
-----------------------------------------------------------------

This is an awesome idea, thanks! Can we also expose |kind| on the IDL level? It would be so cool sometime to just print the principals type (eh, kind). I know it's annoying to expose enums with IDL, but would be useful imo, what do you think?
Attachment #8678406 - Flags: review?(gkrizsanits) → review+
(In reply to Gabor Krizsanits [:krizsa :gabor] from comment #2)
> This is an awesome idea, thanks! Can we also expose |kind| on the IDL level?
> It would be so cool sometime to just print the principals type (eh, kind). I
> know it's annoying to expose enums with IDL, but would be useful imo, what
> do you think?

Do you mean to access from C++ or JS? With C++ you can already get it via BasePrincipal::Cast. For debugging JS, I think it's good enough to print .origin, which has all the information needed.
https://hg.mozilla.org/mozilla-central/rev/4b90b038ae4c
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
> Do you mean to access from C++ or JS? With C++ you can already get it via
> BasePrincipal::Cast. For debugging JS, I think it's good enough to print
> .origin, which has all the information needed.

Oh, you're right I forgot that we already have meaningful origin for all principals.
You need to log in before you can comment on or make changes to this bug.