Fix for bug 308328 (crash in [@ nsDocument::GetPrincipal] when closing browser). r/sr=bz.

This commit is contained in:
peterv%propagandism.org 2005-10-14 09:07:29 +00:00
Родитель aa058b7344
Коммит ef98abb585
27 изменённых файлов: 57 добавлений и 38 удалений

Просмотреть файл

@ -280,7 +280,11 @@ public:
static nsIXTFService* GetXTFService(); static nsIXTFService* GetXTFService();
#endif #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; return sSecurityManager;
} }

Просмотреть файл

@ -574,7 +574,7 @@ nsContentAreaDragDrop::DragDrop(nsIDOMEvent* inMouseEvent)
nsCAutoString sourceUriStr; nsCAutoString sourceUriStr;
sourceUri->GetSpec(sourceUriStr); sourceUri->GetSpec(sourceUriStr);
rv = nsContentUtils::SecurityManager()-> rv = nsContentUtils::GetSecurityManager()->
CheckLoadURIStr(sourceUriStr, NS_ConvertUTF16toUTF8(url), CheckLoadURIStr(sourceUriStr, NS_ConvertUTF16toUTF8(url),
nsIScriptSecurityManager::STANDARD); nsIScriptSecurityManager::STANDARD);

Просмотреть файл

@ -335,7 +335,7 @@ nsContentSink::ProcessHeaderData(nsIAtom* aHeader, const nsAString& aValue,
} }
nsCOMPtr<nsIPrincipal> systemPrincipal; nsCOMPtr<nsIPrincipal> systemPrincipal;
nsContentUtils::SecurityManager()-> nsContentUtils::GetSecurityManager()->
GetSystemPrincipal(getter_AddRefs(systemPrincipal)); GetSystemPrincipal(getter_AddRefs(systemPrincipal));
NS_ASSERTION(systemPrincipal, "No system principal"); NS_ASSERTION(systemPrincipal, "No system principal");

Просмотреть файл

@ -542,7 +542,7 @@ nsDOMImplementation::CreateDocumentType(const nsAString& aQualifiedName,
NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY); NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsIPrincipal> principal; nsCOMPtr<nsIPrincipal> principal;
rv = nsContentUtils::SecurityManager()-> rv = nsContentUtils::GetSecurityManager()->
GetCodebasePrincipal(mBaseURI, getter_AddRefs(principal)); GetCodebasePrincipal(mBaseURI, getter_AddRefs(principal));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
@ -1207,7 +1207,11 @@ nsDocument::GetPrincipal()
{ {
if (!mPrincipal) { if (!mPrincipal) {
nsIScriptSecurityManager *securityManager = nsIScriptSecurityManager *securityManager =
nsContentUtils::SecurityManager(); nsContentUtils::GetSecurityManager();
if (!securityManager) {
return nsnull;
}
NS_WARN_IF_FALSE(mDocumentURI, "no URI!"); NS_WARN_IF_FALSE(mDocumentURI, "no URI!");
nsresult rv = nsresult rv =
@ -1263,7 +1267,7 @@ nsDocument::SetBaseURI(nsIURI* aURI)
NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE); NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE);
nsIScriptSecurityManager* securityManager = nsIScriptSecurityManager* securityManager =
nsContentUtils::SecurityManager(); nsContentUtils::GetSecurityManager();
rv = securityManager-> rv = securityManager->
CheckLoadURIWithPrincipal(principal, aURI, CheckLoadURIWithPrincipal(principal, aURI,
nsIScriptSecurityManager::STANDARD); nsIScriptSecurityManager::STANDARD);

Просмотреть файл

@ -136,7 +136,7 @@ nsFrameLoader::LoadURI(nsIURI* aURI)
NS_ENSURE_TRUE(loadInfo, NS_ERROR_FAILURE); NS_ENSURE_TRUE(loadInfo, NS_ERROR_FAILURE);
// Check for security // Check for security
nsIScriptSecurityManager *secMan = nsContentUtils::SecurityManager(); nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager();
// Get referring URL // Get referring URL
nsCOMPtr<nsIURI> referrer; nsCOMPtr<nsIURI> referrer;

Просмотреть файл

@ -2417,7 +2417,7 @@ nsGenericElement::GetBaseURI() const
doc->GetDocumentCharacterSet().get(), parentBase); doc->GetDocumentCharacterSet().get(), parentBase);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
// do a security check, almost the same as nsDocument::SetBaseURL() // do a security check, almost the same as nsDocument::SetBaseURL()
rv = nsContentUtils::SecurityManager()-> rv = nsContentUtils::GetSecurityManager()->
CheckLoadURIWithPrincipal(doc->GetPrincipal(), ourBase, CheckLoadURIWithPrincipal(doc->GetPrincipal(), ourBase,
nsIScriptSecurityManager::STANDARD); nsIScriptSecurityManager::STANDARD);
} }

