Backed out 3 changesets (bug 1447487, bug 1485374) for failing at browser_ext_devtools_panels_elements_sidebar.js and /mochitest/test_inspector-pick-color.html on a CLOSED TREE

Backed out changeset 82ef44f87f72 (bug 1447487)
Backed out changeset d8a1c6a80a59 (bug 1447487)
Backed out changeset d4761bb0096a (bug 1485374)
This commit is contained in:
Gurzau Raul 2018-08-30 21:31:53 +03:00
parent 1e60ae6690
commit f9c513f20c
5 changed files with 19 additions and 18 deletions

View File

@ -41,6 +41,8 @@ loader.lazyRequireGetter(this, "getHighlighterUtils",
"devtools/client/framework/toolbox-highlighter-utils", true);
loader.lazyRequireGetter(this, "Selection",
"devtools/client/framework/selection", true);
loader.lazyRequireGetter(this, "InspectorFront",
"devtools/shared/fronts/inspector", true);
loader.lazyRequireGetter(this, "flags",
"devtools/shared/flags");
loader.lazyRequireGetter(this, "KeyShortcuts",
@ -2694,7 +2696,7 @@ Toolbox.prototype = {
initInspector: function() {
if (!this._initInspector) {
this._initInspector = (async function() {
this._inspector = this.target.getFront("inspector");
this._inspector = InspectorFront(this._target.client, this._target.form);
const pref = "devtools.inspector.showAllAnonymousContent";
const showAllAnonymousContent = Services.prefs.getBoolPref(pref);
this._walker = await this._inspector.getWalker({ showAllAnonymousContent });
@ -2782,6 +2784,7 @@ Toolbox.prototype = {
await this.highlighterUtils.stopPicker();
}
await this._inspector.destroy();
if (this._highlighter) {
// Note that if the toolbox is closed, this will work fine, but will fail
// in case the browser is closed and will trigger a noSuchActor message.

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({copyOnSelect: true})
return this.inspector.pickColorFromPage(this.toolbox, {copyOnSelect: true})
.catch(console.error);
},

View File

@ -31,6 +31,7 @@
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);
@ -95,12 +96,11 @@ exports.menuitems = [
},
{ id: "menu_eyedropper",
l10nKey: "eyedropper",
async oncommand(event) {
oncommand(event) {
const window = event.target.ownerDocument.defaultView;
const target = TargetFactory.forTab(window.gBrowser.selectedTab);
await target.makeRemote();
const inspectorFront = await target.getFront("inspector");
inspectorFront.pickColorFromPage({copyOnSelect: true, fromMenu: true});
CommandUtils.executeOnTarget(target, "eyedropper --frommenu");
},
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({copyOnSelect: false}).then(() => {
inspector.pickColorFromPage(toolbox, {copyOnSelect: false}).then(() => {
// close the colorpicker tooltip so that only the eyedropper is open.
this.hide();

View File

@ -3,11 +3,6 @@
* 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,
@ -22,6 +17,8 @@ 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.
@ -487,13 +484,14 @@ var InspectorFront = FrontClassWithSpec(inspectorSpec, {
impl: "_getPageStyle"
}),
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);
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");
}
await this._pickColorFromPage(options);
}, {
impl: "_pickColorFromPage"
})