Backed out changeset 3d2eace770d1 (bug 1244120) for very frequent leaks on Win7 CLOSED TREE

--HG--
extra : commitid : AiLlcy3cWsb
This commit is contained in:
Wes Kocher 2016-02-04 12:51:14 -08:00
Родитель 7328567952
Коммит 4722a4bfe8
8 изменённых файлов: 83 добавлений и 55 удалений

Просмотреть файл

@ -559,18 +559,12 @@ nsContextMenu.prototype = {
LoginHelper.openPasswordManager(window, gContextMenuContentData.documentURIObject.host);
},
inspectNode: function() {
inspectNode: function CM_inspectNode() {
let {devtools} = Cu.import("resource://devtools/shared/Loader.jsm", {});
let gBrowser = this.browser.ownerDocument.defaultView.gBrowser;
let target = devtools.TargetFactory.forTab(gBrowser.selectedTab);
return gDevTools.showToolbox(target, "inspector").then(toolbox => {
let tt = devtools.TargetFactory.forTab(gBrowser.selectedTab);
return gDevTools.showToolbox(tt, "inspector").then(function(toolbox) {
let inspector = toolbox.getCurrentPanel();
// new-node-front tells us when the node has been selected, whether the
// browser is remote or not.
let onNewNode = inspector.selection.once("new-node-front");
if (this.isRemote) {
this.browser.messageManager.sendAsyncMessage("debug:inspect", {}, {node: this.target});
inspector.walker.findInspectingNode().then(nodeFront => {
@ -579,13 +573,7 @@ nsContextMenu.prototype = {
} else {
inspector.selection.setNode(this.target, "browser-context-menu");
}
return onNewNode.then(() => {
// Now that the node has been selected, wait until the inspector is
// fully updated.
return inspector.once("inspector-updated");
});
});
}.bind(this));
},
// Set various context menu attributes based on the state of the world.

Просмотреть файл

@ -249,6 +249,8 @@ var AnimationsPanel = {
* the various components again.
*/
refreshAnimationsUI: Task.async(function*() {
let done = gInspector.updating("animationspanel");
// Empty the whole panel first.
this.togglePlayers(true);
@ -267,10 +269,12 @@ var AnimationsPanel = {
if (!AnimationsController.animationPlayers.length) {
this.togglePlayers(false);
this.emit(this.UI_UPDATED_EVENT);
done();
return;
}
this.emit(this.UI_UPDATED_EVENT);
done();
})
};

Просмотреть файл

@ -1,4 +1,5 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* global nsContextMenu*/
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
@ -16,7 +17,7 @@ add_task(function*() {
let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
info("Select the test node with the browser ctx menu");
yield clickOnInspectMenuItem(testActor, "div");
yield selectWithBrowserMenu(inspector);
assertNodeSelected(inspector, "div");
info("Press arrowUp to focus <body> " +
@ -46,6 +47,27 @@ function selectPreviousNodeWithArrowUp(inspector) {
return Promise.all([onUpdated, onNodeHighlighted]);
}
function* selectWithBrowserMenu(inspector) {
let contentAreaContextMenu = document.querySelector("#contentAreaContextMenu");
let contextOpened = once(contentAreaContextMenu, "popupshown");
yield BrowserTestUtils.synthesizeMouseAtCenter("div", {
type: "contextmenu",
button: 2
}, gBrowser.selectedBrowser);
yield contextOpened;
yield gContextMenu.inspectNode();
let contextClosed = once(contentAreaContextMenu, "popuphidden");
contentAreaContextMenu.hidden = true;
contentAreaContextMenu.hidePopup();
yield inspector.once("inspector-updated");
yield contextClosed;
}
function* selectWithElementPicker(inspector, testActor) {
yield inspector.toolbox.highlighterUtils.startPicker();

Просмотреть файл

@ -66,6 +66,7 @@ support-files =
[browser_rules_completion-popup-hidden-after-navigation.js]
[browser_rules_content_01.js]
[browser_rules_content_02.js]
skip-if = e10s # Bug 1039528: "inspect element" contextual-menu doesn't work with e10s
[browser_rules_context-menu-show-mdn-docs-01.js]
[browser_rules_context-menu-show-mdn-docs-02.js]
[browser_rules_context-menu-show-mdn-docs-03.js]

Просмотреть файл

@ -19,12 +19,34 @@ const STRINGS = Services.strings
.createBundle("chrome://devtools-shared/locale/styleinspector.properties");
add_task(function*() {
let tab = yield addTab("data:text/html;charset=utf-8," + CONTENT);
yield addTab("data:text/html;charset=utf-8," + CONTENT);
let testActor = yield getTestActorWithoutToolbox(tab);
let inspector = yield clickOnInspectMenuItem(testActor, "span");
info("Getting the test element");
let element = getNode("span");
checkRuleViewContent(inspector.ruleview.view);
info("Opening the inspector using the content context-menu");
let onInspectorReady = gDevTools.once("inspector-ready");
document.popupNode = element;
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
let contextMenu = new nsContextMenu(contentAreaContextMenu);
yield contextMenu.inspectNode();
// Clean up context menu:
contextMenu.hiding();
yield onInspectorReady;
let target = TargetFactory.forTab(gBrowser.selectedTab);
let toolbox = gDevTools.getToolbox(target);
info("Getting the inspector and making sure it is fully updated");
let inspector = toolbox.getPanel("inspector");
yield inspector.once("inspector-updated");
let view = inspector.ruleview.view;
checkRuleViewContent(view);
});
function checkRuleViewContent({styleDocument}) {
@ -59,4 +81,3 @@ function checkRuleViewContent({styleDocument}) {
is(propertyValues.length, 1, "There's only one property value, as expected");
}
}

Просмотреть файл

@ -218,9 +218,7 @@ var openInspector = Task.async(function*() {
inspector = toolbox.getPanel("inspector");
info("Waiting for the inspector to update");
if (inspector._updateProgress) {
yield inspector.once("inspector-updated");
}
yield inspector.once("inspector-updated");
return {
toolbox: toolbox,

Просмотреть файл

@ -114,3 +114,27 @@ function* testBreadcrumbs(selector, inspector) {
ok(button, "A crumbs is checked=true");
is(button.getAttribute("tooltiptext"), expectedText, "Crumb refers to the right node");
}
function* clickOnInspectMenuItem(testActor, selector) {
info("Showing the contextual menu on node " + selector);
let contentAreaContextMenu = document.querySelector("#contentAreaContextMenu");
let contextOpened = once(contentAreaContextMenu, "popupshown");
yield testActor.synthesizeMouse({
selector: selector,
center: true,
options: {type: "contextmenu", button: 2}
});
yield contextOpened;
info("Triggering inspect action and hiding the menu.");
yield gContextMenu.inspectNode();
let contextClosed = once(contentAreaContextMenu, "popuphidden");
contentAreaContextMenu.hidePopup();
info("Waiting for inspector to update.");
yield getActiveInspector().once("inspector-updated");
yield contextClosed;
}

Просмотреть файл

@ -161,36 +161,6 @@ function getActiveInspector() {
return gDevTools.getToolbox(target).getPanel("inspector");
}
/**
* Right click on a node in the test page and click on the inspect menu item.
* @param {TestActor}
* @param {String} selector The selector for the node to click on in the page.
* @return {Promise} Resolves to the inspector when it has opened and is updated
*/
var clickOnInspectMenuItem = Task.async(function*(testActor, selector) {
info("Showing the contextual menu on node " + selector);
let contentAreaContextMenu = document.querySelector("#contentAreaContextMenu");
let contextOpened = once(contentAreaContextMenu, "popupshown");
yield testActor.synthesizeMouse({
selector: selector,
center: true,
options: {type: "contextmenu", button: 2}
});
yield contextOpened;
info("Triggering the inspect action");
yield gContextMenu.inspectNode();
info("Hiding the menu");
let contextClosed = once(contentAreaContextMenu, "popuphidden");
contentAreaContextMenu.hidePopup();
yield contextClosed;
return getActiveInspector();
});
/**
* Open the toolbox, with the inspector tool visible, and the one of the sidebar
* tabs selected.