mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1442242 - Make the constructor of nsJARURI private r=mayhemer
MozReview-Commit-ID: 2X1mu5576u1 --HG-- extra : rebase_source : 9cfc50d74c407f5fb88768db072cb0fdfbd8ad1c
This commit is contained in:
parent
d4bfa7921c
commit
9bff145dee
@ -36,3 +36,12 @@ interface nsIJARURI : nsIURL {
|
||||
*/
|
||||
nsIJARURI cloneWithJARFile(in nsIURI jarFile);
|
||||
};
|
||||
|
||||
[builtinclass, uuid(d66df117-eda7-4324-b4e4-1f670ff6718e)]
|
||||
interface nsIJARURIMutator : nsISupports
|
||||
{
|
||||
/**
|
||||
* Will initalize a URI using the passed spec, baseURI and charset.
|
||||
*/
|
||||
void setSpecBaseCharset(in AUTF8String aSpec, in nsIURI aBase, in string aCharset);
|
||||
};
|
||||
|
@ -118,21 +118,11 @@ nsJARProtocolHandler::NewURI(const nsACString &aSpec,
|
||||
nsIURI *aBaseURI,
|
||||
nsIURI **result)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
RefPtr<nsJARURI> jarURI = new nsJARURI();
|
||||
if (!jarURI)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = jarURI->Init(aCharset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = jarURI->SetSpecWithBase(aSpec, aBaseURI);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
NS_ADDREF(*result = jarURI);
|
||||
return rv;
|
||||
nsCOMPtr<nsIURI> base(aBaseURI);
|
||||
return NS_MutateURI(new nsJARURI::Mutator())
|
||||
.Apply(NS_MutatorMethod(&nsIJARURIMutator::SetSpecBaseCharset,
|
||||
nsCString(aSpec), base, aCharset))
|
||||
.Finalize(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -268,7 +268,8 @@ NS_IMPL_NSIURIMUTATOR_ISUPPORTS(nsJARURI::Mutator,
|
||||
nsIURISetters,
|
||||
nsIURIMutator,
|
||||
nsIURLMutator,
|
||||
nsISerializable)
|
||||
nsISerializable,
|
||||
nsIJARURIMutator)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::Mutator::SetFileName(const nsACString& aFileName, nsIURIMutator** aMutator)
|
||||
|
@ -59,19 +59,18 @@ public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_THIS_JARURI_IMPL_CID)
|
||||
|
||||
// nsJARURI
|
||||
nsJARURI();
|
||||
|
||||
nsresult Init(const char *charsetHint);
|
||||
nsresult FormatSpec(const nsACString &entryPath, nsACString &result,
|
||||
bool aIncludeScheme = true);
|
||||
nsresult CreateEntryURL(const nsACString& entryFilename,
|
||||
const char* charset,
|
||||
nsIURL** url);
|
||||
nsresult SetSpecWithBase(const nsACString& aSpec, nsIURI* aBaseURL);
|
||||
|
||||
protected:
|
||||
nsJARURI();
|
||||
virtual ~nsJARURI();
|
||||
nsresult SetJAREntry(const nsACString &entryPath);
|
||||
nsresult Init(const char *charsetHint);
|
||||
nsresult SetSpecWithBase(const nsACString& aSpec, nsIURI* aBaseURL);
|
||||
|
||||
// enum used in a few places to specify how .ref attribute should be handled
|
||||
enum RefHandlingEnum {
|
||||
@ -126,6 +125,7 @@ public:
|
||||
, public BaseURIMutator<nsJARURI>
|
||||
, public nsIURLMutator
|
||||
, public nsISerializable
|
||||
, public nsIJARURIMutator
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
|
||||
@ -144,6 +144,30 @@ public:
|
||||
return InitFromInputStream(aStream);
|
||||
}
|
||||
|
||||
NS_IMETHOD
|
||||
SetSpecBaseCharset(const nsACString& aSpec,
|
||||
nsIURI* aBaseURI,
|
||||
const char* aCharset) override
|
||||
{
|
||||
RefPtr<nsJARURI> uri;
|
||||
if (mURI) {
|
||||
mURI.swap(uri);
|
||||
} else {
|
||||
uri = new nsJARURI();
|
||||
}
|
||||
|
||||
nsresult rv = uri->Init(aCharset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = uri->SetSpecWithBase(aSpec, aBaseURI);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
mURI.swap(uri);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
explicit Mutator() { }
|
||||
private:
|
||||
virtual ~Mutator() { }
|
||||
|
Loading…
Reference in New Issue
Block a user