Remove silly warning in GetDocShell impls, and use the principal (which we

should always have) instead of the docshell for chrome vs content
determination.  Bug 51962, r+sr=jst
This commit is contained in:
bzbarsky%mit.edu 2005-09-22 02:10:07 +00:00
parent 23e230a9ab
commit 594e733c16
3 changed files with 11 additions and 17 deletions

View File

@ -240,7 +240,6 @@ nsXBLDocGlobalObject::SetDocShell(nsIDocShell *aDocShell)
nsIDocShell *
nsXBLDocGlobalObject::GetDocShell()
{
NS_WARNING("waaah!");
return nsnull;
}

View File

@ -866,8 +866,6 @@ nsXULPDGlobalObject::SetDocShell(nsIDocShell *aDocShell)
nsIDocShell *
nsXULPDGlobalObject::GetDocShell()
{
NS_WARNING("waaah!");
return nsnull;
}

View File

@ -231,20 +231,17 @@ NS_ScriptErrorReporter(JSContext *cx,
if (errorObject != nsnull) {
nsresult rv;
const char *category = nsnull;
// Set category to XUL or content, if possible.
if (docShell) {
nsCOMPtr<nsIDocShellTreeItem> docShellTI(do_QueryInterface(docShell, &rv));
if (NS_SUCCEEDED(rv) && docShellTI) {
PRInt32 docShellType;
rv = docShellTI->GetItemType(&docShellType);
if (NS_SUCCEEDED(rv)) {
category = docShellType == nsIDocShellTreeItem::typeChrome
? "chrome javascript"
: "content javascript";
}
}
}
// Set category to chrome or content
nsCOMPtr<nsIScriptObjectPrincipal> scriptPrincipal =
do_QueryInterface(globalObject);
NS_ASSERTION(scriptPrincipal, "Global objects must implement "
"nsIScriptObjectPrincipal");
nsCOMPtr<nsIPrincipal> systemPrincipal;
sSecurityManager->GetSystemPrincipal(getter_AddRefs(systemPrincipal));
const char * category =
scriptPrincipal->GetPrincipal() == systemPrincipal
? "chrome javascript"
: "content javascript";
if (report) {
PRUint32 column = report->uctokenptr - report->uclinebuf;