From 0a6dcb125d1b816e9c80724cbd4541807eeffce3 Mon Sep 17 00:00:00 2001 From: "martijn.martijn%gmail.com" Date: Mon, 12 Jun 2006 08:55:37 +0000 Subject: [PATCH] Bug 333922 - Setting designMode doesn't work with enhanced privileges on a frame with a different domain, r+sr=bzbarsky --- content/html/document/src/nsHTMLDocument.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index 519e8110540c..d2f20234d990 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -3673,13 +3673,16 @@ nsHTMLDocument::SetDesignMode(const nsAString & aDesignMode) return NS_ERROR_FAILURE; nsresult rv = NS_OK; - nsCOMPtr 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 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 editSession = do_GetInterface(docshell);