Issue #2542 - Part 3: Expand BasePrincipal with an IsSameOrigin check

Manual checking of the origins in SecFetch fails, so we add this
capability to the base principal interface for sake of ease.
We could use ScriptSecurityManager directly but it's more convenient
this way and can be re-used elsewhere in the future.
This commit is contained in:
Moonchild 2024-07-03 17:02:32 +02:00 • committed by roytam1
commit 5ee2871524
3 changed files with 24 additions and 0 deletions

View file

@ -223,6 +223,12 @@ interface nsIPrincipal : nsISerializable
*/
readonly attribute AUTF8String originSuffix;
/**
* Uses NS_Security Compare to determine if the
* other URI is same-origin as the uri of the Principal
*/
bool IsSameOrigin(in nsIURI otherURI, in bool aIsPrivateWin);
/**
* The base domain of the codebase URI to which this principal pertains
* (generally the document URI), handling null principals and