Bug 246699 CAPS security exceptions should throw richer exception info (not just raw string)
r=shaver a=shaver git-svn-id: svn://10.0.0.236/trunk@247553 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -149,18 +149,13 @@ GetScriptContext(JSContext *cx)
|
||||
inline void SetPendingException(JSContext *cx, const char *aMsg)
|
||||
{
|
||||
JSAutoRequest ar(cx);
|
||||
JSString *str = JS_NewStringCopyZ(cx, aMsg);
|
||||
if (str)
|
||||
JS_SetPendingException(cx, STRING_TO_JSVAL(str));
|
||||
JS_ReportError(cx, "%s", aMsg);
|
||||
}
|
||||
|
||||
inline void SetPendingException(JSContext *cx, const PRUnichar *aMsg)
|
||||
{
|
||||
JSAutoRequest ar(cx);
|
||||
JSString *str = JS_NewUCStringCopyZ(cx,
|
||||
reinterpret_cast<const jschar*>(aMsg));
|
||||
if (str)
|
||||
JS_SetPendingException(cx, STRING_TO_JSVAL(str));
|
||||
JS_ReportError(cx, "%hs", aMsg);
|
||||
}
|
||||
|
||||
// DomainPolicy members
|
||||
@@ -705,7 +700,7 @@ nsScriptSecurityManager::CheckSameOrigin(JSContext* cx,
|
||||
if (!SecurityCompareURIs(sourceURI, aTargetURI))
|
||||
{
|
||||
ReportError(cx, NS_LITERAL_STRING("CheckSameOriginError"), sourceURI, aTargetURI);
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -720,6 +715,7 @@ nsScriptSecurityManager::CheckSameOriginURI(nsIURI* aSourceURI,
|
||||
if (reportError) {
|
||||
ReportError(nsnull, NS_LITERAL_STRING("CheckSameOriginError"),
|
||||
aSourceURI, aTargetURI);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
@@ -1287,7 +1283,7 @@ nsScriptSecurityManager::CheckLoadURIFromScript(JSContext *cx, nsIURI *aURI)
|
||||
if (NS_FAILED(aURI->GetAsciiSpec(spec)))
|
||||
return NS_ERROR_FAILURE;
|
||||
JS_ReportError(cx, "Access to '%s' from script denied", spec.get());
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
||||
Reference in New Issue
Block a user