mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1380617 - Add nsIURI.displayPrePath r=mcmanus,Gijs
- Use displayPrePath in the pageInfo permissions that shows "Permissions for:" - The extra displayPrePath method is necessary because it's difficult to compute it manually, as opposed to not having a displaySpecWithoutRef - as it's easy to get that by truncating displaySpec at the first '#' symbol. MozReview-Commit-ID: 9RM5kQ2OqfC
This commit is contained in:
parent
d1bbd84d19
commit
7520c99a2c
@ -41,7 +41,7 @@ function onLoadPermission(uri, principal) {
|
||||
gPermURI = uri;
|
||||
gPermPrincipal = principal;
|
||||
var hostText = document.getElementById("hostText");
|
||||
hostText.value = gPermURI.prePath;
|
||||
hostText.value = gPermURI.displayPrePath;
|
||||
|
||||
for (var i of gPermissions)
|
||||
initRow(i);
|
||||
|
@ -367,6 +367,12 @@ NullPrincipalURI::GetDisplayHost(nsACString &aUnicodeHost)
|
||||
return GetHost(aUnicodeHost);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NullPrincipalURI::GetDisplayPrePath(nsACString &aPrePath)
|
||||
{
|
||||
return GetPrePath(aPrePath);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// nsIIPCSerializableURI
|
||||
|
||||
|
@ -135,6 +135,12 @@ nsMozIconURI::GetDisplayHost(nsACString& aUnicodeHost)
|
||||
return GetHost(aUnicodeHost);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMozIconURI::GetDisplayPrePath(nsACString& aPrePath)
|
||||
{
|
||||
return GetPrePath(aPrePath);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMozIconURI::GetHasRef(bool* result)
|
||||
{
|
||||
|
@ -240,6 +240,12 @@ nsJARURI::GetDisplayHostPort(nsACString &aUnicodeHostPort)
|
||||
return GetHostPort(aUnicodeHostPort);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetDisplayPrePath(nsACString &aPrePath)
|
||||
{
|
||||
return GetPrePath(aPrePath);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetDisplayHost(nsACString &aUnicodeHost)
|
||||
{
|
||||
|
@ -453,6 +453,12 @@ RustURL::GetDisplayHost(nsACString &aUnicodeHost)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
RustURL::GetDisplayPrePath(nsACString & aPrePath)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
RustURL::GetHasRef(bool *aHasRef)
|
||||
{
|
||||
|
@ -320,4 +320,11 @@ interface nsIURI : nsISupports
|
||||
* the network.IDN_show_punycode pref is false)
|
||||
*/
|
||||
readonly attribute AUTF8String displaySpec;
|
||||
|
||||
/**
|
||||
* Returns the same as calling .prePath, only with a UTF8 encoded hostname
|
||||
* (if that hostname doesn't contain blacklisted characters, and
|
||||
* the network.IDN_show_punycode pref is false)
|
||||
*/
|
||||
readonly attribute AUTF8String displayPrePath;
|
||||
};
|
||||
|
@ -273,6 +273,12 @@ nsSimpleURI::GetDisplayHost(nsACString &aUnicodeHost)
|
||||
return GetHost(aUnicodeHost);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::GetDisplayPrePath(nsACString &aPrePath)
|
||||
{
|
||||
return GetPrePath(aPrePath);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleURI::GetHasRef(bool *result)
|
||||
{
|
||||
|
@ -1508,6 +1508,19 @@ nsStandardURL::GetPrePath(nsACString &result)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// result may contain unescaped UTF-8 characters
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::GetDisplayPrePath(nsACString &result)
|
||||
{
|
||||
result = Prepath();
|
||||
CheckIfHostIsAscii();
|
||||
MOZ_ASSERT(mCheckedIfHostA);
|
||||
if (!mDisplayHost.IsEmpty()) {
|
||||
result.Replace(mHost.mPos, mHost.mLen, mDisplayHost);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// result is strictly US-ASCII
|
||||
NS_IMETHODIMP
|
||||
nsStandardURL::GetScheme(nsACString &result)
|
||||
|
Loading…
Reference in New Issue
Block a user