mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Back out Bug 647570 because it's failing test_bug465752.js
This commit is contained in:
commit
f814521d86
@ -61,7 +61,6 @@ EXPORTS = $(srcdir)/nsJSProtocolHandler.h
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(srcdir) \
|
||||
-I$(topsrcdir)/dom/base \
|
||||
-I$(topsrcdir)/netwerk/base/src \
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
|
@ -22,7 +22,6 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
* Emanuele Costa <emanuele.costa@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
@ -1220,7 +1219,10 @@ nsJSProtocolHandler::NewURI(const nsACString &aSpec,
|
||||
// provided by standard URLs, so there is no "outer" object given to
|
||||
// CreateInstance.
|
||||
|
||||
nsCOMPtr<nsIURI> url = new nsJSURI(aBaseURI);
|
||||
nsCOMPtr<nsIURI> url = do_CreateInstance(NS_SIMPLEURI_CONTRACTID, &rv);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (!aCharset || !nsCRT::strcasecmp("UTF-8", aCharset))
|
||||
rv = url->SetSpec(aSpec);
|
||||
@ -1239,7 +1241,10 @@ nsJSProtocolHandler::NewURI(const nsACString &aSpec,
|
||||
return rv;
|
||||
}
|
||||
|
||||
url.forget(result);
|
||||
*result = new nsJSURI(aBaseURI, url);
|
||||
NS_ENSURE_TRUE(*result, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(*result);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -1277,23 +1282,33 @@ nsJSProtocolHandler::AllowPort(PRInt32 port, const char *scheme, PRBool *_retval
|
||||
////////////////////////////////////////////////////////////
|
||||
// nsJSURI implementation
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsJSURI, nsSimpleURI)
|
||||
NS_IMPL_RELEASE_INHERITED(nsJSURI, nsSimpleURI)
|
||||
NS_IMPL_ADDREF(nsJSURI)
|
||||
NS_IMPL_RELEASE(nsJSURI)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsJSURI)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIURI)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISerializable)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIClassInfo)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMutable)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIURI)
|
||||
if (aIID.Equals(kJSURICID))
|
||||
foundInterface = static_cast<nsIURI*>(this);
|
||||
else
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsSimpleURI)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
// nsISerializable methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSURI::Read(nsIObjectInputStream* aStream)
|
||||
{
|
||||
nsresult rv = nsSimpleURI::Read(aStream);
|
||||
nsresult rv;
|
||||
|
||||
rv = aStream->ReadObject(PR_TRUE, getter_AddRefs(mSimpleURI));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mMutable = do_QueryInterface(mSimpleURI);
|
||||
NS_ENSURE_TRUE(mMutable, NS_ERROR_UNEXPECTED);
|
||||
|
||||
PRBool haveBase;
|
||||
rv = aStream->ReadBoolean(&haveBase);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
@ -1309,7 +1324,9 @@ nsJSURI::Read(nsIObjectInputStream* aStream)
|
||||
NS_IMETHODIMP
|
||||
nsJSURI::Write(nsIObjectOutputStream* aStream)
|
||||
{
|
||||
nsresult rv = nsSimpleURI::Write(aStream);
|
||||
nsresult rv;
|
||||
|
||||
rv = aStream->WriteObject(mSimpleURI, PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = aStream->WriteBoolean(mBaseURI != nsnull);
|
||||
@ -1324,48 +1341,99 @@ nsJSURI::Write(nsIObjectOutputStream* aStream)
|
||||
}
|
||||
|
||||
// nsIURI methods:
|
||||
/* virtual */ nsSimpleURI*
|
||||
nsJSURI::StartClone()
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSURI::Clone(nsIURI** aClone)
|
||||
{
|
||||
nsCOMPtr<nsIURI> simpleClone;
|
||||
nsresult rv = mSimpleURI->Clone(getter_AddRefs(simpleClone));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURI> baseClone;
|
||||
if (mBaseURI) {
|
||||
nsresult rv = mBaseURI->Clone(getter_AddRefs(baseClone));
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsnull;
|
||||
}
|
||||
rv = mBaseURI->Clone(getter_AddRefs(baseClone));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
return new nsJSURI(baseClone);
|
||||
nsIURI* newURI = new nsJSURI(baseClone, simpleClone);
|
||||
NS_ENSURE_TRUE(newURI, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(*aClone = newURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSURI::Equals(nsIURI* other, PRBool *result)
|
||||
nsJSURI::Equals(nsIURI* aOther, PRBool *aResult)
|
||||
{
|
||||
*result = PR_FALSE;
|
||||
|
||||
if (other) {
|
||||
nsresult rv = nsSimpleURI::Equals(other, result);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!*result)
|
||||
return NS_OK;
|
||||
|
||||
nsRefPtr<nsJSURI> otherJSURI;
|
||||
rv = other->QueryInterface(kJSURICID,
|
||||
getter_AddRefs(otherJSURI));
|
||||
if (!otherJSURI)
|
||||
{
|
||||
*result = PR_FALSE;
|
||||
if (!aOther) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<nsJSURI> otherJSUri;
|
||||
aOther->QueryInterface(kJSURICID, getter_AddRefs(otherJSUri));
|
||||
if (!otherJSUri) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIURI* otherBaseURI = otherJSURI->GetBaseURI();
|
||||
|
||||
if (mBaseURI)
|
||||
return mBaseURI->Equals(otherBaseURI, result);
|
||||
|
||||
*result = !otherBaseURI;
|
||||
}
|
||||
|
||||
return mSimpleURI->Equals(otherJSUri->mSimpleURI, aResult);
|
||||
}
|
||||
|
||||
// nsIClassInfo methods:
|
||||
NS_IMETHODIMP
|
||||
nsJSURI::GetInterfaces(PRUint32 *count, nsIID * **array)
|
||||
{
|
||||
*count = 0;
|
||||
*array = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSURI::GetHelperForLanguage(PRUint32 language, nsISupports **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSURI::GetContractID(char * *aContractID)
|
||||
{
|
||||
// Make sure to modify any subclasses as needed if this ever
|
||||
// changes.
|
||||
*aContractID = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSURI::GetClassDescription(char * *aClassDescription)
|
||||
{
|
||||
*aClassDescription = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSURI::GetClassID(nsCID * *aClassID)
|
||||
{
|
||||
// Make sure to modify any subclasses as needed if this ever
|
||||
// changes to not call the virtual GetClassIDNoAlloc.
|
||||
*aClassID = (nsCID*) nsMemory::Alloc(sizeof(nsCID));
|
||||
if (!*aClassID)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return GetClassIDNoAlloc(*aClassID);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSURI::GetImplementationLanguage(PRUint32 *aImplementationLanguage)
|
||||
{
|
||||
*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSURI::GetFlags(PRUint32 *aFlags)
|
||||
{
|
||||
*aFlags = nsIClassInfo::MAIN_THREAD_ONLY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Emanuele Costa <emanuele.costa@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
@ -45,7 +44,6 @@
|
||||
#include "nsIMutable.h"
|
||||
#include "nsISerializable.h"
|
||||
#include "nsIClassInfo.h"
|
||||
#include "nsSimpleURI.h"
|
||||
|
||||
#define NS_JSPROTOCOLHANDLER_CID \
|
||||
{ /* bfc310d2-38a0-11d3-8cd3-0060b0fc14a3 */ \
|
||||
@ -92,36 +90,58 @@ protected:
|
||||
nsCOMPtr<nsITextToSubURI> mTextToSubURI;
|
||||
};
|
||||
|
||||
|
||||
class nsJSURI : public nsSimpleURI
|
||||
// Use an extra base object to avoid having to manually retype all the
|
||||
// nsIURI methods. I wish we could just inherit from nsSimpleURI instead.
|
||||
class nsJSURI_base : public nsIURI,
|
||||
public nsIMutable
|
||||
{
|
||||
public:
|
||||
|
||||
nsJSURI() {}
|
||||
|
||||
nsJSURI(nsIURI* aBaseURI) : mBaseURI(aBaseURI) {}
|
||||
|
||||
nsIURI* GetBaseURI() const
|
||||
nsJSURI_base(nsIURI* aSimpleURI) :
|
||||
mSimpleURI(aSimpleURI)
|
||||
{
|
||||
mMutable = do_QueryInterface(mSimpleURI);
|
||||
NS_ASSERTION(aSimpleURI && mMutable, "This isn't going to work out");
|
||||
}
|
||||
virtual ~nsJSURI_base() {}
|
||||
|
||||
// For use only from deserialization
|
||||
nsJSURI_base() {}
|
||||
|
||||
NS_FORWARD_NSIURI(mSimpleURI->)
|
||||
NS_FORWARD_NSIMUTABLE(mMutable->)
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIURI> mSimpleURI;
|
||||
nsCOMPtr<nsIMutable> mMutable;
|
||||
};
|
||||
|
||||
class nsJSURI : public nsJSURI_base,
|
||||
public nsISerializable,
|
||||
public nsIClassInfo
|
||||
{
|
||||
public:
|
||||
nsJSURI(nsIURI* aBaseURI, nsIURI* aSimpleURI) :
|
||||
nsJSURI_base(aSimpleURI), mBaseURI(aBaseURI)
|
||||
{}
|
||||
virtual ~nsJSURI() {}
|
||||
|
||||
// For use only from deserialization
|
||||
nsJSURI() : nsJSURI_base() {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISERIALIZABLE
|
||||
NS_DECL_NSICLASSINFO
|
||||
|
||||
// Override Clone() and Equals()
|
||||
NS_IMETHOD Clone(nsIURI** aClone);
|
||||
NS_IMETHOD Equals(nsIURI* aOther, PRBool *aResult);
|
||||
|
||||
nsIURI* GetBaseURI() const {
|
||||
return mBaseURI;
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIURI overrides
|
||||
NS_IMETHOD Equals(nsIURI* other, PRBool *result);
|
||||
virtual nsSimpleURI* StartClone();
|
||||
|
||||
// nsISerializable overrides
|
||||
NS_IMETHOD Read(nsIObjectInputStream* aStream);
|
||||
NS_IMETHOD Write(nsIObjectOutputStream* aStream);
|
||||
|
||||
// Override the nsIClassInfo method GetClassIDNoAlloc to make sure our
|
||||
// nsISerializable impl works right.
|
||||
NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIURI> mBaseURI;
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsJSProtocolHandler_h___ */
|
||||
|
@ -337,7 +337,6 @@ LOCAL_INCLUDES += -I$(srcdir)/../base \
|
||||
-I$(topsrcdir)/js/src/xpconnect/src \
|
||||
-I$(topsrcdir)/js/src/xpconnect/loader \
|
||||
-I$(topsrcdir)/caps/include \
|
||||
-I$(topsrcdir)/netwerk/base/src \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_MATHML
|
||||
|
Loading…
Reference in New Issue
Block a user