зеркало из https://github.com/mozilla/pjs.git
Back out MIME/protocol handler work from bug 388388 because of difficult to diagnose unit test lossage on windows. Note that Windows tinderboxen will go and stay red until they are clobbered because of dependency system lossage.
This commit is contained in:
Родитель
c44b982eae
Коммит
6c90e51562
|
@ -49,16 +49,8 @@ typedef long nsHandlerInfoAction;
|
|||
* nsIHandlerInfo gives access to the information about how a given protocol
|
||||
* scheme or MIME-type is handled.
|
||||
*/
|
||||
[scriptable, uuid(51ddc1c5-7077-4c58-a5bd-327d00777b46)]
|
||||
[scriptable, uuid(2ec1216d-59e7-424c-aa1e-70aa3c897520)]
|
||||
interface nsIHandlerInfo : nsISupports {
|
||||
/**
|
||||
* The type of this handler info. For MIME handlers, this is the MIME type.
|
||||
* For protocol handlers, it's the scheme.
|
||||
*
|
||||
* @return String representing the type.
|
||||
*/
|
||||
readonly attribute ACString type;
|
||||
|
||||
/**
|
||||
* A human readable description of the handler type
|
||||
*/
|
||||
|
@ -166,8 +158,6 @@ interface nsIMIMEInfo : nsIHandlerInfo {
|
|||
* The MIME type of this MIMEInfo.
|
||||
*
|
||||
* @return String representing the MIME type.
|
||||
*
|
||||
* @deprecated use nsIHandlerInfo::type instead.
|
||||
*/
|
||||
readonly attribute ACString MIMEType;
|
||||
|
||||
|
|
|
@ -43,8 +43,6 @@ class nsMIMEInfoBeOS : public nsMIMEInfoImpl {
|
|||
public:
|
||||
nsMIMEInfoBeOS(const char* aType = "") : nsMIMEInfoImpl(aType) {}
|
||||
nsMIMEInfoBeOS(const nsACString& aMIMEType) : nsMIMEInfoImpl(aMIMEType) {}
|
||||
nsMIMEInfoBeOS(const nsACString& aType, HandlerClass aClass) :
|
||||
nsMIMEInfoImpl(aType, aClass) {}
|
||||
virtual ~nsMIMEInfoBeOS();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -275,8 +275,7 @@ nsOSHelperAppService::GetProtocolInfoFromOS(const nsACString &aScheme)
|
|||
&exists);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
nsMIMEInfoBeOS *handlerInfo =
|
||||
new nsMIMEInfoBeOS(aScheme, nsMIMEInfoBase::eProtocolInfo);
|
||||
nsMIMEInfoBeOS *handlerInfo = new nsMIMEInfoBeOS();
|
||||
NS_ENSURE_TRUE(handlerInfo, nsnull);
|
||||
NS_ADDREF(handlerInfo);
|
||||
|
||||
|
|
|
@ -43,8 +43,6 @@ class nsMIMEInfoMac : public nsMIMEInfoImpl {
|
|||
public:
|
||||
nsMIMEInfoMac(const char* aMIMEType = "") : nsMIMEInfoImpl(aMIMEType) {}
|
||||
nsMIMEInfoMac(const nsACString& aMIMEType) : nsMIMEInfoImpl(aMIMEType) {}
|
||||
nsMIMEInfoMac(const nsACString& aType, HandlerClass aClass) :
|
||||
nsMIMEInfoImpl(aType, aClass) {}
|
||||
|
||||
NS_IMETHOD LaunchWithURI(nsIURI* aURI);
|
||||
|
||||
|
|
|
@ -343,8 +343,7 @@ nsOSHelperAppService::GetProtocolInfoFromOS(const nsACString &aScheme)
|
|||
&exists);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
nsMIMEInfoMac *handlerInfo =
|
||||
new nsMIMEInfoMac(aScheme, nsMIMEInfoBase::eProtocolInfo);
|
||||
nsMIMEInfoMac *handlerInfo = new nsMIMEInfoMac();
|
||||
NS_ENSURE_TRUE(handlerInfo, nsnull);
|
||||
NS_ADDREF(handlerInfo);
|
||||
|
||||
|
|
|
@ -244,7 +244,9 @@ HandlerService.prototype = {
|
|||
* @returns {string} the ID
|
||||
*/
|
||||
_getClass: function HS__getClass(aHandlerInfo) {
|
||||
if (aHandlerInfo instanceof Ci.nsIMIMEInfo)
|
||||
if (aHandlerInfo instanceof Ci.nsIMIMEInfo &&
|
||||
// FIXME: remove this extra condition in the fix for bug 388388.
|
||||
aHandlerInfo.QueryInterface(Ci.nsIMIMEInfo).MIMEType)
|
||||
return "mimetype";
|
||||
else
|
||||
return "scheme";
|
||||
|
@ -263,7 +265,10 @@ HandlerService.prototype = {
|
|||
* @returns {string} the ID
|
||||
*/
|
||||
_getTypeID: function HS__getTypeID(aHandlerInfo) {
|
||||
return "urn:" + this._getClass(aHandlerInfo) + ":" + aHandlerInfo.type;
|
||||
return "urn:" + this._getClass(aHandlerInfo) + ":" +
|
||||
// FIXME: change this to aHandlerInfo.type in the fix for bug 388388.
|
||||
aHandlerInfo.QueryInterface(Ci.nsIMIMEInfo).MIMEType;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -283,7 +288,8 @@ HandlerService.prototype = {
|
|||
*/
|
||||
_getInfoID: function HS__getInfoID(aHandlerInfo) {
|
||||
return "urn:" + this._getClass(aHandlerInfo) + ":handler:" +
|
||||
aHandlerInfo.type;
|
||||
// FIXME: change this to aHandlerInfo.type in the fix for bug 388388.
|
||||
aHandlerInfo.QueryInterface(Ci.nsIMIMEInfo).MIMEType;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -308,7 +314,8 @@ HandlerService.prototype = {
|
|||
*/
|
||||
_getPreferredHandlerID: function HS__getPreferredHandlerID(aHandlerInfo) {
|
||||
return "urn:" + this._getClass(aHandlerInfo) + ":externalApplication:" +
|
||||
aHandlerInfo.type;
|
||||
// FIXME: change this to aHandlerInfo.type in the fix for bug 388388.
|
||||
aHandlerInfo.QueryInterface(Ci.nsIMIMEInfo).MIMEType;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -376,7 +383,9 @@ HandlerService.prototype = {
|
|||
// Create a basic type record for this type.
|
||||
typeList.AppendElement(type);
|
||||
this._setLiteral(typeID, NC_EDITABLE, "true");
|
||||
this._setLiteral(typeID, NC_VALUE, aHandlerInfo.type);
|
||||
this._setLiteral(typeID, NC_VALUE,
|
||||
// FIXME: change this to aHandlerInfo.type in the fix for bug 388388.
|
||||
aHandlerInfo.QueryInterface(Ci.nsIMIMEInfo).MIMEType);
|
||||
|
||||
// Create a basic info record for this type.
|
||||
var infoID = this._getInfoID(aHandlerInfo);
|
||||
|
|
|
@ -45,23 +45,12 @@
|
|||
#include "nsIFileURL.h"
|
||||
|
||||
// nsISupports methods
|
||||
NS_IMPL_THREADSAFE_ADDREF(nsMIMEInfoBase)
|
||||
NS_IMPL_THREADSAFE_RELEASE(nsMIMEInfoBase)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsMIMEInfoBase)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIHandlerInfo)
|
||||
// This is only an nsIMIMEInfo if it's a MIME handler with a MIME type.
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIMIMEInfo, !mMIMEType.IsEmpty())
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIHandlerInfo)
|
||||
NS_INTERFACE_MAP_END_THREADSAFE
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS2(nsMIMEInfoBase, nsIMIMEInfo, nsIHandlerInfo)
|
||||
|
||||
// nsMIMEInfoImpl methods
|
||||
|
||||
// Constructors for a MIME handler.
|
||||
nsMIMEInfoBase::nsMIMEInfoBase(const char *aMIMEType) :
|
||||
mMacType(0),
|
||||
mMacCreator(0),
|
||||
mType(aMIMEType),
|
||||
mMIMEType(aMIMEType),
|
||||
mPreferredAction(nsIMIMEInfo::saveToDisk),
|
||||
mAlwaysAskBeforeHandling(PR_TRUE)
|
||||
|
@ -71,29 +60,12 @@ nsMIMEInfoBase::nsMIMEInfoBase(const char *aMIMEType) :
|
|||
nsMIMEInfoBase::nsMIMEInfoBase(const nsACString& aMIMEType) :
|
||||
mMacType(0),
|
||||
mMacCreator(0),
|
||||
mType(aMIMEType),
|
||||
mMIMEType(aMIMEType),
|
||||
mPreferredAction(nsIMIMEInfo::saveToDisk),
|
||||
mAlwaysAskBeforeHandling(PR_TRUE)
|
||||
{
|
||||
}
|
||||
|
||||
// Constructor for a handler that lets the caller specify whether this is a
|
||||
// MIME handler or a protocol handler. In the long run, these will be distinct
|
||||
// classes (f.e. nsMIMEInfo and nsProtocolInfo), but for now we reuse this class
|
||||
// for both and distinguish between the two kinds of handlers via the aClass
|
||||
// argument to this method, which can be either eMIMEInfo or eProtocolInfo.
|
||||
nsMIMEInfoBase::nsMIMEInfoBase(const nsACString& aType, HandlerClass aClass) :
|
||||
mMacType(0),
|
||||
mMacCreator(0),
|
||||
mType(aType),
|
||||
mPreferredAction(nsIMIMEInfo::saveToDisk),
|
||||
mAlwaysAskBeforeHandling(PR_TRUE)
|
||||
{
|
||||
if (aClass == eMIMEInfo)
|
||||
mMIMEType = aType;
|
||||
}
|
||||
|
||||
nsMIMEInfoBase::~nsMIMEInfoBase()
|
||||
{
|
||||
}
|
||||
|
@ -164,16 +136,6 @@ nsMIMEInfoBase::AppendExtension(const nsACString& aExtension)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMIMEInfoBase::GetType(nsACString& aType)
|
||||
{
|
||||
if (mType.IsEmpty())
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
aType = mType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMIMEInfoBase::GetMIMEType(nsACString& aMIMEType)
|
||||
{
|
||||
|
|
|
@ -74,7 +74,6 @@ class nsMIMEInfoBase : public nsIMIMEInfo {
|
|||
NS_IMETHOD AppendExtension(const nsACString & aExtension);
|
||||
NS_IMETHOD GetPrimaryExtension(nsACString & aPrimaryExtension);
|
||||
NS_IMETHOD SetPrimaryExtension(const nsACString & aPrimaryExtension);
|
||||
NS_IMETHOD GetType(nsACString & aType);
|
||||
NS_IMETHOD GetMIMEType(nsACString & aMIMEType);
|
||||
NS_IMETHOD GetDescription(nsAString & aDescription);
|
||||
NS_IMETHOD SetDescription(const nsAString & aDescription);
|
||||
|
@ -92,19 +91,11 @@ class nsMIMEInfoBase : public nsIMIMEInfo {
|
|||
NS_IMETHOD GetAlwaysAskBeforeHandling(PRBool *aAlwaysAskBeforeHandling);
|
||||
NS_IMETHOD SetAlwaysAskBeforeHandling(PRBool aAlwaysAskBeforeHandling);
|
||||
|
||||
enum HandlerClass {
|
||||
eMIMEInfo,
|
||||
eProtocolInfo
|
||||
};
|
||||
|
||||
// nsMIMEInfoBase methods
|
||||
nsMIMEInfoBase(const char *aMIMEType = "") NS_HIDDEN;
|
||||
nsMIMEInfoBase(const nsACString& aMIMEType) NS_HIDDEN;
|
||||
nsMIMEInfoBase(const nsACString& aType, HandlerClass aClass) NS_HIDDEN;
|
||||
virtual ~nsMIMEInfoBase(); // must be virtual, as the the base class's Release should call the subclass's destructor
|
||||
|
||||
void SetType(const nsACString & aType) { mType = aType; }
|
||||
|
||||
void SetMIMEType(const nsACString & aMIMEType) { mMIMEType = aMIMEType; }
|
||||
|
||||
void SetDefaultDescription(const nsString& aDesc) { mDefaultAppDescription = aDesc; }
|
||||
|
@ -167,7 +158,6 @@ class nsMIMEInfoBase : public nsIMIMEInfo {
|
|||
nsCStringArray mExtensions; ///< array of file extensions associated w/ this MIME obj
|
||||
nsString mDescription; ///< human readable description
|
||||
PRUint32 mMacType, mMacCreator; ///< Mac file type and creator
|
||||
nsCString mType;
|
||||
nsCString mMIMEType;
|
||||
nsCOMPtr<nsIHandlerApp> mPreferredApplication;
|
||||
nsHandlerInfoAction mPreferredAction; ///< preferred action to associate with this type
|
||||
|
@ -189,8 +179,6 @@ class nsMIMEInfoImpl : public nsMIMEInfoBase {
|
|||
public:
|
||||
nsMIMEInfoImpl(const char *aMIMEType = "") : nsMIMEInfoBase(aMIMEType) {}
|
||||
nsMIMEInfoImpl(const nsACString& aMIMEType) : nsMIMEInfoBase(aMIMEType) {}
|
||||
nsMIMEInfoImpl(const nsACString& aType, HandlerClass aClass) :
|
||||
nsMIMEInfoBase(aType, aClass) {}
|
||||
virtual ~nsMIMEInfoImpl() {}
|
||||
|
||||
// nsIMIMEInfo methods
|
||||
|
|
|
@ -44,8 +44,6 @@ class nsMIMEInfoOS2 : public nsMIMEInfoImpl
|
|||
public:
|
||||
nsMIMEInfoOS2(const char* aType = "") : nsMIMEInfoImpl(aType) {}
|
||||
nsMIMEInfoOS2(const nsACString& aMIMEType) : nsMIMEInfoImpl(aMIMEType) {}
|
||||
nsMIMEInfoOS2(const nsACString& aType, HandlerClass aClass) :
|
||||
nsMIMEInfoImpl(aType, aClass) {}
|
||||
virtual ~nsMIMEInfoOS2();
|
||||
|
||||
NS_IMETHOD LaunchWithURI(nsIURI* aURI);
|
||||
|
|
|
@ -83,9 +83,6 @@ function run_test() {
|
|||
// Make sure it's also an nsIHandlerInfo.
|
||||
do_check_true(handlerInfo instanceof Ci.nsIHandlerInfo);
|
||||
|
||||
do_check_eq(handlerInfo.type, "nonexistent/type");
|
||||
|
||||
// Deprecated property, but we should still make sure it's set correctly.
|
||||
do_check_eq(handlerInfo.MIMEType, "nonexistent/type");
|
||||
|
||||
// These three properties are the ones the handler service knows how to store.
|
||||
|
|
|
@ -1683,8 +1683,7 @@ nsOSHelperAppService::GetProtocolInfoFromOS(const nsACString &aScheme)
|
|||
&exists);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
nsMIMEInfoImpl *handlerInfo =
|
||||
new nsMIMEInfoImpl(aScheme, nsMIMEInfoBase::eProtocolInfo);
|
||||
nsMIMEInfoImpl *handlerInfo = new nsMIMEInfoImpl();
|
||||
NS_ENSURE_TRUE(handlerInfo, nsnull);
|
||||
NS_ADDREF(handlerInfo);
|
||||
|
||||
|
|
|
@ -44,8 +44,6 @@ class nsMIMEInfoWin : public nsMIMEInfoBase, public nsIPropertyBag {
|
|||
public:
|
||||
nsMIMEInfoWin(const char* aType = "") : nsMIMEInfoBase(aType) {}
|
||||
nsMIMEInfoWin(const nsACString& aMIMEType) : nsMIMEInfoBase(aMIMEType) {}
|
||||
nsMIMEInfoWin(const nsACString& aType, HandlerClass aClass) :
|
||||
nsMIMEInfoBase(aType, aClass) {}
|
||||
virtual ~nsMIMEInfoWin();
|
||||
|
||||
NS_IMETHOD GetHasDefaultHandler(PRBool * _retval);
|
||||
|
|
|
@ -598,8 +598,7 @@ nsOSHelperAppService::GetProtocolInfoFromOS(const nsACString &aScheme)
|
|||
&exists);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
nsMIMEInfoWin *handlerInfo =
|
||||
new nsMIMEInfoWin(aScheme, nsMIMEInfoBase::eProtocolInfo);
|
||||
nsMIMEInfoWin *handlerInfo = new nsMIMEInfoWin();
|
||||
NS_ENSURE_TRUE(handlerInfo, nsnull);
|
||||
NS_ADDREF(handlerInfo);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче