Make content grab the cached security manager off of nsContentUtils rather than ask the service manager to find one.

Bug 223192; r+sr=bzbarsky


git-svn-id: svn://10.0.0.236/trunk@148524 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
caillon%returnzero.com
2003-10-30 03:01:25 +00:00
parent 53f764ca0b
commit e64c44f945
20 changed files with 70 additions and 126 deletions

View File

@@ -2619,9 +2619,7 @@ nsHTMLDocument::ScriptWriteCommon(PRBool aNewlineTerminate)
// document for security purposes. Thus a document.write of a script tag
// ends up producing a script with the same principals as the script
// that performed the write.
nsCOMPtr<nsIScriptSecurityManager> secMan =
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager();
nsCOMPtr<nsIPrincipal> subject;
rv = secMan->GetSubjectPrincipal(getter_AddRefs(subject));
@@ -3884,11 +3882,8 @@ nsHTMLDocument::SetDesignMode(const nsAString & aDesignMode)
if (!url.Equals("about:blank")) {
// If we're 'about:blank' then we don't care who can edit us.
// If we're not about:blank, then we need to check sameOrigin.
nsCOMPtr<nsIScriptSecurityManager> secMan =
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = secMan->CheckSameOrigin(nsnull, mDocumentURL);
rv = nsContentUtils::GetSecurityManager()->CheckSameOrigin(nsnull,
mDocumentURL);
if (NS_FAILED(rv))
return rv;
}
@@ -4129,10 +4124,6 @@ nsHTMLDocument::DoClipboardSecurityCheck(PRBool aPaste)
{
nsresult rv = NS_ERROR_FAILURE;
nsCOMPtr<nsIScriptSecurityManager> secMan =
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIJSContextStack> stack =
do_GetService("@mozilla.org/js/xpc/ContextStack;1");
@@ -4142,6 +4133,9 @@ nsHTMLDocument::DoClipboardSecurityCheck(PRBool aPaste)
NS_NAMED_LITERAL_CSTRING(classNameStr, "Clipboard");
nsIScriptSecurityManager *secMan =
nsContentUtils::GetSecurityManager();
if (aPaste) {
if (nsHTMLDocument::sPasteInternal_id == JSVAL_VOID) {
nsHTMLDocument::sPasteInternal_id =