Bug 1290142 - Lint devtools/client/performance/test/; r=jsantell

MozReview-Commit-ID: FprlN3Vm9H7

--HG--
extra : rebase_source : f9b225e5a4464b7e6f937e4670a0bfbf472dc916
This commit is contained in:
Greg Tatum 2016-08-02 17:18:01 -05:00
parent d1d2c48243
commit 34824c4105
84 changed files with 433 additions and 239 deletions

View File

@ -84,7 +84,6 @@ devtools/client/jsonview/lib/**
devtools/client/memory/**
devtools/client/netmonitor/test/**
devtools/client/netmonitor/har/test/**
devtools/client/performance/test/**
devtools/client/projecteditor/**
devtools/client/promisedebugger/**
devtools/client/responsivedesign/**

View File

@ -28,7 +28,8 @@ add_task(function* () {
let recordingStarted = once(PerformanceController, EVENTS.RECORDING_STATE_CHANGE, {
expectedArgs: { "1": "recording-started" }
});
let backendStartReady = once(PerformanceController, EVENTS.BACKEND_READY_AFTER_RECORDING_START);
let backendStartReady = once(PerformanceController,
EVENTS.BACKEND_READY_AFTER_RECORDING_START);
let uiStateRecording = once(PerformanceView, EVENTS.UI_STATE_CHANGED, {
expectedArgs: { "1": "recording" }
});
@ -55,7 +56,8 @@ add_task(function* () {
let recordingStopped = once(PerformanceController, EVENTS.RECORDING_STATE_CHANGE, {
expectedArgs: { "1": "recording-stopped" }
});
let backendStopReady = once(PerformanceController, EVENTS.BACKEND_READY_AFTER_RECORDING_STOP);
let backendStopReady = once(PerformanceController,
EVENTS.BACKEND_READY_AFTER_RECORDING_STOP);
let uiStateRecorded = once(PerformanceView, EVENTS.UI_STATE_CHANGED, {
expectedArgs: { "1": "recorded" }
});

View File

@ -26,7 +26,8 @@ add_task(function* () {
Services.prefs.setBoolPref(UI_SHOW_PLATFORM_DATA_PREF, true);
yield startRecording(panel);
yield busyWait(100); // To show the `Gecko` category in the tree.
// To show the `Gecko` category in the tree.
yield busyWait(100);
yield stopRecording(panel);
let rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED);

View File

@ -25,7 +25,8 @@ add_task(function* () {
Services.prefs.setBoolPref(UI_SHOW_PLATFORM_DATA_PREF, true);
yield startRecording(panel);
yield busyWait(100); // To show the `busyWait` function in the tree.
// To show the `busyWait` function in the tree.
yield busyWait(100);
yield stopRecording(panel);
let rendered = once(JsCallTreeView, EVENTS.UI_JS_CALL_TREE_RENDERED);

View File

@ -10,10 +10,9 @@
const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
const { initPerformanceInTab, initConsoleInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils");
const { waitUntil } = require("devtools/client/performance/test/helpers/wait-utils");
const { once } = require("devtools/client/performance/test/helpers/event-utils");
add_task(function* () {
let { target, toolbox, console } = yield initConsoleInNewTab({
let { target, console } = yield initConsoleInNewTab({
url: SIMPLE_URL,
win: window
});

View File

@ -86,15 +86,15 @@ add_task(function* () {
is(RecordingsView.selectedItem.attachment, recordings[0],
"The first console recording should still be selected.");
is(recordings[0].isRecording(), true,
"The not most recent recording should not stop when calling console.profileEnd with no args.");
is(recordings[1].isRecording(), true,
"The not most recent recording should not stop when calling console.profileEnd with no args.");
is(recordings[2].isRecording(), false,
"Only the most recent recording should stop when calling console.profileEnd with no args.");
is(recordings[0].isRecording(), true, "The not most recent recording should not stop " +
"when calling console.profileEnd with no args.");
is(recordings[1].isRecording(), true, "The not most recent recording should not stop " +
"when calling console.profileEnd with no args.");
is(recordings[2].isRecording(), false, "Only the most recent recording should stop " +
"when calling console.profileEnd with no args.");
info("Trying to `profileEnd` a non-existent console recording.");
/* yield */ console.profileEnd("fxos");
console.profileEnd("fxos");
yield idleWait(1000);
recordings = PerformanceController.getRecordings();
@ -154,10 +154,11 @@ add_task(function* () {
"All recordings should now be ended. (3)");
info("Trying to `profileEnd` with no pending recordings.");
/* yield */ console.profileEnd();
console.profileEnd();
yield idleWait(1000);
ok(true, "Calling console.profileEnd() with no argument and no pending recordings does not throw.");
ok(true, "Calling console.profileEnd() with no argument and no pending recordings " +
"does not throw.");
yield teardownToolboxAndRemoveTab(panel);
});

View File

