diff --git a/mailnews/base/src/nsMessenger.cpp b/mailnews/base/src/nsMessenger.cpp index 22a265ba0f..94f730ba95 100644 --- a/mailnews/base/src/nsMessenger.cpp +++ b/mailnews/base/src/nsMessenger.cpp @@ -50,6 +50,7 @@ #include "nsIDocShellTreeItem.h" #include "nsIWebNavigation.h" #include "nsContentUtils.h" +#include "nsDocShellLoadState.h" // mail #include "nsIMsgMailNewsUrl.h" @@ -590,7 +591,11 @@ nsMessenger::LoadURL(mozIDOMWindowProxy *aWin, const nsACString& aURL) AddMsgUrlToNavigateHistory(aURL); mNavigatingToUri.Truncate(); mLastDisplayURI = aURL; // Remember the last uri we displayed. - return mDocShell->LoadURI(uri, nullptr, nsIWebNavigation::LOAD_FLAGS_NONE, true); + RefPtr loadState = new nsDocShellLoadState(); + loadState->SetURI(uri); + loadState->SetLoadFlags(nsIWebNavigation::LOAD_FLAGS_NONE); + loadState->SetFirstParty(true); + return mDocShell->LoadURI(loadState); } NS_IMETHODIMP nsMessenger::SaveAttachmentToFile(nsIFile *aFile, diff --git a/mailnews/base/util/nsMsgMailNewsUrl.cpp b/mailnews/base/util/nsMsgMailNewsUrl.cpp index 43113a26b6..83091c4e5d 100644 --- a/mailnews/base/util/nsMsgMailNewsUrl.cpp +++ b/mailnews/base/util/nsMsgMailNewsUrl.cpp @@ -27,6 +27,7 @@ #include "mozilla/Services.h" #include "nsProxyRelease.h" #include "mozilla/Encoding.h" +#include "nsDocShellLoadState.h" nsMsgMailNewsUrl::nsMsgMailNewsUrl() { @@ -794,7 +795,11 @@ NS_IMETHODIMP nsMsgMailNewsUrl::LoadURI(nsIDocShell* docShell, uint32_t aLoadFlags) { NS_ENSURE_ARG_POINTER(docShell); - return docShell->LoadURI(this, nullptr, aLoadFlags, false); + RefPtr loadState = new nsDocShellLoadState(); + loadState->SetURI(this); + loadState->SetLoadFlags(aLoadFlags); + loadState->SetFirstParty(false); + return docShell->LoadURI(loadState); } #define SAVE_BUF_SIZE FILE_IO_BUFFER_SIZE diff --git a/mailnews/imap/src/nsImapService.cpp b/mailnews/imap/src/nsImapService.cpp index 13743f84c0..ec65ba4d7e 100644 --- a/mailnews/imap/src/nsImapService.cpp +++ b/mailnews/imap/src/nsImapService.cpp @@ -63,6 +63,7 @@ #include "nsMsgMessageFlags.h" #include "nsIMsgPluggableStore.h" #include "../../base/src/MailnewsLoadContextInfo.h" +#include "nsDocShellLoadState.h" #define PREF_MAIL_ROOT_IMAP "mail.root.imap" // old - for backward compatibility only #define PREF_MAIL_ROOT_IMAP_REL "mail.root.imap-rel" @@ -623,12 +624,13 @@ nsresult nsImapService::FetchMimePart(nsIImapUrl *aImapUrl, // DIRTY LITTLE HACK --> if we are opening an attachment we want the docshell to // treat this load as if it were a user click event. Then the dispatching stuff will be much // happier. - rv = docShell->LoadURI(url, - nullptr, - aImapAction == nsImapUrl::nsImapOpenMimePart - ? nsIWebNavigation::LOAD_FLAGS_IS_LINK - : nsIWebNavigation::LOAD_FLAGS_NONE, - false); + RefPtr loadState = new nsDocShellLoadState(); + loadState->SetURI(url); + loadState->SetLoadFlags(aImapAction == nsImapUrl::nsImapOpenMimePart + ? nsIWebNavigation::LOAD_FLAGS_IS_LINK + : nsIWebNavigation::LOAD_FLAGS_NONE); + loadState->SetFirstParty(false); + rv = docShell->LoadURI(loadState); } else { @@ -1058,7 +1060,11 @@ nsresult nsImapService::GetMessageFromUrl(nsIImapUrl *aImapUrl, if (NS_SUCCEEDED(rv) && docShell) { NS_ASSERTION(!aConvertDataToText, "can't convert to text when using docshell"); - rv = docShell->LoadURI(url, nullptr, nsIWebNavigation::LOAD_FLAGS_NONE, false); + RefPtr loadState = new nsDocShellLoadState(); + loadState->SetURI(url); + loadState->SetLoadFlags(nsIWebNavigation::LOAD_FLAGS_NONE); + loadState->SetFirstParty(false); + rv = docShell->LoadURI(loadState); } else { diff --git a/mailnews/local/src/nsMailboxService.cpp b/mailnews/local/src/nsMailboxService.cpp index a7a4bcebf2..b4e87c15e7 100644 --- a/mailnews/local/src/nsMailboxService.cpp +++ b/mailnews/local/src/nsMailboxService.cpp @@ -26,6 +26,7 @@ #include "nsIMsgHdr.h" #include "nsIFileURL.h" #include "mozilla/RefPtr.h" +#include "nsDocShellLoadState.h" #include "nsIRDFService.h" nsMailboxService::nsMailboxService() @@ -234,12 +235,13 @@ nsresult nsMailboxService::FetchMessage(const char* aMessageURI, // DIRTY LITTLE HACK --> if we are opening an attachment we want the docshell to // treat this load as if it were a user click event. Then the dispatching stuff will be much // happier. - rv = docShell->LoadURI(url, - nullptr, - mailboxAction == nsIMailboxUrl::ActionFetchPart - ? nsIWebNavigation::LOAD_FLAGS_IS_LINK - : nsIWebNavigation::LOAD_FLAGS_NONE, - false); + RefPtr loadState = new nsDocShellLoadState(); + loadState->SetURI(url); + loadState->SetLoadFlags(mailboxAction == nsIMailboxUrl::ActionFetchPart + ? nsIWebNavigation::LOAD_FLAGS_IS_LINK + : nsIWebNavigation::LOAD_FLAGS_NONE); + loadState->SetFirstParty(false); + rv = docShell->LoadURI(loadState); } else rv = RunMailboxUrl(url, aDisplayConsumer); @@ -363,7 +365,11 @@ NS_IMETHODIMP nsMailboxService::OpenAttachment(const char *aContentType, // DIRTY LITTLE HACK --> since we are opening an attachment we want the docshell to // treat this load as if it were a user click event. Then the dispatching stuff will be much // happier. - return docShell->LoadURI(URL, nullptr, nsIWebNavigation::LOAD_FLAGS_IS_LINK, false); + RefPtr loadState = new nsDocShellLoadState(); + loadState->SetURI(URL); + loadState->SetLoadFlags(nsIWebNavigation::LOAD_FLAGS_IS_LINK); + loadState->SetFirstParty(false); + return docShell->LoadURI(loadState); } return RunMailboxUrl(URL, aDisplayConsumer); diff --git a/mailnews/news/src/nsNntpService.cpp b/mailnews/news/src/nsNntpService.cpp index cfb2d0054c..f80a3d6e13 100644 --- a/mailnews/news/src/nsNntpService.cpp +++ b/mailnews/news/src/nsNntpService.cpp @@ -43,6 +43,7 @@ #include "nsIInputStream.h" #include "nsIURIMutator.h" #include "nsTArray.h" +#include "nsDocShellLoadState.h" #include "../../base/src/MailnewsLoadContextInfo.h" @@ -307,12 +308,13 @@ nsresult nsNntpService::GetMessageFromUrl(nsIURI *aUrl, // DIRTY LITTLE HACK --> if we are opening an attachment we want the docshell to // treat this load as if it were a user click event. Then the dispatching stuff will be much // happier. - rv = docShell->LoadURI(aUrl, - nullptr, - mOpenAttachmentOperation - ? nsIWebNavigation::LOAD_FLAGS_IS_LINK - : nsIWebNavigation::LOAD_FLAGS_NONE, - false); + RefPtr loadState = new nsDocShellLoadState(); + loadState->SetURI(aUrl); + loadState->SetLoadFlags(mOpenAttachmentOperation + ? nsIWebNavigation::LOAD_FLAGS_IS_LINK + : nsIWebNavigation::LOAD_FLAGS_NONE); + loadState->SetFirstParty(false); + rv = docShell->LoadURI(loadState); } else { @@ -442,10 +444,15 @@ NS_IMETHODIMP nsNntpService::OpenAttachment(const char *aContentType, msgUrl->RegisterListener(aUrlListener); nsCOMPtr docShell(do_QueryInterface(aDisplayConsumer, &rv)); - if (NS_SUCCEEDED(rv) && docShell) - return docShell->LoadURI(url, nullptr, nsIWebNavigation::LOAD_FLAGS_IS_LINK, false); - else + if (NS_SUCCEEDED(rv) && docShell) { + RefPtr loadState = new nsDocShellLoadState(); + loadState->SetURI(url); + loadState->SetLoadFlags(nsIWebNavigation::LOAD_FLAGS_IS_LINK); + loadState->SetFirstParty(false); + return docShell->LoadURI(loadState); + } else { return RunNewsUrl(url, aMsgWindow, aDisplayConsumer); + } } return NS_OK; }