Backed out 4 changesets (bug 1603176) for perma failures on browser_toolbox_tool_ready.js and browser_memory_fission_switch_target.js. CLOSED TREE

Backed out changeset 1d69574fa593 (bug 1603176)
Backed out changeset 635851b79924 (bug 1603176)
Backed out changeset 2485f2115890 (bug 1603176)
Backed out changeset 7b47a4c77243 (bug 1603176)
This commit is contained in:
Razvan Maries 2020-02-20 16:08:55 +02:00
Родитель a3a95d7b94
Коммит 73a6a77284
18 изменённых файлов: 32 добавлений и 153 удалений

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

@ -1,17 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { actions } = require("devtools/client/memory/constants");
/**
* Update the memory front.
*/
exports.updateMemoryFront = front => {
return {
type: actions.UPDATE_MEMORY_FRONT,
front,
};
};

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

@ -8,7 +8,6 @@ DevToolsModules(
'census-display.js',
'diffing.js',
'filter.js',
'front.js',
'io.js',
'label-display.js',
'refresh.js',

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

@ -120,9 +120,6 @@ actions.COLLAPSE_DOMINATOR_TREE_NODE = "collapse-dominator-tree-node";
actions.RESIZE_SHORTEST_PATHS = "resize-shortest-paths";
// Fired when the memory front is changed.
actions.UPDATE_MEMORY_FRONT = "update-memory-front";
/** * Census Displays ***************************************************************/
const COUNT = Object.freeze({ by: "count", count: true, bytes: true });

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

@ -16,19 +16,18 @@ const App = createFactory(require("devtools/client/memory/app"));
const Store = require("devtools/client/memory/store");
const { assert } = require("devtools/shared/DevToolsUtils");
const { updateMemoryFront } = require("devtools/client/memory/actions/front");
// Shared variables used by several methods of this module.
let root, store, unsubscribe;
const initialize = async function() {
// Exposed by panel.js
const { gToolbox, gHeapAnalysesClient } = window;
const { gFront, gToolbox, gHeapAnalysesClient } = window;
root = document.querySelector("#app");
store = Store();
const app = createElement(App, {
toolbox: gToolbox,
front: gFront,
heapWorker: gHeapAnalysesClient,
});
const provider = createElement(Provider, { store }, app);
@ -39,10 +38,6 @@ const initialize = async function() {
window.gStore = store;
};
const updateFront = front => {
store.dispatch(updateMemoryFront(front));
};
const destroy = function() {
const ok = ReactDOM.unmountComponentAtNode(root);
assert(
@ -77,4 +72,4 @@ function onStateChange() {
isHighlighted = isRecording;
}
module.exports = { initialize, updateFront, destroy };
module.exports = { initialize, destroy };

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

@ -21,38 +21,37 @@ function MemoryPanel(iframeWindow, toolbox) {
}).require;
this.initializer = browserRequire("devtools/client/memory/initializer");
this._onTargetAvailable = this._onTargetAvailable.bind(this);
EventEmitter.decorate(this);
}
MemoryPanel.prototype = {
async open() {
if (this._opening) {
return this._opening;
}
this.panelWin.gToolbox = this._toolbox;
this.panelWin.gTarget = this.target;
this.panelWin.gFront = await this.target.getFront("memory");
this.panelWin.gHeapAnalysesClient = new HeapAnalysesClient();
await this.initializer.initialize();
await this.panelWin.gFront.attach();
await this._toolbox.targetList.watchTargets(
[this._toolbox.targetList.TYPES.FRAME],
this._onTargetAvailable
);
this._opening = this.initializer.initialize().then(() => {
this.isReady = true;
this.emit("ready");
return this;
});
this.emit("ready");
return this;
},
async _onTargetAvailable({ targetFront, isTopLevel }) {
if (isTopLevel) {
const front = await targetFront.getFront("memory");
await front.attach();
this.initializer.updateFront(front);
}
return this._opening;
},
// DevToolPanel API
get target() {
return this._toolbox.target;
},
destroy() {
// Make sure this panel is not already destroyed.
if (this._destroyed) {
@ -60,15 +59,14 @@ MemoryPanel.prototype = {
}
this._destroyed = true;
this._toolbox.targetList.unwatchTargets(
[this._toolbox.targetList.TYPES.FRAME],
this._onTargetAvailable
);
this.initializer.destroy();
// Destroy front to ensure packet handler is removed from client
this.panelWin.gFront.destroy();
this.panelWin.gHeapAnalysesClient.destroy();
this.panelWin = null;
this._opening = null;
this.isReady = false;
this.emit("destroyed");
},
};

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

@ -6,7 +6,6 @@
exports.allocations = require("devtools/client/memory/reducers/allocations");
exports.censusDisplay = require("devtools/client/memory/reducers/census-display");
exports.diffing = require("devtools/client/memory/reducers/diffing");
exports.front = require("devtools/client/memory/reducers/front");
exports.individuals = require("devtools/client/memory/reducers/individuals");
exports.labelDisplay = require("devtools/client/memory/reducers/label-display");
exports.treeMapDisplay = require("devtools/client/memory/reducers/tree-map-display");

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

@ -1,11 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { actions } = require("devtools/client/memory/constants");
module.exports = (front = null, action) => {
return action.type === actions.UPDATE_MEMORY_FRONT ? action.front : front;
};

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

@ -9,7 +9,6 @@ DevToolsModules(
'diffing.js',
'errors.js',
'filter.js',
'front.js',
'individuals.js',
'label-display.js',
'sizes.js',

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

@ -21,7 +21,6 @@ skip-if = ccov # bug 1347244
skip-if = ccov # bug 1347244
[browser_memory_filter_01.js]
skip-if = ccov # bug 1347244
[browser_memory_fission_switch_target.js]
[browser_memory_individuals_01.js]
[browser_memory_keyboard.js]
[browser_memory_keyboard-snapshot-list.js]

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

@ -20,8 +20,8 @@ const TEST_URL =
this.test = makeMemoryTest(TEST_URL, async function({ tab, panel }) {
const heapWorker = panel.panelWin.gHeapAnalysesClient;
const front = panel.panelWin.gFront;
const { getState, dispatch } = panel.panelWin.gStore;
const front = getState().front;
const doc = panel.panelWin.document;
dispatch(changeView(viewState.CENSUS));

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

@ -1,79 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test top-level target switching for memory panel.
const { treeMapState } = require("devtools/client/memory/constants");
const PARENT_PROCESS_URI = "about:robots";
const CONTENT_PROCESS_URI = "data:text/plain,yo";
add_task(async () => {
await pushPref("devtools.target-switching.enabled", true);
info("Open the memory panel with empty page");
const tab = await addTab();
const { panel } = await openMemoryPanel(tab);
const { gToolbox: toolbox, gStore: store } = panel.panelWin;
info("Open a page running on the content process");
await BrowserTestUtils.loadURI(tab.linkedBrowser, CONTENT_PROCESS_URI);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
await takeAndWaitSnapshot(panel.panelWin, store);
info("Navigate to a page running on parent process");
await navigateTo(PARENT_PROCESS_URI, toolbox, tab);
await takeAndWaitSnapshot(panel.panelWin, store);
info("Return to a page running on content process again");
await navigateTo(CONTENT_PROCESS_URI, toolbox, tab);
await takeAndWaitSnapshot(panel.panelWin, store);
info("Check the snapshots");
const snapshots = store.getState().snapshots;
const contentProcessPageNodes = getNodeNames(snapshots[0]);
const parentProcessPageNodes = getNodeNames(snapshots[1]);
const secondContentProcessPageNodes = getNodeNames(snapshots[2]);
isnot(
contentProcessPageNodes.sort().join(","),
parentProcessPageNodes.sort().join(","),
"Nodes on parent process page differ from content process page"
);
is(
contentProcessPageNodes.sort().join(","),
secondContentProcessPageNodes.sort().join(","),
"Nodes on content process page are not changed after switching targets twice"
);
});
function getNodeNames(snapshot) {
const domNodePart = snapshot.treeMap.report.children.find(
child => child.name === "domNode"
);
return domNodePart.children.map(child => child.name);
}
async function takeAndWaitSnapshot(window, store) {
await takeSnapshot(window);
const index = store.getState().snapshots.length - 1;
await waitUntilState(
store,
state =>
state.snapshots[index].treeMap &&
state.snapshots[index].treeMap.state === treeMapState.SAVED
);
return store.getState().snapshots[index];
}
async function navigateTo(uri, toolbox, tab) {
const onSwitched = once(toolbox, "switched-target");
const onLoaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
await BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
await onLoaded;
await onSwitched;
ok(true, "switched-target event is fired");
}

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

@ -20,9 +20,9 @@ this.test = makeMemoryTest(TEST_URL, async function({ panel }) {
requestLongerTimeout(2);
const heapWorker = panel.panelWin.gHeapAnalysesClient;
const front = panel.panelWin.gFront;
const store = panel.panelWin.gStore;
const { dispatch } = store;
const front = store.getState().front;
const doc = panel.panelWin.document;
dispatch(changeView(viewState.CENSUS));

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

@ -39,9 +39,9 @@ function waitUntilExpanded(store, node) {
this.test = makeMemoryTest(TEST_URL, async function({ tab, panel }) {
const heapWorker = panel.panelWin.gHeapAnalysesClient;
const front = panel.panelWin.gFront;
const store = panel.panelWin.gStore;
const { getState, dispatch } = store;
const front = getState().front;
const doc = panel.panelWin.document;
dispatch(changeView(viewState.CENSUS));

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

@ -17,8 +17,8 @@ const TEST_URL =
this.test = makeMemoryTest(TEST_URL, async function({ tab, panel }) {
const heapWorker = panel.panelWin.gHeapAnalysesClient;
const front = panel.panelWin.gFront;
const { getState, dispatch } = panel.panelWin.gStore;
const front = getState().front;
const doc = panel.panelWin.document;
dispatch(changeView(viewState.CENSUS));

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

@ -17,8 +17,8 @@ const TEST_URL =
this.test = makeMemoryTest(TEST_URL, async function({ tab, panel }) {
const heapWorker = panel.panelWin.gHeapAnalysesClient;
const front = panel.panelWin.gFront;
const { getState, dispatch } = panel.panelWin.gStore;
const front = getState().front;
const doc = panel.panelWin.document;
dispatch(changeView(viewState.CENSUS));

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

@ -29,8 +29,8 @@ function checkCells(cells) {
this.test = makeMemoryTest(TEST_URL, async function({ tab, panel }) {
const heapWorker = panel.panelWin.gHeapAnalysesClient;
const front = panel.panelWin.gFront;
const { getState, dispatch } = panel.panelWin.gStore;
const front = getState().front;
const doc = panel.panelWin.document;
dispatch(changeView(viewState.CENSUS));

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

@ -54,7 +54,7 @@ const DESCRIPTION = {
};
this.test = makeMemoryTest(TEST_URL, async function({ tab, panel }) {
const front = panel.panelWin.gStore.getState().front;
const front = panel.panelWin.gFront;
const startWindows = await getWindowsInSnapshot(front);
dumpn(

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

@ -12,7 +12,7 @@
const TEST_URL = "data:text/html,<html><body></body></html>";
this.test = makeMemoryTest(TEST_URL, async function({ tab, panel }) {
const memoryFront = panel.panelWin.gStore.getState().front;
const memoryFront = panel.panelWin.gFront;
ok(memoryFront, "Should get the MemoryFront");
const snapshotFilePath = await memoryFront.saveHeapSnapshot({