Bug 1447487 - remove all uses of GCLI eyedropper; r=ochameau

Summary:
this removes references to GCLI in the inspector front and from the browser menu, leaving
no further uses of gcli eyedropper

Test Plan: mochitests

Reviewers: ochameau

Tags: #secure-revision

Bug #: 1447487

Differential Revision: https://phabricator.services.mozilla.com/D3614

--HG--
extra : rebase_source : a33632edb6127568ec65ca2837ba8c13a3c1ca78
extra : source : d8a1c6a80a59a69ab997f643ce313b022d081e13
This commit is contained in:
yulia 2018-08-17 16:55:01 +02:00
parent 5facf882eb
commit e721d86916
4 changed files with 18 additions and 15 deletions

View File

@ -2024,7 +2024,7 @@ Inspector.prototype = {
this.telemetry.scalarSet(TELEMETRY_EYEDROPPER_OPENED, 1);
this.eyeDropperButton.classList.add("checked");
this.startEyeDropperListeners();
return this.inspector.pickColorFromPage(this.toolbox, {copyOnSelect: true})
return this.inspector.pickColorFromPage({copyOnSelect: true})
.catch(console.error);
},

View File

@ -31,10 +31,10 @@
const { Cu } = require("chrome");
loader.lazyRequireGetter(this, "gDevToolsBrowser", "devtools/client/framework/devtools-browser", true);
loader.lazyRequireGetter(this, "CommandUtils", "devtools/client/shared/developer-toolbar", true);
loader.lazyRequireGetter(this, "TargetFactory", "devtools/client/framework/target", true);
loader.lazyRequireGetter(this, "ResponsiveUIManager", "devtools/client/responsive.html/manager", true);
loader.lazyRequireGetter(this, "openDocLink", "devtools/client/shared/link", true);
loader.lazyRequireGetter(this, "InspectorFront", "devtools/shared/fronts/inspector", true);
loader.lazyImporter(this, "BrowserToolboxProcess", "resource://devtools/client/framework/ToolboxProcess.jsm");
loader.lazyImporter(this, "ScratchpadManager", "resource://devtools/client/scratchpad/scratchpad-manager.jsm");
@ -96,11 +96,12 @@ exports.menuitems = [
},
{ id: "menu_eyedropper",
l10nKey: "eyedropper",
oncommand(event) {
async oncommand(event) {
const window = event.target.ownerDocument.defaultView;
const target = TargetFactory.forTab(window.gBrowser.selectedTab);
CommandUtils.executeOnTarget(target, "eyedropper --frommenu");
await target.makeRemote();
const inspector = new InspectorFront(target.client, target.form);
inspector.pickColorFromPage({copyOnSelect: true, fromMenu: true});
},
checkbox: true
},

View File

@ -174,7 +174,7 @@ class SwatchColorPickerTooltip extends SwatchBasedEditorTooltip {
// resolves. Flip the flag early to avoid issues with onTooltipHidden().
this.eyedropperOpen = true;
inspector.pickColorFromPage(toolbox, {copyOnSelect: false}).then(() => {
inspector.pickColorFromPage({copyOnSelect: false}).then(() => {
// close the colorpicker tooltip so that only the eyedropper is open.
this.hide();

View File

@ -3,6 +3,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const Telemetry = require("devtools/client/shared/telemetry");
const telemetry = new Telemetry();
const TELEMETRY_EYEDROPPER_OPENED = "DEVTOOLS_EYEDROPPER_OPENED_COUNT";
const TELEMETRY_EYEDROPPER_OPENED_MENU = "DEVTOOLS_MENU_EYEDROPPER_OPENED_COUNT";
const {
Front,
FrontClassWithSpec,
@ -17,8 +22,6 @@ const {
const defer = require("devtools/shared/defer");
loader.lazyRequireGetter(this, "nodeConstants",
"devtools/shared/dom-node-constants");
loader.lazyRequireGetter(this, "CommandUtils",
"devtools/client/shared/developer-toolbar", true);
/**
* Client side of the DOM walker.
@ -484,14 +487,13 @@ var InspectorFront = FrontClassWithSpec(inspectorSpec, {
impl: "_getPageStyle"
}),
pickColorFromPage: custom(async function(toolbox, options) {
if (toolbox) {
// If the eyedropper was already started using the gcli command, hide it so we don't
// end up with 2 instances of the eyedropper on the page.
CommandUtils.executeOnTarget(toolbox.target, "eyedropper --hide");
}
pickColorFromPage: custom(async function(options) {
await this._pickColorFromPage(options);
if (options.fromMenu) {
telemetry.getHistogramById(TELEMETRY_EYEDROPPER_OPENED_MENU).add(true);
} else {
telemetry.getHistogramById(TELEMETRY_EYEDROPPER_OPENED).add(true);
}
}, {
impl: "_pickColorFromPage"
})