TL;DR a few hours ago, Bug 1443925 <https://bugzilla.mozilla.org/show_bug.cgi?id=1443925> merged into central, making nsIPrincipal safe to use from multiple threads. Most nsIPrincipal APIs are now threadsafe, though you should check the updated documentation in nsIPrincipal.idl <https://hg.mozilla.org/mozilla-central/file/d9c24252e2b25e4b3eaecfbf6110c27539e47dcd/caps/nsIPrincipal.idl#l56> for the methods you're interested in (at time of writing searchfox is still updating).
Previously, we would use the PrincipalInfo <https://searchfox.org/mozilla-central/rev/ce78234f5e653a5d3916813ff990f053510227bc/ipc/glue/PBackgroundSharedTypes.ipdlh#54> data structure in order to work with principals objects off-main thread, such as in web workers or on the IPDL background thread.This was inconvenient and created a capability difference between background code and main-thread code which could use the full nsIPrincipal type. Going forward, we should prefer using nsIPrincipal over PrincipalInfo to improve consistency, and get access to more powerful APIs. Some services which were frequently used with nsIPrincipal, such as the nsIScriptSecurityService, remain main-thread only. If they are required off-main-thread they will need to be made threadsafe separately. As this thread-safety support is new, it is unfortunately likely you will run into roadblocks when migrating code over to using it. Please file bugs for any issues of that kind going forward. -nika -- You received this message because you are subscribed to the Google Groups "dev-platform@mozilla.org" group. To unsubscribe from this group and stop receiving emails from it, send an email to dev-platform+unsubscr...@mozilla.org. To view this discussion on the web visit https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/CACwGqKikQUPRta6eHhAdztWgXn3vwaG08T7M_1a3Uvd1qrsCCA%40mail.gmail.com.