Bug 1567276 - Refactor inspector to inspectorFront. r=rcaliman

Differential Revision: https://phabricator.services.mozilla.com/D38554
This commit is contained in:
Gabriel Luong 2019-07-18 15:33:55 -04:00
parent 6d42386a82
commit 19aca80c51
46 changed files with 137 additions and 109 deletions

View File

@ -10,8 +10,8 @@ function waitForInspectorPanelChange(dbg) {
return new Promise(resolve => { return new Promise(resolve => {
toolbox.getPanelWhenReady("inspector").then(() => { toolbox.getPanelWhenReady("inspector").then(() => {
ok(toolbox.inspector, "Inspector is shown."); ok(toolbox.inspectorFront, "Inspector is shown.");
resolve(toolbox.inspector); resolve(toolbox.inspectorFront);
}); });
}); });
} }
@ -31,9 +31,14 @@ add_task(async function() {
// Ensure hovering over button highlights the node in content pane // Ensure hovering over button highlights the node in content pane
const view = inspectorNode.ownerDocument.defaultView; const view = inspectorNode.ownerDocument.defaultView;
const onNodeHighlight = toolbox.target.once("inspector") const onNodeHighlight = toolbox.target
.once("inspector")
.then(inspector => inspector.highlighter.once("node-highlight")); .then(inspector => inspector.highlighter.once("node-highlight"));
EventUtils.synthesizeMouseAtCenter(inspectorNode, {type: "mousemove"}, view); EventUtils.synthesizeMouseAtCenter(
inspectorNode,
{ type: "mousemove" },
view
);
const nodeFront = await onNodeHighlight; const nodeFront = await onNodeHighlight;
is(nodeFront.displayName, "button", "The correct node was highlighted"); is(nodeFront.displayName, "button", "The correct node was highlighted");

View File

@ -161,7 +161,7 @@ Tools.inspector = {
preventClosingOnKey: true, preventClosingOnKey: true,
onkey: function(panel, toolbox) { onkey: function(panel, toolbox) {
toolbox.inspector.nodePicker.togglePicker(); toolbox.inspectorFront.nodePicker.togglePicker();
}, },
isTargetSupported: function(target) { isTargetSupported: function(target) {
@ -617,7 +617,7 @@ function createHighlightButton(highlighterName, id) {
isTargetSupported: target => !target.chrome, isTargetSupported: target => !target.chrome,
async onClick(event, toolbox) { async onClick(event, toolbox) {
await toolbox.initInspector(); await toolbox.initInspector();
const highlighter = await toolbox.inspector.getOrCreateHighlighterByType( const highlighter = await toolbox.inspectorFront.getOrCreateHighlighterByType(
highlighterName highlighterName
); );
if (highlighter.isShown()) { if (highlighter.isShown()) {

View File

@ -104,12 +104,12 @@ add_task(async function() {
async function inspectorShouldBeOpenAndHighlighting(inspector) { async function inspectorShouldBeOpenAndHighlighting(inspector) {
is(toolbox.currentToolId, "inspector", "Correct tool has been loaded"); is(toolbox.currentToolId, "inspector", "Correct tool has been loaded");
await toolbox.inspector.nodePicker.once("picker-started"); await toolbox.inspectorFront.nodePicker.once("picker-started");
ok(true, "picker-started event received, highlighter started"); ok(true, "picker-started event received, highlighter started");
inspector.synthesizeKey(); inspector.synthesizeKey();
await toolbox.inspector.nodePicker.once("picker-stopped"); await toolbox.inspectorFront.nodePicker.once("picker-stopped");
ok(true, "picker-stopped event received, highlighter stopped"); ok(true, "picker-stopped event received, highlighter stopped");
} }

View File

@ -496,7 +496,7 @@ Toolbox.prototype = {
* Get the toolbox's inspector front. Note that it may not always have been * Get the toolbox's inspector front. Note that it may not always have been
* initialized first. Use `initInspector()` if needed. * initialized first. Use `initInspector()` if needed.
*/ */
get inspector() { get inspectorFront() {
return this._inspector; return this._inspector;
}, },
@ -1720,10 +1720,10 @@ Toolbox.prototype = {
if (currentPanel.togglePicker) { if (currentPanel.togglePicker) {
currentPanel.togglePicker(focus); currentPanel.togglePicker(focus);
} else { } else {
if (!this.inspector) { if (!this.inspectorFront) {
await this.initInspector(); await this.initInspector();
} }
this.inspector.nodePicker.togglePicker(focus); this.inspectorFront.nodePicker.togglePicker(focus);
} }
}, },
@ -1737,7 +1737,7 @@ Toolbox.prototype = {
if (currentPanel.cancelPicker) { if (currentPanel.cancelPicker) {
currentPanel.cancelPicker(); currentPanel.cancelPicker();
} else { } else {
this.inspector.nodePicker.cancel(); this.inspectorFront.nodePicker.cancel();
} }
// Stop the console from toggling. // Stop the console from toggling.
event.stopImmediatePropagation(); event.stopImmediatePropagation();
@ -1748,7 +1748,7 @@ Toolbox.prototype = {
this.tellRDMAboutPickerState(true); this.tellRDMAboutPickerState(true);
this.pickerButton.isChecked = true; this.pickerButton.isChecked = true;
await this.selectTool("inspector", "inspect_dom"); await this.selectTool("inspector", "inspect_dom");
this.on("select", this.inspector.nodePicker.stop); this.on("select", this.inspectorFront.nodePicker.stop);
}, },
_onPickerStarted: async function() { _onPickerStarted: async function() {
@ -1758,7 +1758,7 @@ Toolbox.prototype = {
_onPickerStopped: function() { _onPickerStopped: function() {
this.tellRDMAboutPickerState(false); this.tellRDMAboutPickerState(false);
this.off("select", this.inspector.nodePicker.stop); this.off("select", this.inspectorFront.nodePicker.stop);
this.doc.removeEventListener("keypress", this._onPickerKeypress, true); this.doc.removeEventListener("keypress", this._onPickerKeypress, true);
this.pickerButton.isChecked = false; this.pickerButton.isChecked = false;
}, },
@ -1881,7 +1881,7 @@ Toolbox.prototype = {
* Update the buttons. * Update the buttons.
*/ */
updateToolboxButtons() { updateToolboxButtons() {
const inspector = this.inspector; const inspector = this.inspectorFront;
// two of the buttons have highlighters that need to be cleared // two of the buttons have highlighters that need to be cleared
// on will-navigate, otherwise we hold on to the stale highlighter // on will-navigate, otherwise we hold on to the stale highlighter
const hasHighlighters = const hasHighlighters =
@ -3267,14 +3267,23 @@ Toolbox.prototype = {
// TODO: replace with getFront once inspector is separated from the toolbox // TODO: replace with getFront once inspector is separated from the toolbox
// TODO: remove these bindings // TODO: remove these bindings
this._inspector = await this.target.getInspector(); this._inspector = await this.target.getInspector();
this._walker = this.inspector.walker; this._walker = this.inspectorFront.walker;
this._highlighter = this.inspector.highlighter; this._highlighter = this.inspectorFront.highlighter;
this._selection = this.inspector.selection; this._selection = this.inspectorFront.selection;
this.inspector.nodePicker.on("picker-starting", this._onPickerStarting); this.inspectorFront.nodePicker.on(
this.inspector.nodePicker.on("picker-started", this._onPickerStarted); "picker-starting",
this.inspector.nodePicker.on("picker-stopped", this._onPickerStopped); this._onPickerStarting
this.inspector.nodePicker.on( );
this.inspectorFront.nodePicker.on(
"picker-started",
this._onPickerStarted
);
this.inspectorFront.nodePicker.on(
"picker-stopped",
this._onPickerStopped
);
this.inspectorFront.nodePicker.on(
"picker-node-canceled", "picker-node-canceled",
this._onPickerCanceled this._onPickerCanceled
); );

View File

@ -150,11 +150,11 @@ class AnimationInspector {
this.provider = provider; this.provider = provider;
this.inspector.sidebar.on("select", this.onSidebarSelectionChanged); this.inspector.sidebar.on("select", this.onSidebarSelectionChanged);
this.inspector.inspector.nodePicker.on( this.inspector.inspectorFront.nodePicker.on(
"picker-started", "picker-started",
this.onElementPickerStarted this.onElementPickerStarted
); );
this.inspector.inspector.nodePicker.on( this.inspector.inspectorFront.nodePicker.on(
"picker-stopped", "picker-stopped",
this.onElementPickerStopped this.onElementPickerStopped
); );
@ -183,11 +183,11 @@ class AnimationInspector {
"inspector-sidebar-resized", "inspector-sidebar-resized",
this.onSidebarResized this.onSidebarResized
); );
this.inspector.inspector.nodePicker.off( this.inspector.inspectorFront.nodePicker.off(
"picker-started", "picker-started",
this.onElementPickerStarted this.onElementPickerStarted
); );
this.inspector.inspector.nodePicker.off( this.inspector.inspectorFront.nodePicker.off(
"picker-stopped", "picker-stopped",
this.onElementPickerStopped this.onElementPickerStopped
); );
@ -711,7 +711,7 @@ class AnimationInspector {
} }
toggleElementPicker() { toggleElementPicker() {
this.inspector.inspector.nodePicker.togglePicker(); this.inspector.inspectorFront.nodePicker.togglePicker();
} }
async update() { async update() {

View File

@ -852,7 +852,7 @@ class FontInspector {
async onToggleFontHighlight(font, show, isForCurrentElement = true) { async onToggleFontHighlight(font, show, isForCurrentElement = true) {
if (!this.fontsHighlighter) { if (!this.fontsHighlighter) {
try { try {
this.fontsHighlighter = await this.inspector.inspector.getHighlighterByType( this.fontsHighlighter = await this.inspector.inspectorFront.getHighlighterByType(
"FontsHighlighter" "FontsHighlighter"
); );
} catch (e) { } catch (e) {

View File

@ -227,8 +227,8 @@ Inspector.prototype = {
return this._toolbox; return this._toolbox;
}, },
get inspector() { get inspectorFront() {
return this.toolbox.inspector; return this.toolbox.inspectorFront;
}, },
get walker() { get walker() {
@ -417,7 +417,7 @@ Inspector.prototype = {
}, },
_getPageStyle: function() { _getPageStyle: function() {
return this.inspector.getPageStyle().then(pageStyle => { return this.inspectorFront.getPageStyle().then(pageStyle => {
this.pageStyle = pageStyle; this.pageStyle = pageStyle;
}, this._handleRejectionIfNotDestroyed); }, this._handleRejectionIfNotDestroyed);
}, },
@ -1208,7 +1208,7 @@ Inspector.prototype = {
*/ */
async supportsEyeDropper() { async supportsEyeDropper() {
try { try {
return await this.inspector.supportsHighlighters(); return await this.inspectorFront.supportsHighlighters();
} catch (e) { } catch (e) {
console.error(e); console.error(e);
return false; return false;
@ -1706,14 +1706,14 @@ Inspector.prototype = {
}, },
startEyeDropperListeners: function() { startEyeDropperListeners: function() {
this.inspector.once("color-pick-canceled", this.onEyeDropperDone); this.inspectorFront.once("color-pick-canceled", this.onEyeDropperDone);
this.inspector.once("color-picked", this.onEyeDropperDone); this.inspectorFront.once("color-picked", this.onEyeDropperDone);
this.walker.once("new-root", this.onEyeDropperDone); this.walker.once("new-root", this.onEyeDropperDone);
}, },
stopEyeDropperListeners: function() { stopEyeDropperListeners: function() {
this.inspector.off("color-pick-canceled", this.onEyeDropperDone); this.inspectorFront.off("color-pick-canceled", this.onEyeDropperDone);
this.inspector.off("color-picked", this.onEyeDropperDone); this.inspectorFront.off("color-picked", this.onEyeDropperDone);
this.walker.off("new-root", this.onEyeDropperDone); this.walker.off("new-root", this.onEyeDropperDone);
}, },
@ -1736,7 +1736,7 @@ Inspector.prototype = {
this.telemetry.scalarSet(TELEMETRY_EYEDROPPER_OPENED, 1); this.telemetry.scalarSet(TELEMETRY_EYEDROPPER_OPENED, 1);
this.eyeDropperButton.classList.add("checked"); this.eyeDropperButton.classList.add("checked");
this.startEyeDropperListeners(); this.startEyeDropperListeners();
return this.inspector return this.inspectorFront
.pickColorFromPage({ copyOnSelect: true }) .pickColorFromPage({ copyOnSelect: true })
.catch(console.error); .catch(console.error);
}, },
@ -1753,7 +1753,7 @@ Inspector.prototype = {
this.eyeDropperButton.classList.remove("checked"); this.eyeDropperButton.classList.remove("checked");
this.stopEyeDropperListeners(); this.stopEyeDropperListeners();
return this.inspector.cancelPickColorFromPage().catch(console.error); return this.inspectorFront.cancelPickColorFromPage().catch(console.error);
}, },
/** /**

View File

@ -79,7 +79,7 @@ class MarkupContextMenu {
* This method is here for the benefit of copying links. * This method is here for the benefit of copying links.
*/ */
_copyAttributeLink(link) { _copyAttributeLink(link) {
this.inspector.inspector this.inspector.inspectorFront
.resolveRelativeURL(link, this.selection.nodeFront) .resolveRelativeURL(link, this.selection.nodeFront)
.then(url => { .then(url => {
clipboardHelper.copyString(url); clipboardHelper.copyString(url);

View File

@ -183,11 +183,11 @@ function MarkupView(inspector, frame, controllerWindow) {
this.walker.on("mutations", this._mutationObserver); this.walker.on("mutations", this._mutationObserver);
this.win.addEventListener("copy", this._onCopy); this.win.addEventListener("copy", this._onCopy);
this.win.addEventListener("mouseup", this._onMouseUp); this.win.addEventListener("mouseup", this._onMouseUp);
this.inspector.inspector.nodePicker.on( this.inspector.inspectorFront.nodePicker.on(
"picker-node-canceled", "picker-node-canceled",
this._onToolboxPickerCanceled this._onToolboxPickerCanceled
); );
this.inspector.inspector.nodePicker.on( this.inspector.inspectorFront.nodePicker.on(
"picker-node-hovered", "picker-node-hovered",
this._onToolboxPickerHover this._onToolboxPickerHover
); );
@ -932,7 +932,7 @@ MarkupView.prototype = {
if (type === "uri" || type === "cssresource" || type === "jsresource") { if (type === "uri" || type === "cssresource" || type === "jsresource") {
// Open link in a new tab. // Open link in a new tab.
this.inspector.inspector this.inspector.inspectorFront
.resolveRelativeURL(link, this.inspector.selection.nodeFront) .resolveRelativeURL(link, this.inspector.selection.nodeFront)
.then(url => { .then(url => {
if (type === "uri") { if (type === "uri") {
@ -2245,7 +2245,7 @@ MarkupView.prototype = {
this._elt.removeEventListener("mouseout", this._onMouseOut); this._elt.removeEventListener("mouseout", this._onMouseOut);
this._frame.removeEventListener("focus", this._onFocus); this._frame.removeEventListener("focus", this._onFocus);
this.inspector.selection.off("new-node-front", this._onNewSelection); this.inspector.selection.off("new-node-front", this._onNewSelection);
this.inspector.inspector.nodePicker.off( this.inspector.inspectorFront.nodePicker.off(
"picker-node-hovered", "picker-node-hovered",
this._onToolboxPickerHover this._onToolboxPickerHover
); );

View File

@ -140,7 +140,7 @@ add_task(async function() {
info("Get link from node attribute"); info("Get link from node attribute");
const link = await nodeFront.getAttribute(test.attributeName); const link = await nodeFront.getAttribute(test.attributeName);
info("Resolve link to absolue URL"); info("Resolve link to absolue URL");
const expected = await inspector.inspector.resolveRelativeURL( const expected = await inspector.inspectorFront.resolveRelativeURL(
link, link,
nodeFront nodeFront
); );

View File

@ -328,7 +328,7 @@ class RulesView {
} }
try { try {
const front = this.inspector.inspector; const front = this.inspector.inspectorFront;
this._selectorHighlighter = await front.getHighlighterByType( this._selectorHighlighter = await front.getHighlighterByType(
"SelectorHighlighter" "SelectorHighlighter"
); );

View File

@ -322,7 +322,7 @@ CssRuleView.prototype = {
} }
try { try {
const front = this.inspector.inspector; const front = this.inspector.inspectorFront;
const h = await front.getHighlighterByType("SelectorHighlighter"); const h = await front.getHighlighterByType("SelectorHighlighter");
this.selectorHighlighter = h; this.selectorHighlighter = h;
return h; return h;

View File

@ -12,7 +12,9 @@ add_task(async function() {
await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
const { view, toolbox } = await openRuleView(); const { view, toolbox } = await openRuleView();
const pickerStopped = toolbox.inspector.nodePicker.once("picker-stopped"); const pickerStopped = toolbox.inspectorFront.nodePicker.once(
"picker-stopped"
);
await startPicker(toolbox); await startPicker(toolbox);

View File

@ -95,7 +95,7 @@ async function runTest(testActor, inspector, view) {
async function testESC(swatch, inspector, testActor) { async function testESC(swatch, inspector, testActor) {
info("Press escape"); info("Press escape");
const onCanceled = new Promise(resolve => { const onCanceled = new Promise(resolve => {
inspector.inspector.once("color-pick-canceled", resolve); inspector.inspectorFront.once("color-pick-canceled", resolve);
}); });
await testActor.synthesizeKey({ key: "VK_ESCAPE", options: {} }); await testActor.synthesizeKey({ key: "VK_ESCAPE", options: {} });
await onCanceled; await onCanceled;
@ -107,7 +107,7 @@ async function testESC(swatch, inspector, testActor) {
async function testSelect(view, swatch, inspector, testActor) { async function testSelect(view, swatch, inspector, testActor) {
info("Click at x:10px y:10px"); info("Click at x:10px y:10px");
const onPicked = new Promise(resolve => { const onPicked = new Promise(resolve => {
inspector.inspector.once("color-picked", resolve); inspector.inspectorFront.once("color-picked", resolve);
}); });
// The change to the content is done async after rule view change // The change to the content is done async after rule view change
const onRuleViewChanged = view.once("ruleview-changed"); const onRuleViewChanged = view.once("ruleview-changed");

View File

@ -34,7 +34,7 @@ class HighlightersOverlay {
*/ */
constructor(inspector) { constructor(inspector) {
this.inspector = inspector; this.inspector = inspector;
this.inspectorFront = this.inspector.inspector; this.inspectorFront = this.inspector.inspectorFront;
this.store = this.inspector.store; this.store = this.inspector.store;
this.target = this.inspector.target; this.target = this.inspector.target;
this.telemetry = this.inspector.telemetry; this.telemetry = this.inspector.telemetry;

View File

@ -414,7 +414,7 @@ StyleInspectorMenu.prototype = {
let message; let message;
try { try {
const inspectorFront = this.inspector.inspector; const inspectorFront = this.inspector.inspectorFront;
const imageUrl = this._clickedNodeInfo.value.url; const imageUrl = this._clickedNodeInfo.value.url;
const data = await inspectorFront.getImageDataFromURL(imageUrl); const data = await inspectorFront.getImageDataFromURL(imageUrl);
message = await data.data.string(); message = await data.data.string();

View File

@ -422,7 +422,7 @@ TooltipsOverlay.prototype = {
naturalWidth = size.naturalWidth; naturalWidth = size.naturalWidth;
naturalHeight = size.naturalHeight; naturalHeight = size.naturalHeight;
} else { } else {
const inspectorFront = this.view.inspector.inspector; const inspectorFront = this.view.inspector.inspectorFront;
const { data, size } = await inspectorFront.getImageDataFromURL( const { data, size } = await inspectorFront.getImageDataFromURL(
imageUrl, imageUrl,
maxDim maxDim

View File

@ -66,7 +66,7 @@ add_task(async function() {
await testActor.isNodeCorrectlyHighlighted(iframeBodySelector, is); await testActor.isNodeCorrectlyHighlighted(iframeBodySelector, is);
info("Waiting for the element picker to deactivate."); info("Waiting for the element picker to deactivate.");
await inspector.inspector.nodePicker.stop(); await inspector.inspectorFront.nodePicker.stop();
function moveMouseOver(selector, x, y) { function moveMouseOver(selector, x, y) {
info("Waiting for element " + selector + " to be highlighted"); info("Waiting for element " + selector + " to be highlighted");
@ -76,6 +76,6 @@ add_task(async function() {
y, y,
options: { type: "mousemove" }, options: { type: "mousemove" },
}); });
return inspector.inspector.nodePicker.once("picker-node-hovered"); return inspector.inspectorFront.nodePicker.once("picker-node-hovered");
} }
}); });

View File

@ -95,6 +95,6 @@ add_task(async function() {
y, y,
options: { type: "mousemove" }, options: { type: "mousemove" },
}); });
return inspector.inspector.nodePicker.once("picker-node-hovered"); return inspector.inspectorFront.nodePicker.once("picker-node-hovered");
} }
}); });

View File

@ -18,23 +18,27 @@ add_task(async function() {
await unknownHighlighterTypeShouldntBeAccepted(inspector); await unknownHighlighterTypeShouldntBeAccepted(inspector);
}); });
async function onlyOneInstanceOfMainHighlighter({ inspector }) { async function onlyOneInstanceOfMainHighlighter({ inspectorFront }) {
info("Check that the inspector always sends back the same main highlighter"); info("Check that the inspector always sends back the same main highlighter");
const h1 = await inspector.getHighlighter(false); const h1 = await inspectorFront.getHighlighter(false);
const h2 = await inspector.getHighlighter(false); const h2 = await inspectorFront.getHighlighter(false);
is(h1, h2, "The same highlighter front was returned"); is(h1, h2, "The same highlighter front was returned");
is(h1.typeName, "highlighter", "The right front type was returned"); is(h1.typeName, "highlighter", "The right front type was returned");
} }
async function manyInstancesOfCustomHighlighters({ inspector }) { async function manyInstancesOfCustomHighlighters({ inspectorFront }) {
const h1 = await inspector.getHighlighterByType("BoxModelHighlighter"); const h1 = await inspectorFront.getHighlighterByType("BoxModelHighlighter");
const h2 = await inspector.getHighlighterByType("BoxModelHighlighter"); const h2 = await inspectorFront.getHighlighterByType("BoxModelHighlighter");
ok(h1 !== h2, "getHighlighterByType returns new instances every time (1)"); ok(h1 !== h2, "getHighlighterByType returns new instances every time (1)");
const h3 = await inspector.getHighlighterByType("CssTransformHighlighter"); const h3 = await inspectorFront.getHighlighterByType(
const h4 = await inspector.getHighlighterByType("CssTransformHighlighter"); "CssTransformHighlighter"
);
const h4 = await inspectorFront.getHighlighterByType(
"CssTransformHighlighter"
);
ok(h3 !== h4, "getHighlighterByType returns new instances every time (2)"); ok(h3 !== h4, "getHighlighterByType returns new instances every time (2)");
ok( ok(
h3 !== h1 && h3 !== h2, h3 !== h1 && h3 !== h2,
@ -51,9 +55,11 @@ async function manyInstancesOfCustomHighlighters({ inspector }) {
await h4.finalize(); await h4.finalize();
} }
async function showHideMethodsAreAvailable({ inspector }) { async function showHideMethodsAreAvailable({ inspectorFront }) {
const h1 = await inspector.getHighlighterByType("BoxModelHighlighter"); const h1 = await inspectorFront.getHighlighterByType("BoxModelHighlighter");
const h2 = await inspector.getHighlighterByType("CssTransformHighlighter"); const h2 = await inspectorFront.getHighlighterByType(
"CssTransformHighlighter"
);
ok("show" in h1, "Show method is present on the front API"); ok("show" in h1, "Show method is present on the front API");
ok("show" in h2, "Show method is present on the front API"); ok("show" in h2, "Show method is present on the front API");
@ -64,7 +70,7 @@ async function showHideMethodsAreAvailable({ inspector }) {
await h2.finalize(); await h2.finalize();
} }
async function unknownHighlighterTypeShouldntBeAccepted({ inspector }) { async function unknownHighlighterTypeShouldntBeAccepted({ inspectorFront }) {
const h = await inspector.getHighlighterByType("whatever"); const h = await inspectorFront.getHighlighterByType("whatever");
ok(!h, "No highlighter was returned for the invalid type"); ok(!h, "No highlighter was returned for the invalid type");
} }

View File

@ -39,7 +39,7 @@ add_task(async function() {
function cancelPickerByShortcut() { function cancelPickerByShortcut() {
info("Key pressed. Waiting for picker to be canceled."); info("Key pressed. Waiting for picker to be canceled.");
testActor.synthesizeKey({ key: "VK_ESCAPE", options: {} }); testActor.synthesizeKey({ key: "VK_ESCAPE", options: {} });
return inspector.inspector.nodePicker.once("picker-node-canceled"); return inspector.inspectorFront.nodePicker.once("picker-node-canceled");
} }
function moveMouseOver(selector) { function moveMouseOver(selector) {

View File

@ -42,7 +42,7 @@ add_task(async function() {
const { inspector, testActor } = await openInspectorForURL( const { inspector, testActor } = await openInspectorForURL(
"data:text/html;charset=utf-8," + encodeURIComponent(TEST_URL) "data:text/html;charset=utf-8," + encodeURIComponent(TEST_URL)
); );
const front = inspector.inspector; const front = inspector.inspectorFront;
const highlighter = await front.getHighlighterByType(HIGHLIGHTER_TYPE); const highlighter = await front.getHighlighterByType(HIGHLIGHTER_TYPE);
await isHiddenByDefault(testActor, highlighter); await isHiddenByDefault(testActor, highlighter);

View File

@ -23,7 +23,7 @@ add_task(async function() {
const { inspector, testActor } = await openInspectorForURL( const { inspector, testActor } = await openInspectorForURL(
"data:text/html;charset=utf-8," + encodeURIComponent(TEST_URL) "data:text/html;charset=utf-8," + encodeURIComponent(TEST_URL)
); );
const front = inspector.inspector; const front = inspector.inspectorFront;
const highlighter = await front.getHighlighterByType(HIGHLIGHTER_TYPE); const highlighter = await front.getHighlighterByType(HIGHLIGHTER_TYPE);
info("Try to show the highlighter on the grid container"); info("Try to show the highlighter on the grid container");

View File

@ -30,7 +30,7 @@ const SHAPE_TYPES = [
add_task(async function() { add_task(async function() {
const { inspector, testActor } = await openInspectorForURL(TEST_URL); const { inspector, testActor } = await openInspectorForURL(TEST_URL);
const front = inspector.inspector; const front = inspector.inspectorFront;
const highlighter = await front.getHighlighterByType(HIGHLIGHTER_TYPE); const highlighter = await front.getHighlighterByType(HIGHLIGHTER_TYPE);
await isHiddenByDefault(testActor, highlighter); await isHiddenByDefault(testActor, highlighter);

View File

@ -11,7 +11,7 @@ const HIGHLIGHTER_TYPE = "ShapesHighlighter";
add_task(async function() { add_task(async function() {
const { inspector, testActor } = await openInspectorForURL(TEST_URL); const { inspector, testActor } = await openInspectorForURL(TEST_URL);
const front = inspector.inspector; const front = inspector.inspectorFront;
const highlighter = await front.getHighlighterByType(HIGHLIGHTER_TYPE); const highlighter = await front.getHighlighterByType(HIGHLIGHTER_TYPE);
await polygonHasCorrectAttrs(testActor, inspector, highlighter); await polygonHasCorrectAttrs(testActor, inspector, highlighter);

View File

@ -23,7 +23,7 @@ add_task(async function() {
const { inspector, testActor } = await openInspectorForURL( const { inspector, testActor } = await openInspectorForURL(
"data:text/html;charset=utf-8," + encodeURI(TEST_URL) "data:text/html;charset=utf-8," + encodeURI(TEST_URL)
); );
const front = inspector.inspector; const front = inspector.inspectorFront;
const highlighter = await front.getHighlighterByType( const highlighter = await front.getHighlighterByType(
"CssTransformHighlighter" "CssTransformHighlighter"

View File

@ -22,7 +22,7 @@ const TEST_URL = URL_ROOT + "doc_inspector_highlighter_csstransform.html";
add_task(async function() { add_task(async function() {
const { inspector, testActor } = await openInspectorForURL(TEST_URL); const { inspector, testActor } = await openInspectorForURL(TEST_URL);
const front = inspector.inspector; const front = inspector.inspectorFront;
const highlighter = await front.getHighlighterByType( const highlighter = await front.getHighlighterByType(
"CssTransformHighlighter" "CssTransformHighlighter"

View File

@ -70,7 +70,7 @@ add_task(async function() {
); );
info("Waiting for element picker to deactivate."); info("Waiting for element picker to deactivate.");
await inspector.inspector.nodePicker.stop(); await inspector.inspectorFront.nodePicker.stop();
function moveMouseOver(selector) { function moveMouseOver(selector) {
info("Waiting for element " + selector + " to be highlighted"); info("Waiting for element " + selector + " to be highlighted");
@ -80,6 +80,8 @@ add_task(async function() {
options: { type: "mousemove" }, options: { type: "mousemove" },
center: true, center: true,
}) })
.then(() => inspector.inspector.nodePicker.once("picker-node-hovered")); .then(() =>
inspector.inspectorFront.nodePicker.once("picker-node-hovered")
);
} }
}); });

View File

@ -54,12 +54,12 @@ add_task(async function() {
info("First child selection test Passed."); info("First child selection test Passed.");
info("Stopping the picker"); info("Stopping the picker");
await toolbox.inspector.nodePicker.stop(); await toolbox.inspectorFront.nodePicker.stop();
function doKeyHover(args) { function doKeyHover(args) {
info("Key pressed. Waiting for element to be highlighted/hovered"); info("Key pressed. Waiting for element to be highlighted/hovered");
testActor.synthesizeKey(args); testActor.synthesizeKey(args);
return toolbox.inspector.nodePicker.once("picker-node-hovered"); return toolbox.inspectorFront.nodePicker.once("picker-node-hovered");
} }
function moveMouseOver(selector) { function moveMouseOver(selector) {
@ -69,6 +69,6 @@ add_task(async function() {
center: true, center: true,
selector: selector, selector: selector,
}); });
return toolbox.inspector.nodePicker.once("picker-node-hovered"); return toolbox.inspectorFront.nodePicker.once("picker-node-hovered");
} }
}); });

View File

@ -48,12 +48,12 @@ add_task(async function() {
info("Previously chosen child is remembered. Passed."); info("Previously chosen child is remembered. Passed.");
info("Stopping the picker"); info("Stopping the picker");
await toolbox.inspector.nodePicker.stop(); await toolbox.inspectorFront.nodePicker.stop();
function doKeyHover(args) { function doKeyHover(args) {
info("Key pressed. Waiting for element to be highlighted/hovered"); info("Key pressed. Waiting for element to be highlighted/hovered");
const onHighlighterReady = toolbox.once("highlighter-ready"); const onHighlighterReady = toolbox.once("highlighter-ready");
const onPickerNodeHovered = toolbox.inspector.nodePicker.once( const onPickerNodeHovered = toolbox.inspectorFront.nodePicker.once(
"picker-node-hovered" "picker-node-hovered"
); );
testActor.synthesizeKey(args); testActor.synthesizeKey(args);
@ -63,7 +63,7 @@ add_task(async function() {
function moveMouseOver(selector) { function moveMouseOver(selector) {
info("Waiting for element " + selector + " to be highlighted"); info("Waiting for element " + selector + " to be highlighted");
const onHighlighterReady = toolbox.once("highlighter-ready"); const onHighlighterReady = toolbox.once("highlighter-ready");
const onPickerNodeHovered = toolbox.inspector.nodePicker.once( const onPickerNodeHovered = toolbox.inspectorFront.nodePicker.once(
"picker-node-hovered" "picker-node-hovered"
); );
testActor.synthesizeMouse({ testActor.synthesizeMouse({

View File

@ -57,20 +57,20 @@ add_task(async function() {
return promise.all([ return promise.all([
inspector.selection.once("new-node-front"), inspector.selection.once("new-node-front"),
inspector.once("inspector-updated"), inspector.once("inspector-updated"),
inspector.inspector.nodePicker.once("picker-stopped"), inspector.inspectorFront.nodePicker.once("picker-stopped"),
]); ]);
} }
function doKeyStop(args) { function doKeyStop(args) {
info("Key pressed. Waiting for picker to be canceled"); info("Key pressed. Waiting for picker to be canceled");
testActor.synthesizeKey(args); testActor.synthesizeKey(args);
return inspector.inspector.nodePicker.once("picker-stopped"); return inspector.inspectorFront.nodePicker.once("picker-stopped");
} }
function moveMouseOver(selector) { function moveMouseOver(selector) {
info("Waiting for element " + selector + " to be highlighted"); info("Waiting for element " + selector + " to be highlighted");
const onHighlighterReady = toolbox.once("highlighter-ready"); const onHighlighterReady = toolbox.once("highlighter-ready");
const onPickerNodeHovered = inspector.inspector.nodePicker.once( const onPickerNodeHovered = inspector.inspectorFront.nodePicker.once(
"picker-node-hovered" "picker-node-hovered"
); );
testActor.synthesizeMouse({ testActor.synthesizeMouse({

View File

@ -15,7 +15,7 @@ add_task(async function() {
await startPicker(toolbox); await startPicker(toolbox);
info("Start using the picker by hovering over nodes"); info("Start using the picker by hovering over nodes");
const onHover = toolbox.inspector.nodePicker.once("picker-node-hovered"); const onHover = toolbox.inspectorFront.nodePicker.once("picker-node-hovered");
testActor.synthesizeMouse({ testActor.synthesizeMouse({
options: { type: "mousemove" }, options: { type: "mousemove" },
center: true, center: true,
@ -24,7 +24,7 @@ add_task(async function() {
await onHover; await onHover;
info("Press escape and wait for the picker to stop"); info("Press escape and wait for the picker to stop");
const onPickerStopped = toolbox.inspector.nodePicker.once( const onPickerStopped = toolbox.inspectorFront.nodePicker.once(
"picker-node-canceled" "picker-node-canceled"
); );
testActor.synthesizeKey({ testActor.synthesizeKey({

View File

@ -23,7 +23,7 @@ const RULERS_TEXT_STEP = 100;
add_task(async function() { add_task(async function() {
const { inspector, testActor } = await openInspectorForURL(TEST_URL); const { inspector, testActor } = await openInspectorForURL(TEST_URL);
const front = inspector.inspector; const front = inspector.inspectorFront;
const highlighter = await front.getHighlighterByType("RulersHighlighter"); const highlighter = await front.getHighlighterByType("RulersHighlighter");

View File

@ -15,7 +15,7 @@ const ID = "rulers-highlighter-";
add_task(async function() { add_task(async function() {
const { inspector, testActor } = await openInspectorForURL(TEST_URL); const { inspector, testActor } = await openInspectorForURL(TEST_URL);
const front = inspector.inspector; const front = inspector.inspectorFront;
const highlighter = await front.getHighlighterByType("RulersHighlighter"); const highlighter = await front.getHighlighterByType("RulersHighlighter");

View File

@ -17,7 +17,7 @@ var { Toolbox } = require("devtools/client/framework/toolbox");
add_task(async function() { add_task(async function() {
const { inspector, testActor } = await openInspectorForURL(TEST_URL); const { inspector, testActor } = await openInspectorForURL(TEST_URL);
const front = inspector.inspector; const front = inspector.inspectorFront;
const highlighter = await front.getHighlighterByType("RulersHighlighter"); const highlighter = await front.getHighlighterByType("RulersHighlighter");

View File

@ -49,7 +49,7 @@ requestLongerTimeout(5);
add_task(async function() { add_task(async function() {
const { inspector, testActor } = await openInspectorForURL(TEST_URL); const { inspector, testActor } = await openInspectorForURL(TEST_URL);
const front = inspector.inspector; const front = inspector.inspectorFront;
const highlighter = await front.getHighlighterByType("SelectorHighlighter"); const highlighter = await front.getHighlighterByType("SelectorHighlighter");
const contextNode = await getNodeFront("body", inspector); const contextNode = await getNodeFront("body", inspector);

View File

@ -42,7 +42,7 @@ requestLongerTimeout(5);
add_task(async function() { add_task(async function() {
const { inspector, testActor } = await openInspectorForURL(TEST_URL); const { inspector, testActor } = await openInspectorForURL(TEST_URL);
const front = inspector.inspector; const front = inspector.inspectorFront;
const highlighter = await front.getHighlighterByType("SelectorHighlighter"); const highlighter = await front.getHighlighterByType("SelectorHighlighter");
for (const { inIframe, selector, containerCount } of TEST_DATA) { for (const { inIframe, selector, containerCount } of TEST_DATA) {

View File

@ -37,6 +37,6 @@ add_task(async function() {
center: true, center: true,
selector: selector, selector: selector,
}); });
return inspector.inspector.nodePicker.once("picker-node-hovered"); return inspector.inspectorFront.nodePicker.once("picker-node-hovered");
} }
}); });

View File

@ -40,5 +40,5 @@ add_task(async function() {
ok(isVisible, "Inspector is highlighting after iframe nav."); ok(isVisible, "Inspector is highlighting after iframe nav.");
info("Stopping element picker."); info("Stopping element picker.");
await toolbox.inspector.nodePicker.stop(); await toolbox.inspectorFront.nodePicker.stop();
}); });

View File

@ -13,7 +13,9 @@ const TEST_URI =
add_task(async function() { add_task(async function() {
const { toolbox } = await openInspectorForURL(TEST_URI); const { toolbox } = await openInspectorForURL(TEST_URI);
const pickerStopped = toolbox.inspector.nodePicker.once("picker-stopped"); const pickerStopped = toolbox.inspectorFront.nodePicker.once(
"picker-stopped"
);
info("Starting the inspector picker"); info("Starting the inspector picker");
await startPicker(toolbox); await startPicker(toolbox);

View File

@ -67,7 +67,7 @@ add_task(async function() {
await startPickerAndAssertSwitchToInspector(toolbox); await startPickerAndAssertSwitchToInspector(toolbox);
info("Stoppping element picker."); info("Stoppping element picker.");
await toolbox.inspector.nodePicker.stop(); await toolbox.inspectorFront.nodePicker.stop();
checkResults(); checkResults();
}); });

View File

@ -76,7 +76,7 @@ var navigateTo = async function(inspector, url) {
var startPicker = async function(toolbox, skipFocus) { var startPicker = async function(toolbox, skipFocus) {
info("Start the element picker"); info("Start the element picker");
toolbox.win.focus(); toolbox.win.focus();
await toolbox.inspector.nodePicker.start(); await toolbox.inspectorFront.nodePicker.start();
if (!skipFocus) { if (!skipFocus) {
// By default make sure the content window is focused since the picker may not focus // By default make sure the content window is focused since the picker may not focus
// the content window by default. // the content window by default.
@ -129,7 +129,9 @@ function pickElement(inspector, testActor, selector, x, y) {
*/ */
function hoverElement(inspector, testActor, selector, x, y) { function hoverElement(inspector, testActor, selector, x, y) {
info("Waiting for element " + selector + " to be hovered"); info("Waiting for element " + selector + " to be hovered");
const onHovered = inspector.inspector.nodePicker.once("picker-node-hovered"); const onHovered = inspector.inspectorFront.nodePicker.once(
"picker-node-hovered"
);
testActor.synthesizeMouse({ selector, x, y, options: { type: "mousemove" } }); testActor.synthesizeMouse({ selector, x, y, options: { type: "mousemove" } });
return onHovered; return onHovered;
} }
@ -504,7 +506,7 @@ async function poll(check, desc, attempts = 10, timeBetweenAttempts = 200) {
*/ */
const getHighlighterHelperFor = type => const getHighlighterHelperFor = type =>
async function({ inspector, testActor }) { async function({ inspector, testActor }) {
const front = inspector.inspector; const front = inspector.inspectorFront;
const highlighter = await front.getHighlighterByType(type); const highlighter = await front.getHighlighterByType(type);
let prefix = ""; let prefix = "";

View File

@ -236,34 +236,34 @@ class SwatchColorPickerTooltip extends SwatchBasedEditorTooltip {
} }
_openEyeDropper() { _openEyeDropper() {
const { inspector, toolbox, telemetry } = this.inspector; const { inspectorFront, toolbox, telemetry } = this.inspector;
telemetry telemetry
.getHistogramById(TELEMETRY_PICKER_EYEDROPPER_OPEN_COUNT) .getHistogramById(TELEMETRY_PICKER_EYEDROPPER_OPEN_COUNT)
.add(true); .add(true);
// cancelling picker(if it is already selected) on opening eye-dropper // cancelling picker(if it is already selected) on opening eye-dropper
inspector.nodePicker.cancel(); inspectorFront.nodePicker.cancel();
// pickColorFromPage will focus the content document. If the devtools are in a // pickColorFromPage will focus the content document. If the devtools are in a
// separate window, the colorpicker tooltip will be closed before pickColorFromPage // separate window, the colorpicker tooltip will be closed before pickColorFromPage
// resolves. Flip the flag early to avoid issues with onTooltipHidden(). // resolves. Flip the flag early to avoid issues with onTooltipHidden().
this.eyedropperOpen = true; this.eyedropperOpen = true;
inspector.pickColorFromPage({ copyOnSelect: false }).then(() => { inspectorFront.pickColorFromPage({ copyOnSelect: false }).then(() => {
// close the colorpicker tooltip so that only the eyedropper is open. // close the colorpicker tooltip so that only the eyedropper is open.
this.hide(); this.hide();
this.tooltip.emit("eyedropper-opened"); this.tooltip.emit("eyedropper-opened");
}, console.error); }, console.error);
inspector.once("color-picked", color => { inspectorFront.once("color-picked", color => {
toolbox.win.focus(); toolbox.win.focus();
this._selectColor(color); this._selectColor(color);
this._onEyeDropperDone(); this._onEyeDropperDone();
}); });
inspector.once("color-pick-canceled", () => { inspectorFront.once("color-pick-canceled", () => {
this._onEyeDropperDone(); this._onEyeDropperDone();
}); });
} }

View File

@ -158,7 +158,7 @@ StyleEditorUI.prototype = {
this._walker = this._toolbox.walker; this._walker = this._toolbox.walker;
try { try {
this._highlighter = await this._toolbox.inspector.getHighlighterByType( this._highlighter = await this._toolbox.inspectorFront.getHighlighterByType(
SELECTOR_HIGHLIGHTER_TYPE SELECTOR_HIGHLIGHTER_TYPE
); );
} catch (e) { } catch (e) {

View File

@ -1139,7 +1139,7 @@ function isReverseSearchInputFocused(hud) {
*/ */
async function selectNodeWithPicker(toolbox, testActor, selector) { async function selectNodeWithPicker(toolbox, testActor, selector) {
const inspector = toolbox.getPanel("inspector"); const inspector = toolbox.getPanel("inspector");
const inspectorFront = inspector.inspector; const inspectorFront = inspector.inspectorFront;
const onPickerStarted = inspectorFront.nodePicker.once("picker-started"); const onPickerStarted = inspectorFront.nodePicker.once("picker-started");
inspectorFront.nodePicker.start(); inspectorFront.nodePicker.start();

View File

@ -28,7 +28,7 @@ add_task(async function() {
info("Waiting for element picker to become active."); info("Waiting for element picker to become active.");
toolbox.win.focus(); toolbox.win.focus();
await toolbox.inspector.nodePicker.start(); await toolbox.inspectorFront.nodePicker.start();
info("Moving mouse over div."); info("Moving mouse over div.");
await moveMouseOver("#maindiv", 1, 1); await moveMouseOver("#maindiv", 1, 1);
@ -50,6 +50,6 @@ add_task(async function() {
y, y,
options: { type: "mousemove" }, options: { type: "mousemove" },
}); });
return inspector.inspector.nodePicker.once("picker-node-hovered"); return inspector.inspectorFront.nodePicker.once("picker-node-hovered");
} }
}); });