Fix bug 7264 All JavaScript running with correct principals

r=mstoltz
This commit is contained in:
norris%netscape.com 2000-03-28 03:59:46 +00:00
Родитель 71d63dc676
Коммит 4054cc5f8f
8 изменённых файлов: 14 добавлений и 64 удалений

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

@ -1712,12 +1712,17 @@ nsXMLContentSink::EvaluateScript(nsString& aScript, PRUint32 aLineNo, const char
rv = docURL->GetSpec(&url);
}
nsCOMPtr<nsIPrincipal> principal;
if (NS_SUCCEEDED(rv)) {
rv = mDocument->GetPrincipal(getter_AddRefs(principal));
NS_ASSERTION(principal, "principal required for document");
}
if (NS_SUCCEEDED(rv)) {
nsAutoString val;
PRBool isUndefined;
// XXX need principal
(void) context->EvaluateString(aScript, nsnull, nsnull, url, aLineNo, aVersion,
(void) context->EvaluateString(aScript, nsnull, principal, url, aLineNo, aVersion,
val, &isUndefined);
NS_IF_RELEASE(docURL);

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

@ -3946,26 +3946,6 @@ void nsEditorShell::SetButtonImage(nsIDOMNode * aParentNode, PRInt32 aBtnNum, co
}
#endif
// XXXbe why is this needed? eliminate
NS_IMETHODIMP
nsEditorShell::ExecuteScript(nsIScriptContext * aContext, const nsString& aScript)
{
if (nsnull != aContext) {
const char* url = "";
PRBool isUndefined = PR_FALSE;
nsAutoString rVal;
#ifdef APP_DEBUG
char* script_str = aScript.ToNewCString();
printf("Executing [%s]\n", script_str);
nsCRT::free(script_str);
#endif
aContext->EvaluateString(aScript, nsnull, nsnull, url, 0, nsnull, rVal, &isUndefined);
}
return NS_OK;
}
NS_IMETHODIMP
nsEditorShell::RunUnitTests()
{

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

@ -108,7 +108,6 @@ class nsEditorShell : public nsIEditorShell,
nsIPresShell* GetPresShellFor(nsIWebShell* aWebShell);
NS_IMETHOD DoEditorMode(nsIWebShell *aWebShell);
NS_IMETHOD ExecuteScript(nsIScriptContext * aContext, const nsString& aScript);
NS_IMETHOD InstantiateEditor(nsIDOMDocument *aDoc, nsIPresShell *aPresShell);
NS_IMETHOD ScrollSelectionIntoView();
NS_IMETHOD TransferDocumentStateListeners();

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

@ -3946,26 +3946,6 @@ void nsEditorShell::SetButtonImage(nsIDOMNode * aParentNode, PRInt32 aBtnNum, co
}
#endif
// XXXbe why is this needed? eliminate
NS_IMETHODIMP
nsEditorShell::ExecuteScript(nsIScriptContext * aContext, const nsString& aScript)
{
if (nsnull != aContext) {
const char* url = "";
PRBool isUndefined = PR_FALSE;
nsAutoString rVal;
#ifdef APP_DEBUG
char* script_str = aScript.ToNewCString();
printf("Executing [%s]\n", script_str);
nsCRT::free(script_str);
#endif
aContext->EvaluateString(aScript, nsnull, nsnull, url, 0, nsnull, rVal, &isUndefined);
}
return NS_OK;
}
NS_IMETHODIMP
nsEditorShell::RunUnitTests()
{

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

@ -108,7 +108,6 @@ class nsEditorShell : public nsIEditorShell,
nsIPresShell* GetPresShellFor(nsIWebShell* aWebShell);
NS_IMETHOD DoEditorMode(nsIWebShell *aWebShell);
NS_IMETHOD ExecuteScript(nsIScriptContext * aContext, const nsString& aScript);
NS_IMETHOD InstantiateEditor(nsIDOMDocument *aDoc, nsIPresShell *aPresShell);
NS_IMETHOD ScrollSelectionIntoView();
NS_IMETHOD TransferDocumentStateListeners();

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

@ -1712,12 +1712,17 @@ nsXMLContentSink::EvaluateScript(nsString& aScript, PRUint32 aLineNo, const char
rv = docURL->GetSpec(&url);
}
nsCOMPtr<nsIPrincipal> principal;
if (NS_SUCCEEDED(rv)) {
rv = mDocument->GetPrincipal(getter_AddRefs(principal));
NS_ASSERTION(principal, "principal required for document");
}
if (NS_SUCCEEDED(rv)) {
nsAutoString val;
PRBool isUndefined;
// XXX need principal
(void) context->EvaluateString(aScript, nsnull, nsnull, url, aLineNo, aVersion,
(void) context->EvaluateString(aScript, nsnull, principal, url, aLineNo, aVersion,
val, &isUndefined);
NS_IF_RELEASE(docURL);

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

@ -1975,23 +1975,6 @@ nsBrowserAppCore::FindNext()
return rv;
}
// XXXbe why is this needed? eliminate
NS_IMETHODIMP
nsBrowserAppCore::ExecuteScript(nsIScriptContext * aContext, const nsString& aScript)
{
if (nsnull != aContext) {
const char* url = "";
PRBool isUndefined = PR_FALSE;
nsString rVal;
if (APP_DEBUG) {
printf("Executing [%s]\n", (const char *)nsCAutoString(aScript));
}
aContext->EvaluateString(aScript, nsnull, nsnull, url, 0, nsnull, rVal, &isUndefined);
}
return NS_OK;
}
//----------------------------------------------------------------------

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

@ -83,7 +83,6 @@ class nsBrowserInstance : public nsIBrowserInstance,
NS_DECL_NSIURICONTENTLISTENER
protected:
NS_IMETHOD ExecuteScript(nsIScriptContext * aContext, const nsString& aScript);
nsresult InitializeSearch(nsIFindComponent*);
NS_IMETHOD CreateMenuItem(nsIDOMNode * , PRInt32,const PRUnichar * );
NS_IMETHOD UpdateGoMenu();