Bug 1500347 - Port Bug 1492648: nsIDocShell.loadURI() takes a nsDocShellLoadState parameter now. rs=bustage-fix

This commit is contained in:
Jorg K 2018-10-19 10:32:36 +02:00
Родитель 0ecf549303
Коммит 4a14a9e0aa
5 изменённых файлов: 54 добавлений и 25 удалений

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

@ -50,6 +50,7 @@
#include "nsIDocShellTreeItem.h" #include "nsIDocShellTreeItem.h"
#include "nsIWebNavigation.h" #include "nsIWebNavigation.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsDocShellLoadState.h"
// mail // mail
#include "nsIMsgMailNewsUrl.h" #include "nsIMsgMailNewsUrl.h"
@ -590,7 +591,11 @@ nsMessenger::LoadURL(mozIDOMWindowProxy *aWin, const nsACString& aURL)
AddMsgUrlToNavigateHistory(aURL); AddMsgUrlToNavigateHistory(aURL);
mNavigatingToUri.Truncate(); mNavigatingToUri.Truncate();
mLastDisplayURI = aURL; // Remember the last uri we displayed. mLastDisplayURI = aURL; // Remember the last uri we displayed.
return mDocShell->LoadURI(uri, nullptr, nsIWebNavigation::LOAD_FLAGS_NONE, true); RefPtr<nsDocShellLoadState> 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, NS_IMETHODIMP nsMessenger::SaveAttachmentToFile(nsIFile *aFile,

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

@ -27,6 +27,7 @@
#include "mozilla/Services.h" #include "mozilla/Services.h"
#include "nsProxyRelease.h" #include "nsProxyRelease.h"
#include "mozilla/Encoding.h" #include "mozilla/Encoding.h"
#include "nsDocShellLoadState.h"
nsMsgMailNewsUrl::nsMsgMailNewsUrl() nsMsgMailNewsUrl::nsMsgMailNewsUrl()
{ {
@ -794,7 +795,11 @@ NS_IMETHODIMP nsMsgMailNewsUrl::LoadURI(nsIDocShell* docShell,
uint32_t aLoadFlags) uint32_t aLoadFlags)
{ {
NS_ENSURE_ARG_POINTER(docShell); NS_ENSURE_ARG_POINTER(docShell);
return docShell->LoadURI(this, nullptr, aLoadFlags, false); RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState();
loadState->SetURI(this);
loadState->SetLoadFlags(aLoadFlags);
loadState->SetFirstParty(false);
return docShell->LoadURI(loadState);
} }
#define SAVE_BUF_SIZE FILE_IO_BUFFER_SIZE #define SAVE_BUF_SIZE FILE_IO_BUFFER_SIZE

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

@ -63,6 +63,7 @@
#include "nsMsgMessageFlags.h" #include "nsMsgMessageFlags.h"
#include "nsIMsgPluggableStore.h" #include "nsIMsgPluggableStore.h"
#include "../../base/src/MailnewsLoadContextInfo.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 "mail.root.imap" // old - for backward compatibility only
#define PREF_MAIL_ROOT_IMAP_REL "mail.root.imap-rel" #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 // 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 // treat this load as if it were a user click event. Then the dispatching stuff will be much
// happier. // happier.
rv = docShell->LoadURI(url, RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState();
nullptr, loadState->SetURI(url);
aImapAction == nsImapUrl::nsImapOpenMimePart loadState->SetLoadFlags(aImapAction == nsImapUrl::nsImapOpenMimePart
? nsIWebNavigation::LOAD_FLAGS_IS_LINK ? nsIWebNavigation::LOAD_FLAGS_IS_LINK
: nsIWebNavigation::LOAD_FLAGS_NONE, : nsIWebNavigation::LOAD_FLAGS_NONE);
false); loadState->SetFirstParty(false);
rv = docShell->LoadURI(loadState);
} }
else else
{ {
@ -1058,7 +1060,11 @@ nsresult nsImapService::GetMessageFromUrl(nsIImapUrl *aImapUrl,
if (NS_SUCCEEDED(rv) && docShell) if (NS_SUCCEEDED(rv) && docShell)
{ {
NS_ASSERTION(!aConvertDataToText, "can't convert to text when using docshell"); NS_ASSERTION(!aConvertDataToText, "can't convert to text when using docshell");
rv = docShell->LoadURI(url, nullptr, nsIWebNavigation::LOAD_FLAGS_NONE, false); RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState();
loadState->SetURI(url);
loadState->SetLoadFlags(nsIWebNavigation::LOAD_FLAGS_NONE);
loadState->SetFirstParty(false);
rv = docShell->LoadURI(loadState);
} }
else else
{ {

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

@ -26,6 +26,7 @@
#include "nsIMsgHdr.h" #include "nsIMsgHdr.h"
#include "nsIFileURL.h" #include "nsIFileURL.h"
#include "mozilla/RefPtr.h" #include "mozilla/RefPtr.h"
#include "nsDocShellLoadState.h"
#include "nsIRDFService.h" #include "nsIRDFService.h"
nsMailboxService::nsMailboxService() 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 // 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 // treat this load as if it were a user click event. Then the dispatching stuff will be much
// happier. // happier.
rv = docShell->LoadURI(url, RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState();
nullptr, loadState->SetURI(url);
mailboxAction == nsIMailboxUrl::ActionFetchPart loadState->SetLoadFlags(mailboxAction == nsIMailboxUrl::ActionFetchPart
? nsIWebNavigation::LOAD_FLAGS_IS_LINK ? nsIWebNavigation::LOAD_FLAGS_IS_LINK
: nsIWebNavigation::LOAD_FLAGS_NONE, : nsIWebNavigation::LOAD_FLAGS_NONE);
false); loadState->SetFirstParty(false);
rv = docShell->LoadURI(loadState);
} }
else else
rv = RunMailboxUrl(url, aDisplayConsumer); 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 // 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 // treat this load as if it were a user click event. Then the dispatching stuff will be much
// happier. // happier.
return docShell->LoadURI(URL, nullptr, nsIWebNavigation::LOAD_FLAGS_IS_LINK, false); RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState();
loadState->SetURI(URL);
loadState->SetLoadFlags(nsIWebNavigation::LOAD_FLAGS_IS_LINK);
loadState->SetFirstParty(false);
return docShell->LoadURI(loadState);
} }
return RunMailboxUrl(URL, aDisplayConsumer); return RunMailboxUrl(URL, aDisplayConsumer);

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

@ -43,6 +43,7 @@
#include "nsIInputStream.h" #include "nsIInputStream.h"
#include "nsIURIMutator.h" #include "nsIURIMutator.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "nsDocShellLoadState.h"
#include "../../base/src/MailnewsLoadContextInfo.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 // 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 // treat this load as if it were a user click event. Then the dispatching stuff will be much
// happier. // happier.
rv = docShell->LoadURI(aUrl, RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState();
nullptr, loadState->SetURI(aUrl);
mOpenAttachmentOperation loadState->SetLoadFlags(mOpenAttachmentOperation
? nsIWebNavigation::LOAD_FLAGS_IS_LINK ? nsIWebNavigation::LOAD_FLAGS_IS_LINK
: nsIWebNavigation::LOAD_FLAGS_NONE, : nsIWebNavigation::LOAD_FLAGS_NONE);
false); loadState->SetFirstParty(false);
rv = docShell->LoadURI(loadState);
} }
else else
{ {
@ -442,10 +444,15 @@ NS_IMETHODIMP nsNntpService::OpenAttachment(const char *aContentType,
msgUrl->RegisterListener(aUrlListener); msgUrl->RegisterListener(aUrlListener);
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aDisplayConsumer, &rv)); nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aDisplayConsumer, &rv));
if (NS_SUCCEEDED(rv) && docShell) if (NS_SUCCEEDED(rv) && docShell) {
return docShell->LoadURI(url, nullptr, nsIWebNavigation::LOAD_FLAGS_IS_LINK, false); RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState();
else loadState->SetURI(url);
loadState->SetLoadFlags(nsIWebNavigation::LOAD_FLAGS_IS_LINK);
loadState->SetFirstParty(false);
return docShell->LoadURI(loadState);
} else {
return RunNewsUrl(url, aMsgWindow, aDisplayConsumer); return RunNewsUrl(url, aMsgWindow, aDisplayConsumer);
}
} }
return NS_OK; return NS_OK;
} }