mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 00:08:39 +09:00
CSP 2 - ignore (x-)frame-options if CSP with frame-ancestors directive exists
This commit is contained in:
parent
ed463cec3e
commit
a01c9abce8
13 changed files with 197 additions and 34 deletions
|
|
@ -61,6 +61,7 @@
|
|||
#include "nsGenericHTMLElement.h"
|
||||
#include "mozilla/dom/CDATASection.h"
|
||||
#include "mozilla/dom/ProcessingInstruction.h"
|
||||
#include "nsDSURIContentListener.h"
|
||||
#include "nsDOMString.h"
|
||||
#include "nsNodeUtils.h"
|
||||
#include "nsLayoutUtils.h" // for GetFrameForPoint
|
||||
|
|
@ -2456,6 +2457,15 @@ nsDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// XFO needs to be checked after CSP because it is ignored if
|
||||
// the CSP defines frame-ancestors.
|
||||
if (!nsDSURIContentListener::CheckFrameOptions(aChannel, docShell, NodePrincipal())) {
|
||||
MOZ_LOG(gCspPRLog, LogLevel::Debug,
|
||||
("XFO doesn't like frame's ancestry, not loading."));
|
||||
// stop! ERROR page!
|
||||
aChannel->Cancel(NS_ERROR_CSP_FRAME_ANCESTOR_VIOLATION);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue