mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Add a check to prevent a crash when CSP directives are used with chrome content
Chrome content uses System Principle and this kind of speculative preloading of CSP just won't work.
This commit is contained in:
parent
5994bb0193
commit
53005879e6
1 changed files with 6 additions and 1 deletions
|
|
@ -1041,12 +1041,17 @@ nsHtml5TreeOpExecutor::AddSpeculationCSP(const nsAString& aCSP)
|
|||
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
nsIPrincipal* principal = mDocument->NodePrincipal();
|
||||
nsCOMPtr<nsIPrincipal> principal = mDocument->NodePrincipal();
|
||||
nsCOMPtr<nsIContentSecurityPolicy> preloadCsp;
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(mDocument);
|
||||
nsresult rv = principal->EnsurePreloadCSP(domDoc, getter_AddRefs(preloadCsp));
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
if (!preloadCsp) {
|
||||
// XXX: System principals can't preload CSP. We're done here.
|
||||
return;
|
||||
}
|
||||
|
||||
// please note that meta CSPs and CSPs delivered through a header need
|
||||
// to be joined together.
|
||||
rv = preloadCsp->AppendPolicy(aCSP,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue