Backed out 2 changesets (bug 1442239) for xpcshell failures at widget/tests/unit/test_taskbar_jumplistitems.js on a CLOSED TREE

Backed out changeset 513cd669aca1 (bug 1442239)
Backed out changeset aef4c73f736f (bug 1442239)
This commit is contained in:
Andreea Pavel 2018-03-19 21:19:26 +02:00
Родитель 27726e9fdd
Коммит e5950c0d39
24 изменённых файлов: 101 добавлений и 324 удалений

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

@ -84,6 +84,11 @@ public:
return InitFromIPCParams(aParams);
}
NS_IMETHOD Read(nsIObjectInputStream* aStream) override
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD Finalize(nsIURI** aURI) override
{
mURI.forget(aURI);

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

@ -75,7 +75,7 @@ nsHostObjectURI::GetPrincipalUri(nsIURI** aUri)
NS_IMETHODIMP
nsHostObjectURI::Read(nsIObjectInputStream* aStream)
{
nsresult rv = mozilla::net::nsSimpleURI::ReadPrivate(aStream);
nsresult rv = mozilla::net::nsSimpleURI::Read(aStream);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISupports> supports;
@ -230,13 +230,7 @@ nsHostObjectURI::EqualsInternal(nsIURI* aOther,
return NS_OK;
}
// Queries this list of interfaces. If none match, it queries mURI.
NS_IMPL_NSIURIMUTATOR_ISUPPORTS(nsHostObjectURI::Mutator,
nsIURISetters,
nsIURIMutator,
nsIBlobURIMutator,
nsIPrincipalURIMutator,
nsISerializable)
NS_IMPL_ISUPPORTS(nsHostObjectURI::Mutator, nsIURISetters, nsIURIMutator, nsIBlobURIMutator, nsIPrincipalURIMutator)
NS_IMETHODIMP
nsHostObjectURI::Mutate(nsIURIMutator** aMutator)

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

@ -85,24 +85,11 @@ public:
, public BaseURIMutator<nsHostObjectURI>
, public nsIBlobURIMutator
, public nsIPrincipalURIMutator
, public nsISerializable
{
NS_DECL_ISUPPORTS
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
NS_DEFINE_NSIMUTATOR_COMMON
NS_IMETHOD
Write(nsIObjectOutputStream *aOutputStream) override
{
return NS_ERROR_NOT_IMPLEMENTED;
}
MOZ_MUST_USE NS_IMETHOD
Read(nsIObjectInputStream* aStream) override
{
return InitFromInputStream(aStream);
}
MOZ_MUST_USE NS_IMETHOD
SetBlobImpl(mozilla::dom::BlobImpl *aBlobImpl) override
{
@ -137,8 +124,4 @@ public:
{ 0xf5475c51, 0x59a7, 0x4757, \
{ 0xb3, 0xd9, 0xe2, 0x11, 0xa9, 0x41, 0x08, 0x72 } }
#define NS_HOSTOBJECTURIMUTATOR_CID \
{ 0xbbe50ef2, 0x80eb, 0x469d, \
{ 0xb7, 0x0d, 0x02, 0x85, 0x82, 0x75, 0x38, 0x9f } }
#endif /* nsHostObjectURI_h */

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

@ -1283,16 +1283,9 @@ NS_INTERFACE_MAP_END_INHERITING(mozilla::net::nsSimpleURI)
// nsISerializable methods:
NS_IMETHODIMP
nsJSURI::Read(nsIObjectInputStream *aStream)
nsJSURI::Read(nsIObjectInputStream* aStream)
{
NS_NOTREACHED("Use nsIURIMutator.read() instead");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsJSURI::ReadPrivate(nsIObjectInputStream *aStream)
{
nsresult rv = mozilla::net::nsSimpleURI::ReadPrivate(aStream);
nsresult rv = mozilla::net::nsSimpleURI::Read(aStream);
if (NS_FAILED(rv)) return rv;
bool haveBase;
@ -1387,11 +1380,7 @@ nsJSURI::StartClone(mozilla::net::nsSimpleURI::RefHandlingEnum refHandlingMode,
return url;
}
// Queries this list of interfaces. If none match, it queries mURI.
NS_IMPL_NSIURIMUTATOR_ISUPPORTS(nsJSURI::Mutator,
nsIURISetters,
nsIURIMutator,
nsISerializable)
NS_IMPL_ISUPPORTS(nsJSURI::Mutator, nsIURISetters, nsIURIMutator)
NS_IMETHODIMP
nsJSURI::Mutate(nsIURIMutator** aMutator)

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

@ -31,14 +31,6 @@
{0xa9, 0x35, 0xd0, 0xc8, 0x74, 0x12, 0x89, 0x30} \
}
#define NS_JSURIMUTATOR_CID \
{ /* 574ce83e-fe9f-4095-b85c-7909abbf7c37 */ \
0x574ce83e, \
0xfe9f, \
0x4095, \
{0xb8, 0x5c, 0x79, 0x09, 0xab, 0xbf, 0x7c, 0x37} \
}
#define NS_JSPROTOCOLHANDLER_CONTRACTID \
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "javascript"
@ -111,7 +103,6 @@ protected:
RefHandlingEnum refHandlingMode,
bool* result) override;
bool Deserialize(const mozilla::ipc::URIParams&);
nsresult ReadPrivate(nsIObjectInputStream *aStream);
private:
nsCOMPtr<nsIURI> mBaseURI;
@ -120,24 +111,11 @@ public:
class Mutator final
: public nsIURIMutator
, public BaseURIMutator<nsJSURI>
, public nsISerializable
{
NS_DECL_ISUPPORTS
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
NS_DEFINE_NSIMUTATOR_COMMON
NS_IMETHOD
Write(nsIObjectOutputStream *aOutputStream) override
{
return NS_ERROR_NOT_IMPLEMENTED;
}
MOZ_MUST_USE NS_IMETHOD
Read(nsIObjectInputStream* aStream) override
{
return InitFromInputStream(aStream);
}
explicit Mutator() { }
private:
virtual ~Mutator() { }

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

@ -77,6 +77,11 @@ public:
return InitFromIPCParams(aParams);
}
NS_IMETHOD Read(nsIObjectInputStream* aStream) override
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD Finalize(nsIURI** aURI) override
{
mURI.forget(aURI);

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

@ -1,39 +1,39 @@
function testActual(CSPContextClassByID)
function testActual(SimpleURIClassByID)
{
var cspContext =
Cc["@mozilla.org/cspcontext;1"].createInstance();
var simpleURI =
Cc["@mozilla.org/network/simple-uri;1"].createInstance();
Assert.equal(cspContext instanceof CSPContextClassByID, true);
Assert.equal(simpleURI instanceof SimpleURIClassByID, true);
}
function testInherited(CSPContextClassByID)
function testInherited(SimpleURIClassByID)
{
var cspContext =
Cc["@mozilla.org/cspcontext;1"].createInstance();
var simpleURI =
Cc["@mozilla.org/network/simple-uri;1"].createInstance();
var inherited = Object.create(cspContext);
var inherited = Object.create(simpleURI);
Assert.equal(inherited instanceof CSPContextClassByID, true);
Assert.equal(inherited instanceof SimpleURIClassByID, true);
}
function testInheritedCrossGlobal(CSPContextClassByID)
function testInheritedCrossGlobal(SimpleURIClassByID)
{
var cspContext =
Cc["@mozilla.org/cspcontext;1"].createInstance();
var simpleURI =
Cc["@mozilla.org/network/simple-uri;1"].createInstance();
var sb = new Cu.Sandbox(this, { wantComponents: true });
var inheritedCross = sb.Object.create(cspContext);
var inheritedCross = sb.Object.create(simpleURI);
Assert.equal(inheritedCross instanceof CSPContextClassByID, true);
Assert.equal(inheritedCross instanceof SimpleURIClassByID, true);
}
function testCrossGlobalArbitraryGetPrototype(CSPContextClassByID)
function testCrossGlobalArbitraryGetPrototype(SimpleURIClassByID)
{
var cspContext =
Cc["@mozilla.org/cspcontext;1"].createInstance();
var simpleURI =
Cc["@mozilla.org/network/simple-uri;1"].createInstance();
var sb = new Cu.Sandbox(this, { wantComponents: true });
var firstLevel = Object.create(cspContext);
var firstLevel = Object.create(simpleURI);
var obj = { shouldThrow: false };
var secondLevel =
@ -53,7 +53,7 @@ function testCrossGlobalArbitraryGetPrototype(CSPContextClassByID)
var err;
try
{
void (thirdLevel instanceof CSPContextClassByID);
void (thirdLevel instanceof SimpleURIClassByID);
}
catch (e)
{
@ -66,14 +66,14 @@ function testCrossGlobalArbitraryGetPrototype(CSPContextClassByID)
obj.shouldThrow = false;
Assert.equal(thirdLevel instanceof CSPContextClassByID, true);
Assert.equal(thirdLevel instanceof SimpleURIClassByID, true);
}
function run_test() {
var CSPContextClassByID = Components.classesByID["{09d9ed1a-e5d4-4004-bfe0-27ceb923d9ac}"];
var SimpleURIClassByID = Components.classesByID["{e0da1d70-2f7b-11d3-8cd0-0060b0fc14a3}"];
testActual(CSPContextClassByID);
testInherited(CSPContextClassByID);
testInheritedCrossGlobal(CSPContextClassByID);
testCrossGlobalArbitraryGetPrototype(CSPContextClassByID);
testActual(SimpleURIClassByID);
testInherited(SimpleURIClassByID);
testInheritedCrossGlobal(SimpleURIClassByID);
testCrossGlobalArbitraryGetPrototype(SimpleURIClassByID);
}

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

@ -220,8 +220,7 @@ already_AddRefed<nsIPresentationService> NS_CreatePresentationService();
// Factory Constructor
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(txNodeSetAdaptor, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMSerializer)
typedef nsHostObjectURI::Mutator nsHostObjectURIMutator;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHostObjectURIMutator)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHostObjectURI)
NS_GENERIC_FACTORY_CONSTRUCTOR(DOMParser)
NS_GENERIC_FACTORY_CONSTRUCTOR(LocalStorageManager)
NS_GENERIC_FACTORY_CONSTRUCTOR(SessionStorageManager)
@ -435,8 +434,7 @@ MAKE_CTOR(CreateFocusManager, nsIFocusManager, NS_NewFocusManag
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStyleSheetService, Init)
typedef nsJSURI::Mutator nsJSURIMutator;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsJSURIMutator)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsJSURI)
// views are not refcounted, so this is the same as
// NS_GENERIC_FACTORY_CONSTRUCTOR without the NS_ADDREF/NS_RELEASE
@ -575,7 +573,6 @@ NS_DEFINE_NAMED_CID(NS_XULDOCUMENT_CID);
NS_DEFINE_NAMED_CID(NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID);
NS_DEFINE_NAMED_CID(NS_JSPROTOCOLHANDLER_CID);
NS_DEFINE_NAMED_CID(NS_JSURI_CID);
NS_DEFINE_NAMED_CID(NS_JSURIMUTATOR_CID);
NS_DEFINE_NAMED_CID(NS_WINDOWCOMMANDTABLE_CID);
NS_DEFINE_NAMED_CID(NS_WINDOWCONTROLLER_CID);
NS_DEFINE_NAMED_CID(NS_PLUGINDOCLOADERFACTORY_CID);
@ -585,7 +582,6 @@ NS_DEFINE_NAMED_CID(NS_STYLESHEETSERVICE_CID);
NS_DEFINE_NAMED_CID(TRANSFORMIIX_NODESET_CID);
NS_DEFINE_NAMED_CID(NS_XMLSERIALIZER_CID);
NS_DEFINE_NAMED_CID(NS_HOSTOBJECTURI_CID);
NS_DEFINE_NAMED_CID(NS_HOSTOBJECTURIMUTATOR_CID);
NS_DEFINE_NAMED_CID(NS_DOMPARSER_CID);
NS_DEFINE_NAMED_CID(NS_DOMSESSIONSTORAGEMANAGER_CID);
NS_DEFINE_NAMED_CID(NS_DOMLOCALSTORAGEMANAGER_CID);
@ -823,8 +819,7 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
#endif
{ &kNS_CONTENT_DOCUMENT_LOADER_FACTORY_CID, false, nullptr, CreateContentDLF },
{ &kNS_JSPROTOCOLHANDLER_CID, false, nullptr, nsJSProtocolHandler::Create },
{ &kNS_JSURI_CID, false, nullptr, nsJSURIMutatorConstructor }, // do_CreateInstance returns mutator
{ &kNS_JSURIMUTATOR_CID, false, nullptr, nsJSURIMutatorConstructor },
{ &kNS_JSURI_CID, false, nullptr, nsJSURIConstructor },
{ &kNS_WINDOWCOMMANDTABLE_CID, false, nullptr, CreateWindowCommandTableConstructor },
{ &kNS_WINDOWCONTROLLER_CID, false, nullptr, CreateWindowControllerWithSingletonCommandTable },
{ &kNS_PLUGINDOCLOADERFACTORY_CID, false, nullptr, CreateContentDLF },
@ -833,8 +828,7 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
{ &kNS_STYLESHEETSERVICE_CID, false, nullptr, nsStyleSheetServiceConstructor },
{ &kTRANSFORMIIX_NODESET_CID, false, nullptr, txNodeSetAdaptorConstructor },
{ &kNS_XMLSERIALIZER_CID, false, nullptr, nsDOMSerializerConstructor },
{ &kNS_HOSTOBJECTURI_CID, false, nullptr, nsHostObjectURIMutatorConstructor }, // do_CreateInstance returns mutator
{ &kNS_HOSTOBJECTURIMUTATOR_CID, false, nullptr, nsHostObjectURIMutatorConstructor },
{ &kNS_HOSTOBJECTURI_CID, false, nullptr, nsHostObjectURIConstructor },
{ &kNS_DOMPARSER_CID, false, nullptr, DOMParserConstructor },
{ &kNS_DOMSESSIONSTORAGEMANAGER_CID, false, nullptr, SessionStorageManagerConstructor },
{ &kNS_DOMLOCALSTORAGEMANAGER_CID, false, nullptr, LocalStorageManagerConstructor },

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

@ -20,6 +20,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsJAR)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsZipReaderCache)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsJARProtocolHandler,
nsJARProtocolHandler::GetSingleton)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsJARURI)
typedef nsJARURI::Mutator nsJARURIMutator;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsJARURIMutator)
@ -34,7 +35,7 @@ static const mozilla::Module::CIDEntry kJARCIDs[] = {
{ &kNS_ZIPREADER_CID, false, nullptr, nsJARConstructor },
{ &kNS_ZIPREADERCACHE_CID, false, nullptr, nsZipReaderCacheConstructor },
{ &kNS_JARPROTOCOLHANDLER_CID, false, nullptr, nsJARProtocolHandlerConstructor },
{ &kNS_JARURI_CID, false, nullptr, nsJARURIMutatorConstructor }, // do_CreateInstance returns mutator
{ &kNS_JARURI_CID, false, nullptr, nsJARURIConstructor },
{ &kNS_JARURIMUTATOR_CID, false, nullptr, nsJARURIMutatorConstructor },
{ nullptr }
};

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

