зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1420954) for build failure in /builds/worker/workspace/build/src/obj-firefox/dist/include/nsIURIMutator.h:340:3: r=backout on a CLOSED TREE
Backed out changeset 8ce0a0d49d9e (bug 1420954) Backed out changeset 480c6e1721e9 (bug 1420954)
This commit is contained in:
Родитель
fecd3a9c13
Коммит
7ba06ee564
|
@ -58,7 +58,7 @@ public:
|
|||
, public BaseURIMutator<NullPrincipalURI>
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
|
||||
NS_FORWARD_SAFE_NSIURISETTERS(mURI)
|
||||
|
||||
NS_IMETHOD Deserialize(const mozilla::ipc::URIParams& aParams) override
|
||||
{
|
||||
|
@ -76,9 +76,8 @@ public:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD SetSpec(const nsACString & aSpec, nsIURIMutator** aMutator) override
|
||||
NS_IMETHOD SetSpec(const nsACString & aSpec) override
|
||||
{
|
||||
NS_ADDREF(*aMutator = this);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
, public BaseURIMutator<nsHostObjectURI>
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
|
||||
NS_FORWARD_SAFE_NSIURISETTERS(mURI)
|
||||
NS_DEFINE_NSIMUTATOR_COMMON
|
||||
|
||||
explicit Mutator() { }
|
||||
|
|
|
@ -110,7 +110,7 @@ public:
|
|||
, public BaseURIMutator<nsJSURI>
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
|
||||
NS_FORWARD_SAFE_NSIURISETTERS(mURI)
|
||||
NS_DEFINE_NSIMUTATOR_COMMON
|
||||
|
||||
explicit Mutator() { }
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
, public BaseURIMutator<nsMozIconURI>
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
|
||||
NS_FORWARD_SAFE_NSIURISETTERS(mURI)
|
||||
|
||||
NS_IMETHOD Deserialize(const mozilla::ipc::URIParams& aParams) override
|
||||
{
|
||||
|
@ -69,8 +69,7 @@ public:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD SetSpec(const nsACString & aSpec, nsIURIMutator** aMutator) override {
|
||||
NS_ADDREF(*aMutator = this);
|
||||
NS_IMETHOD SetSpec(const nsACString & aSpec) override {
|
||||
return InitFromSpec(aSpec);
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ public:
|
|||
, public BaseURIMutator<nsJARURI>
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
|
||||
NS_FORWARD_SAFE_NSIURISETTERS(mURI)
|
||||
NS_DEFINE_NSIMUTATOR_COMMON
|
||||
|
||||
explicit Mutator() { }
|
||||
|
|
|
@ -6,13 +6,10 @@
|
|||
#include "nsISupports.idl"
|
||||
interface nsIURI;
|
||||
interface nsIObjectInputStream;
|
||||
interface nsIURIMutator;
|
||||
|
||||
%{C++
|
||||
#include "nsStringGlue.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
extern nsresult NS_GetURIMutator(nsIURI* aURI, nsIURIMutator** aMutator);
|
||||
#undef SetPort // XXX Windows!
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -90,8 +87,9 @@ protected:
|
|||
{ return InitFromInputStream(aStream); } \
|
||||
NS_IMETHOD Finalize(nsIURI** aURI) override \
|
||||
{ mURI.forget(aURI); return NS_OK; } \
|
||||
NS_IMETHOD SetSpec(const nsACString & aSpec, nsIURIMutator** aMutator) override \
|
||||
{ if (aMutator) NS_ADDREF(*aMutator = this); return InitFromSpec(aSpec); }
|
||||
NS_IMETHOD SetSpec(const nsACString & aSpec) override \
|
||||
{ return InitFromSpec(aSpec); }
|
||||
|
||||
%}
|
||||
|
||||
[ptr] native Encoding(const mozilla::Encoding);
|
||||
|
@ -106,70 +104,27 @@ interface nsIURISetSpec : nsISupports
|
|||
* to define it separately, while the rest of the setters may be simply
|
||||
* forwarded to the mutable URI.
|
||||
*/
|
||||
nsIURIMutator setSpec(in AUTF8String aSpec);
|
||||
void setSpec(in AUTF8String aSpec);
|
||||
};
|
||||
|
||||
/**
|
||||
* These methods allow the mutator to change various parts of the URI.
|
||||
* They return the same nsIURIMutator so that we may chain setter operations:
|
||||
* Example:
|
||||
* let newURI = uri.mutate()
|
||||
* .setSpec("http://example.com")
|
||||
* .setQuery("hello")
|
||||
* .finalize();
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(5403a6ec-99d7-405e-8b45-9f805bbdfcef)]
|
||||
interface nsIURISetters : nsIURISetSpec
|
||||
{
|
||||
nsIURIMutator setScheme(in AUTF8String aScheme);
|
||||
nsIURIMutator setUserPass(in AUTF8String aUserPass);
|
||||
nsIURIMutator setUsername(in AUTF8String aUsername);
|
||||
nsIURIMutator setPassword(in AUTF8String aPassword);
|
||||
nsIURIMutator setHostPort(in AUTF8String aHostPort);
|
||||
nsIURIMutator setHostAndPort(in AUTF8String aHostAndPort);
|
||||
nsIURIMutator setHost(in AUTF8String aHost);
|
||||
nsIURIMutator setPort(in long aPort);
|
||||
nsIURIMutator setPathQueryRef(in AUTF8String aPathQueryRef);
|
||||
nsIURIMutator setRef(in AUTF8String aRef);
|
||||
nsIURIMutator setFilePath(in AUTF8String aFilePath);
|
||||
nsIURIMutator setQuery(in AUTF8String aQuery);
|
||||
[noscript] nsIURIMutator setQueryWithEncoding(in AUTF8String query, in Encoding encoding);
|
||||
void setScheme(in AUTF8String aScheme);
|
||||
void setUserPass(in AUTF8String aUserPass);
|
||||
void setUsername(in AUTF8String aUsername);
|
||||
void setPassword(in AUTF8String aPassword);
|
||||
void setHostPort(in AUTF8String aHostPort);
|
||||
void setHostAndPort(in AUTF8String aHostAndPort);
|
||||
void setHost(in AUTF8String aHost);
|
||||
void setPort(in long aPort);
|
||||
void setPathQueryRef(in AUTF8String aPathQueryRef);
|
||||
void setRef(in AUTF8String aRef);
|
||||
void setFilePath(in AUTF8String aFilePath);
|
||||
void setQuery(in AUTF8String aQuery);
|
||||
[noscript] void setQueryWithEncoding(in AUTF8String query, in Encoding encoding);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
// Using this macro instead of NS_FORWARD_SAFE_NSIURISETTERS makes chaining
|
||||
// setter operations possible.
|
||||
#define NS_FORWARD_SAFE_NSIURISETTERS_RET(_to) \
|
||||
NS_IMETHOD SetScheme(const nsACString & aScheme, nsIURIMutator** aMutator) override \
|
||||
{ if (aMutator) NS_ADDREF(*aMutator = this); return !_to ? NS_ERROR_NULL_POINTER : _to->SetScheme(aScheme); } \
|
||||
NS_IMETHOD SetUserPass(const nsACString & aUserPass, nsIURIMutator** aMutator) override \
|
||||
{ if (aMutator) NS_ADDREF(*aMutator = this); return !_to ? NS_ERROR_NULL_POINTER : _to->SetUserPass(aUserPass); } \
|
||||
NS_IMETHOD SetUsername(const nsACString & aUsername, nsIURIMutator** aMutator) override \
|
||||
{ if (aMutator) NS_ADDREF(*aMutator = this); return !_to ? NS_ERROR_NULL_POINTER : _to->SetUsername(aUsername); } \
|
||||
NS_IMETHOD SetPassword(const nsACString & aPassword, nsIURIMutator** aMutator) override \
|
||||
{ if (aMutator) NS_ADDREF(*aMutator = this); return !_to ? NS_ERROR_NULL_POINTER : _to->SetPassword(aPassword); } \
|
||||
NS_IMETHOD SetHostPort(const nsACString & aHostPort, nsIURIMutator** aMutator) override \
|
||||
{ if (aMutator) NS_ADDREF(*aMutator = this); return !_to ? NS_ERROR_NULL_POINTER : _to->SetHostPort(aHostPort); } \
|
||||
NS_IMETHOD SetHostAndPort(const nsACString & aHostAndPort, nsIURIMutator** aMutator) override \
|
||||
{ if (aMutator) NS_ADDREF(*aMutator = this); return !_to ? NS_ERROR_NULL_POINTER : _to->SetHostAndPort(aHostAndPort); } \
|
||||
NS_IMETHOD SetHost(const nsACString & aHost, nsIURIMutator** aMutator) override \
|
||||
{ if (aMutator) NS_ADDREF(*aMutator = this); return !_to ? NS_ERROR_NULL_POINTER : _to->SetHost(aHost); } \
|
||||
NS_IMETHOD SetPort(int32_t aPort, nsIURIMutator** aMutator) override \
|
||||
{ if (aMutator) NS_ADDREF(*aMutator = this); return !_to ? NS_ERROR_NULL_POINTER : _to->SetPort(aPort); } \
|
||||
NS_IMETHOD SetPathQueryRef(const nsACString & aPathQueryRef, nsIURIMutator** aMutator) override \
|
||||
{ if (aMutator) NS_ADDREF(*aMutator = this); return !_to ? NS_ERROR_NULL_POINTER : _to->SetPathQueryRef(aPathQueryRef); } \
|
||||
NS_IMETHOD SetRef(const nsACString & aRef, nsIURIMutator** aMutator) override \
|
||||
{ if (aMutator) NS_ADDREF(*aMutator = this); return !_to ? NS_ERROR_NULL_POINTER : _to->SetRef(aRef); } \
|
||||
NS_IMETHOD SetFilePath(const nsACString & aFilePath, nsIURIMutator** aMutator) override \
|
||||
{ if (aMutator) NS_ADDREF(*aMutator = this); return !_to ? NS_ERROR_NULL_POINTER : _to->SetFilePath(aFilePath); } \
|
||||
NS_IMETHOD SetQuery(const nsACString & aQuery, nsIURIMutator** aMutator) override \
|
||||
{ if (aMutator) NS_ADDREF(*aMutator = this); return !_to ? NS_ERROR_NULL_POINTER : _to->SetQuery(aQuery); } \
|
||||
NS_IMETHOD SetQueryWithEncoding(const nsACString & query, const mozilla::Encoding *encoding, nsIURIMutator** aMutator) override \
|
||||
{ if (aMutator) NS_ADDREF(*aMutator = this); return !_to ? NS_ERROR_NULL_POINTER : _to->SetQueryWithEncoding(query, encoding); }
|
||||
|
||||
%}
|
||||
|
||||
[scriptable, builtinclass, uuid(4d1f3103-1c44-4dcd-b717-5d22a697a7d9)]
|
||||
interface nsIURIMutator : nsIURISetters
|
||||
{
|
||||
|
@ -193,111 +148,3 @@ interface nsIURIMutator : nsIURISetters
|
|||
nsIURI finalize();
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
// This class provides a useful helper that allows chaining of setter operations
|
||||
class MOZ_STACK_CLASS NS_MutateURI
|
||||
{
|
||||
public:
|
||||
NS_MutateURI(nsIURI* aURI)
|
||||
{ mStatus = NS_GetURIMutator(aURI, getter_AddRefs(mMutator)); }
|
||||
NS_MutateURI(nsCOMPtr<nsIURIMutator> aMutator)
|
||||
{ mStatus = NS_OK; mMutator = aMutator; }
|
||||
|
||||
NS_MutateURI& SetSpec(const nsACString& aSpec)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mStatus, *this);
|
||||
mStatus = mMutator->SetSpec(aSpec, nullptr);
|
||||
return *this;
|
||||
}
|
||||
NS_MutateURI& SetScheme(const nsACString& aScheme)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mStatus, *this);
|
||||
mStatus = mMutator->SetScheme(aScheme, nullptr);
|
||||
return *this;
|
||||
}
|
||||
NS_MutateURI& SetUserPass(const nsACString& aUserPass)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mStatus, *this);
|
||||
mStatus = mMutator->SetUserPass(aUserPass, nullptr);
|
||||
return *this;
|
||||
}
|
||||
NS_MutateURI& SetUsername(const nsACString& aUsername)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mStatus, *this);
|
||||
mStatus = mMutator->SetUsername(aUsername, nullptr);
|
||||
return *this;
|
||||
}
|
||||
NS_MutateURI& SetPassword(const nsACString& aPassword)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mStatus, *this);
|
||||
mStatus = mMutator->SetPassword(aPassword, nullptr);
|
||||
return *this;
|
||||
}
|
||||
NS_MutateURI& SetHostPort(const nsACString& aHostPort)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mStatus, *this);
|
||||
mStatus = mMutator->SetHostPort(aHostPort, nullptr);
|
||||
return *this;
|
||||
}
|
||||
NS_MutateURI& SetHostAndPort(const nsACString& aHostAndPort)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mStatus, *this);
|
||||
mStatus = mMutator->SetHostAndPort(aHostAndPort, nullptr);
|
||||
return *this;
|
||||
}
|
||||
NS_MutateURI& SetHost(const nsACString& aHost)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mStatus, *this);
|
||||
mStatus = mMutator->SetHost(aHost, nullptr);
|
||||
return *this;
|
||||
}
|
||||
NS_MutateURI& SetPort(int32_t aPort)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mStatus, *this);
|
||||
mStatus = mMutator->SetPort(aPort, nullptr);
|
||||
return *this;
|
||||
}
|
||||
NS_MutateURI& SetPathQueryRef(const nsACString& aPathQueryRef)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mStatus, *this);
|
||||
mStatus = mMutator->SetPathQueryRef(aPathQueryRef, nullptr);
|
||||
return *this;
|
||||
}
|
||||
NS_MutateURI& SetRef(const nsACString& aRef)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mStatus, *this);
|
||||
mStatus = mMutator->SetRef(aRef, nullptr);
|
||||
return *this;
|
||||
}
|
||||
NS_MutateURI& SetFilePath(const nsACString& aFilePath)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mStatus, *this);
|
||||
mStatus = mMutator->SetFilePath(aFilePath, nullptr);
|
||||
return *this;
|
||||
}
|
||||
NS_MutateURI& SetQuery(const nsACString& aQuery)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mStatus, *this);
|
||||
mStatus = mMutator->SetQuery(aQuery, nullptr);
|
||||
return *this;
|
||||
}
|
||||
NS_MutateURI& SetQueryWithEncoding(const nsACString& query, const mozilla::Encoding *encoding)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mStatus, *this);
|
||||
mStatus = mMutator->SetQueryWithEncoding(query, encoding, nullptr);
|
||||
return *this;
|
||||
}
|
||||
nsresult Finalize(nsIURI** aURI)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mStatus, mStatus);
|
||||
mStatus = mMutator->Finalize(aURI);
|
||||
return mStatus;
|
||||
}
|
||||
nsresult GetStatus() { return mStatus; }
|
||||
private:
|
||||
nsresult mStatus;
|
||||
RefPtr<nsIURIMutator> mMutator;
|
||||
};
|
||||
|
||||
%}
|
||||
|
|
|
@ -77,8 +77,8 @@ public:
|
|||
, public BaseURIMutator<nsSimpleNestedURI>
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_FORWARD_SAFE_NSIURISETTERS(mURI)
|
||||
NS_DEFINE_NSIMUTATOR_COMMON
|
||||
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
|
||||
|
||||
explicit Mutator() { }
|
||||
private:
|
||||
|
|
|
@ -118,7 +118,7 @@ public:
|
|||
, public BaseURIMutator<nsSimpleURI>
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
|
||||
NS_FORWARD_SAFE_NSIURISETTERS(mURI)
|
||||
NS_DEFINE_NSIMUTATOR_COMMON
|
||||
|
||||
explicit Mutator() { }
|
||||
|
|
|
@ -3768,9 +3768,3 @@ Test_NormalizeIPv4(const nsACString& host, nsCString& result)
|
|||
{
|
||||
return nsStandardURL::NormalizeIPv4(host, result);
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_GetURIMutator(nsIURI* aURI, nsIURIMutator** aMutator)
|
||||
{
|
||||
return aURI->Mutate(aMutator);
|
||||
}
|
||||
|
|
|
@ -318,7 +318,7 @@ public:
|
|||
, public BaseURIMutator<nsStandardURL>
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
|
||||
NS_FORWARD_SAFE_NSIURISETTERS(mURI)
|
||||
NS_DEFINE_NSIMUTATOR_COMMON
|
||||
|
||||
explicit Mutator() { }
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
, public BaseURIMutator<nsNestedAboutURI>
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
|
||||
NS_FORWARD_SAFE_NSIURISETTERS(mURI)
|
||||
NS_DEFINE_NSIMUTATOR_COMMON
|
||||
|
||||
explicit Mutator() { }
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "nsString.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIURIMutator.h"
|
||||
|
||||
|
||||
// In nsStandardURL.cpp
|
||||
extern nsresult Test_NormalizeIPv4(const nsACString& host, nsCString& result);
|
||||
|
@ -235,26 +235,3 @@ MOZ_GTEST_BENCH(TestStandardURL, NormalizePerfFails, [] {
|
|||
}
|
||||
});
|
||||
#endif
|
||||
|
||||
|
||||
TEST(TestStandardURL, Mutator)
|
||||
{
|
||||
nsAutoCString out;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_MutateURI(do_CreateInstance(NS_STANDARDURLMUTATOR_CONTRACTID))
|
||||
.SetSpec(NS_LITERAL_CSTRING("http://example.com"))
|
||||
.Finalize(getter_AddRefs(uri));
|
||||
ASSERT_EQ(rv, NS_OK);
|
||||
|
||||
ASSERT_EQ(uri->GetSpec(out), NS_OK);
|
||||
ASSERT_TRUE(out == NS_LITERAL_CSTRING("http://example.com/"));
|
||||
|
||||
rv = NS_MutateURI(uri)
|
||||
.SetScheme(NS_LITERAL_CSTRING("ftp"))
|
||||
.SetHost(NS_LITERAL_CSTRING("mozilla.org"))
|
||||
.SetPathQueryRef(NS_LITERAL_CSTRING("/path?query#ref"))
|
||||
.Finalize(getter_AddRefs(uri));
|
||||
ASSERT_EQ(rv, NS_OK);
|
||||
ASSERT_EQ(uri->GetSpec(out), NS_OK);
|
||||
ASSERT_TRUE(out == NS_LITERAL_CSTRING("ftp://mozilla.org/path?query#ref"));
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 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/. */
|
||||
|
||||
"use strict";
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
function standardMutator()
|
||||
{
|
||||
return Cc['@mozilla.org/network/standard-url-mutator;1']
|
||||
.createInstance(Ci.nsIURIMutator);
|
||||
}
|
||||
|
||||
add_task(async function test_simple_setter_chaining() {
|
||||
let uri = standardMutator()
|
||||
.setSpec("http://example.com/")
|
||||
.setQuery("hello")
|
||||
.setRef("bla")
|
||||
.setScheme("ftp")
|
||||
.finalize();
|
||||
equal(uri.spec, "ftp://example.com/?hello#bla");
|
||||
});
|
|
@ -405,4 +405,3 @@ skip-if = os == "android"
|
|||
[test_bug1378385_http1.js]
|
||||
[test_tls_flags_separate_connections.js]
|
||||
[test_tls_flags.js]
|
||||
[test_uri_mutator.js]
|
||||
|
|
Загрузка…
Ссылка в новой задаче