Fix another portion of 13192 Mozilla is "oversecured" and does not allow access to documents in the same domain

Reviewed by vidur.
This commit is contained in:
norris%netscape.com 1999-10-06 21:13:37 +00:00
Родитель 7a6ad2b541
Коммит 4e4a099dd2
3 изменённых файлов: 21 добавлений и 6 удалений

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

@ -64,6 +64,7 @@
#include "nsIRefreshURI.h"
#include "nsVoidArray.h"
#include "nsIScriptContextOwner.h"
#include "nsIPrincipal.h"
#include "nsHTMLIIDs.h"
#include "nsTextFragment.h"
@ -3251,6 +3252,10 @@ HTMLContentSink::EvaluateScript(nsString& aScript,
NS_RELEASE(owner);
return rv;
}
nsCOMPtr<nsIPrincipal> principal;
principal = getter_AddRefs(mDocument->GetDocumentPrincipal());
NS_ASSERTION(principal, "principal expected for document");
nsAutoString ret;
nsIURI* docURL = mDocument->GetDocumentURL();
@ -3261,8 +3266,8 @@ HTMLContentSink::EvaluateScript(nsString& aScript,
}
PRBool isUndefined;
context->EvaluateString(aScript, url, aLineNo,
ret, &isUndefined);
context->EvaluateString(aScript, nsnull, principal, url,
aLineNo, ret, &isUndefined);
if (docURL) {
NS_RELEASE(docURL);

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

@ -31,6 +31,7 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#include "nsCOMPtr.h"
#include "nsJSUtils.h"
#include "nsIScriptSecurityManager.h"
#include "nsIScriptContextOwner.h"
#include "nsIJSContextStack.h"
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
@ -102,9 +103,13 @@ LocationImpl::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
NS_PRECONDITION(nsnull != aScriptObject, "null arg");
nsresult res = NS_OK;
if (nsnull == mScriptObject) {
nsIScriptGlobalObject *global = aContext->GetGlobalObject();
nsCOMPtr<nsIScriptContextOwner> owner = do_QueryInterface(mWebShell);
if (!owner)
return NS_ERROR_NO_INTERFACE;
nsCOMPtr<nsIScriptGlobalObject> global;
if (NS_FAILED(res = owner->GetScriptGlobalObject(getter_AddRefs(global))))
return res;
res = NS_NewScriptLocation(aContext, (nsISupports *)(nsIDOMLocation *)this, global, &mScriptObject);
NS_IF_RELEASE(global);
}
*aScriptObject = mScriptObject;

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

@ -64,6 +64,7 @@
#include "nsIRefreshURI.h"
#include "nsVoidArray.h"
#include "nsIScriptContextOwner.h"
#include "nsIPrincipal.h"
#include "nsHTMLIIDs.h"
#include "nsTextFragment.h"
@ -3251,6 +3252,10 @@ HTMLContentSink::EvaluateScript(nsString& aScript,
NS_RELEASE(owner);
return rv;
}
nsCOMPtr<nsIPrincipal> principal;
principal = getter_AddRefs(mDocument->GetDocumentPrincipal());
NS_ASSERTION(principal, "principal expected for document");
nsAutoString ret;
nsIURI* docURL = mDocument->GetDocumentURL();
@ -3261,8 +3266,8 @@ HTMLContentSink::EvaluateScript(nsString& aScript,
}
PRBool isUndefined;
context->EvaluateString(aScript, url, aLineNo,
ret, &isUndefined);
context->EvaluateString(aScript, nsnull, principal, url,
aLineNo, ret, &isUndefined);
if (docURL) {
NS_RELEASE(docURL);