зеркало из https://github.com/mozilla/gecko-dev.git
Fix bug 7264 All JavaScript running with correct principals
r=mstoltz
This commit is contained in:
Родитель
71d63dc676
Коммит
4054cc5f8f
|
@ -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();
|
||||
|
|
Загрузка…
Ссылка в новой задаче