nsCOMPtr<nsIScriptSecurityManager> secMan = do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv);  rv = secMan->CheckSameOrigin(cx, mInner->mURL);
rv = nsContentUtils::GetSecurityManager()->CheckSameOrigin(cx, mInner->mURL);
CSSStyleSheetImpl::GetCssRules(nsIDOMCSSRuleList** aCssRules){  // No doing this on incomplete sheets!  PRBool complete;  GetComplete(complete);  if (!complete) {    return NS_ERROR_DOM_INVALID_ACCESS_ERR;  }    //-- Security check: Only scripts from the same origin as the  //   style sheet can access rule collections  // Get JSContext from stack  nsCOMPtr<nsIJSContextStack> stack =    do_GetService("@mozilla.org/js/xpc/ContextStack;1");  NS_ENSURE_TRUE(stack, NS_ERROR_FAILURE);  JSContext *cx = nsnull;  nsresult rv = NS_OK;  rv = stack->Peek(&cx);  NS_ENSURE_SUCCESS(rv, rv);  if (!cx)    return NS_ERROR_FAILURE;  // Get the security manager and do the same-origin check  nsCOMPtr<nsIScriptSecurityManager> secMan =     do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);  NS_ENSURE_SUCCESS(rv, rv);  rv = secMan->CheckSameOrigin(cx, mInner->mURL);  if (NS_FAILED(rv)) {    return rv;  }  // OK, security check passed, so get the rule collection  if (nsnull == mRuleCollection) {    mRuleCollection = new CSSRuleListImpl(this);    if (nsnull == mRuleCollection) {      return NS_ERROR_OUT_OF_MEMORY;    }    NS_ADDREF(mRuleCollection);  }  *aCssRules = mRuleCollection;  NS_ADDREF(mRuleCollection);  return NS_OK;}