Bug 333922 - Setting designMode doesn't work with enhanced privileges on a frame with a different domain, r+sr=bzbarsky

This commit is contained in:
martijn.martijn%gmail.com 2006-06-12 08:55:37 +00:00
parent 46799013e7
commit 0a6dcb125d

View File

@ -3673,13 +3673,16 @@ nsHTMLDocument::SetDesignMode(const nsAString & aDesignMode)
return NS_ERROR_FAILURE;
nsresult rv = NS_OK;
nsCOMPtr<nsIPrincipal> subject;
nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager();
rv = secMan->GetSubjectPrincipal(getter_AddRefs(subject));
NS_ENSURE_SUCCESS(rv, rv);
if (subject) {
rv = secMan->CheckSameOriginPrincipal(subject, NodePrincipal());
NS_ENSURE_SUCCESS(rv, rv);
if (!nsContentUtils::IsCallerTrustedForWrite()) {
nsCOMPtr<nsIPrincipal> subject;
nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager();
rv = secMan->GetSubjectPrincipal(getter_AddRefs(subject));
NS_ENSURE_SUCCESS(rv, rv);
if (subject) {
rv = secMan->CheckSameOriginPrincipal(subject, NodePrincipal());
NS_ENSURE_SUCCESS(rv, rv);
}
}
nsCOMPtr<nsIEditingSession> editSession = do_GetInterface(docshell);