зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1434766 - Make nsIFileURL attributes readonly r=mayhemer
MozReview-Commit-ID: AN5EzyuuKuJ --HG-- extra : rebase_source : 2d986fa39930469472f24a208d9b06650ddb78f4
This commit is contained in:
Родитель
eda8c9ed75
Коммит
f77fba2c4c
|
@ -17,13 +17,13 @@ interface nsIURIMutator;
|
|||
interface nsIFileURL : nsIURL
|
||||
{
|
||||
/**
|
||||
* Get/Set nsIFile corresponding to this URL.
|
||||
* Get the nsIFile corresponding to this URL.
|
||||
*
|
||||
* - Getter returns a reference to an immutable object. Callers must clone
|
||||
* - Returns a reference to an immutable object. Callers must clone
|
||||
* before attempting to modify the returned nsIFile object. NOTE: this
|
||||
* constraint might not be enforced at runtime, so beware!!
|
||||
*/
|
||||
attribute nsIFile file;
|
||||
readonly attribute nsIFile file;
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(a588b6f2-d2b9-4024-84c7-be3368546b57)]
|
||||
|
|
|
@ -3256,7 +3256,7 @@ nsStandardURL::GetFile(nsIFile **result)
|
|||
return mFile->Clone(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsStandardURL::SetFile(nsIFile *file)
|
||||
{
|
||||
ENSURE_MUTABLE();
|
||||
|
|
|
@ -184,6 +184,7 @@ private:
|
|||
nsresult Init(uint32_t urlType, int32_t defaultPort, const nsACString &spec,
|
||||
const char *charset, nsIURI *baseURI);
|
||||
nsresult SetDefaultPort(int32_t aNewDefaultPort);
|
||||
nsresult SetFile(nsIFile *file);
|
||||
|
||||
nsresult SetFileNameInternal(const nsACString &input);
|
||||
nsresult SetFileBaseNameInternal(const nsACString &input);
|
||||
|
|
|
@ -242,18 +242,12 @@ NS_IMETHODIMP
|
|||
nsFileProtocolHandler::NewFileURI(nsIFile *file, nsIURI **result)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(file);
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIFileURL> url = new nsStandardURL(true);
|
||||
if (!url)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
// NOTE: the origin charset is assigned the value of the platform
|
||||
// charset by the SetFile method.
|
||||
rv = url->SetFile(file);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return CallQueryInterface(url, result);
|
||||
return NS_MutateURI(new nsStandardURL::Mutator())
|
||||
.Apply(NS_MutatorMethod(&nsIFileURLMutator::SetFile, file))
|
||||
.Finalize(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
Загрузка…
Ссылка в новой задаче