Backed out changeset 55739a1e4de9 (bug 1474356) for mochitest bc failures on browser_ext_devtools_panel.js. CLOSED TREE

This commit is contained in:
Narcis Beleuzu 2018-07-26 14:06:18 +03:00
parent 91bcab3f74
commit 032970b913
8 changed files with 32 additions and 43 deletions

View file

@ -7,8 +7,8 @@
"use strict";
const toolId1 = "testtool1";
const toolId2 = "testtool2";
const toolId1 = "test-tool-1";
const toolId2 = "test-tool-2";
function test() {
addTab("about:blank").then(runTests1);

View file

@ -19,7 +19,7 @@ function testRegister(aToolbox) {
gDevTools.once("tool-registered", toolRegistered);
gDevTools.registerTool({
id: "testTool",
id: "test-tool",
label: "Test Tool",
inMenu: true,
isTargetSupported: () => true,
@ -28,7 +28,7 @@ function testRegister(aToolbox) {
}
function toolRegistered(toolId) {
is(toolId, "testTool", "tool-registered event handler sent tool id");
is(toolId, "test-tool", "tool-registered event handler sent tool id");
ok(gDevTools.getToolDefinitionMap().has(toolId), "tool added to map");
@ -61,11 +61,11 @@ function getAllBrowserWindows() {
function testUnregister() {
gDevTools.once("tool-unregistered", toolUnregistered);
gDevTools.unregisterTool("testTool");
gDevTools.unregisterTool("test-tool");
}
function toolUnregistered(toolId) {
is(toolId, "testTool", "tool-unregistered event handler sent tool id");
is(toolId, "test-tool", "tool-unregistered event handler sent tool id");
ok(!gDevTools.getToolDefinitionMap().has(toolId), "tool removed from map");

View file

@ -39,7 +39,7 @@ add_task(async function() {
function registerNewTool() {
const toolDefinition = {
id: "testTool",
id: "test-tool",
isTargetSupported: () => true,
visibilityswitch: "devtools.test-tool.enabled",
url: "about:blank",
@ -47,11 +47,11 @@ function registerNewTool() {
};
ok(gDevTools, "gDevTools exists");
ok(!gDevTools.getToolDefinitionMap().has("testTool"),
ok(!gDevTools.getToolDefinitionMap().has("test-tool"),
"The tool is not registered");
gDevTools.registerTool(toolDefinition);
ok(gDevTools.getToolDefinitionMap().has("testTool"),
ok(gDevTools.getToolDefinitionMap().has("test-tool"),
"The tool is registered");
}
@ -476,7 +476,7 @@ async function lookupButtonForToolId(toolId) {
}
async function cleanup() {
gDevTools.unregisterTool("testTool");
gDevTools.unregisterTool("test-tool");
await toolbox.destroy();
gBrowser.removeCurrentTab();
for (const pref of modifiedPrefs) {

View file

@ -9,7 +9,7 @@
// tool is not supported.
const testToolDefinition = {
id: "testTool",
id: "test-tool",
isTargetSupported: () => true,
visibilityswitch: "devtools.test-tool.enabled",
url: "about:blank",
@ -31,7 +31,7 @@ add_task(async function() {
let target = TargetFactory.forTab(tab);
let toolbox = await gDevTools.showToolbox(target, testToolDefinition.id);
is(toolbox.currentToolId, "testTool", "test-tool was selected");
is(toolbox.currentToolId, "test-tool", "test-tool was selected");
await gDevTools.closeToolbox(target);
// Make the previously selected tool unavailable.

View file

@ -10,7 +10,7 @@
// right state, and that it works for an input inside of a panel.
const URL = "data:text/html;charset=utf8,test for textbox context menu";
const textboxToolId = "testtool1";
const textboxToolId = "test-tool-1";
registerCleanupFunction(() => {
gDevTools.unregisterTool(textboxToolId);

View file

@ -13,6 +13,8 @@ const DISABLE_AUTOHIDE_PREF = "ui.popup.disable_autohide";
const HOST_HISTOGRAM = "DEVTOOLS_TOOLBOX_HOST";
const CURRENT_THEME_SCALAR = "devtools.current_theme";
const HTML_NS = "http://www.w3.org/1999/xhtml";
const REGEX_PANEL =
/^(?:webconsole|inspector|jsdebugger|styleeditor|netmonitor|storage)$/;
var {Ci, Cc} = require("chrome");
var promise = require("promise");
@ -1927,17 +1929,16 @@ Toolbox.prototype = {
const pending = ["host", "width", "start_state", "panel_name", "cold", "session_id"];
if (id === "webconsole") {
pending.push("message_count");
// Cold webconsole event message_count is handled in
// devtools/client/webconsole/webconsole-output-wrapper.js
if (!cold) {
this.telemetry.addEventProperty(
"devtools.main", "enter", "webconsole", null, "message_count", 0);
}
}
this.telemetry.preparePendingEvent("devtools.main", "enter", panelName, null, pending);
// Cold webconsole event message_count is handled in
// devtools/client/webconsole/webconsole-output-wrapper.js
if (!cold && id === "webconsole") {
this.telemetry.addEventProperty(
"devtools.main", "enter", "webconsole", null, "message_count", 0);
}
this.telemetry.preparePendingEvent(
"devtools.main", "enter", panelName, null, pending);
this.telemetry.addEventProperty(
"devtools.main", "open", "tools", null, "session_id", this.sessionId
);
@ -2909,7 +2910,6 @@ Toolbox.prototype = {
}
this.browserRequire = null;
this._toolNames = null;
// Now that we are closing the toolbox we can re-enable the cache settings
// and disable the service workers testing settings for the current tab.
@ -3378,13 +3378,7 @@ Toolbox.prototype = {
},
getTelemetryPanelNameOrOther: function(id) {
if (!this._toolNames) {
const definitions = gDevTools.getToolDefinitionArray();
const definitionIds = definitions.map(definition => definition.id);
this._toolNames = new Set(definitionIds);
}
if (!this._toolNames.has(id)) {
if (!REGEX_PANEL.test(id)) {
return "other";
}
return id;

View file

@ -429,13 +429,8 @@ WebConsoleOutputWrapper.prototype = {
store.dispatch(actions.messagesAdd(this.queuedMessageAdds));
const length = this.queuedMessageAdds.length;
// This telemetry event is only useful when we have a toolbox so only
// send it when we have one.
if (this.toolbox) {
this.telemetry.addEventProperty(
"devtools.main", "enter", "webconsole", null, "message_count", length);
}
this.telemetry.addEventProperty(
"devtools.main", "enter", "webconsole", null, "message_count", length);
this.queuedMessageAdds = [];

View file

@ -447,7 +447,7 @@ devtools.main:
width: Toolbox width rounded up to the nearest 50px.
session_id: The start time of the session in milliseconds since epoch (Unix Timestamp) e.g. 1396381378123.
enter:
objects: ["accessibility", "application", "canvasdebugger", "dom", "inspector", "jsdebugger", "memory", "netmonitor", "options", "performance", "scratchpad", "shadereditor", "storage", "styleeditor", "webaudioeditor", "webconsole", "other", "fakeTool4242", "testTool", "testtool1", "testTool1072208", "testtool2"]
objects: ["webconsole", "inspector", "jsdebugger", "styleeditor", "netmonitor", "storage", "other"]
bug_numbers: [1441070]
notification_emails: ["dev-developer-tools@lists.mozilla.org", "hkirschner@mozilla.com"]
record_in_processes: ["main"]
@ -459,11 +459,11 @@ devtools.main:
width: Toolbox width rounded up to the nearest 50px.
message_count: The number of cached console messages.
start_state: debuggerStatement, breakpoint, exception, tab_switch, toolbox_show, initial_panel, toggle_settings_off, toggle_settings_on, key_shortcut, select_next_key, select_prev_key, tool_unloaded, inspect_dom, unknown etc.
panel_name: The name of the panel opened or other
panel_name: The name of the panel opened, webconsole, inspector, jsdebugger, styleeditor, netmonitor, storage or other
cold: Is this the first time the current panel has been opened in this toolbox?
session_id: The start time of the session in milliseconds since epoch (Unix Timestamp) e.g. 1396381378123.
exit:
objects: ["accessibility", "application", "canvasdebugger", "dom", "inspector", "jsdebugger", "memory", "netmonitor", "options", "performance", "scratchpad", "shadereditor", "storage", "styleeditor", "webaudioeditor", "webconsole", "other", "fakeTool4242", "testTool", "testtool1", "testTool1072208", "testtool2"]
objects: ["webconsole", "inspector", "jsdebugger", "styleeditor", "netmonitor", "storage", "other"]
bug_numbers: [1455270]
notification_emails: ["dev-developer-tools@lists.mozilla.org", "hkirschner@mozilla.com"]
record_in_processes: ["main"]
@ -473,8 +473,8 @@ devtools.main:
extra_keys:
host: "Toolbox host (positioning): bottom, side, window or other."
width: Toolbox width rounded up to the nearest 50px.
next_panel: The name of the panel closed or other.
panel_name: The name of the panel opened or other
next_panel: The name of the panel closed, webconsole, inspector, jsdebugger, styleeditor, netmonitor, storage or other.
panel_name: The name of the panel opened, webconsole, inspector, jsdebugger, styleeditor, netmonitor, storage or other
reason: debuggerStatement, breakpoint, exception, tab_switch, toolbox_show, initial_panel, toggle_settings_off, toggle_settings_on, key_shortcut, select_next_key, select_prev_key, tool_unloaded, inspect_dom, toolbox_closed, unknown etc.
session_id: The start time of the session in milliseconds since epoch (Unix Timestamp) e.g. 1396381378123.
activate: