Bug 1956954 - ValidatePrincipal in CreateAboutBlankDocumentViewer calls, r=smaug
This should avoid the content crash by blocking the initial createAboutBlankDocumentViewer call and throwing an exception instead of crashing the content process. This also adds a call to LogAndAssertFailedPrincipalValidationInfo which should help us collect telemetry to detect when these failures happen. Differential Revision: https://phabricator.services.mozilla.com/D247350
This commit is contained in:
committed by
nlayzell@mozilla.com
parent
411d05a2ac
commit
262cc4223d
@@ -254,6 +254,14 @@ BrowserHost::CreateAboutBlankDocumentViewer(
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Before creating the viewer in-content, ensure that the process is allowed
|
||||||
|
// to load this principal.
|
||||||
|
if (NS_WARN_IF(!mRoot->Manager()->ValidatePrincipal(aPrincipal))) {
|
||||||
|
ContentParent::LogAndAssertFailedPrincipalValidationInfo(
|
||||||
|
aPrincipal, "BrowserHost::CreateAboutBlankDocumentViewer");
|
||||||
|
return NS_ERROR_DOM_SECURITY_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure the content process has permisisons for the new document we're about
|
// Ensure the content process has permisisons for the new document we're about
|
||||||
// to create in it.
|
// to create in it.
|
||||||
nsresult rv = GetContentParent()->TransmitPermissionsForPrincipal(aPrincipal);
|
nsresult rv = GetContentParent()->TransmitPermissionsForPrincipal(aPrincipal);
|
||||||
|
|||||||
Reference in New Issue
Block a user