mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 11:58:55 +00:00
Change the SendMail to use a convience function to get the script context
This commit is contained in:
parent
cc87304924
commit
82e8577f6f
@ -135,6 +135,7 @@ nsMailCore::SetWindow(nsIDOMWindow* aWin)
|
|||||||
{
|
{
|
||||||
mWindow = aWin;
|
mWindow = aWin;
|
||||||
NS_ADDREF(aWin);
|
NS_ADDREF(aWin);
|
||||||
|
mScriptContext = GetScriptContext(aWin);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,20 +143,7 @@ NS_IMETHODIMP
|
|||||||
nsMailCore::SendMail(const nsString& aAddrTo, const nsString& aSubject, const nsString& aMsg)
|
nsMailCore::SendMail(const nsString& aAddrTo, const nsString& aSubject, const nsString& aMsg)
|
||||||
{
|
{
|
||||||
if (nsnull == mScriptContext) {
|
if (nsnull == mScriptContext) {
|
||||||
nsIDOMDocument * domDoc;
|
return NS_ERROR_FAILURE;
|
||||||
mWindow->GetDocument(&domDoc);
|
|
||||||
if (nsnull != domDoc) {
|
|
||||||
nsIDocument * doc;
|
|
||||||
if (NS_OK == domDoc->QueryInterface(kIDocumentIID,(void**)&doc)) {
|
|
||||||
nsIScriptContextOwner * owner = doc->GetScriptContextOwner();
|
|
||||||
if (nsnull != owner) {
|
|
||||||
owner->GetScriptContext(&mScriptContext);
|
|
||||||
NS_RELEASE(owner);
|
|
||||||
}
|
|
||||||
NS_RELEASE(doc);
|
|
||||||
}
|
|
||||||
NS_RELEASE(domDoc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("----------------------------\n");
|
printf("----------------------------\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user