diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index 519e8110540..d2f20234d99 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/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);