mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 11:57:32 +09:00
Merge remote-tracking branch 'origin/tracking' into custom
This commit is contained in:
commit
296db1641b
7 changed files with 42 additions and 27 deletions
|
|
@ -140,12 +140,18 @@ CSPService::ShouldLoad(uint32_t aContentType,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// query the principal of the document; if no document is passed, then
|
||||
// fall back to using the requestPrincipal (e.g. service workers do not
|
||||
// pass a document).
|
||||
// Find a principal to retrieve the CSP from. If we don't have a context node
|
||||
// (because, for instance, the load originates in a service worker), or the
|
||||
// requesting principal's CSP overrides our document CSP, use the request
|
||||
// principal. Otherwise, use the document principal.
|
||||
nsCOMPtr<nsINode> node(do_QueryInterface(aRequestContext));
|
||||
nsCOMPtr<nsIPrincipal> principal = node ? node->NodePrincipal()
|
||||
: aRequestPrincipal;
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
if (!node || (aRequestPrincipal &&
|
||||
BasePrincipal::Cast(aRequestPrincipal)->OverridesCSP(node->NodePrincipal()))) {
|
||||
principal = aRequestPrincipal;
|
||||
} else {
|
||||
principal = node->NodePrincipal();
|
||||
}
|
||||
if (!principal) {
|
||||
// if we can't query a principal, then there is nothing to do.
|
||||
return NS_OK;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue