зеркало из https://github.com/mozilla/gecko-dev.git
bug 1360756 show internal ID for about:debugging r=jdescottes,mstriemer
MozReview-Commit-ID: 2LwFAzKSVKT --HG-- extra : rebase_source : 1bffb7764fb2b6bf48a0559f5b27a1ae8886c61e
This commit is contained in:
Родитель
d075979256
Коммит
53f5dca650
|
@ -279,6 +279,10 @@ button {
|
|||
margin: 0;
|
||||
}
|
||||
|
||||
.addon-target-info-more {
|
||||
padding-left: 1ch;
|
||||
}
|
||||
|
||||
.addon-target-button {
|
||||
background: none;
|
||||
border: none;
|
||||
|
|
|
@ -80,6 +80,7 @@ module.exports = createClass({
|
|||
addonActor: addon.actor,
|
||||
temporarilyInstalled: addon.temporarilyInstalled,
|
||||
url: addon.url,
|
||||
manifestURL: addon.manifestURL,
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
@ -39,6 +39,34 @@ function filePathForTarget(target) {
|
|||
];
|
||||
}
|
||||
|
||||
function internalIDForTarget(target) {
|
||||
if (!target.manifestURL) {
|
||||
return [];
|
||||
}
|
||||
// Strip off the protocol and rest, leaving us with just the UUID.
|
||||
let uuid = /moz-extension:\/\/([^/]*)/.exec(target.manifestURL)[1];
|
||||
return [
|
||||
dom.dt(
|
||||
{ className: "addon-target-info-label" },
|
||||
Strings.GetStringFromName("internalUUID"),
|
||||
),
|
||||
dom.dd(
|
||||
{ className: "addon-target-info-content internal-uuid" },
|
||||
dom.span(
|
||||
{ title: uuid },
|
||||
uuid
|
||||
),
|
||||
dom.span(
|
||||
{ className: "addon-target-info-more" },
|
||||
dom.a(
|
||||
{ href: target.manifestURL, target: "_blank", className: "manifest-url" },
|
||||
Strings.GetStringFromName("manifestURL"),
|
||||
),
|
||||
)
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
module.exports = createClass({
|
||||
displayName: "AddonTarget",
|
||||
|
||||
|
@ -91,6 +119,7 @@ module.exports = createClass({
|
|||
dom.dl(
|
||||
{ className: "addon-target-info" },
|
||||
...filePathForTarget(target),
|
||||
...internalIDForTarget(target),
|
||||
),
|
||||
dom.div({className: "addon-target-actions"},
|
||||
dom.button({
|
||||
|
|
|
@ -1,28 +1,58 @@
|
|||
"use strict";
|
||||
|
||||
const ADDON_ID = "test-devtools@mozilla.org";
|
||||
const ADDON_NAME = "test-devtools";
|
||||
const UUID_REGEX = /^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/;
|
||||
|
||||
add_task(function* () {
|
||||
function testFilePath(container, expectedFilePath) {
|
||||
// Verify that the path to the install location is shown next to its label.
|
||||
let filePath = container.querySelector(".file-path");
|
||||
ok(filePath, "file path is in DOM");
|
||||
ok(filePath.textContent.endsWith(expectedFilePath), "file path is set correctly");
|
||||
is(filePath.previousElementSibling.textContent, "Location", "file path has label");
|
||||
}
|
||||
|
||||
add_task(function* testLegacyAddon() {
|
||||
let addonId = "test-devtools@mozilla.org";
|
||||
let addonName = "test-devtools";
|
||||
let { tab, document } = yield openAboutDebugging("addons");
|
||||
yield waitForInitialAddonList(document);
|
||||
|
||||
yield installAddon({
|
||||
document,
|
||||
path: "addons/unpacked/install.rdf",
|
||||
name: ADDON_NAME,
|
||||
name: addonName,
|
||||
});
|
||||
|
||||
let container = document.querySelector(`[data-addon-id="${ADDON_ID}"]`);
|
||||
let filePath = container.querySelector(".file-path");
|
||||
let expectedFilePath = "browser/devtools/client/aboutdebugging/test/addons/unpacked/";
|
||||
let container = document.querySelector(`[data-addon-id="${addonId}"]`);
|
||||
testFilePath(container, "browser/devtools/client/aboutdebugging/test/addons/unpacked/");
|
||||
|
||||
// Verify that the path to the install location is shown next to its label.
|
||||
ok(filePath, "file path is in DOM");
|
||||
ok(filePath.textContent.endsWith(expectedFilePath), "file path is set correctly");
|
||||
is(filePath.previousElementSibling.textContent, "Location", "file path has label");
|
||||
|
||||
yield uninstallAddon({document, id: ADDON_ID, name: ADDON_NAME});
|
||||
yield uninstallAddon({document, id: addonId, name: addonName});
|
||||
|
||||
yield closeAboutDebugging(tab);
|
||||
});
|
||||
|
||||
add_task(function* testWebExtension() {
|
||||
let addonId = "test-devtools-webextension-nobg@mozilla.org";
|
||||
let addonName = "test-devtools-webextension-nobg";
|
||||
let { tab, document } = yield openAboutDebugging("addons");
|
||||
|
||||
yield waitForInitialAddonList(document);
|
||||
yield installAddon({
|
||||
document,
|
||||
path: "addons/test-devtools-webextension-nobg/manifest.json",
|
||||
name: addonName,
|
||||
isWebExtension: true
|
||||
});
|
||||
|
||||
let container = document.querySelector(`[data-addon-id="${addonId}"]`);
|
||||
testFilePath(container, "/test/addons/test-devtools-webextension-nobg/");
|
||||
|
||||
let internalUUID = container.querySelector(".internal-uuid span");
|
||||
ok(internalUUID.textContent.match(UUID_REGEX), "internalUUID is correct");
|
||||
|
||||
let manifestURL = container.querySelector(".manifest-url");
|
||||
ok(manifestURL.href.startsWith("moz-extension://"), "href for manifestURL exists");
|
||||
|
||||
yield uninstallAddon({document, id: addonId, name: addonName});
|
||||
|
||||
yield closeAboutDebugging(tab);
|
||||
});
|
||||
|
|
|
@ -66,6 +66,16 @@ extensions = Extensions
|
|||
# This string is displayed as a header above the list of temporarily loaded add-ons.
|
||||
temporaryExtensions = Temporary Extensions
|
||||
|
||||
# LOCALIZATION NOTE (internalUUID):
|
||||
# This string is displayed as a label for the internal UUID of an extension.
|
||||
# The UUID is generated for this profile on install.
|
||||
internalUUID = Internal UUID
|
||||
|
||||
# LOCALIZATION NOTE (manifestURL):
|
||||
# This string is displayed as a link for the manifest of an extension,
|
||||
# accessible in a browser, such as moz-extension://[internalUUID]/manifest.json.
|
||||
manifestURL = Manifest URL
|
||||
|
||||
# LOCALIZATION NOTE (webExtTip):
|
||||
# This string is displayed as a message below the list of temporarily loaded add-ons.
|
||||
# Web-ext is a command line tool for web-extensions developers.
|
||||
|
|
|
@ -9,6 +9,7 @@ const protocol = require("devtools/shared/protocol");
|
|||
const {webExtensionSpec} = require("devtools/shared/specs/webextension-parent");
|
||||
|
||||
loader.lazyImporter(this, "AddonManager", "resource://gre/modules/AddonManager.jsm");
|
||||
loader.lazyImporter(this, "ExtensionManagement", "resource://gre/modules/ExtensionManagement.jsm");
|
||||
loader.lazyImporter(this, "ExtensionParent", "resource://gre/modules/ExtensionParent.jsm");
|
||||
|
||||
/**
|
||||
|
@ -68,10 +69,12 @@ const WebExtensionParentActor = protocol.ActorClassWithSpec(webExtensionSpec, {
|
|||
actor: this.actorID,
|
||||
id: this.id,
|
||||
name: this.addon.name,
|
||||
url: this.addon.sourceURI ? this.addon.sourceURI.spec : undefined,
|
||||
iconURL: this.addon.iconURL,
|
||||
debuggable: this.addon.isDebuggable,
|
||||
temporarilyInstalled: this.addon.temporarilyInstalled,
|
||||
isWebExtension: true,
|
||||
manifestURL: ExtensionManagement.getURLForExtension(this.id, "manifest.json"),
|
||||
};
|
||||
},
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче