Backed out changeset 8587f3e2dbbf (bug 1662665) for breaking tests.
--HG-- extra : rebase_source : 6a54710b5597914738e13abd9c420d92b52bee67 extra : histedit_source : cc6f9da408f138ed3948a5a2783ab3b35e1f6b3a
This commit is contained in:
Родитель
09a70e63e1
Коммит
b9e48a04a7
|
@ -109,38 +109,12 @@ function openURI(uri) {
|
|||
|
||||
loadgroup.groupObserver = loadlistener;
|
||||
|
||||
/**
|
||||
* @implements {nsIURIContentListener}
|
||||
*/
|
||||
var listener = {
|
||||
doContent(ctype, preferred, request, handler) {
|
||||
let uri = request.URI;
|
||||
let mailnewsurl = "";
|
||||
try {
|
||||
mailnewsurl = uri.QueryInterface(Ci.nsIMsgMailNewsUrl);
|
||||
} catch (e) {}
|
||||
if (mailnewsurl) {
|
||||
let queryPart = mailnewsurl.query.replace(
|
||||
"type=message/rfc822",
|
||||
"type=application/x-message-display"
|
||||
);
|
||||
uri = mailnewsurl
|
||||
.mutate()
|
||||
.setQuery(queryPart)
|
||||
.finalize();
|
||||
} else if (uri.scheme == "file") {
|
||||
uri = uri
|
||||
.mutate()
|
||||
.setQuery("type=application/x-message-display")
|
||||
.finalize();
|
||||
}
|
||||
Services.ww.openWindow(
|
||||
null,
|
||||
"chrome://messenger/content/messageWindow.xhtml",
|
||||
"_blank",
|
||||
"all,chrome,dialog=no,status,toolbar",
|
||||
uri
|
||||
);
|
||||
var newHandler = Cc[
|
||||
"@mozilla.org/uriloader/content-handler;1?type=application/x-message-display"
|
||||
].createInstance(Ci.nsIContentHandler);
|
||||
newHandler.handleContent("application/x-message-display", this, request);
|
||||
return true;
|
||||
},
|
||||
isPreferred(ctype, desired) {
|
||||
|
|
|
@ -6903,11 +6903,6 @@ function OpenSelectedAttachment() {
|
|||
} // if one attachment selected
|
||||
}
|
||||
|
||||
/**
|
||||
* @implements {nsIURIContentListener}
|
||||
*
|
||||
* @see {MessengerContentHandler}
|
||||
*/
|
||||
function nsAttachmentOpener() {}
|
||||
|
||||
nsAttachmentOpener.prototype = {
|
||||
|
@ -6924,33 +6919,10 @@ nsAttachmentOpener.prototype = {
|
|||
.setQuery(newQuery)
|
||||
.finalize();
|
||||
}
|
||||
let uri = request.URI;
|
||||
let mailnewsurl = "";
|
||||
try {
|
||||
mailnewsurl = uri.QueryInterface(Ci.nsIMsgMailNewsUrl);
|
||||
} catch (e) {}
|
||||
if (mailnewsurl) {
|
||||
let queryPart = mailnewsurl.query.replace(
|
||||
"type=message/rfc822",
|
||||
"type=application/x-message-display"
|
||||
);
|
||||
uri = mailnewsurl
|
||||
.mutate()
|
||||
.setQuery(queryPart)
|
||||
.finalize();
|
||||
} else if (uri.scheme == "file") {
|
||||
uri = uri
|
||||
.mutate()
|
||||
.setQuery("type=application/x-message-display")
|
||||
.finalize();
|
||||
}
|
||||
Services.ww.openWindow(
|
||||
null,
|
||||
"chrome://messenger/content/messageWindow.xhtml",
|
||||
"_blank",
|
||||
"all,chrome,dialog=no,status,toolbar",
|
||||
uri
|
||||
);
|
||||
let newHandler = Cc[
|
||||
"@mozilla.org/uriloader/content-handler;1?type=application/x-message-display"
|
||||
].createInstance(Ci.nsIContentHandler);
|
||||
newHandler.handleContent("application/x-message-display", this, request);
|
||||
return true;
|
||||
},
|
||||
|
||||
|
|
|
@ -485,6 +485,19 @@
|
|||
} \
|
||||
}
|
||||
|
||||
//
|
||||
// nsMessengerContentHandler
|
||||
//
|
||||
#define NS_MESSENGERCONTENTHANDLER_CID \
|
||||
{ \
|
||||
0x57e1bcbb, 0x1fba, 0x47e7, { \
|
||||
0xb9, 0x6b, 0xf5, 0x9e, 0x39, 0x24, 0x73, 0xb0 \
|
||||
} \
|
||||
}
|
||||
|
||||
#define NS_MESSENGERCONTENTHANDLER_CONTRACTID \
|
||||
NS_CONTENT_HANDLER_CONTRACTID_PREFIX "application/x-message-display"
|
||||
|
||||
//
|
||||
// nsMsgShutdownService
|
||||
//
|
||||
|
|
|
@ -37,6 +37,7 @@ SOURCES += [
|
|||
"nsMailDirProvider.cpp",
|
||||
"nsMessenger.cpp",
|
||||
"nsMessengerBootstrap.cpp",
|
||||
"nsMessengerContentHandler.cpp",
|
||||
"nsMsgAccount.cpp",
|
||||
"nsMsgAccountManager.cpp",
|
||||
"nsMsgBiffManager.cpp",
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsMessengerContentHandler.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsString.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "plstr.h"
|
||||
#include "nsIMsgMailNewsUrl.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIURIMutator.h"
|
||||
|
||||
nsMessengerContentHandler::nsMessengerContentHandler() {}
|
||||
|
||||
/* the following macro actually implement addref, release and query interface
|
||||
* for our component. */
|
||||
NS_IMPL_ISUPPORTS(nsMessengerContentHandler, nsIContentHandler)
|
||||
|
||||
nsMessengerContentHandler::~nsMessengerContentHandler() {}
|
||||
|
||||
NS_IMETHODIMP nsMessengerContentHandler::HandleContent(
|
||||
const char* aContentType, nsIInterfaceRequestor* aWindowContext,
|
||||
nsIRequest* request) {
|
||||
nsresult rv = NS_OK;
|
||||
if (!request) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// First of all, get the content type and make sure it is a content type we
|
||||
// know how to handle!
|
||||
if (PL_strcasecmp(aContentType, "application/x-message-display") == 0) {
|
||||
nsCOMPtr<nsIURI> aUri;
|
||||
nsCOMPtr<nsIChannel> aChannel = do_QueryInterface(request);
|
||||
if (!aChannel) return NS_ERROR_FAILURE;
|
||||
|
||||
rv = aChannel->GetURI(getter_AddRefs(aUri));
|
||||
if (aUri) {
|
||||
rv = request->Cancel(NS_ERROR_ABORT);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(aUri);
|
||||
if (mailnewsurl) {
|
||||
nsAutoCString queryPart;
|
||||
mailnewsurl->GetQuery(queryPart);
|
||||
queryPart.Replace(queryPart.Find("type=message/rfc822"),
|
||||
sizeof("type=message/rfc822") - 1,
|
||||
"type=application/x-message-display");
|
||||
// Don't mutate/clone here.
|
||||
rv = mailnewsurl->SetQueryInternal(queryPart);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = OpenWindow(aUri);
|
||||
} else {
|
||||
// Not an nsIMsgMailNewsUrl, so maybe a file URL, like opening a
|
||||
// message attachment (.eml file in a temp directory).
|
||||
nsAutoCString scheme;
|
||||
rv = aUri->GetScheme(scheme);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (scheme.Equals("file")) {
|
||||
// Add a special bit like in MsgOpenFromFile().
|
||||
rv = NS_MutateURI(aUri)
|
||||
.SetQuery("type=application/x-message-display"_ns)
|
||||
.Finalize(aUri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
rv = OpenWindow(aUri);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Utility function to open a message display window and and load the message in
|
||||
// it.
|
||||
nsresult nsMessengerContentHandler::OpenWindow(nsIURI* aURI) {
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch =
|
||||
do_GetService("@mozilla.org/embedcomp/window-watcher;1");
|
||||
if (!wwatch) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<mozIDOMWindowProxy> newWindow;
|
||||
return wwatch->OpenWindow(
|
||||
0, "chrome://messenger/content/messageWindow.xhtml"_ns, "_blank"_ns,
|
||||
"all,chrome,dialog=no,status,toolbar"_ns, aURI,
|
||||
getter_AddRefs(newWindow));
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsIContentHandler.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
class nsMessengerContentHandler : public nsIContentHandler {
|
||||
public:
|
||||
nsMessengerContentHandler();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICONTENTHANDLER
|
||||
|
||||
private:
|
||||
virtual ~nsMessengerContentHandler();
|
||||
nsresult OpenWindow(nsIURI* aURI);
|
||||
};
|
|
@ -103,6 +103,7 @@
|
|||
# include "nsMessengerUnixIntegration.h"
|
||||
#endif
|
||||
#include "nsCURILoader.h"
|
||||
#include "nsMessengerContentHandler.h"
|
||||
#include "nsStopwatch.h"
|
||||
#include "MailNewsDLF.h"
|
||||
|
||||
|
@ -351,6 +352,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMessengerOSXIntegration, Init)
|
|||
#if defined(MOZ_WIDGET_GTK)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMessengerUnixIntegration, Init)
|
||||
#endif
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMessengerContentHandler)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgContentPolicy, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsStopwatch)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(MailNewsDLF)
|
||||
|
@ -404,6 +406,7 @@ NS_DEFINE_NAMED_CID(NS_MESSENGEROSXINTEGRATION_CID);
|
|||
#if defined(MOZ_WIDGET_GTK)
|
||||
NS_DEFINE_NAMED_CID(NS_MESSENGERUNIXINTEGRATION_CID);
|
||||
#endif
|
||||
NS_DEFINE_NAMED_CID(NS_MESSENGERCONTENTHANDLER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_MSGCONTENTPOLICY_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_MSGSHUTDOWNSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(MAILDIRPROVIDER_CID);
|
||||
|
@ -808,6 +811,8 @@ const mozilla::Module::CIDEntry kMailNewsCIDs[] = {
|
|||
{&kNS_MESSENGERUNIXINTEGRATION_CID, false, NULL,
|
||||
nsMessengerUnixIntegrationConstructor},
|
||||
#endif
|
||||
{&kNS_MESSENGERCONTENTHANDLER_CID, false, NULL,
|
||||
nsMessengerContentHandlerConstructor},
|
||||
{&kNS_MSGCONTENTPOLICY_CID, false, NULL, nsMsgContentPolicyConstructor},
|
||||
{&kNS_MSGSHUTDOWNSERVICE_CID, false, NULL, nsMsgShutdownServiceConstructor},
|
||||
{&kMAILDIRPROVIDER_CID, false, NULL, nsMailDirProviderConstructor},
|
||||
|
@ -1032,6 +1037,7 @@ const mozilla::Module::ContractIDEntry kMailNewsContracts[] = {
|
|||
#if defined(MOZ_WIDGET_GTK)
|
||||
{NS_MESSENGEROSINTEGRATION_CONTRACTID, &kNS_MESSENGERUNIXINTEGRATION_CID},
|
||||
#endif
|
||||
{NS_MESSENGERCONTENTHANDLER_CONTRACTID, &kNS_MESSENGERCONTENTHANDLER_CID},
|
||||
{NS_MSGCONTENTPOLICY_CONTRACTID, &kNS_MSGCONTENTPOLICY_CID},
|
||||
{NS_MSGSHUTDOWNSERVICE_CONTRACTID, &kNS_MSGSHUTDOWNSERVICE_CID},
|
||||
{NS_MAILDIRPROVIDER_CONTRACTID, &kMAILDIRPROVIDER_CID},
|
||||
|
|
Загрузка…
Ссылка в новой задаче