Bug 1431204 - Make nsIURI.spec readonly r=mayhemer

MozReview-Commit-ID: 1l1CBUotIPh

--HG--
extra : rebase_source : 92af70ad412719d93222551b658f313cefd85e75
This commit is contained in:
Valentin Gosu 2018-01-19 15:26:07 +01:00
Родитель 89445898bd
Коммит ea4e6b68ff
7 изменённых файлов: 25 добавлений и 17 удалений

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

@ -257,8 +257,8 @@ NullPrincipalURI::GetHasRef(bool* _result)
return NS_OK;
}
NS_IMETHODIMP
NullPrincipalURI::SetSpec(const nsACString& aSpec)
nsresult
NullPrincipalURI::SetSpecInternal(const nsACString& aSpec)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

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

@ -204,8 +204,8 @@ extractAttributeValue(const char* aSearchString,
} // if we got non-null search string and attribute name values
}
NS_IMETHODIMP
nsMozIconURI::SetSpec(const nsACString& aSpec)
nsresult
nsMozIconURI::SetSpecInternal(const nsACString& aSpec)
{
// Reset everything to default values.
mIconURL = nullptr;

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

@ -258,8 +258,8 @@ nsJARURI::GetHasRef(bool *result)
return mJAREntry->GetHasRef(result);
}
NS_IMETHODIMP
nsJARURI::SetSpec(const nsACString& aSpec)
nsresult
nsJARURI::SetSpecInternal(const nsACString& aSpec)
{
return SetSpecWithBase(aSpec, nullptr);
}

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

@ -80,7 +80,16 @@ interface nsIURI : nsISupports
*/
/**
* Returns a string representation of the URI. Setting the spec causes
* Returns a string representation of the URI.
*
* Some characters may be escaped.
*/
readonly attribute AUTF8String spec;
/*
* This method should only be called by nsIURIMutator or C++ unit tests.
*
* Setting the spec causes
* the new spec to be parsed per the rules for the scheme the URI
* currently has. In particular, setting the spec to a URI string with a
* different scheme will generally produce incorrect results; no one
@ -88,10 +97,9 @@ interface nsIURI : nsISupports
* the URI stores information from the nsIIOService.newURI call used to
* create it other than just the parsed string, then behavior of this
* information on setting the spec attribute is undefined.
*
* Some characters may be escaped.
*/
attribute AUTF8String spec;
[noscript,notxpcom,nostdcall]
nsresult setSpecInternal(in ACString aSpec);
%{ C++
// An infallible wrapper for GetSpec() that returns a failure indication

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

@ -75,7 +75,7 @@ protected:
uri = new T();
}
rv = uri->SetSpec(aSpec);
rv = uri->SetSpecInternal(aSpec);
if (NS_FAILED(rv)) {
return rv;
}

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

@ -287,8 +287,8 @@ nsSimpleURI::GetHasRef(bool *result)
return NS_OK;
}
NS_IMETHODIMP
nsSimpleURI::SetSpec(const nsACString &aSpec)
nsresult
nsSimpleURI::SetSpecInternal(const nsACString &aSpec)
{
NS_ENSURE_STATE(mMutable);

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

@ -1554,8 +1554,8 @@ IsSpecialProtocol(const nsACString &input)
protocol.LowerCaseEqualsLiteral("gopher");
}
NS_IMETHODIMP
nsStandardURL::SetSpec(const nsACString &input)
nsresult
nsStandardURL::SetSpecInternal(const nsACString &input)
{
return SetSpecWithEncoding(input, nullptr);
}
@ -2209,7 +2209,7 @@ nsStandardURL::SetPathQueryRef(const nsACString &input)
spec.Append('/');
spec.Append(path);
return SetSpec(spec);
return SetSpecInternal(spec);
}
else if (mPath.mLen >= 1) {
mSpec.Cut(mPath.mPos + 1, mPath.mLen - 1);
@ -2893,7 +2893,7 @@ nsStandardURL::SetFilePath(const nsACString &input)
spec.Append(mSpec.get() + end, mSpec.Length() - end);
}
return SetSpec(spec);
return SetSpecInternal(spec);
}
else if (mPath.mLen > 1) {
mSpec.Cut(mPath.mPos + 1, mFilepath.mLen - 1);