Bug 403728 - Better display non-eTLDable download URIs (file: data: jar:). r=sdwilsh, b-ff3=mconnor
git-svn-id: svn://10.0.0.236/trunk@240147 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
d293ae569b
commit
1a3d1db3bc
@ -57,6 +57,10 @@ doneStatus=#1 — #2
|
||||
# LOCALIZATION NOTE (doneSize): #1 size number; #2 size unit
|
||||
doneSize=#1 #2
|
||||
doneSizeUnknown=Unknown size
|
||||
# LOCALIZATION NOTE (doneScheme): #1 URI scheme like data: jar: about:
|
||||
doneScheme=#1 resource
|
||||
# LOCALIZATION NOTE (doneFileScheme): Special case of doneScheme for file:
|
||||
doneFileScheme=local file
|
||||
|
||||
stateFailed=Failed
|
||||
stateCanceled=Canceled
|
||||
|
||||
@ -86,6 +86,8 @@ let gStr = {
|
||||
doneStatus: "doneStatus",
|
||||
doneSize: "doneSize",
|
||||
doneSizeUnknown: "doneSizeUnknown",
|
||||
doneScheme: "doneScheme",
|
||||
doneFileScheme: "doneFileScheme",
|
||||
stateFailed: "stateFailed",
|
||||
stateCanceled: "stateCanceled",
|
||||
stateBlocked: "stateBlocked",
|
||||
@ -857,21 +859,33 @@ function updateStatus(aItem, aDownload) {
|
||||
// Get a URI that knows about its components
|
||||
let uri = ioService.newURI(getReferrerOrSource(aItem), null, null);
|
||||
|
||||
// Get the inner-most uri for schemes like jar:
|
||||
if (uri instanceof Ci.nsINestedURI)
|
||||
uri = uri.innermostURI
|
||||
|
||||
try {
|
||||
// This might fail if it's an IP address or doesn't have >1 parts
|
||||
displayHost = eTLDService.getBaseDomain(uri);
|
||||
} catch (e) {
|
||||
// Default to the host name
|
||||
displayHost = uri.host;
|
||||
try {
|
||||
// Default to the host name; some special URIs fail (data: jar:)
|
||||
displayHost = uri.host;
|
||||
} catch (e) {
|
||||
displayHost = "";
|
||||
}
|
||||
}
|
||||
|
||||
// Ahh! we have nothing :( Let's give the full spec (e.g., about:blank)
|
||||
if (displayHost.length == 0)
|
||||
displayHost = uri.spec;
|
||||
|
||||
// Tack on the port if it's not the default port
|
||||
else if (uri.port != -1)
|
||||
// Check if we need to show something else for the host
|
||||
if (uri.scheme == "file") {
|
||||
// Display special text for file protocol
|
||||
displayHost = gStr.doneFileScheme;
|
||||
} else if (displayHost.length == 0) {
|
||||
// Got nothing; show the scheme (data: about: moz-icon:)
|
||||
displayHost = replaceInsert(gStr.doneScheme, 1, uri.scheme);
|
||||
} else if (uri.port != -1) {
|
||||
// Tack on the port if it's not the default port
|
||||
displayHost += ":" + uri.port;
|
||||
}
|
||||
|
||||
// Insert 2 is the eTLD + 1 or other variations of the host
|
||||
status = replaceInsert(status, 2, displayHost);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user