mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1731630 - [devtools] Record leaks when reloading the page for all panels. r=jdescottes
We should probably tweak the test page to include logs and sources... Differential Revision: https://phabricator.services.mozilla.com/D126112
This commit is contained in:
parent
506e2a66e3
commit
9f31f931ea
@ -5,10 +5,6 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
BROWSER_CHROME_MANIFESTS += [
|
||||
"test/allocations/browser_allocations_browser_console.ini",
|
||||
"test/allocations/browser_allocations_reload.ini",
|
||||
"test/allocations/browser_allocations_target.ini",
|
||||
"test/allocations/browser_allocations_toolbox.ini",
|
||||
"test/browser-enable-popup-devtools-user.ini",
|
||||
"test/browser-enable-popup-new-user.ini",
|
||||
"test/browser-telemetry-startup.ini",
|
||||
@ -26,6 +22,7 @@ DIRS += [
|
||||
"browser-toolbox",
|
||||
"components",
|
||||
"reducers",
|
||||
"test/allocations",
|
||||
]
|
||||
|
||||
DevToolsModules(
|
||||
|
@ -9,5 +9,5 @@ support-files =
|
||||
|
||||
# Each metrics tests is loaded in a separate .ini file. This way the test is executed
|
||||
# individually, without any other test being executed before or after.
|
||||
[browser_allocations_reload.js]
|
||||
[browser_allocations_reload_debugger.js]
|
||||
skip-if = os != 'linux' || debug || asan # Results should be platform agnostic - only run on linux64-opt
|
@ -0,0 +1,65 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Record allocations while reloading the page with the DevTools opened
|
||||
|
||||
const TEST_URL =
|
||||
"http://example.com/browser/devtools/client/framework/test/allocations/reloaded-page.html";
|
||||
|
||||
const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm");
|
||||
const { gDevTools } = require("devtools/client/framework/devtools");
|
||||
|
||||
async function testScript(toolbox) {
|
||||
const onTargetSwitched = toolbox.commands.targetCommand.once(
|
||||
"switched-target"
|
||||
);
|
||||
const onReloaded = toolbox.getCurrentPanel().once("reloaded");
|
||||
|
||||
gBrowser.reloadTab(gBrowser.selectedTab);
|
||||
|
||||
if (
|
||||
toolbox.commands.targetCommand.targetFront.targetForm
|
||||
.followWindowGlobalLifeCycle
|
||||
) {
|
||||
info("Wait for target switched");
|
||||
await onTargetSwitched;
|
||||
}
|
||||
|
||||
info("Wait for panel reload");
|
||||
await onReloaded;
|
||||
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
const tab = await addTab(TEST_URL);
|
||||
const toolbox = await gDevTools.showToolboxForTab(tab, {
|
||||
toolId: "jsdebugger",
|
||||
});
|
||||
|
||||
// Run the test scenario first before recording in order to load all the
|
||||
// modules. Otherwise they get reported as "still allocated" objects,
|
||||
// whereas we do expect them to be kept in memory as they are loaded via
|
||||
// the main DevTools loader, which keeps the module loaded until the
|
||||
// shutdown of Firefox
|
||||
await testScript(toolbox);
|
||||
|
||||
await startRecordingAllocations({
|
||||
alsoRecordContentProcess: true,
|
||||
});
|
||||
|
||||
// Now, run the test script. This time, we record this run.
|
||||
for (let i = 0; i < 10; i++) {
|
||||
await testScript(toolbox);
|
||||
}
|
||||
|
||||
await stopRecordingAllocations("reload-debugger", {
|
||||
alsoRecordContentProcess: true,
|
||||
});
|
||||
|
||||
await toolbox.destroy();
|
||||
gBrowser.removeTab(tab);
|
||||
});
|
@ -0,0 +1,13 @@
|
||||
[DEFAULT]
|
||||
tags = devtools
|
||||
subsuite = devtools
|
||||
support-files =
|
||||
!/devtools/shared/test-helpers/allocation-tracker.js
|
||||
head.js
|
||||
reloaded-page.html
|
||||
reloaded.png
|
||||
|
||||
# Each metrics tests is loaded in a separate .ini file. This way the test is executed
|
||||
# individually, without any other test being executed before or after.
|
||||
[browser_allocations_reload_inspector.js]
|
||||
skip-if = os != 'linux' || debug || asan # Results should be platform agnostic - only run on linux64-opt
|
@ -56,7 +56,7 @@ add_task(async function() {
|
||||
await testScript(toolbox);
|
||||
}
|
||||
|
||||
await stopRecordingAllocations("reload", {
|
||||
await stopRecordingAllocations("reload-inspector", {
|
||||
alsoRecordContentProcess: true,
|
||||
});
|
||||
|
@ -0,0 +1,13 @@
|
||||
[DEFAULT]
|
||||
tags = devtools
|
||||
subsuite = devtools
|
||||
support-files =
|
||||
!/devtools/shared/test-helpers/allocation-tracker.js
|
||||
head.js
|
||||
reloaded-page.html
|
||||
reloaded.png
|
||||
|
||||
# Each metrics tests is loaded in a separate .ini file. This way the test is executed
|
||||
# individually, without any other test being executed before or after.
|
||||
[browser_allocations_reload_netmonitor.js]
|
||||
skip-if = os != 'linux' || debug || asan # Results should be platform agnostic - only run on linux64-opt
|
@ -0,0 +1,65 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Record allocations while reloading the page with the DevTools opened
|
||||
|
||||
const TEST_URL =
|
||||
"http://example.com/browser/devtools/client/framework/test/allocations/reloaded-page.html";
|
||||
|
||||
const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm");
|
||||
const { gDevTools } = require("devtools/client/framework/devtools");
|
||||
|
||||
async function testScript(toolbox) {
|
||||
const onTargetSwitched = toolbox.commands.targetCommand.once(
|
||||
"switched-target"
|
||||
);
|
||||
const onReloaded = toolbox.getCurrentPanel().once("reloaded");
|
||||
|
||||
gBrowser.reloadTab(gBrowser.selectedTab);
|
||||
|
||||
if (
|
||||
toolbox.commands.targetCommand.targetFront.targetForm
|
||||
.followWindowGlobalLifeCycle
|
||||
) {
|
||||
info("Wait for target switched");
|
||||
await onTargetSwitched;
|
||||
}
|
||||
|
||||
info("Wait for panel reload");
|
||||
await onReloaded;
|
||||
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
const tab = await addTab(TEST_URL);
|
||||
const toolbox = await gDevTools.showToolboxForTab(tab, {
|
||||
toolId: "netmonitor",
|
||||
});
|
||||
|
||||
// Run the test scenario first before recording in order to load all the
|
||||
// modules. Otherwise they get reported as "still allocated" objects,
|
||||
// whereas we do expect them to be kept in memory as they are loaded via
|
||||
// the main DevTools loader, which keeps the module loaded until the
|
||||
// shutdown of Firefox
|
||||
await testScript(toolbox);
|
||||
|
||||
await startRecordingAllocations({
|
||||
alsoRecordContentProcess: true,
|
||||
});
|
||||
|
||||
// Now, run the test script. This time, we record this run.
|
||||
for (let i = 0; i < 10; i++) {
|
||||
await testScript(toolbox);
|
||||
}
|
||||
|
||||
await stopRecordingAllocations("reload-netmonitor", {
|
||||
alsoRecordContentProcess: true,
|
||||
});
|
||||
|
||||
await toolbox.destroy();
|
||||
gBrowser.removeTab(tab);
|
||||
});
|
@ -0,0 +1,13 @@
|
||||
[DEFAULT]
|
||||
tags = devtools
|
||||
subsuite = devtools
|
||||
support-files =
|
||||
!/devtools/shared/test-helpers/allocation-tracker.js
|
||||
head.js
|
||||
reloaded-page.html
|
||||
reloaded.png
|
||||
|
||||
# Each metrics tests is loaded in a separate .ini file. This way the test is executed
|
||||
# individually, without any other test being executed before or after.
|
||||
[browser_allocations_reload_webconsole.js]
|
||||
skip-if = os != 'linux' || debug || asan # Results should be platform agnostic - only run on linux64-opt
|
@ -0,0 +1,65 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Record allocations while reloading the page with the DevTools opened
|
||||
|
||||
const TEST_URL =
|
||||
"http://example.com/browser/devtools/client/framework/test/allocations/reloaded-page.html";
|
||||
|
||||
const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm");
|
||||
const { gDevTools } = require("devtools/client/framework/devtools");
|
||||
|
||||
async function testScript(toolbox) {
|
||||
const onTargetSwitched = toolbox.commands.targetCommand.once(
|
||||
"switched-target"
|
||||
);
|
||||
const onReloaded = toolbox.getCurrentPanel().once("reloaded");
|
||||
|
||||
gBrowser.reloadTab(gBrowser.selectedTab);
|
||||
|
||||
if (
|
||||
toolbox.commands.targetCommand.targetFront.targetForm
|
||||
.followWindowGlobalLifeCycle
|
||||
) {
|
||||
info("Wait for target switched");
|
||||
await onTargetSwitched;
|
||||
}
|
||||
|
||||
info("Wait for panel reload");
|
||||
await onReloaded;
|
||||
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
const tab = await addTab(TEST_URL);
|
||||
const toolbox = await gDevTools.showToolboxForTab(tab, {
|
||||
toolId: "webconsole",
|
||||
});
|
||||
|
||||
// Run the test scenario first before recording in order to load all the
|
||||
// modules. Otherwise they get reported as "still allocated" objects,
|
||||
// whereas we do expect them to be kept in memory as they are loaded via
|
||||
// the main DevTools loader, which keeps the module loaded until the
|
||||
// shutdown of Firefox
|
||||
await testScript(toolbox);
|
||||
|
||||
await startRecordingAllocations({
|
||||
alsoRecordContentProcess: true,
|
||||
});
|
||||
|
||||
// Now, run the test script. This time, we record this run.
|
||||
for (let i = 0; i < 10; i++) {
|
||||
await testScript(toolbox);
|
||||
}
|
||||
|
||||
await stopRecordingAllocations("reload-webconsole", {
|
||||
alsoRecordContentProcess: true,
|
||||
});
|
||||
|
||||
await toolbox.destroy();
|
||||
gBrowser.removeTab(tab);
|
||||
});
|
15
devtools/client/framework/test/allocations/moz.build
Normal file
15
devtools/client/framework/test/allocations/moz.build
Normal file
@ -0,0 +1,15 @@
|
||||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
BROWSER_CHROME_MANIFESTS += [
|
||||
"browser_allocations_browser_console.ini",
|
||||
"browser_allocations_reload_debugger.ini",
|
||||
"browser_allocations_reload_inspector.ini",
|
||||
"browser_allocations_reload_netmonitor.ini",
|
||||
"browser_allocations_reload_webconsole.ini",
|
||||
"browser_allocations_target.ini",
|
||||
"browser_allocations_toolbox.ini",
|
||||
]
|
Loading…
Reference in New Issue
Block a user