@ -107,14 +107,7 @@ nsJARURI::CreateEntryURL(const nsACString& entryFilename,
// nsISerializable methods:
NS_IMETHODIMP
nsJARURI::Read(nsIObjectInputStream *aStream)
{
NS_NOTREACHED("Use nsIURIMutator.read() instead");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsJARURI::ReadPrivate(nsIObjectInputStream *aInputStream)
nsJARURI::Read(nsIObjectInputStream* aInputStream)
{
nsresult rv;
@ -263,12 +256,7 @@ nsJARURI::SetSpecInternal(const nsACString& aSpec)
return SetSpecWithBase(aSpec, nullptr);
}
// Queries this list of interfaces. If none match, it queries mURI.
NS_IMPL_NSIURIMUTATOR_ISUPPORTS(nsJARURI::Mutator,
nsIURISetters,
nsIURIMutator,
nsIURLMutator,
nsISerializable)
NS_IMPL_ISUPPORTS(nsJARURI::Mutator, nsIURISetters, nsIURIMutator, nsIURLMutator)
NS_IMETHODIMP
nsJARURI::Mutator::SetFileName(const nsACString& aFileName, nsIURIMutator** aMutator)

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

@ -114,7 +114,6 @@ private:
nsresult SetQuery(const nsACString &input);
nsresult SetQueryWithEncoding(const nsACString &input, const Encoding* encoding);
bool Deserialize(const mozilla::ipc::URIParams&);
nsresult ReadPrivate(nsIObjectInputStream *aStream);
nsresult SetFileNameInternal(const nsACString& fileName);
nsresult SetFileBaseNameInternal(const nsACString& fileBaseName);
@ -125,25 +124,12 @@ public:
: public nsIURIMutator
, public BaseURIMutator<nsJARURI>
, public nsIURLMutator
, public nsISerializable
{
NS_DECL_ISUPPORTS
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
NS_DEFINE_NSIMUTATOR_COMMON
NS_DECL_NSIURLMUTATOR
NS_IMETHOD
Write(nsIObjectOutputStream *aOutputStream) override
{
return NS_ERROR_NOT_IMPLEMENTED;
}
MOZ_MUST_USE NS_IMETHOD
Read(nsIObjectInputStream* aStream) override
{
return InitFromInputStream(aStream);
}
explicit Mutator() { }
private:
virtual ~Mutator() { }

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

@ -46,7 +46,7 @@ protected:
MOZ_MUST_USE nsresult InitFromInputStream(nsIObjectInputStream* aStream)
{
RefPtr<T> uri = new T();
nsresult rv = uri->ReadPrivate(aStream);
nsresult rv = uri->Read(aStream);
if (NS_FAILED(rv)) {
return rv;
}
@ -98,6 +98,12 @@ protected:
} \
\
MOZ_MUST_USE NS_IMETHOD \
Read(nsIObjectInputStream* aStream) override \
{ \
return InitFromInputStream(aStream); \
} \
\
MOZ_MUST_USE NS_IMETHOD \
Finalize(nsIURI** aURI) override \
{ \
mURI.forget(aURI); return NS_OK; \
@ -109,39 +115,6 @@ protected:
if (aMutator) NS_ADDREF(*aMutator = this); \
return InitFromSpec(aSpec); \
} \
// Implements AddRef, Release and QueryInterface for the mutator
#define NS_IMPL_NSIURIMUTATOR_ISUPPORTS(aClass, ...) \
NS_IMPL_ADDREF(aClass) \
NS_IMPL_RELEASE(aClass) \
NS_IMPL_NSIURIMUTATOR_QUERY_INTERFACE(aClass, __VA_ARGS__) \
// The list of interfaces is queried and an AddRef-ed pointer is returned if
// there is a match. Otherwise, we call QueryInterface on mURI and return.
// The reason for this specialized QueryInterface implementation is that we
// we want to be able to instantiate the mutator for a given CID of a
// nsIURI implementation, call nsISerializable.Read() on the mutator to
// deserialize the URI then QueryInterface the mutator to an nsIURI interface.
// See bug 1442239.
// If you QueryInterface a mutator to an interface of the URI
// implementation this is similar to calling Finalize.
#define NS_IMPL_NSIURIMUTATOR_QUERY_INTERFACE(aClass, ...) \
static_assert(MOZ_ARG_COUNT(__VA_ARGS__) > 0, \
"Need more arguments"); \
NS_INTERFACE_MAP_BEGIN(aClass) \
nsCOMPtr<nsIURI> uri; \
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIURIMutator) \
MOZ_FOR_EACH(NS_INTERFACE_MAP_ENTRY, (), (__VA_ARGS__)) \
if (aIID.Equals(NS_GET_IID(nsIClassInfo))) { \
foundInterface = nullptr; \
} else \
if (mURI && \
NS_SUCCEEDED(mURI->QueryInterface(aIID, getter_AddRefs(uri)))) { \
mURI = nullptr; \
foundInterface = uri.get(); \
} else \
NS_INTERFACE_MAP_END \
%}
[ptr] native Encoding(const mozilla::Encoding);
@ -279,6 +252,14 @@ interface nsIURISetters : nsIURISetSpec
[scriptable, builtinclass, uuid(4d1f3103-1c44-4dcd-b717-5d22a697a7d9)]
interface nsIURIMutator : nsIURISetters
{
/**
* Initializes the URI by reading from the input stream.
* The input stream must contain the serialization of the same object type.
* See nsISerializable.
*/
[must_use]
void read(in nsIObjectInputStream aInputStream);
/**
* Initalizes the URI by reading IPC URIParams.
* See nsIIPCSerializableURI.

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

@ -28,16 +28,9 @@ nsSimpleNestedURI::nsSimpleNestedURI(nsIURI* innerURI)
// nsISerializable
NS_IMETHODIMP
nsSimpleNestedURI::Read(nsIObjectInputStream *aStream)
nsSimpleNestedURI::Read(nsIObjectInputStream* aStream)
{
NS_NOTREACHED("Use nsIURIMutator.read() instead");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsSimpleNestedURI::ReadPrivate(nsIObjectInputStream *aStream)
{
nsresult rv = nsSimpleURI::ReadPrivate(aStream);
nsresult rv = nsSimpleURI::Read(aStream);
if (NS_FAILED(rv)) return rv;
NS_ASSERTION(!mMutable, "How did that happen?");
@ -193,11 +186,7 @@ nsSimpleNestedURI::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
return NS_OK;
}
// Queries this list of interfaces. If none match, it queries mURI.
NS_IMPL_NSIURIMUTATOR_ISUPPORTS(nsSimpleNestedURI::Mutator,
nsIURISetters,
nsIURIMutator,
nsISerializable)
NS_IMPL_ISUPPORTS(nsSimpleNestedURI::Mutator, nsIURISetters, nsIURIMutator)
NS_IMETHODIMP
nsSimpleNestedURI::Mutate(nsIURIMutator** aMutator)

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

@ -71,13 +71,11 @@ protected:
nsCOMPtr<nsIURI> mInnerURI;
bool Deserialize(const mozilla::ipc::URIParams&);
nsresult ReadPrivate(nsIObjectInputStream *stream);
public:
class Mutator final
: public nsIURIMutator
, public BaseURIMutator<nsSimpleNestedURI>
, public nsISerializable
{
NS_DECL_ISUPPORTS
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
@ -92,12 +90,6 @@ public:
return InitFromIPCParams(aParams);
}
NS_IMETHOD
Write(nsIObjectOutputStream *aOutputStream) override
{
return NS_ERROR_NOT_IMPLEMENTED;
}
MOZ_MUST_USE NS_IMETHOD
Read(nsIObjectInputStream* aStream) override
{

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

@ -75,14 +75,7 @@ NS_INTERFACE_MAP_END
// nsISerializable methods:
NS_IMETHODIMP
nsSimpleURI::Read(nsIObjectInputStream *aStream)
{
NS_NOTREACHED("Use nsIURIMutator.read() instead");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsSimpleURI::ReadPrivate(nsIObjectInputStream *aStream)
nsSimpleURI::Read(nsIObjectInputStream* aStream)
{
nsresult rv;
@ -884,11 +877,8 @@ nsSimpleURI::SetQueryWithEncoding(const nsACString& aQuery,
return SetQuery(aQuery);
}
// Queries this list of interfaces. If none match, it queries mURI.
NS_IMPL_NSIURIMUTATOR_ISUPPORTS(nsSimpleURI::Mutator,
nsIURISetters,
nsIURIMutator,
nsISerializable)
NS_IMPL_ISUPPORTS(nsSimpleURI::Mutator, nsIURISetters, nsIURIMutator)
NS_IMETHODIMP
nsSimpleURI::Mutate(nsIURIMutator** aMutator)

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

@ -88,7 +88,6 @@ protected:
virtual nsresult SetFilePath(const nsACString &input);
virtual nsresult SetQuery(const nsACString &input);
virtual nsresult SetQueryWithEncoding(const nsACString &input, const Encoding* encoding);
nsresult ReadPrivate(nsIObjectInputStream *stream);
// Helper to share code between Equals methods.
virtual nsresult EqualsInternal(nsIURI* other,
@ -133,24 +132,11 @@ public:
class Mutator final
: public nsIURIMutator
, public BaseURIMutator<nsSimpleURI>
, public nsISerializable
{
NS_DECL_ISUPPORTS
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
NS_DEFINE_NSIMUTATOR_COMMON
NS_IMETHOD
Write(nsIObjectOutputStream *aOutputStream) override
{
return NS_ERROR_NOT_IMPLEMENTED;
}
MOZ_MUST_USE NS_IMETHOD
Read(nsIObjectInputStream* aStream) override
{
return InitFromInputStream(aStream);
}
explicit Mutator() { }
private:
virtual ~Mutator() { }

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

@ -2219,14 +2219,12 @@ nsStandardURL::SetPathQueryRef(const nsACString &input)
}
// When updating this also update SubstitutingURL::Mutator
// Queries this list of interfaces. If none match, it queries mURI.
NS_IMPL_NSIURIMUTATOR_ISUPPORTS(nsStandardURL::Mutator,
NS_IMPL_ISUPPORTS(nsStandardURL::Mutator,
nsIURISetters,
nsIURIMutator,
nsIStandardURLMutator,
nsIURLMutator,
nsIFileURLMutator,
nsISerializable)
nsIFileURLMutator)
NS_IMETHODIMP
nsStandardURL::Mutate(nsIURIMutator** aMutator)
@ -3388,13 +3386,6 @@ nsStandardURL::SetMutable(bool value)
NS_IMETHODIMP
nsStandardURL::Read(nsIObjectInputStream *stream)
{
NS_NOTREACHED("Use nsIURIMutator.read() instead");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsStandardURL::ReadPrivate(nsIObjectInputStream *stream)
{
NS_PRECONDITION(mDisplayHost.IsEmpty(), "Shouldn't have cached unicode host");
NS_PRECONDITION(mSpecEncoding == eEncoding_Unknown,

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

@ -194,7 +194,6 @@ protected:
virtual nsresult SetQuery(const nsACString &input);
virtual nsresult SetQueryWithEncoding(const nsACString &input, const Encoding* encoding);
bool Deserialize(const mozilla::ipc::URIParams&);
nsresult ReadPrivate(nsIObjectInputStream *stream);
private:
nsresult Init(uint32_t urlType, int32_t defaultPort, const nsACString &spec,
@ -348,7 +347,6 @@ public:
, public nsIStandardURLMutator
, public nsIURLMutator
, public nsIFileURLMutator
, public nsISerializable
{
NS_FORWARD_SAFE_NSIURISETTERS_RET(BaseURIMutator<T>::mURI)
@ -358,13 +356,6 @@ public:
return BaseURIMutator<T>::InitFromIPCParams(aParams);
}
NS_IMETHOD
Write(nsIObjectOutputStream *aOutputStream) override
{
NS_NOTREACHED("Use nsIURIMutator.read() instead");
return NS_ERROR_NOT_IMPLEMENTED;
}
MOZ_MUST_USE NS_IMETHOD
Read(nsIObjectInputStream* aStream) override
{

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

@ -101,14 +101,6 @@
{ 0xa7, 0x85, 0x85, 0xc3, 0x94, 0x01, 0x25, 0x03 } \
}
#define NS_SIMPLENESTEDURIMUTATOR_CID \
{ /* 9c4e9d49-ce64-4ca3-acef-3075c5e5aba7 */ \
0x9c4e9d49, \
0xce64, \
0x4ca3, \
{ 0xac, 0xef, 0x30, 0x75, 0xc5, 0xe5, 0xab, 0xa7 } \
}
// component inheriting from the nested simple URI component and also
// carrying along its base URI
#define NS_NESTEDABOUTURI_CID \
@ -119,14 +111,6 @@
{ 0xb9, 0x36, 0x41, 0x32, 0x6b, 0xa4, 0x8a, 0xae } \
}
#define NS_NESTEDABOUTURIMUTATOR_CID \
{ /* b0054ef3-b096-483d-8242-4ee36b7b2115 */ \
0xb0054ef3, \
0xb096, \
0x483d, \
{ 0x82, 0x42, 0x4e, 0xe3, 0x6b, 0x7b, 0x21, 0x15 } \
}
// component implementing nsIStandardURL, nsIURI, nsIURL, nsISerializable,
// and nsIClassInfo.
#define NS_STANDARDURL_CONTRACTID \
@ -712,13 +696,6 @@
{ 0xbd, 0xe9, 0xcc, 0xef, 0x5d, 0x8a, 0xb4, 0x73 } \
}
#define NS_SUBSTITUTINGURLMUTATOR_CID \
{ 0xb3cfeb91, \
0x332a, \
0x46c9, \
{ 0xad, 0x97, 0x93, 0xff, 0x39, 0x84, 0x14, 0x94 } \
}
/******************************************************************************
* netwerk/protocol/file/ classes
*/

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

@ -222,10 +222,10 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsWifiMonitor)
#include "nsAboutBlank.h"
typedef mozilla::net::nsAboutProtocolHandler nsAboutProtocolHandler;
typedef mozilla::net::nsSafeAboutProtocolHandler nsSafeAboutProtocolHandler;
typedef mozilla::net::nsNestedAboutURI::Mutator nsNestedAboutURIMutator;
typedef mozilla::net::nsNestedAboutURI nsNestedAboutURI;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAboutProtocolHandler)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSafeAboutProtocolHandler)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNestedAboutURIMutator)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNestedAboutURI)
// about
#include "nsAboutCache.h"
@ -294,13 +294,12 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(NamedPipeService, Init)
#include "nsResProtocolHandler.h"
#include "ExtensionProtocolHandler.h"
#include "SubstitutingProtocolHandler.h"
typedef mozilla::net::SubstitutingURL::Mutator SubstitutingURLMutator;
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsResProtocolHandler, Init)
namespace mozilla {
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ExtensionProtocolHandler,
ExtensionProtocolHandler::GetSingleton)
NS_GENERIC_FACTORY_CONSTRUCTOR(SubstitutingURLMutator)
NS_GENERIC_FACTORY_CONSTRUCTOR(SubstitutingURL)
} // namespace mozilla
#include "nsViewSourceHandler.h"
@ -364,13 +363,17 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAuthURLParser)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsStdURLParser)
#include "nsStandardURL.h"
typedef mozilla::net::nsStandardURL nsStandardURL;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsStandardURL)
typedef mozilla::net::nsStandardURL::Mutator nsStandardURLMutator;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsStandardURLMutator)
typedef mozilla::net::nsSimpleURI nsSimpleURI;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSimpleURI)
typedef mozilla::net::nsSimpleURI::Mutator nsSimpleURIMutator;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSimpleURIMutator)
typedef mozilla::net::nsSimpleNestedURI::Mutator nsSimpleNestedURIMutator;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSimpleNestedURIMutator)
typedef mozilla::net::nsSimpleNestedURI nsSimpleNestedURI;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSimpleNestedURI)
///////////////////////////////////////////////////////////////////////////////
@ -643,7 +646,7 @@ static nsresult nsNetStartup()
static void nsNetShutdown()
{
// Release the url parser that the stdurl is holding.
mozilla::net::nsStandardURL::ShutdownGlobalObjects();
nsStandardURL::ShutdownGlobalObjects();
// Release global state used by the URL helper module.
net_ShutdownURLHelper();
@ -678,7 +681,6 @@ NS_DEFINE_NAMED_CID(NS_EFFECTIVETLDSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_SIMPLEURI_CID);
NS_DEFINE_NAMED_CID(NS_SIMPLEURIMUTATOR_CID);
NS_DEFINE_NAMED_CID(NS_SIMPLENESTEDURI_CID);
NS_DEFINE_NAMED_CID(NS_SIMPLENESTEDURIMUTATOR_CID);
NS_DEFINE_NAMED_CID(NS_ASYNCSTREAMCOPIER_CID);
NS_DEFINE_NAMED_CID(NS_INPUTSTREAMPUMP_CID);
NS_DEFINE_NAMED_CID(NS_INPUTSTREAMCHANNEL_CID);
@ -740,12 +742,10 @@ NS_DEFINE_NAMED_CID(NS_FTPPROTOCOLHANDLER_CID);
NS_DEFINE_NAMED_CID(NS_RESPROTOCOLHANDLER_CID);
NS_DEFINE_NAMED_CID(NS_EXTENSIONPROTOCOLHANDLER_CID);
NS_DEFINE_NAMED_CID(NS_SUBSTITUTINGURL_CID);
NS_DEFINE_NAMED_CID(NS_SUBSTITUTINGURLMUTATOR_CID);
NS_DEFINE_NAMED_CID(NS_ABOUTPROTOCOLHANDLER_CID);
NS_DEFINE_NAMED_CID(NS_SAFEABOUTPROTOCOLHANDLER_CID);
NS_DEFINE_NAMED_CID(NS_ABOUT_BLANK_MODULE_CID);
NS_DEFINE_NAMED_CID(NS_NESTEDABOUTURI_CID);
NS_DEFINE_NAMED_CID(NS_NESTEDABOUTURIMUTATOR_CID);
NS_DEFINE_NAMED_CID(NS_ABOUT_CACHE_MODULE_CID);
NS_DEFINE_NAMED_CID(NS_ABOUT_CACHE_ENTRY_MODULE_CID);
NS_DEFINE_NAMED_CID(NS_SOCKSSOCKETPROVIDER_CID);
@ -798,10 +798,9 @@ static const mozilla::Module::CIDEntry kNeckoCIDs[] = {
{ &kNS_DNSSERVICE_CID, false, nullptr, nsIDNSServiceConstructor },
{ &kNS_IDNSERVICE_CID, false, nullptr, nsIDNServiceConstructor },
{ &kNS_EFFECTIVETLDSERVICE_CID, false, nullptr, nsEffectiveTLDServiceConstructor },
{ &kNS_SIMPLEURI_CID, false, nullptr, nsSimpleURIMutatorConstructor }, // do_CreateInstance returns mutator
{ &kNS_SIMPLEURI_CID, false, nullptr, nsSimpleURIConstructor },
{ &kNS_SIMPLEURIMUTATOR_CID, false, nullptr, nsSimpleURIMutatorConstructor },
{ &kNS_SIMPLENESTEDURI_CID, false, nullptr, nsSimpleNestedURIMutatorConstructor }, // do_CreateInstance returns mutator
{ &kNS_SIMPLENESTEDURIMUTATOR_CID, false, nullptr, nsSimpleNestedURIMutatorConstructor },
{ &kNS_SIMPLENESTEDURI_CID, false, nullptr, nsSimpleNestedURIConstructor },
{ &kNS_ASYNCSTREAMCOPIER_CID, false, nullptr, nsAsyncStreamCopierConstructor },
{ &kNS_INPUTSTREAMPUMP_CID, false, nullptr, nsInputStreamPumpConstructor },
{ &kNS_INPUTSTREAMCHANNEL_CID, false, nullptr, nsInputStreamChannelConstructor },
@ -827,7 +826,7 @@ static const mozilla::Module::CIDEntry kNeckoCIDs[] = {
{ &kNS_STDURLPARSER_CID, false, nullptr, nsStdURLParserConstructor },
{ &kNS_NOAUTHURLPARSER_CID, false, nullptr, nsNoAuthURLParserConstructor },
{ &kNS_AUTHURLPARSER_CID, false, nullptr, nsAuthURLParserConstructor },
{ &kNS_STANDARDURL_CID, false, nullptr, nsStandardURLMutatorConstructor }, // do_CreateInstance returns mutator
{ &kNS_STANDARDURL_CID, false, nullptr, nsStandardURLConstructor },
{ &kNS_STANDARDURLMUTATOR_CID, false, nullptr, nsStandardURLMutatorConstructor },
{ &kNS_ARRAYBUFFERINPUTSTREAM_CID, false, nullptr, ArrayBufferInputStreamConstructor },
{ &kNS_BUFFEREDINPUTSTREAM_CID, false, nullptr, nsBufferedInputStream::Create },
@ -864,13 +863,11 @@ static const mozilla::Module::CIDEntry kNeckoCIDs[] = {
{ &kNS_FTPPROTOCOLHANDLER_CID, false, nullptr, nsFtpProtocolHandlerConstructor },
{ &kNS_RESPROTOCOLHANDLER_CID, false, nullptr, nsResProtocolHandlerConstructor },
{ &kNS_EXTENSIONPROTOCOLHANDLER_CID, false, nullptr, mozilla::ExtensionProtocolHandlerConstructor },
{ &kNS_SUBSTITUTINGURL_CID, false, nullptr, mozilla::SubstitutingURLMutatorConstructor }, // do_CreateInstance returns mutator
{ &kNS_SUBSTITUTINGURLMUTATOR_CID, false, nullptr, mozilla::SubstitutingURLMutatorConstructor },
{ &kNS_SUBSTITUTINGURL_CID, false, nullptr, mozilla::SubstitutingURLConstructor },
{ &kNS_ABOUTPROTOCOLHANDLER_CID, false, nullptr, nsAboutProtocolHandlerConstructor },
{ &kNS_SAFEABOUTPROTOCOLHANDLER_CID, false, nullptr, nsSafeAboutProtocolHandlerConstructor },
{ &kNS_ABOUT_BLANK_MODULE_CID, false, nullptr, nsAboutBlank::Create },
{ &kNS_NESTEDABOUTURI_CID, false, nullptr, nsNestedAboutURIMutatorConstructor }, // do_CreateInstance returns mutator
{ &kNS_NESTEDABOUTURIMUTATOR_CID, false, nullptr, nsNestedAboutURIMutatorConstructor },
{ &kNS_NESTEDABOUTURI_CID, false, nullptr, nsNestedAboutURIConstructor },
{ &kNS_ABOUT_CACHE_MODULE_CID, false, nullptr, nsAboutCache::Create },
{ &kNS_ABOUT_CACHE_ENTRY_MODULE_CID, false, nullptr, nsAboutCacheEntryConstructor },
{ &kNS_SOCKSSOCKETPROVIDER_CID, false, nullptr, nsSOCKSSocketProvider::CreateV5 },
@ -928,6 +925,7 @@ static const mozilla::Module::ContractIDEntry kNeckoContracts[] = {
{ NS_DNSSERVICE_CONTRACTID, &kNS_DNSSERVICE_CID },
{ NS_IDNSERVICE_CONTRACTID, &kNS_IDNSERVICE_CID },
{ NS_EFFECTIVETLDSERVICE_CONTRACTID, &kNS_EFFECTIVETLDSERVICE_CID },
{ NS_SIMPLEURI_CONTRACTID, &kNS_SIMPLEURI_CID },
{ NS_SIMPLEURIMUTATOR_CONTRACTID, &kNS_SIMPLEURIMUTATOR_CID },
{ NS_ASYNCSTREAMCOPIER_CONTRACTID, &kNS_ASYNCSTREAMCOPIER_CID },
{ NS_INPUTSTREAMPUMP_CONTRACTID, &kNS_INPUTSTREAMPUMP_CID },
@ -952,6 +950,7 @@ static const mozilla::Module::ContractIDEntry kNeckoContracts[] = {
{ NS_STDURLPARSER_CONTRACTID, &kNS_STDURLPARSER_CID },
{ NS_NOAUTHURLPARSER_CONTRACTID, &kNS_NOAUTHURLPARSER_CID },
{ NS_AUTHURLPARSER_CONTRACTID, &kNS_AUTHURLPARSER_CID },
{ NS_STANDARDURL_CONTRACTID, &kNS_STANDARDURL_CID },
{ NS_STANDARDURLMUTATOR_CONTRACTID, &kNS_STANDARDURLMUTATOR_CID },
{ NS_ARRAYBUFFERINPUTSTREAM_CONTRACTID, &kNS_ARRAYBUFFERINPUTSTREAM_CID },
{ NS_BUFFEREDINPUTSTREAM_CONTRACTID, &kNS_BUFFEREDINPUTSTREAM_CID },

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

@ -360,18 +360,10 @@ NS_INTERFACE_MAP_BEGIN(nsNestedAboutURI)
NS_INTERFACE_MAP_END_INHERITING(nsSimpleNestedURI)
// nsISerializable
NS_IMETHODIMP
nsNestedAboutURI::Read(nsIObjectInputStream *aStream)
nsNestedAboutURI::Read(nsIObjectInputStream* aStream)
{
NS_NOTREACHED("Use nsIURIMutator.read() instead");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsNestedAboutURI::ReadPrivate(nsIObjectInputStream *aStream)
{
nsresult rv = nsSimpleNestedURI::ReadPrivate(aStream);
nsresult rv = nsSimpleNestedURI::Read(aStream);
if (NS_FAILED(rv)) return rv;
bool haveBase;
@ -447,11 +439,7 @@ nsNestedAboutURI::StartClone(nsSimpleURI::RefHandlingEnum aRefHandlingMode,
return url;
}
// Queries this list of interfaces. If none match, it queries mURI.
NS_IMPL_NSIURIMUTATOR_ISUPPORTS(nsNestedAboutURI::Mutator,
nsIURISetters,
nsIURIMutator,
nsISerializable)
NS_IMPL_ISUPPORTS(nsNestedAboutURI::Mutator, nsIURISetters, nsIURIMutator)
NS_IMETHODIMP
nsNestedAboutURI::Mutate(nsIURIMutator** aMutator)

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

@ -87,13 +87,11 @@ public:
protected:
nsCOMPtr<nsIURI> mBaseURI;
nsresult ReadPrivate(nsIObjectInputStream *stream);
public:
class Mutator final
: public nsIURIMutator
, public BaseURIMutator<nsNestedAboutURI>
, public nsISerializable
{
NS_DECL_ISUPPORTS
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
@ -108,12 +106,6 @@ public:
return InitFromIPCParams(aParams);
}
NS_IMETHOD
Write(nsIObjectOutputStream *aOutputStream) override
{
return NS_ERROR_NOT_IMPLEMENTED;
}
MOZ_MUST_USE NS_IMETHOD
Read(nsIObjectInputStream* aStream) override
{

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

@ -32,15 +32,12 @@ static NS_DEFINE_CID(kSubstitutingURLCID, NS_SUBSTITUTINGURL_CID);
// SubstitutingURL : overrides nsStandardURL::GetFile to provide nsIFile resolution
//---------------------------------------------------------------------------------
// The list of interfaces should be in sync with nsStandardURL
// Queries this list of interfaces. If none match, it queries mURI.
NS_IMPL_NSIURIMUTATOR_ISUPPORTS(SubstitutingURL::Mutator,
NS_IMPL_ISUPPORTS(SubstitutingURL::Mutator,
nsIURISetters,
nsIURIMutator,
nsIStandardURLMutator,
nsIURLMutator,
nsIFileURLMutator,
nsISerializable)
nsIFileURLMutator)
nsresult
SubstitutingURL::EnsureFile()

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

@ -21,22 +21,3 @@ add_task(async function test_simple_setter_chaining() {
.finalize();
equal(uri.spec, "ftp://example.com/?hello#bla");
});
add_task(async function test_qi_behaviour() {
let uri = standardMutator()
.setSpec("http://example.com/")
.QueryInterface(Ci.nsIURI);
equal(uri.spec, "http://example.com/");
Assert.throws(() => { uri = standardMutator().QueryInterface(Ci.nsIURI); },
/NS_NOINTERFACE/,
"mutator doesn't QI if it holds no URI");
let mutator = standardMutator()
.setSpec("http://example.com/path");
uri = mutator.QueryInterface(Ci.nsIURI);
equal(uri.spec, "http://example.com/path");
Assert.throws(() => { uri = mutator.QueryInterface(Ci.nsIURI); },
/NS_NOINTERFACE/,
"Second QueryInterface should fail");
});