Bug 1448553 - Part 5: Decodeds Punycode-encoded international domain names and URI-encoded filenames in the Developer Toolbox's frame menu so that they are displayed as human-readable Unicode text. r=jdescottes

The Punycode-encoded international domain names and URI-encoded filenames are
human-unreadable, so they should be displayed as human-readable Unicode text.
This commit decodes this kind of names in the Developer Toolbox's frame menu.

MozReview-Commit-ID: LGzw31z05OD

--HG--
extra : rebase_source : fba5cd9a4e78c9e6206c15fc3d858845b3d3c007
This commit is contained in:
Zhang Junzhi 2018-04-03 01:23:24 +08:00
Родитель d2a2865c92
Коммит 4ffaca3e3f
1 изменённых файлов: 8 добавлений и 4 удалений

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

@ -23,6 +23,7 @@ var ChromeUtils = require("ChromeUtils");
var {gDevTools} = require("devtools/client/framework/devtools");
var EventEmitter = require("devtools/shared/event-emitter");
var Telemetry = require("devtools/client/shared/telemetry");
const { getUnicodeUrl } = require("devtools/client/shared/unicode-url");
var { attachThread, detachThread } = require("./attach-thread");
var Menu = require("devtools/client/framework/menu");
var MenuItem = require("devtools/client/framework/menu-item");
@ -2057,11 +2058,13 @@ Toolbox.prototype = {
let title;
if (this.target.name && this.target.name != this.target.url) {
const url = this.target.isWebExtension ?
this.target.getExtensionPathName(this.target.url) : this.target.url;
this.target.getExtensionPathName(this.target.url) :
getUnicodeUrl(this.target.url);
title = L10N.getFormatStr("toolbox.titleTemplate2", this.target.name,
url);
} else {
title = L10N.getFormatStr("toolbox.titleTemplate1", this.target.url);
title = L10N.getFormatStr("toolbox.titleTemplate1",
getUnicodeUrl(this.target.url));
}
this.postMessage({
name: "set-host-title",
@ -2148,11 +2151,12 @@ Toolbox.prototype = {
// A frame is checked if it's the selected one.
let checked = frame.id == this.selectedFrameId;
let label = frame.url;
let label;
if (this.target.isWebExtension) {
// Show a shorter url for extensions page.
label = this.target.getExtensionPathName(frame.url);
} else {
label = getUnicodeUrl(frame.url);
}
// Create menu item.