mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 04:38:02 +00:00
Bug 1450309 - Allow nSIContentPolicy to reject based on enterprise policy. r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D91487
This commit is contained in:
parent
a9816b2cdb
commit
01ac66c721
@ -8431,8 +8431,13 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
|
||||
&shouldLoad);
|
||||
|
||||
if (NS_FAILED(rv) || NS_CP_REJECTED(shouldLoad)) {
|
||||
if (NS_SUCCEEDED(rv) && shouldLoad == nsIContentPolicy::REJECT_TYPE) {
|
||||
return NS_ERROR_CONTENT_BLOCKED_SHOW_ALT;
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (shouldLoad == nsIContentPolicy::REJECT_TYPE) {
|
||||
return NS_ERROR_CONTENT_BLOCKED_SHOW_ALT;
|
||||
}
|
||||
if (shouldLoad == nsIContentPolicy::REJECT_POLICY) {
|
||||
return NS_ERROR_BLOCKED_BY_POLICY;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_ERROR_CONTENT_BLOCKED;
|
||||
|
@ -468,6 +468,12 @@ interface nsIContentPolicy : nsISupports
|
||||
*/
|
||||
const short REJECT_OTHER = -4;
|
||||
|
||||
/**
|
||||
* Returned from shouldLoad or shouldProcess if the load/process is forbiddden
|
||||
* based on enterprise policy.
|
||||
*/
|
||||
const short REJECT_POLICY = -5;
|
||||
|
||||
/**
|
||||
* Returned from shouldLoad or shouldProcess if the load or process request
|
||||
* is not rejected.
|
||||
|
@ -588,11 +588,16 @@ static nsresult DoContentSecurityChecks(nsIChannel* aChannel,
|
||||
NS_SetRequestBlockingReasonIfNull(
|
||||
aLoadInfo, nsILoadInfo::BLOCKING_REASON_CONTENT_POLICY_GENERAL);
|
||||
|
||||
if ((NS_SUCCEEDED(rv) && shouldLoad == nsIContentPolicy::REJECT_TYPE) &&
|
||||
if (NS_SUCCEEDED(rv) &&
|
||||
(contentPolicyType == nsIContentPolicy::TYPE_DOCUMENT ||
|
||||
contentPolicyType == nsIContentPolicy::TYPE_SUBDOCUMENT)) {
|
||||
// for docshell loads we might have to return SHOW_ALT.
|
||||
return NS_ERROR_CONTENT_BLOCKED_SHOW_ALT;
|
||||
if (shouldLoad == nsIContentPolicy::REJECT_TYPE) {
|
||||
// for docshell loads we might have to return SHOW_ALT.
|
||||
return NS_ERROR_CONTENT_BLOCKED_SHOW_ALT;
|
||||
}
|
||||
if (shouldLoad == nsIContentPolicy::REJECT_POLICY) {
|
||||
return NS_ERROR_BLOCKED_BY_POLICY;
|
||||
}
|
||||
}
|
||||
return NS_ERROR_CONTENT_BLOCKED;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user