Bug 1391421 - Part 3 - Switch various places that can end up being user-visible to use Unicode domains. r=esawin,jwu

Amongst others, this includes some prompts, as well as various progress messages sent to the Java UI.

We also fix getTabWithURL to be able to find tabs regardless of whether the given URL to search is written in Punycode or with Unicode characters.

MozReview-Commit-ID: K7xhgz2IK2h

--HG--
extra : rebase_source : cf8a56ef84be77a6c01d7c926b7eae43a20ca453
This commit is contained in:
Jan Henning 2017-09-14 18:55:09 +02:00
Родитель 30fbb132f0
Коммит 9371ff3146
8 изменённых файлов: 21 добавлений и 21 удалений

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

@ -1352,7 +1352,7 @@ var BrowserApp = {
for (let i = 0; i < this._tabs.length; ++i) {
let tab = this._tabs[i];
if (aOptions.startsWith) {
if (tab.currentURI.spec.startsWith(aURL)) {
if (tab.currentURI.spec.startsWith(uri.spec)) {
return tab;
}
} else {
@ -2209,8 +2209,8 @@ var BrowserApp = {
for (let i = toIndex; i >= fromIndex; i--) {
let entry = hist.getEntryAtIndex(i, false);
let item = {
title: entry.title || entry.URI.spec,
url: entry.URI.spec,
title: entry.title || entry.URI.displaySpec,
url: entry.URI.displaySpec,
selected: (i == selIndex)
};
listitems.push(item);
@ -3582,7 +3582,7 @@ Tab.prototype = {
let uri = null;
let title = aParams.title || aURL;
try {
uri = Services.io.newURI(aURL).spec;
uri = Services.io.newURI(aURL).displaySpec;
} catch (e) {}
// When the tab is stubbed from Java, there's a window between the stub
@ -4362,7 +4362,7 @@ Tab.prototype = {
this.originalURI = aRequest.QueryInterface(Components.interfaces.nsIChannel).originalURI;
if (this.originalURI != null)
uri = this.originalURI.spec;
uri = this.originalURI.displaySpec;
} catch (e) { }
try {
success = aRequest.QueryInterface(Components.interfaces.nsIHttpChannel).requestSucceeded;
@ -4442,10 +4442,10 @@ Tab.prototype = {
let baseDomain = "";
// For recognized scheme, get base domain from host.
let principalURI = contentWin.document.nodePrincipal.URI;
if (principalURI && ["http", "https", "ftp"].includes(principalURI.scheme) && principalURI.host) {
if (principalURI && ["http", "https", "ftp"].includes(principalURI.scheme) && principalURI.displayHost) {
try {
baseDomain = Services.eTLD.getBaseDomainFromHost(principalURI.host);
if (!principalURI.host.endsWith(baseDomain)) {
baseDomain = Services.eTLD.getBaseDomainFromHost(principalURI.displayHost);
if (!principalURI.displayHost.endsWith(baseDomain)) {
// getBaseDomainFromHost converts its resultant to ACE.
let IDNService = Cc["@mozilla.org/network/idn-service;1"].getService(Ci.nsIIDNService);
baseDomain = IDNService.convertACEtoUTF8(baseDomain);
@ -4479,7 +4479,7 @@ Tab.prototype = {
let message = {
type: "Content:LocationChange",
tabID: this.id,
uri: truncate(fixedURI.spec, MAX_URI_LENGTH),
uri: truncate(fixedURI.displaySpec, MAX_URI_LENGTH),
userRequested: this.userRequested || "",
baseDomain: baseDomain,
contentType: (contentType ? contentType : ""),
@ -5976,7 +5976,7 @@ var SearchEngines = {
// prompt user for name of search engine
let promptTitle = Strings.browser.GetStringFromName("contextmenu.addSearchEngine3");
let title = { value: (aElement.ownerDocument.title || docURI.host) };
let title = { value: (aElement.ownerDocument.title || docURI.displayHost) };
if (!Services.prompt.prompt(null, promptTitle, null, title, null, {})) {
if (resultCallback) {
resultCallback(false);

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

@ -790,7 +790,7 @@ var PromptUtils = {
* Strip out things like userPass and path for display.
*/
getFormattedHostname: function pu_getFormattedHostname(uri) {
return uri.scheme + "://" + uri.hostPort;
return uri.scheme + "://" + uri.displayHostPort;
},
fireDialogEvent: function(aDomWin, aEventName) {

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

@ -44,9 +44,9 @@ TabSource.prototype = {
if (tab.browser.contentTitle)
label = tab.browser.contentTitle;
else if (tab.browser.contentURI)
label = tab.browser.contentURI.spec;
label = tab.browser.contentURI.displaySpec;
else
label = tab.originalURI.spec;
label = tab.originalURI.displaySpec;
return { label: label,
icon: "thumbnail:" + tab.id }
}));

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

@ -108,7 +108,7 @@ GeckoViewPermission.prototype = {
let uri = win.document.documentURIObject;
return dispatcher.sendRequestForResult({
type: "GeckoView:MediaPermission",
uri: uri.spec,
uri: uri.displaySpec,
video: constraints.video ? sources.filter(source => source.type === "video") : null,
audio: constraints.audio ? sources.filter(source => source.type === "audio") : null,
}).then(response => {
@ -185,7 +185,7 @@ GeckoViewPermission.prototype = {
aRequest.window ? aRequest.window : aRequest.element.ownerGlobal);
let promise = dispatcher.sendRequestForResult({
type: "GeckoView:ContentPermission",
uri: aRequest.principal.URI.spec,
uri: aRequest.principal.URI.displaySpec,
perm: perm.type,
access: perm.access !== "unused" ? perm.access : null,
}).then(granted => {

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

@ -668,7 +668,7 @@ PromptDelegate.prototype = {
mode: aAuthInfo.flags & Ci.nsIAuthInformation.ONLY_PASSWORD ? "password" : "auth",
options: {
flags: aAuthInfo.flags,
uri: aChannel && aChannel.URI.spec,
uri: aChannel && aChannel.URI.displaySpec,
level: aLevel,
username: username,
password: aAuthInfo.password,
@ -801,7 +801,7 @@ PromptDelegate.prototype = {
return [hostname, realm];
}
let hostname = aChannel.URI.scheme + "://" + aChannel.URI.hostPort;
let hostname = aChannel.URI.scheme + "://" + aChannel.URI.displayHostPort;
// If a HTTP WWW-Authenticate header specified a realm, that value
// will be available here. If it wasn't set or wasn't HTTP, we'll use
// the formatted hostname instead.

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

@ -196,7 +196,7 @@ var HelperApps = {
type: type,
mime: mimeType,
action: options.action || "", // empty action string defaults to android.intent.action.VIEW
url: uri ? uri.spec : "",
url: uri ? uri.displaySpec : "",
packageName: options.packageName || "",
className: options.className || ""
};

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

@ -84,7 +84,7 @@ class GeckoViewNavigation extends GeckoViewModule {
let message = {
type: "GeckoView:OnLoadUri",
uri: aUri.spec,
uri: aUri.displaySpec,
where: aWhere,
flags: aFlags
};
@ -196,7 +196,7 @@ class GeckoViewNavigation extends GeckoViewModule {
let message = {
type: "GeckoView:LocationChange",
uri: fixedURI.spec,
uri: fixedURI.displaySpec,
canGoBack: this.browser.canGoBack,
canGoForward: this.browser.canGoForward,
};

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

@ -271,7 +271,7 @@ class GeckoViewProgress extends GeckoViewModule {
let uri = aRequest.QueryInterface(Ci.nsIChannel).URI;
let message = {
type: "GeckoView:PageStart",
uri: uri.spec,
uri: uri.displaySpec,
};
this.eventDispatcher.sendRequest(message);