зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1568157
- Part 1: Replace `toolbox.inspectorFront` with the `inspectorFront` from `target.getFront("inspector")`. r=yulia,ochameau
Differential Revision: https://phabricator.services.mozilla.com/D40313 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
be2d349416
Коммит
341915c5fc
|
@ -6,14 +6,7 @@
|
|||
// opens the Inspector panel
|
||||
|
||||
function waitForInspectorPanelChange(dbg) {
|
||||
const { toolbox } = dbg;
|
||||
|
||||
return new Promise(resolve => {
|
||||
toolbox.getPanelWhenReady("inspector").then(() => {
|
||||
ok(toolbox.inspectorFront, "Inspector is shown.");
|
||||
resolve(toolbox.inspectorFront);
|
||||
});
|
||||
});
|
||||
return dbg.toolbox.getPanelWhenReady("inspector");
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
|
|
|
@ -163,8 +163,9 @@ Tools.inspector = {
|
|||
// preventRaisingOnKey is used to keep the focus on the content window for shortcuts
|
||||
// that trigger the element picker.
|
||||
preventRaisingOnKey: true,
|
||||
onkey: function(panel, toolbox) {
|
||||
toolbox.inspectorFront.nodePicker.togglePicker();
|
||||
onkey: async function(panel, toolbox) {
|
||||
const inspectorFront = await toolbox.target.getFront("inspector");
|
||||
inspectorFront.nodePicker.togglePicker();
|
||||
},
|
||||
|
||||
isTargetSupported: function(target) {
|
||||
|
@ -619,8 +620,8 @@ function createHighlightButton(highlighterName, id) {
|
|||
description: l10n(`toolbox.buttons.${id}`),
|
||||
isTargetSupported: target => !target.chrome,
|
||||
async onClick(event, toolbox) {
|
||||
await toolbox.initInspector();
|
||||
const highlighter = await toolbox.inspectorFront.getOrCreateHighlighterByType(
|
||||
const inspectorFront = await toolbox.target.getFront("inspector");
|
||||
const highlighter = await inspectorFront.getOrCreateHighlighterByType(
|
||||
highlighterName
|
||||
);
|
||||
if (highlighter.isShown()) {
|
||||
|
|
|
@ -104,12 +104,13 @@ add_task(async function() {
|
|||
async function inspectorShouldBeOpenAndHighlighting(inspector) {
|
||||
is(toolbox.currentToolId, "inspector", "Correct tool has been loaded");
|
||||
|
||||
await toolbox.inspectorFront.nodePicker.once("picker-started");
|
||||
const nodePicker = (await toolbox.target.getFront("inspector")).nodePicker;
|
||||
await nodePicker.once("picker-started");
|
||||
|
||||
ok(true, "picker-started event received, highlighter started");
|
||||
inspector.synthesizeKey();
|
||||
|
||||
await toolbox.inspectorFront.nodePicker.once("picker-stopped");
|
||||
await nodePicker.once("picker-stopped");
|
||||
ok(true, "picker-stopped event received, highlighter stopped");
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ const TEST_URI = `<style>body{background:red}</style>`;
|
|||
add_task(async function() {
|
||||
await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
|
||||
|
||||
const { view, toolbox } = await openRuleView();
|
||||
const pickerStopped = toolbox.inspectorFront.nodePicker.once(
|
||||
const { inspector, toolbox, view } = await openRuleView();
|
||||
const pickerStopped = inspector.inspectorFront.nodePicker.once(
|
||||
"picker-stopped"
|
||||
);
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
const TEST_URL = URL_ROOT + "doc_inspector_highlighter_dom.html";
|
||||
|
||||
add_task(async function() {
|
||||
const { toolbox, testActor } = await openInspectorForURL(TEST_URL);
|
||||
const { inspector, toolbox, testActor } = await openInspectorForURL(TEST_URL);
|
||||
const { inspectorFront } = inspector;
|
||||
|
||||
await startPicker(toolbox);
|
||||
|
||||
|
@ -54,12 +55,12 @@ add_task(async function() {
|
|||
info("First child selection test Passed.");
|
||||
|
||||
info("Stopping the picker");
|
||||
await toolbox.inspectorFront.nodePicker.stop();
|
||||
await inspectorFront.nodePicker.stop();
|
||||
|
||||
function doKeyHover(args) {
|
||||
info("Key pressed. Waiting for element to be highlighted/hovered");
|
||||
testActor.synthesizeKey(args);
|
||||
return toolbox.inspectorFront.nodePicker.once("picker-node-hovered");
|
||||
return inspectorFront.nodePicker.once("picker-node-hovered");
|
||||
}
|
||||
|
||||
function moveMouseOver(selector) {
|
||||
|
@ -69,6 +70,6 @@ add_task(async function() {
|
|||
center: true,
|
||||
selector: selector,
|
||||
});
|
||||
return toolbox.inspectorFront.nodePicker.once("picker-node-hovered");
|
||||
return inspectorFront.nodePicker.once("picker-node-hovered");
|
||||
}
|
||||
});
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
const TEST_URL = URL_ROOT + "doc_inspector_highlighter_dom.html";
|
||||
|
||||
add_task(async function() {
|
||||
const { toolbox, testActor } = await openInspectorForURL(TEST_URL);
|
||||
const { inspector, toolbox, testActor } = await openInspectorForURL(TEST_URL);
|
||||
const { inspectorFront } = inspector;
|
||||
|
||||
await startPicker(toolbox);
|
||||
|
||||
|
@ -48,12 +49,12 @@ add_task(async function() {
|
|||
info("Previously chosen child is remembered. Passed.");
|
||||
|
||||
info("Stopping the picker");
|
||||
await toolbox.inspectorFront.nodePicker.stop();
|
||||
await inspectorFront.nodePicker.stop();
|
||||
|
||||
function doKeyHover(args) {
|
||||
info("Key pressed. Waiting for element to be highlighted/hovered");
|
||||
const onHighlighterReady = toolbox.once("highlighter-ready");
|
||||
const onPickerNodeHovered = toolbox.inspectorFront.nodePicker.once(
|
||||
const onPickerNodeHovered = inspectorFront.nodePicker.once(
|
||||
"picker-node-hovered"
|
||||
);
|
||||
testActor.synthesizeKey(args);
|
||||
|
@ -63,7 +64,7 @@ add_task(async function() {
|
|||
function moveMouseOver(selector) {
|
||||
info("Waiting for element " + selector + " to be highlighted");
|
||||
const onHighlighterReady = toolbox.once("highlighter-ready");
|
||||
const onPickerNodeHovered = toolbox.inspectorFront.nodePicker.once(
|
||||
const onPickerNodeHovered = inspectorFront.nodePicker.once(
|
||||
"picker-node-hovered"
|
||||
);
|
||||
testActor.synthesizeMouse({
|
||||
|
|
|
@ -11,11 +11,12 @@ const TEST_URL = "data:text/html;charset=utf8,<div></div>";
|
|||
|
||||
add_task(async function() {
|
||||
const { inspector, toolbox, testActor } = await openInspectorForURL(TEST_URL);
|
||||
const { inspectorFront } = inspector;
|
||||
|
||||
await startPicker(toolbox);
|
||||
|
||||
info("Start using the picker by hovering over nodes");
|
||||
const onHover = toolbox.inspectorFront.nodePicker.once("picker-node-hovered");
|
||||
const onHover = inspectorFront.nodePicker.once("picker-node-hovered");
|
||||
testActor.synthesizeMouse({
|
||||
options: { type: "mousemove" },
|
||||
center: true,
|
||||
|
@ -24,7 +25,7 @@ add_task(async function() {
|
|||
await onHover;
|
||||
|
||||
info("Press escape and wait for the picker to stop");
|
||||
const onPickerStopped = toolbox.inspectorFront.nodePicker.once(
|
||||
const onPickerStopped = inspectorFront.nodePicker.once(
|
||||
"picker-node-canceled"
|
||||
);
|
||||
testActor.synthesizeKey({
|
||||
|
|
|
@ -12,7 +12,8 @@ const TEST_URI =
|
|||
"<iframe src='data:text/html;charset=utf-8,hello world'></iframe>";
|
||||
|
||||
add_task(async function() {
|
||||
const { toolbox, testActor } = await openInspectorForURL(TEST_URI);
|
||||
const { inspector, toolbox, testActor } = await openInspectorForURL(TEST_URI);
|
||||
const { inspectorFront } = inspector;
|
||||
|
||||
info("Starting element picker.");
|
||||
await startPicker(toolbox);
|
||||
|
@ -40,5 +41,5 @@ add_task(async function() {
|
|||
ok(isVisible, "Inspector is highlighting after iframe nav.");
|
||||
|
||||
info("Stopping element picker.");
|
||||
await toolbox.inspectorFront.nodePicker.stop();
|
||||
await inspectorFront.nodePicker.stop();
|
||||
});
|
||||
|
|
|
@ -12,10 +12,9 @@ const TEST_URI =
|
|||
"testing the highlighter goes away on tool selection";
|
||||
|
||||
add_task(async function() {
|
||||
const { toolbox } = await openInspectorForURL(TEST_URI);
|
||||
const pickerStopped = toolbox.inspectorFront.nodePicker.once(
|
||||
"picker-stopped"
|
||||
);
|
||||
const { inspector, toolbox } = await openInspectorForURL(TEST_URI);
|
||||
const { inspectorFront } = inspector;
|
||||
const pickerStopped = inspectorFront.nodePicker.once("picker-stopped");
|
||||
|
||||
info("Starting the inspector picker");
|
||||
await startPicker(toolbox);
|
||||
|
|
|
@ -63,11 +63,12 @@ add_task(async function() {
|
|||
|
||||
const tab = await addTab(TEST_URI);
|
||||
const toolbox = await openToolbox(tab);
|
||||
const inspectorFront = await toolbox.target.getFront("inspector");
|
||||
|
||||
await startPickerAndAssertSwitchToInspector(toolbox);
|
||||
|
||||
info("Stoppping element picker.");
|
||||
await toolbox.inspectorFront.nodePicker.stop();
|
||||
await inspectorFront.nodePicker.stop();
|
||||
|
||||
checkResults();
|
||||
});
|
||||
|
|
|
@ -74,9 +74,11 @@ var navigateTo = async function(inspector, url) {
|
|||
* @param {Boolean} skipFocus - Allow tests to bypass the focus event.
|
||||
*/
|
||||
var startPicker = async function(toolbox, skipFocus) {
|
||||
const inspectorFront = await toolbox.target.getFront("inspector");
|
||||
|
||||
info("Start the element picker");
|
||||
toolbox.win.focus();
|
||||
await toolbox.inspectorFront.nodePicker.start();
|
||||
await inspectorFront.nodePicker.start();
|
||||
if (!skipFocus) {
|
||||
// By default make sure the content window is focused since the picker may not focus
|
||||
// the content window by default.
|
||||
|
|
|
@ -154,11 +154,11 @@ StyleEditorUI.prototype = {
|
|||
},
|
||||
|
||||
async initializeHighlighter() {
|
||||
await this._toolbox.initInspector();
|
||||
this._walker = this._toolbox.walker;
|
||||
const inspectorFront = await this._toolbox.target.getFront("inspector");
|
||||
this._walker = inspectorFront.walker;
|
||||
|
||||
try {
|
||||
this._highlighter = await this._toolbox.inspectorFront.getHighlighterByType(
|
||||
this._highlighter = await inspectorFront.getHighlighterByType(
|
||||
SELECTOR_HIGHLIGHTER_TYPE
|
||||
);
|
||||
} catch (e) {
|
||||
|
|
|
@ -28,7 +28,7 @@ add_task(async function() {
|
|||
|
||||
info("Waiting for element picker to become active.");
|
||||
toolbox.win.focus();
|
||||
await toolbox.inspectorFront.nodePicker.start();
|
||||
await inspector.inspectorFront.nodePicker.start();
|
||||
|
||||
info("Moving mouse over div.");
|
||||
await moveMouseOver("#maindiv", 1, 1);
|
||||
|
|
Загрузка…
Ссылка в новой задаче