Bug 165606, document.load throws wrong error code when security settings prevent load, r=mstoltz, sr=peterv.

This commit is contained in:
heikki%netscape.com 2003-02-24 23:08:45 +00:00
Родитель bcd2417d76
Коммит e37c900518
1 изменённых файлов: 7 добавлений и 2 удалений

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

@ -345,8 +345,13 @@ nsXMLDocument::Load(const nsAString& aUrl)
nsCOMPtr<nsIScriptSecurityManager> secMan =
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(secMan->CheckConnect(nsnull, uri, "XMLDocument", "load")))
return NS_ERROR_FAILURE;
rv = secMan->CheckConnect(nsnull, uri, "XMLDocument", "load");
if (NS_FAILED(rv)) {
// We need to return success here so that JS will get a proper exception
// thrown later. Native calls should always result in CheckConnect() succeeding,
// but in case JS calls C++ which calls this code the exception might be lost.
return NS_OK;
}
// Partial Reset, need to restore principal for security reasons and
// event listener manager so that load listeners etc. will remain.