mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 15:25:52 +00:00
Bug 1420680: Remove the mechanism to buffer CSP violations. r=bz
With the previous patch it's unused. MozReview-Commit-ID: 4EKufeNu0Jz
This commit is contained in:
parent
a4433a4de8
commit
109ffb9beb
@ -1429,7 +1429,6 @@ nsIDocument::nsIDocument()
|
||||
mIsTopLevelContentDocument(false),
|
||||
mIsContentDocument(false),
|
||||
mDidCallBeginLoad(false),
|
||||
mBufferingCSPViolations(false),
|
||||
mAllowPaymentRequest(false),
|
||||
mEncodingMenuDisabled(false),
|
||||
mIsShadowDOMEnabled(false),
|
||||
|
@ -1109,54 +1109,6 @@ public:
|
||||
mSandboxFlags = sandboxFlags;
|
||||
}
|
||||
|
||||
/**
|
||||
* After calling this function, any CSP violation reports will be buffered up
|
||||
* by the document (by calling BufferCSPViolation) instead of being sent
|
||||
* immediately.
|
||||
*
|
||||
* This facility is used by the user font cache, which wants to pre-emptively
|
||||
* check whether a given font load would violate CSP directives, and so
|
||||
* shouldn't immediately send the report.
|
||||
*/
|
||||
void StartBufferingCSPViolations()
|
||||
{
|
||||
MOZ_ASSERT(!mBufferingCSPViolations);
|
||||
mBufferingCSPViolations = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops buffering CSP violation reports, and stores any buffered reports in
|
||||
* aResult.
|
||||
*/
|
||||
void StopBufferingCSPViolations(nsTArray<nsCOMPtr<nsIRunnable>>& aResult)
|
||||
{
|
||||
MOZ_ASSERT(mBufferingCSPViolations);
|
||||
mBufferingCSPViolations = false;
|
||||
|
||||
aResult.SwapElements(mBufferedCSPViolations);
|
||||
mBufferedCSPViolations.Clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether we are currently buffering CSP violation reports.
|
||||
*/
|
||||
bool ShouldBufferCSPViolations() const
|
||||
{
|
||||
return mBufferingCSPViolations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a CSP violation is encountered that would generate a report
|
||||
* while buffering is enabled.
|
||||
*/
|
||||
void BufferCSPViolation(nsIRunnable* aReportingRunnable)
|
||||
{
|
||||
MOZ_ASSERT(mBufferingCSPViolations);
|
||||
|
||||
// Dropping the CSP violation report seems preferable to OOMing.
|
||||
mBufferedCSPViolations.AppendElement(aReportingRunnable, mozilla::fallible);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the document was decoded as UTF-8 and decoder encountered no
|
||||
* errors.
|
||||
@ -4027,10 +3979,6 @@ protected:
|
||||
// True if we have called BeginLoad and are expecting a paired EndLoad call.
|
||||
bool mDidCallBeginLoad : 1;
|
||||
|
||||
// True if any CSP violation reports for this doucment will be buffered in
|
||||
// mBufferedCSPViolations instead of being sent immediately.
|
||||
bool mBufferingCSPViolations : 1;
|
||||
|
||||
// True if the document is allowed to use PaymentRequest.
|
||||
bool mAllowPaymentRequest : 1;
|
||||
|
||||
@ -4317,10 +4265,6 @@ protected:
|
||||
// existing in the set means the corresponding script isn't a tracking script.
|
||||
nsTHashtable<nsCStringHashKey> mTrackingScripts;
|
||||
|
||||
// CSP violation reports that have been buffered up due to a call to
|
||||
// StartBufferingCSPViolations.
|
||||
nsTArray<nsCOMPtr<nsIRunnable>> mBufferedCSPViolations;
|
||||
|
||||
// List of ancestor principals. This is set at the point a document
|
||||
// is connected to a docshell and not mutated thereafter.
|
||||
nsTArray<nsCOMPtr<nsIPrincipal>> mAncestorPrincipals;
|
||||
|
@ -1384,14 +1384,6 @@ nsCSPContext::AsyncReportViolation(nsISupports* aBlockedContentSource,
|
||||
aLineNum,
|
||||
this);
|
||||
|
||||
// If the document is currently buffering up CSP violation reports, send the
|
||||
// runnable to it instead of dispatching it immediately.
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mLoadingContext);
|
||||
if (doc && doc->ShouldBufferCSPViolations()) {
|
||||
doc->BufferCSPViolation(task);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (XRE_IsContentProcess()) {
|
||||
if (mEventTarget) {
|
||||
mEventTarget->Dispatch(task.forget(), NS_DISPATCH_NORMAL);
|
||||
|
Loading…
Reference in New Issue
Block a user