@ -87,19 +87,22 @@ add_task(function* () {
RecordingsView.selectedIndex = 3;
yield recordingSelected;
testRecordings(PerformanceController, [C + R, R, C + R, C + S]);
ok(!OverviewView.isRendering(), "Stop rendering overview when a completed recording is selected.");
ok(!OverviewView.isRendering(),
"Stop rendering overview when a completed recording is selected.");
info("Stop manual recording...");
yield stopRecording(panel);
testRecordings(PerformanceController, [C + R, S, C + R, C]);
ok(!OverviewView.isRendering(), "Stop rendering overview when a completed recording is selected.");
ok(!OverviewView.isRendering(),
"Stop rendering overview when a completed recording is selected.");
info("Select first recording...");
recordingSelected = once(PerformanceController, EVENTS.RECORDING_SELECTED);
RecordingsView.selectedIndex = 0;
yield recordingSelected;
testRecordings(PerformanceController, [C + R + S, 0, C + R, C]);
ok(OverviewView.isRendering(), "Should be rendering overview a recording in progress is selected.");
ok(OverviewView.isRendering(),
"Should be rendering overview a recording in progress is selected.");
// Ensure overview is still rendering.
yield times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, {
@ -120,7 +123,8 @@ add_task(function* () {
yield console.profileEnd();
yield stopped;
testRecordings(PerformanceController, [C + R + S, 0, C, C]);
ok(OverviewView.isRendering(), "Should be rendering overview a recording in progress is selected.");
ok(OverviewView.isRendering(),
"Should be rendering overview a recording in progress is selected.");
// Ensure overview is still rendering.
yield times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, {
@ -130,7 +134,8 @@ add_task(function* () {
info("Start one more manual recording...");
yield startRecording(panel);
testRecordings(PerformanceController, [C + R, 0, C, C, R + S]);
ok(OverviewView.isRendering(), "Should be rendering overview a recording in progress is selected.");
ok(OverviewView.isRendering(),
"Should be rendering overview a recording in progress is selected.");
// Ensure overview is still rendering.
yield times(OverviewView, EVENTS.UI_OVERVIEW_RENDERED, 3, {
@ -140,7 +145,8 @@ add_task(function* () {
info("Stop manual recording...");
yield stopRecording(panel);
testRecordings(PerformanceController, [C + R, 0, C, C, S]);
ok(!OverviewView.isRendering(), "Stop rendering overview when a completed recording is selected.");
ok(!OverviewView.isRendering(),
"Stop rendering overview when a completed recording is selected.");
info("Ending console.profileEnd()...");
stopped = waitForRecordingStoppedEvents(panel, {
@ -156,14 +162,18 @@ add_task(function* () {
yield console.profileEnd();
yield stopped;
testRecordings(PerformanceController, [C, 0, C, C, S]);
ok(!OverviewView.isRendering(), "Stop rendering overview when a completed recording is selected.");
ok(!OverviewView.isRendering(),
"Stop rendering overview when a completed recording is selected.");
yield teardownToolboxAndRemoveTab(panel);
});
const C = 1; // is console
const R = 2; // is recording
const S = 4; // is selected
// is console
const C = 1;
// is recording
const R = 2;
// is selected
const S = 4;
function testRecordings(controller, expected) {
let recordings = controller.getRecordings();

View File

@ -11,7 +11,7 @@
const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
const { initPerformanceInTab, initConsoleInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils");
const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions");
const { waitForRecordingStartedEvents, waitForRecordingStoppedEvents } = require("devtools/client/performance/test/helpers/actions");
const { waitForRecordingStartedEvents } = require("devtools/client/performance/test/helpers/actions");
const { idleWait } = require("devtools/client/performance/test/helpers/wait-utils");
add_task(function* () {
@ -51,7 +51,8 @@ add_task(function* () {
yield console.profileEnd();
yield idleWait(1000);
ok(true, "Stopping an in-progress console profile after clearing recordings does not throw.");
ok(true,
"Stopping an in-progress console profile after clearing recordings does not throw.");
yield PerformanceController.clearRecordings();
recordings = PerformanceController.getRecordings();

View File

@ -27,23 +27,24 @@ add_task(function* () {
checkViews(DetailsView, $, "waterfall");
// Select calltree view.
let viewChanged = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED, { spreadArgs: true });
let viewChanged = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED,
{ spreadArgs: true });
command($("toolbarbutton[data-view='js-calltree']"));
let [_, viewName] = yield viewChanged;
let [, viewName] = yield viewChanged;
is(viewName, "js-calltree", "UI_DETAILS_VIEW_SELECTED fired with view name");
checkViews(DetailsView, $, "js-calltree");
// Select js flamegraph view.
viewChanged = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED, { spreadArgs: true });
command($("toolbarbutton[data-view='js-flamegraph']"));
[_, viewName] = yield viewChanged;
[, viewName] = yield viewChanged;
is(viewName, "js-flamegraph", "UI_DETAILS_VIEW_SELECTED fired with view name");
checkViews(DetailsView, $, "js-flamegraph");
// Select waterfall view.
viewChanged = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED, { spreadArgs: true });
command($("toolbarbutton[data-view='waterfall']"));
[_, viewName] = yield viewChanged;
[, viewName] = yield viewChanged;
is(viewName, "waterfall", "UI_DETAILS_VIEW_SELECTED fired with view name");
checkViews(DetailsView, $, "waterfall");

View File

@ -17,7 +17,13 @@ add_task(function* () {
win: window
});
let { EVENTS, DetailsView, WaterfallView, JsCallTreeView, JsFlameGraphView } = panel.panelWin;
let {
EVENTS,
DetailsView,
WaterfallView,
JsCallTreeView,
JsFlameGraphView
} = panel.panelWin;
yield startRecording(panel);
yield stopRecording(panel);

View File

@ -21,7 +21,15 @@ add_task(function* () {
win: window
});
let { EVENTS, $, RecordingsView, DetailsView, WaterfallView, MemoryCallTreeView, MemoryFlameGraphView } = panel.panelWin;
let {
EVENTS,
$,
RecordingsView,
DetailsView,
WaterfallView,
MemoryCallTreeView,
MemoryFlameGraphView
} = panel.panelWin;
let flameBtn = $("toolbarbutton[data-view='memory-flamegraph']");
let callBtn = $("toolbarbutton[data-view='memory-calltree']");
@ -76,8 +84,8 @@ add_task(function* () {
yield selected;
yield rendered;
ok(DetailsView.isViewSelected(WaterfallView),
"The waterfall view is now selected when switching back to a recording that does not have memory data.");
ok(DetailsView.isViewSelected(WaterfallView), "The waterfall view is now selected " +
"when switching back to a recording that does not have memory data.");
is(callBtn.hidden, true,
"The `memory-calltree` button is hidden when recording has no memory data.");
@ -103,8 +111,8 @@ add_task(function* () {
yield selected;
yield rendered;
ok(DetailsView.isViewSelected(MemoryCallTreeView),
"The memory call tree view can be selected again after going back to the view with memory data.");
ok(DetailsView.isViewSelected(MemoryCallTreeView), "The memory call tree view can be " +
"selected again after going back to the view with memory data.");
selected = once(DetailsView, EVENTS.UI_DETAILS_VIEW_SELECTED);
rendered = once(MemoryFlameGraphView, EVENTS.UI_MEMORY_FLAMEGRAPH_RENDERED);
@ -112,8 +120,8 @@ add_task(function* () {
yield selected;
yield rendered;
ok(DetailsView.isViewSelected(MemoryFlameGraphView),
"The memory flamegraph view can be selected again after going back to the view with memory data.");
ok(DetailsView.isViewSelected(MemoryFlameGraphView), "The memory flamegraph view can " +
"be selected again after going back to the view with memory data.");
yield teardownToolboxAndRemoveTab(panel);
});

View File

@ -18,7 +18,13 @@ add_task(function* () {
win: window
});
let { EVENTS, $, PerformanceController, RecordingsView, WaterfallView } = panel.panelWin;
let {
EVENTS,
$,
PerformanceController,
RecordingsView,
WaterfallView
} = panel.panelWin;
let waterfallBtn = $("toolbarbutton[data-view='waterfall']");
let jsFlameBtn = $("toolbarbutton[data-view='js-flamegraph']");

View File

@ -32,7 +32,8 @@ add_task(function* () {
ok(DetailsView.isViewSelected(JsCallTreeView),
"The js calltree view is now selected in the details view.");
let cleared = once(PerformanceController, EVENTS.RECORDING_SELECTED, { expectedArgs: { "1": null } });
let cleared = once(PerformanceController, EVENTS.RECORDING_SELECTED,
{ expectedArgs: { "1": null } });
yield PerformanceController.clearRecordings();
yield cleared;

View File

@ -19,7 +19,14 @@ add_task(function* () {
win: window
});
let { EVENTS, OverviewView, DetailsView, WaterfallView, JsCallTreeView, JsFlameGraphView } = panel.panelWin;
let {
EVENTS,
OverviewView,
DetailsView,
WaterfallView,
JsCallTreeView,
JsFlameGraphView
} = panel.panelWin;
yield startRecording(panel);
yield stopRecording(panel);

View File

@ -17,7 +17,7 @@ add_task(function* () {
win: window
});
let { EVENTS, DetailsView, WaterfallView, JsCallTreeView } = panel.panelWin;
let { EVENTS, DetailsView, JsCallTreeView } = panel.panelWin;
yield startRecording(panel);
yield stopRecording(panel);

View File

@ -9,7 +9,6 @@
const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils");
const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions");
const { once } = require("devtools/client/performance/test/helpers/event-utils");
add_task(function* () {
let { panel } = yield initPerformanceInNewTab({
@ -17,10 +16,11 @@ add_task(function* () {
win: window
});
let { EVENTS, DetailsView, WaterfallView } = panel.panelWin;
let { DetailsView, WaterfallView } = panel.panelWin;
yield startRecording(panel);
yield stopRecording(panel); // Already waits for EVENTS.UI_WATERFALL_RENDERED.
// Already waits for EVENTS.UI_WATERFALL_RENDERED.
yield stopRecording(panel);
ok(DetailsView.isViewSelected(WaterfallView),
"The waterfall view is selected by default in the details view.");
@ -28,7 +28,8 @@ add_task(function* () {
ok(true, "WaterfallView rendered after recording is stopped.");
yield startRecording(panel);
yield stopRecording(panel); // Already waits for EVENTS.UI_WATERFALL_RENDERED.
// Already waits for EVENTS.UI_WATERFALL_RENDERED.
yield stopRecording(panel);
ok(DetailsView.isViewSelected(WaterfallView),
"The waterfall view is still selected in the details view.");

View File

@ -38,7 +38,8 @@ add_task(function* () {
expectedViewEvent: "UI_MEMORY_FLAMEGRAPH_RENDERED"
});
ok(true, "MemoryFlameGraphView rendered again after recording completed a second time.");
ok(true,
"MemoryFlameGraphView rendered again after recording completed a second time.");
yield teardownToolboxAndRemoveTab(panel);
});

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* eslint-disable */
/**
* Tests that the marker details on GC markers displays allocation
* buttons and snaps to the correct range
@ -142,3 +143,4 @@ var GC_MARKERS = [
marker.end = marker.start + 9;
return marker;
});
/* eslint-enable */

View File

@ -23,8 +23,8 @@ add_task(function* () {
yield console.profile("rust");
yield waitUntil(() => tab.hasAttribute("highlighted"));
ok(tab.hasAttribute("highlighted"),
"Performance tab is highlighted during recording from console.profile when unloaded.");
ok(tab.hasAttribute("highlighted"), "Performance tab is highlighted during recording " +
"from console.profile when unloaded.");
yield console.profileEnd("rust");
yield waitUntil(() => !tab.hasAttribute("highlighted"));

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* eslint-disable */
/**
* Tests if the Marker Details view renders all properties expected
* for each marker.
@ -142,3 +143,4 @@ function shouldHaveLabel($, name, value, marker) {
let $value = $name.parentNode.querySelector(".marker-details-labelvalue");
is($value.getAttribute("value"), value, `${marker.name} has correct label for ${name}:${value}`);
}
/* eslint-enable */

View File

@ -18,7 +18,7 @@ add_task(function* () {
win: window
});
let { $, PerformanceController } = panel.panelWin;
let { PerformanceController } = panel.panelWin;
// Test starting without framerate, and stopping with it.
Services.prefs.setBoolPref(UI_ENABLE_FRAMERATE_PREF, false);

View File

@ -29,8 +29,8 @@ add_task(function* () {
is(PerformanceController.getCurrentRecording().getConfiguration().withMemory, false,
"PerformanceFront started without memory recording.");
is(PerformanceController.getCurrentRecording().getConfiguration().withAllocations, false,
"PerformanceFront started without allocations recording.");
is(PerformanceController.getCurrentRecording().getConfiguration().withAllocations,
false, "PerformanceFront started without allocations recording.");
ok(!isVisible($("#memory-overview")),
"The memory graph is hidden when memory disabled.");
@ -39,18 +39,18 @@ add_task(function* () {
is(PerformanceController.getCurrentRecording().getConfiguration().withMemory, false,
"PerformanceFront still marked without memory recording.");
is(PerformanceController.getCurrentRecording().getConfiguration().withAllocations, false,
"PerformanceFront still marked without allocations recording.");
ok(!isVisible($("#memory-overview")),
"memory graph is still hidden after enabling if recording did not start recording memory");
is(PerformanceController.getCurrentRecording().getConfiguration().withAllocations,
false, "PerformanceFront still marked without allocations recording.");
ok(!isVisible($("#memory-overview")), "memory graph is still hidden after enabling " +
"if recording did not start recording memory");
yield startRecording(panel);
yield stopRecording(panel);
is(PerformanceController.getCurrentRecording().getConfiguration().withMemory, true,
"PerformanceFront started with memory recording.");
is(PerformanceController.getCurrentRecording().getConfiguration().withAllocations, false,
"PerformanceFront did not record with allocations.");
is(PerformanceController.getCurrentRecording().getConfiguration().withAllocations,
false, "PerformanceFront did not record with allocations.");
ok(isVisible($("#memory-overview")),
"The memory graph is not hidden when memory enabled before recording.");

View File

@ -18,7 +18,7 @@ add_task(function* () {
win: window
});
let { $, PerformanceController } = panel.panelWin;
let { PerformanceController } = panel.panelWin;
// Test starting without memory, and stopping with it.
Services.prefs.setBoolPref(UI_ENABLE_MEMORY_PREF, false);
@ -29,7 +29,8 @@ add_task(function* () {
is(PerformanceController.getCurrentRecording().getConfiguration().withMemory, false,
"The recording finished without tracking memory.");
is(PerformanceController.getCurrentRecording().getConfiguration().withAllocations, false,
is(PerformanceController.getCurrentRecording().getConfiguration().withAllocations,
false,
"The recording finished without tracking allocations.");
// Test starting with memory, and stopping without it.
@ -40,7 +41,8 @@ add_task(function* () {
is(PerformanceController.getCurrentRecording().getConfiguration().withMemory, true,
"The recording finished with tracking memory.");
is(PerformanceController.getCurrentRecording().getConfiguration().withAllocations, false,
is(PerformanceController.getCurrentRecording().getConfiguration().withAllocations,
false,
"The recording still is not recording allocations.");
yield teardownToolboxAndRemoveTab(panel);

View File

@ -18,7 +18,13 @@ add_task(function* () {
win: window
});
let { EVENTS, PerformanceController, DetailsView, JsFlameGraphView, FlameGraphUtils } = panel.panelWin;
let {
EVENTS,
PerformanceController,
DetailsView,
JsFlameGraphView,
FlameGraphUtils
} = panel.panelWin;
Services.prefs.setBoolPref(UI_FLATTEN_RECURSION_PREF, true);

View File

@ -3,7 +3,8 @@
"use strict";
/**
* Tests that the memory flamegraphs get rerendered when toggling `flatten-tree-recursion`.
* Tests that the memory flamegraphs get rerendered when toggling
* `flatten-tree-recursion`.
*/
const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
@ -18,7 +19,14 @@ add_task(function* () {
win: window
});
let { EVENTS, PerformanceController, DetailsView, MemoryFlameGraphView, RecordingUtils, FlameGraphUtils } = panel.panelWin;
let {
EVENTS,
PerformanceController,
DetailsView,
MemoryFlameGraphView,
RecordingUtils,
FlameGraphUtils
} = panel.panelWin;
// Enable memory to test
Services.prefs.setBoolPref(UI_ENABLE_ALLOCATIONS_PREF, true);

View File

@ -3,7 +3,8 @@
"use strict";
/**
* Tests that the memory flamegraphs views get rerendered when toggling `invert-flame-graph`.
* Tests that the memory flamegraphs views get rerendered when toggling
* `invert-flame-graph`.
*/
const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* eslint-disable */
// Bug 1235788, increase time out of this test
requestLongerTimeout(2);
@ -256,3 +257,4 @@ gThread.frameTable.data.forEach((frame) => {
break;
}
});
/* eslint-enable */

View File

@ -49,20 +49,24 @@ add_task(function* () {
yield startRecording(panel, { skipWaitingForOverview: true });
is(isVisible($("#overview-pane")), false, "Overview graphs hidden again when starting new recording.");
is(isVisible($("#overview-pane")), false,
"Overview graphs hidden again when starting new recording.");
is(updated, 1, "Overview graphs have not been updated again.");
RecordingsView.selectedIndex = 0;
is(isVisible($("#overview-pane")), true, "Overview graphs no longer hidden when switching back to complete recording.");
is(isVisible($("#overview-pane")), true,
"Overview graphs no longer hidden when switching back to complete recording.");
is(updated, 1, "Overview graphs have not been updated again.");
RecordingsView.selectedIndex = 1;
is(isVisible($("#overview-pane")), false, "Overview graphs hidden again when going back to inprogress recording.");
is(isVisible($("#overview-pane")), false,
"Overview graphs hidden again when going back to inprogress recording.");
is(updated, 1, "Overview graphs have not been updated again.");
yield stopRecording(panel);
is(isVisible($("#overview-pane")), true, "overview graphs no longer hidden when recording finishes");
is(isVisible($("#overview-pane")), true,
"overview graphs no longer hidden when recording finishes");
is(updated, 2, "Overview graphs rendered again upon completion.");
yield teardownToolboxAndRemoveTab(panel);

View File

@ -10,7 +10,6 @@ const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils");
const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions");
const { once } = require("devtools/client/performance/test/helpers/event-utils");
const { idleWait } = require("devtools/client/performance/test/helpers/wait-utils");
const { dragStartCanvasGraph, dragStopCanvasGraph, clickCanvasGraph } = require("devtools/client/performance/test/helpers/input-utils");
add_task(function* () {
@ -29,14 +28,16 @@ add_task(function* () {
// Select the first half of the graph.
let rangeSelected = once(OverviewView, EVENTS.UI_OVERVIEW_RANGE_SELECTED, { spreadArgs: true });
let rangeSelected = once(OverviewView, EVENTS.UI_OVERVIEW_RANGE_SELECTED,
{ spreadArgs: true });
dragStartCanvasGraph(graph, { x: 0 });
let [_, { startTime, endTime }] = yield rangeSelected;
let [, { startTime, endTime }] = yield rangeSelected;
is(endTime, duration, "The selected range is the entire graph, for now.");
rangeSelected = once(OverviewView, EVENTS.UI_OVERVIEW_RANGE_SELECTED, { spreadArgs: true });
rangeSelected = once(OverviewView, EVENTS.UI_OVERVIEW_RANGE_SELECTED,
{ spreadArgs: true });
dragStopCanvasGraph(graph, { x: graph.width / 2 });
[_, { startTime, endTime }] = yield rangeSelected;
[, { startTime, endTime }] = yield rangeSelected;
is(endTime, duration / 2, "The selected range is half of the graph.");
is(graph.hasSelection(), true,
@ -54,9 +55,10 @@ add_task(function* () {
// Listen to deselection.
rangeSelected = once(OverviewView, EVENTS.UI_OVERVIEW_RANGE_SELECTED, { spreadArgs: true });
rangeSelected = once(OverviewView, EVENTS.UI_OVERVIEW_RANGE_SELECTED,
{ spreadArgs: true });
clickCanvasGraph(graph, { x: 3 * graph.width / 4 });
[_, { startTime, endTime }] = yield rangeSelected;
[, { startTime, endTime }] = yield rangeSelected;
is(graph.hasSelection(), false,
"A selection no longer on the graph.");

View File

@ -76,7 +76,8 @@ function* testRecordingFailingInWindow(index) {
PerformanceController.on(EVENTS.RECORDING_STATE_CHANGE, onRecordingStarted);
let whenFailed = once(PerformanceController, EVENTS.BACKEND_FAILED_AFTER_RECORDING_START);
let whenFailed = once(PerformanceController,
EVENTS.BACKEND_FAILED_AFTER_RECORDING_START);
PerformanceController.startRecording();
yield whenFailed;
ok(true, "Recording has failed.");
@ -92,13 +93,15 @@ function* testRecordingSucceedingInWindow(index) {
ok(false, "Recording should start while now private windows are present.");
};
PerformanceController.on(EVENTS.BACKEND_FAILED_AFTER_RECORDING_START, onRecordingFailed);
PerformanceController.on(EVENTS.BACKEND_FAILED_AFTER_RECORDING_START,
onRecordingFailed);
yield startRecording(panel);
yield stopRecording(panel);
ok(true, "Recording has succeeded.");
PerformanceController.off(EVENTS.BACKEND_FAILED_AFTER_RECORDING_START, onRecordingFailed);
PerformanceController.off(EVENTS.BACKEND_FAILED_AFTER_RECORDING_START,
onRecordingFailed);
}
function* teardownPerfInWindow(index, options) {

View File

@ -17,7 +17,14 @@ add_task(function* () {
win: window
});
let { EVENTS, OverviewView, DetailsView, WaterfallView, JsCallTreeView, JsFlameGraphView } = panel.panelWin;
let {
EVENTS,
OverviewView,
DetailsView,
WaterfallView,
JsCallTreeView,
JsFlameGraphView
} = panel.panelWin;
let updatedWaterfall = 0;
let updatedCallTree = 0;

View File

@ -18,7 +18,13 @@ add_task(function* () {
win: window
});
let { EVENTS, $, PerformanceController, PerformanceView, RecordingsView } = panel.panelWin;
let {
EVENTS,
$,
PerformanceController,
PerformanceView,
RecordingsView
} = panel.panelWin;
let MAIN_CONTAINER = $("#performance-view");
let CONTENT = $("#performance-view-content");
@ -39,7 +45,8 @@ add_task(function* () {
RecordingsView.selectedIndex = 0;
yield selected;
is(PerformanceView.getState(), "recorded", "Correct state during recording but selecting a completed recording.");
is(PerformanceView.getState(), "recorded",
"Correct state during recording but selecting a completed recording.");
is(MAIN_CONTAINER.selectedPanel, CONTENT, "Showing main view with timeline.");
is(DETAILS_CONTAINER.selectedPanel, DETAILS, "Showing recorded panel.");
@ -47,7 +54,8 @@ add_task(function* () {
RecordingsView.selectedIndex = 1;
yield selected;
is(PerformanceView.getState(), "recording", "Correct state when switching back to recording in progress.");
is(PerformanceView.getState(), "recording",
"Correct state when switching back to recording in progress.");
is(MAIN_CONTAINER.selectedPanel, CONTENT, "Showing main view with timeline.");
is(DETAILS_CONTAINER.selectedPanel, RECORDING, "Showing recording panel.");

View File

@ -10,7 +10,7 @@
const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
const { PROFILER_BUFFER_SIZE_PREF } = require("devtools/client/performance/test/helpers/prefs");
const { PMM_loadFrameScripts, PMM_stopProfiler, PMM_clearFrameScripts } = require("devtools/client/performance/test/helpers/profiler-mm-utils");
const { pmmLoadFrameScripts, pmmStopProfiler, pmmClearFrameScripts } = require("devtools/client/performance/test/helpers/profiler-mm-utils");
const { initPerformanceInTab, initConsoleInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils");
const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions");
const { waitUntil } = require("devtools/client/performance/test/helpers/wait-utils");
@ -18,8 +18,8 @@ const { once } = require("devtools/client/performance/test/helpers/event-utils")
add_task(function* () {
// Make sure the profiler module is stopped so we can set a new buffer limit.
PMM_loadFrameScripts(gBrowser);
yield PMM_stopProfiler();
pmmLoadFrameScripts(gBrowser);
yield pmmStopProfiler();
// Keep the profiler's buffer large, but still get to 1% relatively quick.
Services.prefs.setIntPref(PROFILER_BUFFER_SIZE_PREF, 1000000);
@ -30,27 +30,38 @@ add_task(function* () {
});
let { panel } = yield initPerformanceInTab({ tab: target.tab });
let { gFront, EVENTS, $, PerformanceController, PerformanceView, RecordingsView } = panel.panelWin;
let {
gFront,
EVENTS,
$,
PerformanceController,
PerformanceView,
RecordingsView
} = panel.panelWin;
// Set a fast profiler-status update interval.
yield gFront.setProfilerStatusInterval(10);
let DETAILS_CONTAINER = $("#details-pane-container");
let NORMAL_BUFFER_STATUS_MESSAGE = $("#recording-notice .buffer-status-message");
let CONSOLE_BUFFER_STATUS_MESSAGE = $("#console-recording-notice .buffer-status-message");
let CONSOLE_BUFFER_STATUS_MESSAGE =
$("#console-recording-notice .buffer-status-message");
let gPercent;
// Start a manual recording.
yield startRecording(panel);
yield waitUntil(function* () {
[, gPercent] = yield once(PerformanceView, EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED, { spreadArgs: true });
[, gPercent] = yield once(PerformanceView,
EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED,
{ spreadArgs: true });
return gPercent > 0;
});
ok(true, "Buffer percentage increased in display (1).");
let bufferUsage = PerformanceController.getBufferUsageForRecording(PerformanceController.getCurrentRecording());
let bufferUsage = PerformanceController.getBufferUsageForRecording(
PerformanceController.getCurrentRecording());
either(DETAILS_CONTAINER.getAttribute("buffer-status"), "in-progress", "full",
"Container has [buffer-status=in-progress] or [buffer-status=full].");
ok(NORMAL_BUFFER_STATUS_MESSAGE.value.indexOf(gPercent + "%") !== -1,
@ -60,13 +71,16 @@ add_task(function* () {
yield console.profile("rust");
yield waitUntil(function* () {
[, gPercent] = yield once(PerformanceView, EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED, { spreadArgs: true });
[, gPercent] = yield once(PerformanceView,
EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED,
{ spreadArgs: true });
return gPercent > Math.floor(bufferUsage * 100);
});
ok(true, "Buffer percentage increased in display (2).");
bufferUsage = PerformanceController.getBufferUsageForRecording(PerformanceController.getCurrentRecording());
bufferUsage = PerformanceController.getBufferUsageForRecording(
PerformanceController.getCurrentRecording());
either(DETAILS_CONTAINER.getAttribute("buffer-status"), "in-progress", "full",
"Container has [buffer-status=in-progress] or [buffer-status=full].");
ok(NORMAL_BUFFER_STATUS_MESSAGE.value.indexOf(gPercent + "%") !== -1,
@ -78,7 +92,9 @@ add_task(function* () {
yield selected;
yield waitUntil(function* () {
[, gPercent] = yield once(PerformanceView, EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED, { spreadArgs: true });
[, gPercent] = yield once(PerformanceView,
EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED,
{ spreadArgs: true });
return gPercent > 0;
});
@ -97,7 +113,9 @@ add_task(function* () {
yield selected;
yield waitUntil(function* () {
[, gPercent] = yield once(PerformanceView, EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED, { spreadArgs: true });
[, gPercent] = yield once(PerformanceView,
EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED,
{ spreadArgs: true });
return gPercent > Math.floor(bufferUsage * 100);
});
@ -113,5 +131,5 @@ add_task(function* () {
yield teardownToolboxAndRemoveTab(panel);
PMM_clearFrameScripts();
pmmClearFrameScripts();
});

View File

@ -9,7 +9,7 @@
const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
const { PROFILER_BUFFER_SIZE_PREF } = require("devtools/client/performance/test/helpers/prefs");
const { PMM_loadFrameScripts, PMM_stopProfiler, PMM_clearFrameScripts } = require("devtools/client/performance/test/helpers/profiler-mm-utils");
const { pmmLoadFrameScripts, pmmStopProfiler, pmmClearFrameScripts } = require("devtools/client/performance/test/helpers/profiler-mm-utils");
const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils");
const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions");
const { waitUntil } = require("devtools/client/performance/test/helpers/wait-utils");
@ -17,8 +17,8 @@ const { once } = require("devtools/client/performance/test/helpers/event-utils")
add_task(function* () {
// Make sure the profiler module is stopped so we can set a new buffer limit.
PMM_loadFrameScripts(gBrowser);
yield PMM_stopProfiler();
pmmLoadFrameScripts(gBrowser);
yield pmmStopProfiler();
// Keep the profiler's buffer small, to get to 100% really quickly.
Services.prefs.setIntPref(PROFILER_BUFFER_SIZE_PREF, 10000);
@ -41,13 +41,16 @@ add_task(function* () {
yield startRecording(panel);
yield waitUntil(function* () {
[, gPercent] = yield once(PerformanceView, EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED, { spreadArgs: true });
[, gPercent] = yield once(PerformanceView,
EVENTS.UI_RECORDING_PROFILER_STATUS_RENDERED,
{ spreadArgs: true });
return gPercent == 100;
});
ok(true, "Buffer percentage increased in display.");
let bufferUsage = PerformanceController.getBufferUsageForRecording(PerformanceController.getCurrentRecording());
let bufferUsage = PerformanceController.getBufferUsageForRecording(
PerformanceController.getCurrentRecording());
ok(bufferUsage, 1, "Buffer is full for this recording.");
ok(DETAILS_CONTAINER.getAttribute("buffer-status"), "full",
"Container has [buffer-status=full].");
@ -59,5 +62,5 @@ add_task(function* () {
yield teardownToolboxAndRemoveTab(panel);
PMM_clearFrameScripts();
pmmClearFrameScripts();
});

View File

@ -41,7 +41,8 @@ add_task(function* () {
enabled = true;
PerformanceController._setMultiprocessAttributes();
ok($("#performance-view").getAttribute("e10s"), "",
"When e10s is enabled, but not supported, this probably means we no longer have E10S_TESTING_ONLY, and we have no e10s attribute.");
"When e10s is enabled, but not supported, this probably means we no longer have " +
"E10S_TESTING_ONLY, and we have no e10s attribute.");
supported = true;
enabled = true;

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* eslint-disable */
/**
* Tests if the performance tool is able to save and load recordings.
*/
@ -90,3 +91,4 @@ var test = Task.async(function* () {
yield teardown(panel);
finish();
});
/* eslint-enable */

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* eslint-disable */
/**
* Tests if the performance tool gracefully handles loading bogus files.
*/

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* eslint-disable */
/**
* Tests if the performance tool gracefully handles loading files that are JSON,
* but don't contain the appropriate recording data.
@ -52,3 +53,4 @@ function asyncCopy(data, file) {
return deferred.promise;
}
/* eslint-enable */

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* eslint-disable */
/**
* Tests if the performance tool can import profiler data from the
* original profiler tool (Performance Recording v1, and Profiler data v2) and the correct views and graphs are loaded.
@ -174,3 +175,4 @@ function asyncCopy(data, file) {
return deferred.promise;
}
/* eslint-enable */

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* eslint-disable */
/**
* Test that when importing and no graphs rendered yet, we do not get a
* `getMappedSelection` error.
@ -39,3 +40,4 @@ var test = Task.async(function* () {
yield teardown(panel);
finish();
});
/* eslint-enable */

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* eslint-disable */
/**
* Tests if the performance tool can import profiler data when Profiler is v2
* and requires deflating, and has an extra thread that's a string. Not sure
@ -138,3 +139,4 @@ function asyncCopy(data, file) {
return deferred.promise;
}
/* eslint-enable */

View File

@ -29,7 +29,7 @@ add_task(function* () {
ok(!(OverviewView.graphs.get("framerate")),
"The framerate graph should not have been created yet.");
ok(!DetailsView.components["waterfall"].initialized,
ok(!DetailsView.components.waterfall.initialized,
"The waterfall detail view should not have been created yet.");
ok(!DetailsView.components["js-calltree"].initialized,
"The js-calltree detail view should not have been created yet.");

View File

@ -38,12 +38,16 @@ add_task(function* () {
yield stopRecording(panel);
is(logs[DURATION].length, 2, `There are two entries for ${DURATION}.`);
ok(logs[DURATION].every(d => typeof d === "number"), `Every ${DURATION} entry is a number.`);
ok(logs[DURATION].every(d => typeof d === "number"),
`Every ${DURATION} entry is a number.`);
is(logs[COUNT].length, 2, `There are two entries for ${COUNT}.`);
is(logs[CONSOLE_COUNT], void 0, `There are no entries for ${CONSOLE_COUNT}.`);
is(logs[FEATURES].length, 8, `There are two recordings worth of entries for ${FEATURES}.`);
ok(logs[FEATURES].find(r => r[0] === "withMemory" && r[1] === true), "One feature entry for memory enabled.");
ok(logs[FEATURES].find(r => r[0] === "withMemory" && r[1] === false), "One feature entry for memory disabled.");
is(logs[FEATURES].length, 8,
`There are two recordings worth of entries for ${FEATURES}.`);
ok(logs[FEATURES].find(r => r[0] === "withMemory" && r[1] === true),
"One feature entry for memory enabled.");
ok(logs[FEATURES].find(r => r[0] === "withMemory" && r[1] === false),
"One feature entry for memory disabled.");
yield teardownToolboxAndRemoveTab(panel);
});

View File

@ -32,7 +32,8 @@ add_task(function* () {
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("666", 8));
let exported = once(PerformanceController, EVENTS.RECORDING_EXPORTED);
yield PerformanceController.exportRecording("", PerformanceController.getCurrentRecording(), file);
yield PerformanceController.exportRecording("",
PerformanceController.getCurrentRecording(), file);
yield exported;
ok(logs[EXPORTED], `A telemetry entry for ${EXPORTED} exists after exporting.`);

View File

@ -18,7 +18,13 @@ add_task(function* () {
win: window
});
let { EVENTS, PerformanceController, DetailsView, JsCallTreeView, JsFlameGraphView } = panel.panelWin;
let {
EVENTS,
PerformanceController,
DetailsView,
JsCallTreeView,
JsFlameGraphView
} = panel.panelWin;
let telemetry = PerformanceController._telemetry;
let logs = telemetry.getLogs();
@ -41,7 +47,10 @@ add_task(function* () {
// Check views after destruction to ensure `js-flamegraph` gets called
// with a time during destruction.
ok(logs[VIEWS].find(r => r[0] === "waterfall" && typeof r[1] === "number"), `${VIEWS} for waterfall view and time.`);
ok(logs[VIEWS].find(r => r[0] === "js-calltree" && typeof r[1] === "number"), `${VIEWS} for js-calltree view and time.`);
ok(logs[VIEWS].find(r => r[0] === "js-flamegraph" && typeof r[1] === "number"), `${VIEWS} for js-flamegraph view and time.`);
ok(logs[VIEWS].find(r => r[0] === "waterfall" && typeof r[1] === "number"),
`${VIEWS} for waterfall view and time.`);
ok(logs[VIEWS].find(r => r[0] === "js-calltree" && typeof r[1] === "number"),
`${VIEWS} for js-calltree view and time.`);
ok(logs[VIEWS].find(r => r[0] === "js-flamegraph" && typeof r[1] === "number"),
`${VIEWS} for js-flamegraph view and time.`);
});

View File

@ -40,9 +40,11 @@ add_task(function* () {
yield stopped;
is(logs[DURATION].length, 1, `There is one entry for ${DURATION}.`);
ok(logs[DURATION].every(d => typeof d === "number"), `Every ${DURATION} entry is a number.`);
ok(logs[DURATION].every(d => typeof d === "number"),
`Every ${DURATION} entry is a number.`);
is(logs[CONSOLE_COUNT].length, 1, `There is one entry for ${CONSOLE_COUNT}.`);
is(logs[FEATURES].length, 4, `There is one recording worth of entries for ${FEATURES}.`);
is(logs[FEATURES].length, 4,
`There is one recording worth of entries for ${FEATURES}.`);
yield teardownToolboxAndRemoveTab(panel);
});

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* eslint-disable */
/**
* Tests if the markers and memory overviews render with the correct
* theme on load, and rerenders when changed.
@ -74,3 +75,4 @@ function* spawnTest() {
yield teardown(panel);
finish();
}
/* eslint-enable */

View File

@ -51,7 +51,7 @@ add_task(function* () {
let receivedFocusEvent = once(treeRoot, "focus");
mousedown(treeRoot.target.querySelector(".arrow"));
let [_, eventItem] = yield receivedExpandEvent;
let [, eventItem] = yield receivedExpandEvent;
is(eventItem, treeRoot,
"The 'expand' event target is correct (1).");
@ -102,7 +102,7 @@ add_task(function* () {
receivedFocusEvent = once(treeRoot, "focus", { spreadArgs: true });
mousedown(fooItem.target);
[_, eventItem] = yield receivedFocusEvent;
[, eventItem] = yield receivedFocusEvent;
is(eventItem, fooItem,
"The 'focus' event target is correct (2).");
is(document.commandDispatcher.focusedElement, fooItem.target,
@ -114,7 +114,7 @@ add_task(function* () {
receivedFocusEvent = once(treeRoot, "focus");
dblclick(barItem.target);
[_, eventItem] = yield receivedExpandEvent;
[, eventItem] = yield receivedExpandEvent;
is(eventItem, barItem,
"The 'expand' event target is correct (3).");

View File

@ -9,7 +9,6 @@
const { appendAndWaitForPaint } = require("devtools/client/performance/test/helpers/dom-utils");
const { synthesizeCustomTreeClass } = require("devtools/client/performance/test/helpers/synth-utils");
const { once } = require("devtools/client/performance/test/helpers/event-utils");
add_task(function* () {
let { MyCustomTreeItem, myDataSrc } = synthesizeCustomTreeClass();

View File

@ -9,7 +9,6 @@
const { appendAndWaitForPaint } = require("devtools/client/performance/test/helpers/dom-utils");
const { synthesizeCustomTreeClass } = require("devtools/client/performance/test/helpers/synth-utils");
const { once } = require("devtools/client/performance/test/helpers/event-utils");
add_task(function* () {
let { MyCustomTreeItem, myDataSrc } = synthesizeCustomTreeClass();

View File

@ -9,14 +9,13 @@
const { appendAndWaitForPaint } = require("devtools/client/performance/test/helpers/dom-utils");
const { synthesizeCustomTreeClass } = require("devtools/client/performance/test/helpers/synth-utils");
const { once } = require("devtools/client/performance/test/helpers/event-utils");
add_task(function* () {
let { MyCustomTreeItem } = synthesizeCustomTreeClass();
let container = document.createElement("vbox");
container.style.height = '100%';
container.style.overflow = 'scroll';
container.style.height = "100%";
container.style.overflow = "scroll";
yield appendAndWaitForPaint(gBrowser.selectedBrowser.parentNode, container);
let myDataSrc = {

View File

@ -33,8 +33,10 @@ add_task(function () {
treeRoot.attachTo(container);
let $$ = node => container.querySelectorAll(node);
let $fun = (node, ancestor) => (ancestor || container).querySelector(".call-tree-cell[type=function] > " + node);
let $$fun = (node, ancestor) => (ancestor || container).querySelectorAll(".call-tree-cell[type=function] > " + node);
let $fun = (node, ancestor) => (ancestor || container).querySelector(
".call-tree-cell[type=function] > " + node);
let $$fun = (node, ancestor) => (ancestor || container).querySelectorAll(
".call-tree-cell[type=function] > " + node);
let $$dur = i => container.querySelectorAll(".call-tree-cell[type=duration]")[i];
let $$per = i => container.querySelectorAll(".call-tree-cell[type=percentage]")[i];
let $$sam = i => container.querySelectorAll(".call-tree-cell[type=samples]")[i];

View File

@ -23,7 +23,8 @@ add_task(function () {
treeRoot.attachTo(container);
let $$fun = i => container.querySelectorAll(".call-tree-cell[type=function]")[i];
let $$nam = i => container.querySelectorAll(".call-tree-cell[type=function] > .call-tree-name")[i];
let $$nam = i => container.querySelectorAll(
".call-tree-cell[type=function] > .call-tree-name")[i];
let $$dur = i => container.querySelectorAll(".call-tree-cell[type=duration]")[i];
is(container.childNodes.length, 7,

View File

@ -28,7 +28,9 @@ add_task(function* () {
let D = B.getChild();
let linkEvent = null;
let handler = (_, e) => linkEvent = e;
let handler = (_, e) => {
linkEvent = e;
};
treeRoot.on("link", handler);

View File

@ -13,7 +13,8 @@ const { CATEGORY_MASK } = require("devtools/client/performance/modules/categorie
const RecordingUtils = require("devtools/shared/performance/recording-utils");
add_task(function () {
let threadNode = new ThreadNode(gProfile.threads[0], { startTime: 0, endTime: 20, contentOnly: true });
let threadNode = new ThreadNode(gProfile.threads[0], { startTime: 0, endTime: 20,
contentOnly: true });
// Don't display the synthesized (root) and the real (root) node twice.
threadNode.calls = threadNode.calls[0].calls;

View File

@ -12,7 +12,8 @@ const { CallView } = require("devtools/client/performance/modules/widgets/tree-v
const RecordingUtils = require("devtools/shared/performance/recording-utils");
add_task(function () {
let threadNode = new ThreadNode(gProfile.threads[0], { startTime: 0, endTime: 20, invertTree: true });
let threadNode = new ThreadNode(gProfile.threads[0], { startTime: 0, endTime: 20,
invertTree: true });
let treeRoot = new CallView({ frame: threadNode, inverted: true });
let container = document.createElement("vbox");
treeRoot.attachTo(container);

View File

@ -12,15 +12,19 @@ const { CallView } = require("devtools/client/performance/modules/widgets/tree-v
const RecordingUtils = require("devtools/shared/performance/recording-utils");
add_task(function () {
let threadNode = new ThreadNode(gProfile.threads[0], { startTime: 0, endTime: 50, invertTree: true });
let threadNode = new ThreadNode(gProfile.threads[0], { startTime: 0, endTime: 50,
invertTree: true });
let treeRoot = new CallView({ frame: threadNode, inverted: true });
let container = document.createElement("vbox");
treeRoot.attachTo(container);
// Add 1 to each index to skip the hidden root node
let $$nam = i => container.querySelectorAll(".call-tree-cell[type=function] > .call-tree-name")[i + 1];
let $$per = i => container.querySelectorAll(".call-tree-cell[type=percentage]")[i + 1];
let $$selfper = i => container.querySelectorAll(".call-tree-cell[type='self-percentage']")[i + 1];
let $$nam = i => container.querySelectorAll(
".call-tree-cell[type=function] > .call-tree-name")[i + 1];
let $$per = i => container.querySelectorAll(
".call-tree-cell[type=percentage]")[i + 1];
let $$selfper = i => container.querySelectorAll(
".call-tree-cell[type='self-percentage']")[i + 1];
/**
* Samples:
@ -48,7 +52,8 @@ add_task(function () {
is(container.childNodes.length, 10,
"The container node should have all children available.");
[ // total, self, indent + name
// total, self, indent + name
[
[ 50, 50, "C"],
[ 40, 0, " B"],
[ 30, 0, " A"],

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* eslint-disable */
/**
* Tests that if `show-jit-optimizations` is true, then an
* icon is next to the frame with optimizations
@ -150,3 +151,4 @@ gThread.frameTable.data.forEach((frame) => {
break;
}
});
/* eslint-enable */

View File

@ -7,7 +7,7 @@
* in the UI.
*/
const { PMM_loadFrameScripts, PMM_isProfilerActive, PMM_clearFrameScripts } = require("devtools/client/performance/test/helpers/profiler-mm-utils");
const { pmmLoadFrameScripts, pmmIsProfilerActive, pmmClearFrameScripts } = require("devtools/client/performance/test/helpers/profiler-mm-utils");
const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils");
const { startRecording, stopRecording } = require("devtools/client/performance/test/helpers/actions");
@ -18,22 +18,22 @@ add_task(function* () {
win: window
});
PMM_loadFrameScripts(gBrowser);
pmmLoadFrameScripts(gBrowser);
ok(!(yield PMM_isProfilerActive()),
ok(!(yield pmmIsProfilerActive()),
"The built-in profiler module should not have been automatically started.");
yield startRecording(panel);
ok((yield PMM_isProfilerActive()),
ok((yield pmmIsProfilerActive()),
"The built-in profiler module should now be active.");
yield stopRecording(panel);
ok((yield PMM_isProfilerActive()),
ok((yield pmmIsProfilerActive()),
"The built-in profiler module should still be active.");
yield teardownToolboxAndRemoveTab(panel);
PMM_clearFrameScripts();
pmmClearFrameScripts();
});

View File

@ -1,5 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable */
/**
* Tests markers filtering mechanism.
@ -115,3 +116,4 @@ function waitForOverviewAndCommand(overview, item) {
let menuitemCommandDispatched = once(item, "command");
return Promise.all([overviewRendered, menuitemCommandDispatched]);
}
/* eslint-enable */

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* eslint-disable */
/**
* Tests markers filtering mechanism.
*/
@ -44,3 +45,4 @@ function* spawnTest() {
yield teardown(panel);
finish();
}
/* eslint-enable */

View File

@ -7,7 +7,6 @@
* the container bounds.
*/
const { WATERFALL_MARKER_SIDEBAR_SAFE_BOUNDS } = require("devtools/client/performance/modules/widgets/marker-view");
const { SIMPLE_URL } = require("devtools/client/performance/test/helpers/urls");
const { initPerformanceInNewTab, teardownToolboxAndRemoveTab } = require("devtools/client/performance/test/helpers/panel-utils");
const { startRecording, stopRecording, waitForOverviewRenderedWithMarkers } = require("devtools/client/performance/test/helpers/actions");
@ -18,7 +17,7 @@ add_task(function* () {
win: window
});
let { $, WaterfallView } = panel.panelWin;
let { WaterfallView } = panel.panelWin;
yield startRecording(panel);
ok(true, "Recording has started.");
@ -36,7 +35,8 @@ add_task(function* () {
ok(WaterfallView._waterfallHeader._ctx,
"A 2d context should be created after the recording ended.");
is(WaterfallView._waterfallHeader._canvas.width, WaterfallView._markersRoot._waterfallWidth,
is(WaterfallView._waterfallHeader._canvas.width,
WaterfallView._markersRoot._waterfallWidth,
"The canvas width is correct.");
is(WaterfallView._waterfallHeader._canvas.height, 1,
"The canvas height is correct.");

View File

@ -68,7 +68,8 @@ add_task(function* () {
let detailsView = WaterfallView.details;
let markersRoot = WaterfallView._markersRoot;
markersRoot.recalculateBounds(); // Make sure the bounds are up to date.
// Make sure the bounds are up to date.
markersRoot.recalculateBounds();
let parentWidthBefore = $("#waterfall-view").getBoundingClientRect().width;
let sidebarWidthBefore = $(".waterfall-sidebar").getBoundingClientRect().width;
@ -78,8 +79,9 @@ add_task(function* () {
"The details view in the waterfall view is hidden by default.");
is(detailsWidthBefore, 0,
"The details view width should be 0 when hidden.");
is(markersRoot._waterfallWidth, parentWidthBefore - sidebarWidthBefore - WATERFALL_MARKER_SIDEBAR_SAFE_BOUNDS,
"The waterfall width is correct (1).");
is(markersRoot._waterfallWidth,
parentWidthBefore - sidebarWidthBefore - WATERFALL_MARKER_SIDEBAR_SAFE_BOUNDS,
"The waterfall width is correct (1).");
let receivedFocusEvent = once(markersRoot, "focus");
let waterfallRerendered = once(WaterfallView, EVENTS.UI_WATERFALL_RENDERED);
@ -99,8 +101,10 @@ add_task(function* () {
"The sidebar view's width should not have changed.");
isnot(detailsWidthAfter, 0,
"The details view width should not be 0 when visible.");
is(markersRoot._waterfallWidth, parentWidthAfter - sidebarWidthAfter - detailsWidthAfter - WATERFALL_MARKER_SIDEBAR_SAFE_BOUNDS,
"The waterfall width is correct (2).");
is(markersRoot._waterfallWidth,
parentWidthAfter - sidebarWidthAfter - detailsWidthAfter
- WATERFALL_MARKER_SIDEBAR_SAFE_BOUNDS,
"The waterfall width is correct (2).");
yield teardownToolboxAndRemoveTab(panel);
});

View File

@ -1,6 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable */
/**
* Tests if the waterfall remembers the selection when rerendering.
*/
@ -73,3 +73,4 @@ function* spawnTest() {
yield teardown(panel);
finish();
}
/* eslint-enable */

View File

@ -1,6 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable */
/**
* Tests if the sidebar is properly updated when a marker is selected.
*/
@ -74,3 +74,4 @@ function* spawnTest() {
yield teardown(panel);
finish();
}
/* eslint-enable */

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* eslint-disable */
/**
* Tests if the sidebar is properly updated with worker markers.
*/
@ -93,3 +94,4 @@ function evalInDebuggee(script) {
return deferred.promise;
}
/* eslint-enable */

View File

@ -10,9 +10,10 @@
<body>
<script type="text/javascript">
var allocs = [];
"use strict";
const allocs = [];
function test() {
for (var i = 0; i < 10; i++) {
for (let i = 0; i < 10; i++) {
allocs.push({});
}
}

View File

@ -10,10 +10,11 @@
<body>
<script type="text/javascript">
window.test = function () {
document.body.innerHTML = "<h1>LOL</h1>";
};
setInterval(window.test, 100);
"use strict";
window.test = function () {
document.body.innerHTML = "<h1>LOL</h1>";
};
setInterval(window.test, 100);
</script>
</body>

View File

@ -10,14 +10,17 @@
<body>
<script type="text/javascript">
var x = 1;
"use strict";
function test() {
var i = 10;
let i = 10;
// generate sync styles and reflows
while (--i) {
var h = document.body.clientHeight;
document.body.style.height = (200 + i) + "px";
document.body.style.borderTop = i + "px solid red"; // paint
/* eslint-disable no-unused-vars */
let h = document.body.clientHeight;
/* eslint-enable no-unused-vars */
document.body.style.height = (200 + i) + "px";
// paint
document.body.style.borderTop = i + "px solid red";
}
console.time("!!!");
test2();

View File

@ -10,11 +10,13 @@
<body>
<script type="text/javascript">
var x = 1;
"use strict";
let x = 1;
function test() {
document.body.style.borderTop = x + "px solid red";
x = 1^x;
document.body.innerHeight; // flush pending reflows
x = 1 ^ x;
// flush pending reflows
document.body.innerHeight;
}
// Prevent this script from being garbage collected.

View File

@ -10,10 +10,13 @@
<body>
<script type="text/javascript">
function performWork() {
var worker = new Worker("js_simpleWorker.js");
"use strict";
worker.addEventListener("message", function(e) {
/* exported performWork */
function performWork() {
const worker = new Worker("js_simpleWorker.js");
worker.addEventListener("message", function (e) {
console.log(e.data);
console.timeStamp("Done");
}, false);

View File

@ -4,6 +4,7 @@
const { require, loader } = Cu.import("resource://devtools/shared/Loader.jsm", {});
/* exported loader, either, click, dblclick, mousedown, rightMousedown, key */
// All tests are asynchronous.
waitForExplicitFinish();
@ -57,11 +58,12 @@ const key = (id, win = window) => {
DevToolsUtils.testing = true;
// Make sure all the prefs are reverted to their defaults once tests finish.
let stopObservingPrefs = PrefUtils.whenUnknownPrefChanged("devtools.performance", pref => {
ok(false, `Unknown pref changed: ${pref}. Please add it to test/helpers/prefs.js ` +
"to make sure it's reverted to its default value when the tests finishes, " +
"and avoid interfering with future tests.\n");
});
let stopObservingPrefs = PrefUtils.whenUnknownPrefChanged("devtools.performance",
pref => {
ok(false, `Unknown pref changed: ${pref}. Please add it to test/helpers/prefs.js ` +
"to make sure it's reverted to its default value when the tests finishes, " +
"and avoid interfering with future tests.\n");
});
// By default, enable memory flame graphs for tests for now.
// TODO: remove when we have flame charts via bug 1148663.
@ -78,7 +80,8 @@ const key = (id, win = window) => {
// avoid at least some leaks on OSX. Theoretically the module should never
// be active at this point. We shouldn't have to do this, but rather
// find and fix the leak in the module itself. Bug 1257439.
let nsIProfilerModule = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler);
let nsIProfilerModule = Cc["@mozilla.org/tools/profiler;1"]
.getService(Ci.nsIProfiler);
nsIProfilerModule.StopProfiler();
// Forces GC, CC and shrinking GC to get rid of disconnected docshells

View File

@ -26,4 +26,5 @@ exports.appendAndWaitForPaint = function (parent, element) {
return onMozAfterPaint;
}
parent.appendChild(element);
return null;
};

View File

@ -58,13 +58,15 @@ exports.times = function (target, eventName, receiveCount, options = {}) {
(!(options.expectedArgs[index] instanceof RegExp) &&
options.expectedArgs[index] != args[index])
) {
dump(`Ignoring event '${eventName}' with unexpected argument at index ${index}: ${args[index]}\n`);
dump(`Ignoring event '${eventName}' with unexpected argument at index ` +
`${index}: ${args[index]}\n`);
return;
}
}
}
if (--receiveCount > 0) {
dump(`Event: '${eventName}' on ${target} needs to be fired ${receiveCount} more time(s).\n`);
dump(`Event: '${eventName}' on ${target} needs to be fired ${receiveCount} ` +
`more time(s).\n`);
} else if (!receiveCount) {
dump(`Event: '${eventName}' on ${target} received.\n`);
target[remove](eventName, onEvent, options.useCapture);
@ -95,11 +97,13 @@ exports.observeTimes = function (notificationName, receiveCount, options = {}) {
Services.obs.addObserver(function onObserve(subject, topic, data) {
if ("expectedSubject" in options && options.expectedSubject != subject) {
dump(`Ignoring notification '${notificationName}' with unexpected subject: ${subject}\n`);
dump(`Ignoring notification '${notificationName}' with unexpected subject: ` +
`${subject}\n`);
return;
}
if (--receiveCount > 0) {
dump(`Notification: '${notificationName}' needs to be fired ${receiveCount} more time(s).\n`);
dump(`Notification: '${notificationName}' needs to be fired ${receiveCount} ` +
`more time(s).\n`);
} else if (!receiveCount) {
dump(`Notification: '${notificationName}' received.\n`);
Services.obs.removeObserver(onObserve, topic);

View File

@ -10,7 +10,8 @@ exports.VERTICAL_AXIS = 2;
*/
exports.command = (node) => {
let ev = node.ownerDocument.createEvent("XULCommandEvent");
ev.initCommandEvent("command", true, true, node.ownerDocument.defaultView, 0, false, false, false, false, null);
ev.initCommandEvent("command", true, true, node.ownerDocument.defaultView, 0, false,
false, false, false, null);
node.dispatchEvent(ev);
};

View File

@ -19,7 +19,7 @@ let gMM = null;
/**
* Loads the relevant frame scripts into the provided browser's message manager.
*/
exports.PMM_loadFrameScripts = (gBrowser) => {
exports.pmmLoadFrameScripts = (gBrowser) => {
gMM = gBrowser.selectedBrowser.messageManager;
gMM.loadFrameScript(FRAME_SCRIPT_UTILS_URL, false);
};
@ -27,7 +27,7 @@ exports.PMM_loadFrameScripts = (gBrowser) => {
/**
* Clears the cached message manager.
*/
exports.PMM_clearFrameScripts = () => {
exports.pmmClearFrameScripts = () => {
gMM = null;
};
@ -36,12 +36,13 @@ exports.PMM_clearFrameScripts = () => {
* Resolves a returned promise when the response is received from the message
* listener, with the same id as part of the response payload data.
*/
exports.PMM_uniqueMessage = function (message, payload) {
exports.pmmUniqueMessage = function (message, payload) {
if (!gMM) {
throw new Error("`PMM_loadFrameScripts()` must be called when using MessageManager.");
throw new Error("`pmmLoadFrameScripts()` must be called when using MessageManager.");
}
let { generateUUID } = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
let { generateUUID } = Cc["@mozilla.org/uuid-generator;1"]
.getService(Ci.nsIUUIDGenerator);
payload.id = generateUUID().toString();
return new Promise(resolve => {
@ -58,48 +59,51 @@ exports.PMM_uniqueMessage = function (message, payload) {
/**
* Checks if the nsProfiler module is active.
*/
exports.PMM_isProfilerActive = () => {
return exports.PMM_sendProfilerCommand("IsActive");
exports.pmmIsProfilerActive = () => {
return exports.pmmSendProfilerCommand("IsActive");
};
/**
* Starts the nsProfiler module.
*/
exports.PMM_startProfiler = Task.async(function* ({ entries, interval, features }) {
let isActive = (yield exports.PMM_sendProfilerCommand("IsActive")).isActive;
exports.pmmStartProfiler = Task.async(function* ({ entries, interval, features }) {
let isActive = (yield exports.pmmSendProfilerCommand("IsActive")).isActive;
if (!isActive) {
return exports.PMM_sendProfilerCommand("StartProfiler", [entries, interval, features, features.length]);
return exports.pmmSendProfilerCommand("StartProfiler", [entries, interval, features,
features.length]);
}
return null;
});
/**
* Stops the nsProfiler module.
*/
exports.PMM_stopProfiler = Task.async(function* () {
let isActive = (yield exports.PMM_sendProfilerCommand("IsActive")).isActive;
exports.pmmStopProfiler = Task.async(function* () {
let isActive = (yield exports.pmmSendProfilerCommand("IsActive")).isActive;
if (isActive) {
return exports.PMM_sendProfilerCommand("StopProfiler");
return exports.pmmSendProfilerCommand("StopProfiler");
}
return null;
});
/**
* Calls a method on the nsProfiler module.
*/
exports.PMM_sendProfilerCommand = (method, args = []) => {
return exports.PMM_uniqueMessage("devtools:test:profiler", { method, args });
exports.pmmSendProfilerCommand = (method, args = []) => {
return exports.pmmUniqueMessage("devtools:test:profiler", { method, args });
};
/**
* Evaluates a script in content, returning a promise resolved with the
* returned result.
*/
exports.PMM_evalInDebuggee = (script) => {
return exports.PMM_uniqueMessage("devtools:test:eval", { script });
exports.pmmEvalInDebuggee = (script) => {
return exports.pmmUniqueMessage("devtools:test:eval", { script });
};
/**
* Evaluates a console method in content.
*/
exports.PMM_consoleMethod = function (method, ...args) {
exports.pmmConsoleMethod = function (method, ...args) {
// Terrible ugly hack -- this gets stringified when it uses the
// message manager, so an undefined arg in `console.profileEnd()`
// turns into a stringified "null", which is terrible. This method
@ -109,5 +113,5 @@ exports.PMM_consoleMethod = function (method, ...args) {
if (args[0] == null) {
args[0] = "";
}
return exports.PMM_uniqueMessage("devtools:test:console", { method, args });
return exports.pmmUniqueMessage("devtools:test:console", { method, args });
};

View File

@ -15,10 +15,12 @@ const { once, observeOnce } = require("devtools/client/performance/test/helpers/
exports.busyWait = function (time) {
dump(`Busy waiting for: ${time} milliseconds.\n`);
let start = Date.now();
/* eslint-disable no-unused-vars */
let stack;
while (Date.now() - start < time) {
stack = CC.stack;
}
/* eslint-enable no-unused-vars */
};
/**

View File

@ -1,3 +1,5 @@
"use strict";
self.addEventListener("message", function (e) {
self.postMessage(e.data);
self.close();

View File

@ -22,7 +22,7 @@ function getFrameNodePath(root, path) {
if (!foundNode) {
break;
}
calls = node.calls;
calls = foundNode.calls;
}
return foundNode;
}

View File

@ -6,7 +6,7 @@
*/
const { PerformanceFront } = require("devtools/shared/fronts/performance");
const { PMM_consoleMethod, PMM_loadFrameScripts, PMM_clearFrameScripts } = require("devtools/client/performance/test/helpers/profiler-mm-utils");
const { pmmConsoleMethod, pmmLoadFrameScripts, pmmClearFrameScripts } = require("devtools/client/performance/test/helpers/profiler-mm-utils");
const MARKER_NAME = "TimeStamp";
add_task(function* () {
@ -20,9 +20,9 @@ add_task(function* () {
yield front.connect();
let rec = yield front.startRecording({ withMarkers: true });
PMM_loadFrameScripts(gBrowser);
PMM_consoleMethod("timeStamp");
PMM_consoleMethod("timeStamp", "myLabel");
pmmLoadFrameScripts(gBrowser);
pmmConsoleMethod("timeStamp");
pmmConsoleMethod("timeStamp", "myLabel");
let markers = yield waitForMarkerType(front, MARKER_NAME, markers => markers.length >= 2);
@ -36,7 +36,7 @@ add_task(function* () {
is(markers[0].causeName, void 0, "Unlabeled timestamps have an empty causeName");
is(markers[1].causeName, "myLabel", "Labeled timestamps have correct causeName");
PMM_clearFrameScripts();
pmmClearFrameScripts();
yield closeDebuggerClient(client);
gBrowser.removeCurrentTab();

View File

@ -8,7 +8,7 @@
*/
const { PerformanceFront } = require("devtools/shared/fronts/performance");
const { PMM_isProfilerActive, PMM_stopProfiler, PMM_loadFrameScripts } = require("devtools/client/performance/test/helpers/profiler-mm-utils");
const { pmmIsProfilerActive, pmmStopProfiler, pmmLoadFrameScripts } = require("devtools/client/performance/test/helpers/profiler-mm-utils");
add_task(function* () {
let browser = yield addTab(MAIN_DOMAIN + "doc_perf.html");
@ -20,25 +20,25 @@ add_task(function* () {
let front = PerformanceFront(client, form);
yield front.connect();
PMM_loadFrameScripts(gBrowser);
pmmLoadFrameScripts(gBrowser);
ok(!(yield PMM_isProfilerActive()),
ok(!(yield pmmIsProfilerActive()),
"The built-in profiler module should not have been automatically started.");
let rec = yield front.startRecording();
yield front.stopRecording(rec);
ok((yield PMM_isProfilerActive()),
ok((yield pmmIsProfilerActive()),
"The built-in profiler module should still be active (1).");
rec = yield front.startRecording();
yield front.stopRecording(rec);
ok((yield PMM_isProfilerActive()),
ok((yield pmmIsProfilerActive()),
"The built-in profiler module should still be active (2).");
yield front.destroy();
yield closeDebuggerClient(client);
ok(!(yield PMM_isProfilerActive()),
ok(!(yield pmmIsProfilerActive()),
"The built-in profiler module should no longer be active.");
gBrowser.removeCurrentTab();

View File

@ -7,7 +7,7 @@
*/
const { PerformanceFront } = require("devtools/shared/fronts/performance");
const { PMM_isProfilerActive, PMM_stopProfiler, PMM_loadFrameScripts } = require("devtools/client/performance/test/helpers/profiler-mm-utils");
const { pmmIsProfilerActive, pmmStopProfiler, pmmLoadFrameScripts } = require("devtools/client/performance/test/helpers/profiler-mm-utils");
add_task(function* () {
yield addTab(MAIN_DOMAIN + "doc_perf.html");
@ -17,7 +17,7 @@ add_task(function* () {
let firstFront = PerformanceFront(client, form);
yield firstFront.connect();
PMM_loadFrameScripts(gBrowser);
pmmLoadFrameScripts(gBrowser);
yield firstFront.startRecording();
@ -26,19 +26,19 @@ add_task(function* () {
let form2 = yield connectDebuggerClient(client2);
let secondFront = PerformanceFront(client2, form2);
yield secondFront.connect();
PMM_loadFrameScripts(gBrowser);
pmmLoadFrameScripts(gBrowser);
yield secondFront.startRecording();
// Manually teardown the tabs so we can check profiler status
yield secondFront.destroy();
yield closeDebuggerClient(client2);
ok((yield PMM_isProfilerActive()),
ok((yield pmmIsProfilerActive()),
"The built-in profiler module should still be active.");
yield firstFront.destroy();
yield closeDebuggerClient(client);
ok(!(yield PMM_isProfilerActive()),
ok(!(yield pmmIsProfilerActive()),
"The built-in profiler module should no longer be active.");
gBrowser.removeCurrentTab();

View File

@ -9,17 +9,17 @@
*/
const { PerformanceFront } = require("devtools/shared/fronts/performance");
const { PMM_isProfilerActive, PMM_startProfiler, PMM_stopProfiler, PMM_loadFrameScripts, PMM_clearFrameScripts } = require("devtools/client/performance/test/helpers/profiler-mm-utils");
const { pmmIsProfilerActive, pmmStartProfiler, pmmStopProfiler, pmmLoadFrameScripts, pmmClearFrameScripts } = require("devtools/client/performance/test/helpers/profiler-mm-utils");
add_task(function* () {
// Ensure the profiler is already running when the test starts.
PMM_loadFrameScripts(gBrowser);
pmmLoadFrameScripts(gBrowser);
let entries = 1000000;
let interval = 1;
let features = ["js"];
yield PMM_startProfiler({ entries, interval, features });
yield pmmStartProfiler({ entries, interval, features });
ok((yield PMM_isProfilerActive()),
ok((yield pmmIsProfilerActive()),
"The built-in profiler module should still be active.");
yield addTab(MAIN_DOMAIN + "doc_perf.html");
@ -39,15 +39,15 @@ add_task(function* () {
yield secondFront.destroy();
yield closeDebuggerClient(client2);
ok((yield PMM_isProfilerActive()),
ok((yield pmmIsProfilerActive()),
"The built-in profiler module should still be active.");
yield firstFront.destroy();
yield closeDebuggerClient(client);
ok(!(yield PMM_isProfilerActive()),
ok(!(yield pmmIsProfilerActive()),
"The built-in profiler module should have been automatically stopped.");
PMM_clearFrameScripts();
pmmClearFrameScripts();
gBrowser.removeCurrentTab();
gBrowser.removeCurrentTab();

View File

@ -10,10 +10,11 @@
<body>
<script type="text/javascript">
window.test = function () {
document.body.innerHTML = "<h1>LOL</h1>";
};
setInterval(window.test, 100);
"use strict";
window.test = function () {
document.body.innerHTML = "<h1>LOL</h1>";
};
setInterval(window.test, 100);
</script>
</body>