Просмотреть файл

@ -643,7 +643,7 @@ nsObjectLoadingContent::ObjectURIChanged(nsIURI* aURI,
// Null URIs happen when the URL to load is specified via other means than the // Null URIs happen when the URL to load is specified via other means than the
// data/src attribute, for example via custom <param> elements. // data/src attribute, for example via custom <param> elements.
if (aURI) { if (aURI) {
nsIScriptSecurityManager* secMan = nsContentUtils::SecurityManager(); nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
NS_ASSERTION(secMan, "No security manager!?"); NS_ASSERTION(secMan, "No security manager!?");
nsresult rv = secMan->CheckLoadURIWithPrincipal(doc->GetPrincipal(), aURI, 0); nsresult rv = secMan->CheckLoadURIWithPrincipal(doc->GetPrincipal(), aURI, 0);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {

Просмотреть файл

@ -2433,7 +2433,8 @@ nsRange::CreateContextualFragment(const nsAString& aFragment,
nsCOMPtr<nsIPrincipal> sysPrin; nsCOMPtr<nsIPrincipal> sysPrin;
nsCOMPtr<nsIPrincipal> subjectPrin; nsCOMPtr<nsIPrincipal> subjectPrin;
nsIScriptSecurityManager *secMan = nsContentUtils::SecurityManager(); nsIScriptSecurityManager *secMan =
nsContentUtils::GetSecurityManager();
// Just to compare, not to use! // Just to compare, not to use!
result = secMan->GetSystemPrincipal(getter_AddRefs(sysPrin)); result = secMan->GetSystemPrincipal(getter_AddRefs(sysPrin));

Просмотреть файл

@ -85,7 +85,7 @@ IntersectPrincipalCerts(nsIPrincipal *aOld, nsIPrincipal *aNew)
aOld->GetURI(getter_AddRefs(uri)); aOld->GetURI(getter_AddRefs(uri));
aOld->GetDomain(getter_AddRefs(domain)); aOld->GetDomain(getter_AddRefs(domain));
nsContentUtils::SecurityManager()->GetCodebasePrincipal(uri, &principal); nsContentUtils::GetSecurityManager()->GetCodebasePrincipal(uri, &principal);
if (principal && domain) { if (principal && domain) {
principal->SetDomain(domain); principal->SetDomain(domain);
} }
@ -507,7 +507,7 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement,
if (!docPrincipal) { if (!docPrincipal) {
return FireErrorNotification(NS_ERROR_UNEXPECTED, aElement, aObserver); return FireErrorNotification(NS_ERROR_UNEXPECTED, aElement, aObserver);
} }
rv = nsContentUtils::SecurityManager()-> rv = nsContentUtils::GetSecurityManager()->
CheckLoadURIWithPrincipal(docPrincipal, scriptURI, CheckLoadURIWithPrincipal(docPrincipal, scriptURI,
nsIScriptSecurityManager::ALLOW_CHROME); nsIScriptSecurityManager::ALLOW_CHROME);

Просмотреть файл

@ -332,7 +332,7 @@ nsSyncLoader::LoadDocument(nsIChannel* aChannel,
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
nsIScriptSecurityManager *securityManager = nsIScriptSecurityManager *securityManager =
nsContentUtils::SecurityManager(); nsContentUtils::GetSecurityManager();
rv = securityManager->CheckLoadURI(aLoaderURI, docURI, rv = securityManager->CheckLoadURI(aLoaderURI, docURI,
nsIScriptSecurityManager::STANDARD); nsIScriptSecurityManager::STANDARD);
@ -527,8 +527,10 @@ nsSyncLoader::OnChannelRedirect(nsIChannel *aOldChannel,
rv = aNewChannel->GetURI(getter_AddRefs(newURI)); // The new URI rv = aNewChannel->GetURI(getter_AddRefs(newURI)); // The new URI
NS_ENSURE_SUCCESS(rv, rv); 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); NS_ENSURE_SUCCESS(rv, rv);
mChannel = aNewChannel; mChannel = aNewChannel;

Просмотреть файл

@ -507,7 +507,7 @@ nsDOMEvent::InitEvent(const nsAString& aEventTypeArg, PRBool aCanBubbleArg, PRBo
// Ensure the caller is permitted to dispatch trusted DOM events. // Ensure the caller is permitted to dispatch trusted DOM events.
PRBool enabled = PR_FALSE; PRBool enabled = PR_FALSE;
nsContentUtils::SecurityManager()-> nsContentUtils::GetSecurityManager()->
IsCapabilityEnabled("UniversalBrowserWrite", &enabled); IsCapabilityEnabled("UniversalBrowserWrite", &enabled);
if (!enabled) { if (!enabled) {

Просмотреть файл

@ -1462,7 +1462,7 @@ nsEventListenerManager::RegisterScriptEventListener(nsIScriptContext *aContext,
STRING_TO_JSVAL(::JS_InternString(cx, "addEventListener")); STRING_TO_JSVAL(::JS_InternString(cx, "addEventListener"));
} }
rv = nsContentUtils::SecurityManager()-> rv = nsContentUtils::GetSecurityManager()->
CheckPropertyAccess(cx, jsobj, CheckPropertyAccess(cx, jsobj,
"EventTarget", "EventTarget",
sAddListenerID, sAddListenerID,

Просмотреть файл

@ -4558,7 +4558,7 @@ nsEventStateManager::DispatchNewEvent(nsISupports* aTarget,
if (!trusted) { if (!trusted) {
//Check security state to determine if dispatcher is trusted //Check security state to determine if dispatcher is trusted
nsIScriptSecurityManager *securityManager = nsIScriptSecurityManager *securityManager =
nsContentUtils::SecurityManager(); nsContentUtils::GetSecurityManager();
PRBool enabled; PRBool enabled;
nsresult res = nsresult res =

Просмотреть файл

@ -1374,7 +1374,7 @@ nsHTMLFormElement::GetActionURL(nsIURI** aActionURL)
// Get security manager, check to see if access to action URI is allowed. // Get security manager, check to see if access to action URI is allowed.
// //
nsIScriptSecurityManager *securityManager = nsIScriptSecurityManager *securityManager =
nsContentUtils::SecurityManager(); nsContentUtils::GetSecurityManager();
rv = securityManager-> rv = securityManager->
CheckLoadURIWithPrincipal(document->GetPrincipal(), actionURL, CheckLoadURIWithPrincipal(document->GetPrincipal(), actionURL,
nsIScriptSecurityManager::STANDARD); nsIScriptSecurityManager::STANDARD);

Просмотреть файл

@ -666,7 +666,7 @@ nsHTMLInputElement::SetValue(const nsAString& aValue)
// OK and gives pages a way to clear a file input if necessary. // OK and gives pages a way to clear a file input if necessary.
if (mType == NS_FORM_INPUT_FILE && !aValue.IsEmpty()) { if (mType == NS_FORM_INPUT_FILE && !aValue.IsEmpty()) {
nsIScriptSecurityManager *securityManager = nsIScriptSecurityManager *securityManager =
nsContentUtils::SecurityManager(); nsContentUtils::GetSecurityManager();
PRBool enabled; PRBool enabled;
nsresult rv = nsresult rv =

Просмотреть файл

@ -1991,8 +1991,8 @@ IsScriptEnabled(nsIDocument *aDoc, nsIDocShell *aContainer)
NS_ENSURE_TRUE(cx, PR_TRUE); NS_ENSURE_TRUE(cx, PR_TRUE);
PRBool enabled = PR_TRUE; PRBool enabled = PR_TRUE;
nsContentUtils::SecurityManager()->CanExecuteScripts(cx, principal, nsContentUtils::GetSecurityManager()->CanExecuteScripts(cx, principal,
&enabled); &enabled);
return enabled; return enabled;
} }
@ -3607,7 +3607,7 @@ HTMLContentSink::ProcessBaseHref(const nsAString& aBaseHref)
// NAV compatibility quirk // NAV compatibility quirk
nsIScriptSecurityManager *securityManager = nsIScriptSecurityManager *securityManager =
nsContentUtils::SecurityManager(); nsContentUtils::GetSecurityManager();
rv = securityManager-> rv = securityManager->
CheckLoadURIWithPrincipal(mDocument->GetPrincipal(), baseHrefURI, CheckLoadURIWithPrincipal(mDocument->GetPrincipal(), baseHrefURI,

Просмотреть файл

@ -1849,7 +1849,7 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace)
} }
nsCOMPtr<nsIPrincipal> callerPrincipal; nsCOMPtr<nsIPrincipal> callerPrincipal;
nsContentUtils::SecurityManager()-> nsContentUtils::GetSecurityManager()->
GetSubjectPrincipal(getter_AddRefs(callerPrincipal)); GetSubjectPrincipal(getter_AddRefs(callerPrincipal));
// The URI for the document after this call. Get it from the calling // 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 // document for security purposes. Thus a document.write of a script tag
// ends up producing a script with the same principals as the script // ends up producing a script with the same principals as the script
// that performed the write. // that performed the write.
nsIScriptSecurityManager *secMan = nsContentUtils::SecurityManager(); nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager();
nsCOMPtr<nsIPrincipal> subject; nsCOMPtr<nsIPrincipal> subject;
rv = secMan->GetSubjectPrincipal(getter_AddRefs(subject)); rv = secMan->GetSubjectPrincipal(getter_AddRefs(subject));
@ -3550,7 +3550,7 @@ nsHTMLDocument::SetDesignMode(const nsAString & aDesignMode)
if (!url.Equals("about:blank")) { if (!url.Equals("about:blank")) {
// If we're 'about:blank' then we don't care who can edit us. // 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. // If we're not about:blank, then we need to check sameOrigin.
rv = nsContentUtils::SecurityManager()->CheckSameOrigin(nsnull, rv = nsContentUtils::GetSecurityManager()->CheckSameOrigin(nsnull,
mDocumentURI); mDocumentURI);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return rv; return rv;
@ -3824,7 +3824,7 @@ nsHTMLDocument::DoClipboardSecurityCheck(PRBool aPaste)
NS_NAMED_LITERAL_CSTRING(classNameStr, "Clipboard"); NS_NAMED_LITERAL_CSTRING(classNameStr, "Clipboard");
nsIScriptSecurityManager *secMan = nsContentUtils::SecurityManager(); nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager();
if (aPaste) { if (aPaste) {
if (nsHTMLDocument::sPasteInternal_id == JSVAL_VOID) { if (nsHTMLDocument::sPasteInternal_id == JSVAL_VOID) {

Просмотреть файл

@ -208,7 +208,7 @@ nsWyciwygChannel::GetOwner(nsISupports **aOwner)
NS_ENSURE_TRUE(mOriginalURI, NS_ERROR_FAILURE); NS_ENSURE_TRUE(mOriginalURI, NS_ERROR_FAILURE);
nsCOMPtr<nsIPrincipal> principal; nsCOMPtr<nsIPrincipal> principal;
nsIScriptSecurityManager *secMan = nsContentUtils::SecurityManager(); nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager();
rv = secMan->GetCodebasePrincipal(mOriginalURI, getter_AddRefs(principal)); rv = secMan->GetCodebasePrincipal(mOriginalURI, getter_AddRefs(principal));
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
mOwner = principal; mOwner = principal;

Просмотреть файл

@ -1203,6 +1203,11 @@ nsXBLBinding::AllowScripts()
// Nasty hack. Use the JSContext of the bound node, since the // Nasty hack. Use the JSContext of the bound node, since the
// security manager API expects to get the docshell type from // security manager API expects to get the docshell type from
// that. But use the nsIPrincipal of our document. // that. But use the nsIPrincipal of our document.
nsIScriptSecurityManager* mgr = nsContentUtils::GetSecurityManager();
if (!mgr) {
return PR_FALSE;
}
nsIDocument* doc = mBoundElement->GetOwnerDoc(); nsIDocument* doc = mBoundElement->GetOwnerDoc();
if (!doc) { if (!doc) {
return PR_FALSE; return PR_FALSE;
@ -1227,8 +1232,6 @@ nsXBLBinding::AllowScripts()
return PR_FALSE; return PR_FALSE;
} }
nsIScriptSecurityManager* mgr = nsContentUtils::SecurityManager();
PRBool canExecute; PRBool canExecute;
nsresult rv = mgr->CanExecuteScripts(cx, principal, &canExecute); nsresult rv = mgr->CanExecuteScripts(cx, principal, &canExecute);
return NS_SUCCEEDED(rv) && canExecute; return NS_SUCCEEDED(rv) && canExecute;

Просмотреть файл

@ -330,7 +330,8 @@ nsXBLProtoImplAnonymousMethod::Execute(nsIContent* aBoundElement)
nsCxPusher pusher(aBoundElement); nsCxPusher pusher(aBoundElement);
// Check whether it's OK to call the method. // 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; JSBool ok = JS_TRUE;
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {

Просмотреть файл

@ -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. // Not everything with a chrome URI has a system principal. See bug 160042.
if (NS_FAILED(rv) || !isChrome) { if (NS_FAILED(rv) || !isChrome) {
nsIScriptSecurityManager *secMan = nsContentUtils::SecurityManager(); nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager();
rv = secMan-> rv = secMan->
CheckLoadURIWithPrincipal(document->GetPrincipal(), aURL, CheckLoadURIWithPrincipal(document->GetPrincipal(), aURL,

Просмотреть файл

@ -639,7 +639,7 @@ nsXMLContentSink::ProcessStyleLink(nsIContent* aElement,
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
// Do security check // Do security check
nsIScriptSecurityManager *secMan = nsContentUtils::SecurityManager(); nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager();
rv = secMan-> rv = secMan->
CheckLoadURIWithPrincipal(mDocument->GetPrincipal(), url, CheckLoadURIWithPrincipal(mDocument->GetPrincipal(), url,
nsIScriptSecurityManager::ALLOW_CHROME); nsIScriptSecurityManager::ALLOW_CHROME);

Просмотреть файл

@ -276,7 +276,7 @@ nsXMLDocument::OnChannelRedirect(nsIChannel *aOldChannel,
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return rv; return rv;
nsIScriptSecurityManager *secMan = nsContentUtils::SecurityManager(); nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager();
if (mScriptContext && !mCrossSiteAccessEnabled) { if (mScriptContext && !mCrossSiteAccessEnabled) {
nsCOMPtr<nsIJSContextStack> stack(do_GetService("@mozilla.org/js/xpc/ContextStack;1", & rv)); nsCOMPtr<nsIJSContextStack> stack(do_GetService("@mozilla.org/js/xpc/ContextStack;1", & rv));

Просмотреть файл

@ -243,8 +243,11 @@ XULPopupListenerImpl::PreLaunchPopup(nsIDOMEvent* aMouseEvent)
getter_AddRefs(doc), getter_AddRefs(doc),
getter_AddRefs(prin)); getter_AddRefs(prin));
if (prin) { if (prin) {
nsIScriptSecurityManager *securityManager =
nsContentUtils::GetSecurityManager();
nsCOMPtr<nsIPrincipal> system; nsCOMPtr<nsIPrincipal> system;
nsContentUtils::SecurityManager()->GetSystemPrincipal(getter_AddRefs(system)); securityManager->GetSystemPrincipal(getter_AddRefs(system));
if (prin != system) { if (prin != system) {
// This isn't chrome. Cancel the preventDefault() and // This isn't chrome. Cancel the preventDefault() and
// let the event go forth. // let the event go forth.

Просмотреть файл

@ -668,7 +668,7 @@ nsXULPrototypeDocument::GetDocumentPrincipal()
NS_PRECONDITION(mNodeInfoManager, "missing nodeInfoManager"); NS_PRECONDITION(mNodeInfoManager, "missing nodeInfoManager");
if (!mDocumentPrincipal) { if (!mDocumentPrincipal) {
nsIScriptSecurityManager *securityManager = nsIScriptSecurityManager *securityManager =
nsContentUtils::SecurityManager(); nsContentUtils::GetSecurityManager();
nsresult rv = NS_OK; nsresult rv = NS_OK;
// XXX This should be handled by the security manager, see bug 160042 // XXX This should be handled by the security manager, see bug 160042

Просмотреть файл

@ -879,7 +879,7 @@ CSSLoaderImpl::CheckLoadAllowed(nsIURI* aSourceURI,
LOG(("CSSLoaderImpl::CheckLoadAllowed")); LOG(("CSSLoaderImpl::CheckLoadAllowed"));
// Check with the security manager // Check with the security manager
nsIScriptSecurityManager *secMan = nsContentUtils::SecurityManager(); nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager();
nsresult rv = secMan->CheckLoadURI(aSourceURI, aTargetURI, nsresult rv = secMan->CheckLoadURI(aSourceURI, aTargetURI,
nsIScriptSecurityManager::ALLOW_CHROME); nsIScriptSecurityManager::ALLOW_CHROME);
if (NS_FAILED(rv)) { // failure is normal here; don't warn if (NS_FAILED(rv)) { // failure is normal here; don't warn

Просмотреть файл

@ -2172,8 +2172,9 @@ nsCSSStyleSheet::GetCssRules(nsIDOMCSSRuleList** aCssRules)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
// Get the security manager and do the same-origin check // Get the security manager and do the same-origin check
rv = nsContentUtils::SecurityManager()->CheckSameOrigin(cx, nsIScriptSecurityManager *securityManager =
mInner->mSheetURI); nsContentUtils::GetSecurityManager();
rv = securityManager->CheckSameOrigin(cx, mInner->mSheetURI);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }