зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1578772 - Enable/disable replay from Devtools settings. r=bhackett
Differential Revision: https://phabricator.services.mozilla.com/D46162 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
c136338d72
Коммит
751b6be5a3
|
@ -556,20 +556,14 @@ exports.ToolboxButtons = [
|
|||
{
|
||||
id: "command-button-replay",
|
||||
description: l10n("toolbox.buttons.replay"),
|
||||
isTargetSupported: target =>
|
||||
Services.prefs.getBoolPref("devtools.recordreplay.mvp.enabled") &&
|
||||
!target.canRewind &&
|
||||
target.isLocalTab,
|
||||
isTargetSupported: target => !target.canRewind && target.isLocalTab,
|
||||
onClick: () => reloadAndRecordTab(),
|
||||
isChecked: () => false,
|
||||
},
|
||||
{
|
||||
id: "command-button-stop-replay",
|
||||
description: l10n("toolbox.buttons.stopReplay"),
|
||||
isTargetSupported: target =>
|
||||
Services.prefs.getBoolPref("devtools.recordreplay.mvp.enabled") &&
|
||||
target.canRewind &&
|
||||
target.isLocalTab,
|
||||
isTargetSupported: target => target.canRewind && target.isLocalTab,
|
||||
onClick: () => reloadAndStopRecordingTab(),
|
||||
isChecked: () => true,
|
||||
},
|
||||
|
|
|
@ -130,9 +130,9 @@ function testToggleToolboxButtons() {
|
|||
|
||||
const toolbarButtonNodes = [...doc.querySelectorAll(".command-button")];
|
||||
|
||||
// NOTE: the web-replay buttons are not checkboxes
|
||||
// NOTE: the web-replay buttons only appear if the feature is enabled.
|
||||
is(
|
||||
checkNodes.length + 2,
|
||||
checkNodes.length + 1,
|
||||
toolbox.toolbarButtons.length,
|
||||
"All of the buttons are toggleable."
|
||||
);
|
||||
|
|
|
@ -181,6 +181,7 @@ OptionsPanel.prototype = {
|
|||
const commandButton = toolbarButtons.filter(
|
||||
toggleableButton => toggleableButton.id === checkbox.id
|
||||
)[0];
|
||||
|
||||
Services.prefs.setBoolPref(
|
||||
commandButton.visibilityswitch,
|
||||
checkbox.checked
|
||||
|
@ -195,7 +196,12 @@ OptionsPanel.prototype = {
|
|||
const checkboxInput = this.panelDoc.createElement("input");
|
||||
checkboxInput.setAttribute("type", "checkbox");
|
||||
checkboxInput.setAttribute("id", button.id);
|
||||
if (Services.prefs.getBoolPref(button.visibilityswitch, true)) {
|
||||
const defaultValue =
|
||||
button.id !== "command-button-replay"
|
||||
? true
|
||||
: Services.prefs.getBoolPref("devtools.recordreplay.mvp.enabled");
|
||||
|
||||
if (Services.prefs.getBoolPref(button.visibilityswitch, defaultValue)) {
|
||||
checkboxInput.setAttribute("checked", true);
|
||||
}
|
||||
checkboxInput.addEventListener(
|
||||
|
|
|
@ -2014,7 +2014,12 @@ Toolbox.prototype = {
|
|||
_commandIsVisible: function(button) {
|
||||
const { isTargetSupported, isCurrentlyVisible, visibilityswitch } = button;
|
||||
|
||||
if (!Services.prefs.getBoolPref(visibilityswitch, true)) {
|
||||
const defaultValue =
|
||||
button.id !== "command-button-replay"
|
||||
? true
|
||||
: Services.prefs.getBoolPref("devtools.recordreplay.mvp.enabled");
|
||||
|
||||
if (!Services.prefs.getBoolPref(visibilityswitch, defaultValue)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче