From ef98abb585f05a8ccc8cc1d08176cacbe16619d1 Mon Sep 17 00:00:00 2001 From: "peterv%propagandism.org" Date: Fri, 14 Oct 2005 09:07:29 +0000 Subject: [PATCH] Fix for bug 308328 (crash in [@ nsDocument::GetPrincipal] when closing browser). r/sr=bz. --- content/base/public/nsContentUtils.h | 6 +++++- content/base/src/nsContentAreaDragDrop.cpp | 2 +- content/base/src/nsContentSink.cpp | 2 +- content/base/src/nsDocument.cpp | 10 +++++++--- content/base/src/nsFrameLoader.cpp | 2 +- content/base/src/nsGenericElement.cpp | 2 +- content/base/src/nsObjectLoadingContent.cpp | 2 +- content/base/src/nsRange.cpp | 3 ++- content/base/src/nsScriptLoader.cpp | 4 ++-- content/base/src/nsSyncLoadService.cpp | 6 ++++-- content/events/src/nsDOMEvent.cpp | 2 +- content/events/src/nsEventListenerManager.cpp | 2 +- content/events/src/nsEventStateManager.cpp | 2 +- content/html/content/src/nsHTMLFormElement.cpp | 2 +- content/html/content/src/nsHTMLInputElement.cpp | 2 +- content/html/document/src/nsHTMLContentSink.cpp | 6 +++--- content/html/document/src/nsHTMLDocument.cpp | 8 ++++---- content/html/document/src/nsWyciwygChannel.cpp | 2 +- content/xbl/src/nsXBLBinding.cpp | 7 +++++-- content/xbl/src/nsXBLProtoImplMethod.cpp | 3 ++- content/xbl/src/nsXBLService.cpp | 2 +- content/xml/document/src/nsXMLContentSink.cpp | 2 +- content/xml/document/src/nsXMLDocument.cpp | 2 +- content/xul/content/src/nsXULPopupListener.cpp | 5 ++++- content/xul/document/src/nsXULPrototypeDocument.cpp | 2 +- layout/style/nsCSSLoader.cpp | 2 +- layout/style/nsCSSStyleSheet.cpp | 5 +++-- 27 files changed, 57 insertions(+), 38 deletions(-) diff --git a/content/base/public/nsContentUtils.h b/content/base/public/nsContentUtils.h index ad80ab7e276..3d612b0598a 100644 --- a/content/base/public/nsContentUtils.h +++ b/content/base/public/nsContentUtils.h @@ -280,7 +280,11 @@ public: static nsIXTFService* GetXTFService(); #endif - static nsIScriptSecurityManager* SecurityManager() + /** + * Get the cache security manager service. Can return null if the layout + * module has been shut down. + */ + static nsIScriptSecurityManager* GetSecurityManager() { return sSecurityManager; } diff --git a/content/base/src/nsContentAreaDragDrop.cpp b/content/base/src/nsContentAreaDragDrop.cpp index 4683547d62a..a94076bd7fb 100644 --- a/content/base/src/nsContentAreaDragDrop.cpp +++ b/content/base/src/nsContentAreaDragDrop.cpp @@ -574,7 +574,7 @@ nsContentAreaDragDrop::DragDrop(nsIDOMEvent* inMouseEvent) nsCAutoString sourceUriStr; sourceUri->GetSpec(sourceUriStr); - rv = nsContentUtils::SecurityManager()-> + rv = nsContentUtils::GetSecurityManager()-> CheckLoadURIStr(sourceUriStr, NS_ConvertUTF16toUTF8(url), nsIScriptSecurityManager::STANDARD); diff --git a/content/base/src/nsContentSink.cpp b/content/base/src/nsContentSink.cpp index d1b75592363..9fd4aaa5d43 100644 --- a/content/base/src/nsContentSink.cpp +++ b/content/base/src/nsContentSink.cpp @@ -335,7 +335,7 @@ nsContentSink::ProcessHeaderData(nsIAtom* aHeader, const nsAString& aValue, } nsCOMPtr systemPrincipal; - nsContentUtils::SecurityManager()-> + nsContentUtils::GetSecurityManager()-> GetSystemPrincipal(getter_AddRefs(systemPrincipal)); NS_ASSERTION(systemPrincipal, "No system principal"); diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 225e630821e..dffb0faa6bf 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -542,7 +542,7 @@ nsDOMImplementation::CreateDocumentType(const nsAString& aQualifiedName, NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY); nsCOMPtr principal; - rv = nsContentUtils::SecurityManager()-> + rv = nsContentUtils::GetSecurityManager()-> GetCodebasePrincipal(mBaseURI, getter_AddRefs(principal)); NS_ENSURE_SUCCESS(rv, rv); @@ -1207,7 +1207,11 @@ nsDocument::GetPrincipal() { if (!mPrincipal) { nsIScriptSecurityManager *securityManager = - nsContentUtils::SecurityManager(); + nsContentUtils::GetSecurityManager(); + + if (!securityManager) { + return nsnull; + } NS_WARN_IF_FALSE(mDocumentURI, "no URI!"); nsresult rv = @@ -1263,7 +1267,7 @@ nsDocument::SetBaseURI(nsIURI* aURI) NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE); nsIScriptSecurityManager* securityManager = - nsContentUtils::SecurityManager(); + nsContentUtils::GetSecurityManager(); rv = securityManager-> CheckLoadURIWithPrincipal(principal, aURI, nsIScriptSecurityManager::STANDARD); diff --git a/content/base/src/nsFrameLoader.cpp b/content/base/src/nsFrameLoader.cpp index 58ef4f22093..ac1d98c61ed 100644 --- a/content/base/src/nsFrameLoader.cpp +++ b/content/base/src/nsFrameLoader.cpp @@ -136,7 +136,7 @@ nsFrameLoader::LoadURI(nsIURI* aURI) NS_ENSURE_TRUE(loadInfo, NS_ERROR_FAILURE); // Check for security - nsIScriptSecurityManager *secMan = nsContentUtils::SecurityManager(); + nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager(); // Get referring URL nsCOMPtr referrer; diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index da14de86ce5..2a693ba67b3 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -2417,7 +2417,7 @@ nsGenericElement::GetBaseURI() const doc->GetDocumentCharacterSet().get(), parentBase); if (NS_SUCCEEDED(rv)) { // do a security check, almost the same as nsDocument::SetBaseURL() - rv = nsContentUtils::SecurityManager()-> + rv = nsContentUtils::GetSecurityManager()-> CheckLoadURIWithPrincipal(doc->GetPrincipal(), ourBase, nsIScriptSecurityManager::STANDARD); } diff --git a/content/base/src/nsObjectLoadingContent.cpp b/content/base/src/nsObjectLoadingContent.cpp index 2688a2bfe0a..057f73c64ee 100644 --- a/content/base/src/nsObjectLoadingContent.cpp +++ b/content/base/src/nsObjectLoadingContent.cpp @@ -643,7 +643,7 @@ nsObjectLoadingContent::ObjectURIChanged(nsIURI* aURI, // Null URIs happen when the URL to load is specified via other means than the // data/src attribute, for example via custom elements. if (aURI) { - nsIScriptSecurityManager* secMan = nsContentUtils::SecurityManager(); + nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager(); NS_ASSERTION(secMan, "No security manager!?"); nsresult rv = secMan->CheckLoadURIWithPrincipal(doc->GetPrincipal(), aURI, 0); if (NS_FAILED(rv)) { diff --git a/content/base/src/nsRange.cpp b/content/base/src/nsRange.cpp index 23b8b04b5d7..2d122a3a1c1 100644 --- a/content/base/src/nsRange.cpp +++ b/content/base/src/nsRange.cpp @@ -2433,7 +2433,8 @@ nsRange::CreateContextualFragment(const nsAString& aFragment, nsCOMPtr sysPrin; nsCOMPtr subjectPrin; - nsIScriptSecurityManager *secMan = nsContentUtils::SecurityManager(); + nsIScriptSecurityManager *secMan = + nsContentUtils::GetSecurityManager(); // Just to compare, not to use! result = secMan->GetSystemPrincipal(getter_AddRefs(sysPrin)); diff --git a/content/base/src/nsScriptLoader.cpp b/content/base/src/nsScriptLoader.cpp index 331e5d8f888..0f99f0dbd03 100644 --- a/content/base/src/nsScriptLoader.cpp +++ b/content/base/src/nsScriptLoader.cpp @@ -85,7 +85,7 @@ IntersectPrincipalCerts(nsIPrincipal *aOld, nsIPrincipal *aNew) aOld->GetURI(getter_AddRefs(uri)); aOld->GetDomain(getter_AddRefs(domain)); - nsContentUtils::SecurityManager()->GetCodebasePrincipal(uri, &principal); + nsContentUtils::GetSecurityManager()->GetCodebasePrincipal(uri, &principal); if (principal && domain) { principal->SetDomain(domain); } @@ -507,7 +507,7 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement, if (!docPrincipal) { return FireErrorNotification(NS_ERROR_UNEXPECTED, aElement, aObserver); } - rv = nsContentUtils::SecurityManager()-> + rv = nsContentUtils::GetSecurityManager()-> CheckLoadURIWithPrincipal(docPrincipal, scriptURI, nsIScriptSecurityManager::ALLOW_CHROME); diff --git a/content/base/src/nsSyncLoadService.cpp b/content/base/src/nsSyncLoadService.cpp index 0eedb4d112c..073e2991fdd 100644 --- a/content/base/src/nsSyncLoadService.cpp +++ b/content/base/src/nsSyncLoadService.cpp @@ -332,7 +332,7 @@ nsSyncLoader::LoadDocument(nsIChannel* aChannel, NS_ENSURE_SUCCESS(rv, rv); nsIScriptSecurityManager *securityManager = - nsContentUtils::SecurityManager(); + nsContentUtils::GetSecurityManager(); rv = securityManager->CheckLoadURI(aLoaderURI, docURI, nsIScriptSecurityManager::STANDARD); @@ -527,8 +527,10 @@ nsSyncLoader::OnChannelRedirect(nsIChannel *aOldChannel, rv = aNewChannel->GetURI(getter_AddRefs(newURI)); // The new URI NS_ENSURE_SUCCESS(rv, rv); - rv = nsContentUtils::SecurityManager()->CheckSameOriginURI(oldURI, newURI); + nsIScriptSecurityManager *securityManager = + nsContentUtils::GetSecurityManager(); + rv = securityManager->CheckSameOriginURI(oldURI, newURI); NS_ENSURE_SUCCESS(rv, rv); mChannel = aNewChannel; diff --git a/content/events/src/nsDOMEvent.cpp b/content/events/src/nsDOMEvent.cpp index 851b48ee290..d2703f61a08 100644 --- a/content/events/src/nsDOMEvent.cpp +++ b/content/events/src/nsDOMEvent.cpp @@ -507,7 +507,7 @@ nsDOMEvent::InitEvent(const nsAString& aEventTypeArg, PRBool aCanBubbleArg, PRBo // Ensure the caller is permitted to dispatch trusted DOM events. PRBool enabled = PR_FALSE; - nsContentUtils::SecurityManager()-> + nsContentUtils::GetSecurityManager()-> IsCapabilityEnabled("UniversalBrowserWrite", &enabled); if (!enabled) { diff --git a/content/events/src/nsEventListenerManager.cpp b/content/events/src/nsEventListenerManager.cpp index 6e476f0ada0..c41f61931bd 100644 --- a/content/events/src/nsEventListenerManager.cpp +++ b/content/events/src/nsEventListenerManager.cpp @@ -1462,7 +1462,7 @@ nsEventListenerManager::RegisterScriptEventListener(nsIScriptContext *aContext, STRING_TO_JSVAL(::JS_InternString(cx, "addEventListener")); } - rv = nsContentUtils::SecurityManager()-> + rv = nsContentUtils::GetSecurityManager()-> CheckPropertyAccess(cx, jsobj, "EventTarget", sAddListenerID, diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 16e8b81e866..1fcee8c10ab 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -4558,7 +4558,7 @@ nsEventStateManager::DispatchNewEvent(nsISupports* aTarget, if (!trusted) { //Check security state to determine if dispatcher is trusted nsIScriptSecurityManager *securityManager = - nsContentUtils::SecurityManager(); + nsContentUtils::GetSecurityManager(); PRBool enabled; nsresult res = diff --git a/content/html/content/src/nsHTMLFormElement.cpp b/content/html/content/src/nsHTMLFormElement.cpp index b5a51565c23..3fcdec0dcea 100644 --- a/content/html/content/src/nsHTMLFormElement.cpp +++ b/content/html/content/src/nsHTMLFormElement.cpp @@ -1374,7 +1374,7 @@ nsHTMLFormElement::GetActionURL(nsIURI** aActionURL) // Get security manager, check to see if access to action URI is allowed. // nsIScriptSecurityManager *securityManager = - nsContentUtils::SecurityManager(); + nsContentUtils::GetSecurityManager(); rv = securityManager-> CheckLoadURIWithPrincipal(document->GetPrincipal(), actionURL, nsIScriptSecurityManager::STANDARD); diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index 411069f205a..636ac54d1db 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -666,7 +666,7 @@ nsHTMLInputElement::SetValue(const nsAString& aValue) // OK and gives pages a way to clear a file input if necessary. if (mType == NS_FORM_INPUT_FILE && !aValue.IsEmpty()) { nsIScriptSecurityManager *securityManager = - nsContentUtils::SecurityManager(); + nsContentUtils::GetSecurityManager(); PRBool enabled; nsresult rv = diff --git a/content/html/document/src/nsHTMLContentSink.cpp b/content/html/document/src/nsHTMLContentSink.cpp index 72b0aef05ff..d169ebde497 100644 --- a/content/html/document/src/nsHTMLContentSink.cpp +++ b/content/html/document/src/nsHTMLContentSink.cpp @@ -1991,8 +1991,8 @@ IsScriptEnabled(nsIDocument *aDoc, nsIDocShell *aContainer) NS_ENSURE_TRUE(cx, PR_TRUE); PRBool enabled = PR_TRUE; - nsContentUtils::SecurityManager()->CanExecuteScripts(cx, principal, - &enabled); + nsContentUtils::GetSecurityManager()->CanExecuteScripts(cx, principal, + &enabled); return enabled; } @@ -3607,7 +3607,7 @@ HTMLContentSink::ProcessBaseHref(const nsAString& aBaseHref) // NAV compatibility quirk nsIScriptSecurityManager *securityManager = - nsContentUtils::SecurityManager(); + nsContentUtils::GetSecurityManager(); rv = securityManager-> CheckLoadURIWithPrincipal(mDocument->GetPrincipal(), baseHrefURI, diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index ef6527f2ada..e33a04021c5 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -1849,7 +1849,7 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace) } nsCOMPtr callerPrincipal; - nsContentUtils::SecurityManager()-> + nsContentUtils::GetSecurityManager()-> GetSubjectPrincipal(getter_AddRefs(callerPrincipal)); // The URI for the document after this call. Get it from the calling @@ -2246,7 +2246,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. - nsIScriptSecurityManager *secMan = nsContentUtils::SecurityManager(); + nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager(); nsCOMPtr subject; rv = secMan->GetSubjectPrincipal(getter_AddRefs(subject)); @@ -3550,7 +3550,7 @@ 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. - rv = nsContentUtils::SecurityManager()->CheckSameOrigin(nsnull, + rv = nsContentUtils::GetSecurityManager()->CheckSameOrigin(nsnull, mDocumentURI); if (NS_FAILED(rv)) return rv; @@ -3824,7 +3824,7 @@ nsHTMLDocument::DoClipboardSecurityCheck(PRBool aPaste) NS_NAMED_LITERAL_CSTRING(classNameStr, "Clipboard"); - nsIScriptSecurityManager *secMan = nsContentUtils::SecurityManager(); + nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager(); if (aPaste) { if (nsHTMLDocument::sPasteInternal_id == JSVAL_VOID) { diff --git a/content/html/document/src/nsWyciwygChannel.cpp b/content/html/document/src/nsWyciwygChannel.cpp index 91c2b0d066d..7a92295d2f0 100644 --- a/content/html/document/src/nsWyciwygChannel.cpp +++ b/content/html/document/src/nsWyciwygChannel.cpp @@ -208,7 +208,7 @@ nsWyciwygChannel::GetOwner(nsISupports **aOwner) NS_ENSURE_TRUE(mOriginalURI, NS_ERROR_FAILURE); nsCOMPtr principal; - nsIScriptSecurityManager *secMan = nsContentUtils::SecurityManager(); + nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager(); rv = secMan->GetCodebasePrincipal(mOriginalURI, getter_AddRefs(principal)); if (NS_SUCCEEDED(rv)) { mOwner = principal; diff --git a/content/xbl/src/nsXBLBinding.cpp b/content/xbl/src/nsXBLBinding.cpp index bae3d3dab75..32f725dbfbe 100644 --- a/content/xbl/src/nsXBLBinding.cpp +++ b/content/xbl/src/nsXBLBinding.cpp @@ -1203,6 +1203,11 @@ nsXBLBinding::AllowScripts() // Nasty hack. Use the JSContext of the bound node, since the // security manager API expects to get the docshell type from // that. But use the nsIPrincipal of our document. + nsIScriptSecurityManager* mgr = nsContentUtils::GetSecurityManager(); + if (!mgr) { + return PR_FALSE; + } + nsIDocument* doc = mBoundElement->GetOwnerDoc(); if (!doc) { return PR_FALSE; @@ -1227,8 +1232,6 @@ nsXBLBinding::AllowScripts() return PR_FALSE; } - nsIScriptSecurityManager* mgr = nsContentUtils::SecurityManager(); - PRBool canExecute; nsresult rv = mgr->CanExecuteScripts(cx, principal, &canExecute); return NS_SUCCEEDED(rv) && canExecute; diff --git a/content/xbl/src/nsXBLProtoImplMethod.cpp b/content/xbl/src/nsXBLProtoImplMethod.cpp index 482256763bc..b51e42de3ac 100644 --- a/content/xbl/src/nsXBLProtoImplMethod.cpp +++ b/content/xbl/src/nsXBLProtoImplMethod.cpp @@ -330,7 +330,8 @@ nsXBLProtoImplAnonymousMethod::Execute(nsIContent* aBoundElement) nsCxPusher pusher(aBoundElement); // Check whether it's OK to call the method. - rv = nsContentUtils::SecurityManager()->CheckFunctionAccess(cx, method, thisObject); + rv = nsContentUtils::GetSecurityManager()->CheckFunctionAccess(cx, method, + thisObject); JSBool ok = JS_TRUE; if (NS_SUCCEEDED(rv)) { diff --git a/content/xbl/src/nsXBLService.cpp b/content/xbl/src/nsXBLService.cpp index 9d019df7ce3..e1ea09b53e2 100644 --- a/content/xbl/src/nsXBLService.cpp +++ b/content/xbl/src/nsXBLService.cpp @@ -552,7 +552,7 @@ nsXBLService::LoadBindings(nsIContent* aContent, nsIURI* aURL, PRBool aAugmentFl // Not everything with a chrome URI has a system principal. See bug 160042. if (NS_FAILED(rv) || !isChrome) { - nsIScriptSecurityManager *secMan = nsContentUtils::SecurityManager(); + nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager(); rv = secMan-> CheckLoadURIWithPrincipal(document->GetPrincipal(), aURL, diff --git a/content/xml/document/src/nsXMLContentSink.cpp b/content/xml/document/src/nsXMLContentSink.cpp index a2fd12f970a..edeee5d87b3 100644 --- a/content/xml/document/src/nsXMLContentSink.cpp +++ b/content/xml/document/src/nsXMLContentSink.cpp @@ -639,7 +639,7 @@ nsXMLContentSink::ProcessStyleLink(nsIContent* aElement, NS_ENSURE_SUCCESS(rv, rv); // Do security check - nsIScriptSecurityManager *secMan = nsContentUtils::SecurityManager(); + nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager(); rv = secMan-> CheckLoadURIWithPrincipal(mDocument->GetPrincipal(), url, nsIScriptSecurityManager::ALLOW_CHROME); diff --git a/content/xml/document/src/nsXMLDocument.cpp b/content/xml/document/src/nsXMLDocument.cpp index 9ec1474df47..2ede539b054 100644 --- a/content/xml/document/src/nsXMLDocument.cpp +++ b/content/xml/document/src/nsXMLDocument.cpp @@ -276,7 +276,7 @@ nsXMLDocument::OnChannelRedirect(nsIChannel *aOldChannel, if (NS_FAILED(rv)) return rv; - nsIScriptSecurityManager *secMan = nsContentUtils::SecurityManager(); + nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager(); if (mScriptContext && !mCrossSiteAccessEnabled) { nsCOMPtr stack(do_GetService("@mozilla.org/js/xpc/ContextStack;1", & rv)); diff --git a/content/xul/content/src/nsXULPopupListener.cpp b/content/xul/content/src/nsXULPopupListener.cpp index 115716079dd..9aca0ad432b 100644 --- a/content/xul/content/src/nsXULPopupListener.cpp +++ b/content/xul/content/src/nsXULPopupListener.cpp @@ -243,8 +243,11 @@ XULPopupListenerImpl::PreLaunchPopup(nsIDOMEvent* aMouseEvent) getter_AddRefs(doc), getter_AddRefs(prin)); if (prin) { + nsIScriptSecurityManager *securityManager = + nsContentUtils::GetSecurityManager(); + nsCOMPtr system; - nsContentUtils::SecurityManager()->GetSystemPrincipal(getter_AddRefs(system)); + securityManager->GetSystemPrincipal(getter_AddRefs(system)); if (prin != system) { // This isn't chrome. Cancel the preventDefault() and // let the event go forth. diff --git a/content/xul/document/src/nsXULPrototypeDocument.cpp b/content/xul/document/src/nsXULPrototypeDocument.cpp index 30b9a88ed3f..03275c8a557 100644 --- a/content/xul/document/src/nsXULPrototypeDocument.cpp +++ b/content/xul/document/src/nsXULPrototypeDocument.cpp @@ -668,7 +668,7 @@ nsXULPrototypeDocument::GetDocumentPrincipal() NS_PRECONDITION(mNodeInfoManager, "missing nodeInfoManager"); if (!mDocumentPrincipal) { nsIScriptSecurityManager *securityManager = - nsContentUtils::SecurityManager(); + nsContentUtils::GetSecurityManager(); nsresult rv = NS_OK; // XXX This should be handled by the security manager, see bug 160042 diff --git a/layout/style/nsCSSLoader.cpp b/layout/style/nsCSSLoader.cpp index f7089564258..cded13d7388 100644 --- a/layout/style/nsCSSLoader.cpp +++ b/layout/style/nsCSSLoader.cpp @@ -879,7 +879,7 @@ CSSLoaderImpl::CheckLoadAllowed(nsIURI* aSourceURI, LOG(("CSSLoaderImpl::CheckLoadAllowed")); // Check with the security manager - nsIScriptSecurityManager *secMan = nsContentUtils::SecurityManager(); + nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager(); nsresult rv = secMan->CheckLoadURI(aSourceURI, aTargetURI, nsIScriptSecurityManager::ALLOW_CHROME); if (NS_FAILED(rv)) { // failure is normal here; don't warn diff --git a/layout/style/nsCSSStyleSheet.cpp b/layout/style/nsCSSStyleSheet.cpp index 6ca31491c46..38b80b6bb60 100644 --- a/layout/style/nsCSSStyleSheet.cpp +++ b/layout/style/nsCSSStyleSheet.cpp @@ -2172,8 +2172,9 @@ nsCSSStyleSheet::GetCssRules(nsIDOMCSSRuleList** aCssRules) return NS_ERROR_FAILURE; // Get the security manager and do the same-origin check - rv = nsContentUtils::SecurityManager()->CheckSameOrigin(cx, - mInner->mSheetURI); + nsIScriptSecurityManager *securityManager = + nsContentUtils::GetSecurityManager(); + rv = securityManager->CheckSameOrigin(cx, mInner->mSheetURI); if (NS_FAILED(rv)) { return rv; }