зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1809848 - [devtools] Remove TargetMixin.chrome attribute. r=devtools-reviewers,nchevobbe
This is a very old and legacy attribute which always had a fuzzy definition. As of today it was a somewhat alias of "not debugging a local/remote tab". Differential Revision: https://phabricator.services.mozilla.com/D166904
This commit is contained in:
Родитель
4a6ec1e674
Коммит
016b0934ad
|
@ -584,7 +584,8 @@ function createHighlightButton(highlighterName, id) {
|
|||
return {
|
||||
id: `command-button-${id}`,
|
||||
description: l10n(`toolbox.buttons.${id}`),
|
||||
isToolSupported: toolbox => !toolbox.target.chrome,
|
||||
isToolSupported: toolbox =>
|
||||
toolbox.commands.descriptorFront.isTabDescriptor,
|
||||
async onClick(event, toolbox) {
|
||||
const inspectorFront = await toolbox.target.getFront("inspector");
|
||||
const highlighter = await inspectorFront.getOrCreateHighlighterByType(
|
||||
|
|
|
@ -19,9 +19,8 @@ SimpleTest.registerCleanupFunction(() => {
|
|||
Services.prefs.clearUserPref("devtools.debugger.prompt-connection");
|
||||
});
|
||||
|
||||
function assertTarget(target, url, chrome = false) {
|
||||
function assertTarget(target, url) {
|
||||
is(target.url, url);
|
||||
is(target.chrome, chrome);
|
||||
is(target.isBrowsingContext, true);
|
||||
}
|
||||
|
||||
|
@ -71,7 +70,7 @@ add_task(async function() {
|
|||
commands = await commandsFromURL(new URL("https://foo?type=process"));
|
||||
target = await commands.descriptorFront.getTarget();
|
||||
const topWindow = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
assertTarget(target, topWindow.location.href, true);
|
||||
assertTarget(target, topWindow.location.href);
|
||||
await commands.destroy();
|
||||
|
||||
await testRemoteTCP();
|
||||
|
@ -127,7 +126,7 @@ async function testRemoteTCP() {
|
|||
);
|
||||
const target = await commands.descriptorFront.getTarget();
|
||||
const topWindow = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
assertTarget(target, topWindow.location.href, true);
|
||||
assertTarget(target, topWindow.location.href);
|
||||
|
||||
const settings = commands.client._transport.connectionSettings;
|
||||
is(settings.host, "127.0.0.1");
|
||||
|
@ -150,7 +149,7 @@ async function testRemoteWebSocket() {
|
|||
);
|
||||
const target = await commands.descriptorFront.getTarget();
|
||||
const topWindow = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
assertTarget(target, topWindow.location.href, true);
|
||||
assertTarget(target, topWindow.location.href);
|
||||
|
||||
const settings = commands.client._transport.connectionSettings;
|
||||
is(settings.host, "127.0.0.1");
|
||||
|
|
|
@ -276,16 +276,6 @@ function TargetMixin(parentClass) {
|
|||
return this._client;
|
||||
}
|
||||
|
||||
// Tells us if we are debugging content document
|
||||
// or if we are debugging chrome stuff.
|
||||
// Allows to controls which features are available against
|
||||
// a chrome or a content document.
|
||||
get chrome() {
|
||||
return (
|
||||
this.isWebExtension || this.isContentProcess || this.isParentProcess
|
||||
);
|
||||
}
|
||||
|
||||
// Tells us if the related actor implements WindowGlobalTargetActor
|
||||
// interface and requires to call `attach` request before being used and
|
||||
// `detach` during cleanup.
|
||||
|
|
|
@ -485,40 +485,26 @@ Inspector.prototype = {
|
|||
return this._highlighters;
|
||||
},
|
||||
|
||||
get _3PanePrefName() {
|
||||
// All other contexts: webextension and browser toolbox
|
||||
// are considered as "chrome"
|
||||
return this.commands.descriptorFront.isTabDescriptor
|
||||
? THREE_PANE_ENABLED_PREF
|
||||
: THREE_PANE_CHROME_ENABLED_PREF;
|
||||
},
|
||||
|
||||
get is3PaneModeEnabled() {
|
||||
if (this.currentTarget.chrome) {
|
||||
if (!this._is3PaneModeChromeEnabled) {
|
||||
this._is3PaneModeChromeEnabled = Services.prefs.getBoolPref(
|
||||
THREE_PANE_CHROME_ENABLED_PREF
|
||||
);
|
||||
}
|
||||
|
||||
return this._is3PaneModeChromeEnabled;
|
||||
}
|
||||
|
||||
if (!this._is3PaneModeEnabled) {
|
||||
this._is3PaneModeEnabled = Services.prefs.getBoolPref(
|
||||
THREE_PANE_ENABLED_PREF
|
||||
this._3PanePrefName
|
||||
);
|
||||
}
|
||||
|
||||
return this._is3PaneModeEnabled;
|
||||
},
|
||||
|
||||
set is3PaneModeEnabled(value) {
|
||||
if (this.currentTarget.chrome) {
|
||||
this._is3PaneModeChromeEnabled = value;
|
||||
Services.prefs.setBoolPref(
|
||||
THREE_PANE_CHROME_ENABLED_PREF,
|
||||
this._is3PaneModeChromeEnabled
|
||||
);
|
||||
} else {
|
||||
this._is3PaneModeEnabled = value;
|
||||
Services.prefs.setBoolPref(
|
||||
THREE_PANE_ENABLED_PREF,
|
||||
this._is3PaneModeEnabled
|
||||
);
|
||||
}
|
||||
this._is3PaneModeEnabled = value;
|
||||
Services.prefs.setBoolPref(this._3PanePrefName, this._is3PaneModeEnabled);
|
||||
},
|
||||
|
||||
get search() {
|
||||
|
@ -1765,7 +1751,6 @@ Inspector.prototype = {
|
|||
// any object (bug 1729925)
|
||||
this.splitBox = null;
|
||||
|
||||
this._is3PaneModeChromeEnabled = null;
|
||||
this._is3PaneModeEnabled = null;
|
||||
this._markupBox = null;
|
||||
this._markupFrame = null;
|
||||
|
|
|
@ -574,7 +574,7 @@ class MarkupContextMenu {
|
|||
const type = popupNode.dataset.type;
|
||||
if (type === "uri" || type === "cssresource" || type === "jsresource") {
|
||||
// Links can't be opened in new tabs in the browser toolbox.
|
||||
if (type === "uri" && !this.target.chrome) {
|
||||
if (type === "uri" && !this.toolbox.isBrowserToolbox) {
|
||||
linkFollow.visible = true;
|
||||
linkFollow.label = INSPECTOR_L10N.getStr(
|
||||
"inspector.menu.openUrlInNewTab.label"
|
||||
|
|
|
@ -534,27 +534,27 @@ CssRuleView.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Enables the print and color scheme simulation if they are supported in the
|
||||
* current target.
|
||||
* Enables the print and color scheme simulation only for local and remote tab debugging.
|
||||
*/
|
||||
async _initSimulationFeatures() {
|
||||
if (!this.currentTarget.chrome) {
|
||||
this.colorSchemeLightSimulationButton.removeAttribute("hidden");
|
||||
this.colorSchemeDarkSimulationButton.removeAttribute("hidden");
|
||||
this.printSimulationButton.removeAttribute("hidden");
|
||||
this.printSimulationButton.addEventListener(
|
||||
"click",
|
||||
this._onTogglePrintSimulation
|
||||
);
|
||||
this.colorSchemeLightSimulationButton.addEventListener(
|
||||
"click",
|
||||
this._onToggleLightColorSchemeSimulation
|
||||
);
|
||||
this.colorSchemeDarkSimulationButton.addEventListener(
|
||||
"click",
|
||||
this._onToggleDarkColorSchemeSimulation
|
||||
);
|
||||
if (!this.inspector.commands.descriptorFront.isTabDescriptor) {
|
||||
return;
|
||||
}
|
||||
this.colorSchemeLightSimulationButton.removeAttribute("hidden");
|
||||
this.colorSchemeDarkSimulationButton.removeAttribute("hidden");
|
||||
this.printSimulationButton.removeAttribute("hidden");
|
||||
this.printSimulationButton.addEventListener(
|
||||
"click",
|
||||
this._onTogglePrintSimulation
|
||||
);
|
||||
this.colorSchemeLightSimulationButton.addEventListener(
|
||||
"click",
|
||||
this._onToggleLightColorSchemeSimulation
|
||||
);
|
||||
this.colorSchemeDarkSimulationButton.addEventListener(
|
||||
"click",
|
||||
this._onToggleDarkColorSchemeSimulation
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче