зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1763961 [devtools] Make unchecking "Pick an element from the page" in "Available Toolbox Buttons" disable hotkey for opening element picker/inspector r=jdescottes,devtools-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D203948
This commit is contained in:
Родитель
f9672884e8
Коммит
ca9371a138
|
@ -161,7 +161,11 @@ Tools.inspector = {
|
|||
// that trigger the element picker.
|
||||
preventRaisingOnKey: true,
|
||||
onkey(panel, toolbox) {
|
||||
toolbox.nodePicker.togglePicker();
|
||||
if (
|
||||
Services.prefs.getBoolPref("devtools.command-button-pick.enabled", false)
|
||||
) {
|
||||
toolbox.nodePicker.togglePicker();
|
||||
}
|
||||
},
|
||||
|
||||
isToolSupported(toolbox) {
|
||||
|
|
|
@ -97,6 +97,33 @@ add_task(async function () {
|
|||
key.synthesizeKey();
|
||||
await onPickerStop;
|
||||
ok(true, "picker-stopped event received, highlighter stopped");
|
||||
|
||||
info(
|
||||
`Run the keyboard shortcut for ${test.id} with picker shortcut disabled`
|
||||
);
|
||||
await pushPref("devtools.command-button-pick.enabled", false);
|
||||
|
||||
// Switch to another panel to assure the hotkey still opens inspector
|
||||
await toolbox.selectTool("webconsole");
|
||||
await waitUntil(() => toolbox.currentToolId === "webconsole");
|
||||
|
||||
// Check if picker event times out
|
||||
const onHasPickerStarted = Promise.race([
|
||||
toolbox.nodePicker.once("picker-started").then(() => true),
|
||||
wait(100).then(() => false),
|
||||
]);
|
||||
|
||||
key.synthesizeKey();
|
||||
const hasPickerStarted = await onHasPickerStarted;
|
||||
|
||||
ok(!hasPickerStarted, "picker was not started on shortcut");
|
||||
is(
|
||||
toolbox.currentToolId,
|
||||
"inspector",
|
||||
"shortcut still switches tab to inspector"
|
||||
);
|
||||
|
||||
await pushPref("devtools.command-button-pick.enabled", true);
|
||||
}
|
||||
|
||||
await onSelectTool;
|
||||
|
|
Загрузка…
Ссылка в новой задаче