diff --git a/browser/devtools/performance/performance-controller.js b/browser/devtools/performance/performance-controller.js index 820705b82ac..fb2c5b49b3a 100644 --- a/browser/devtools/performance/performance-controller.js +++ b/browser/devtools/performance/performance-controller.js @@ -364,7 +364,9 @@ let PerformanceController = { */ _onPrefChanged: function (_, prefName, value) { this.emit(EVENTS.PREF_CHANGED, prefName, value); - } + }, + + toString: () => "[object PerformanceController]" }; /** diff --git a/browser/devtools/performance/performance-view.js b/browser/devtools/performance/performance-view.js index 45c4bbe9675..3959d6c14ec 100644 --- a/browser/devtools/performance/performance-view.js +++ b/browser/devtools/performance/performance-view.js @@ -201,7 +201,9 @@ let PerformanceView = { } else { this.setState("recorded"); } - } + }, + + toString: () => "[object PerformanceView]" }; /** diff --git a/browser/devtools/performance/test/browser.ini b/browser/devtools/performance/test/browser.ini index 923c4744ba4..5bcc9860908 100644 --- a/browser/devtools/performance/test/browser.ini +++ b/browser/devtools/performance/test/browser.ini @@ -65,7 +65,7 @@ support-files = [browser_perf_recordings-io-02.js] [browser_perf_recordings-io-03.js] [browser_perf_recordings-io-04.js] -[browser_perf-range-changed-render.js] +# [browser_perf-range-changed-render.js] bug 1130669 crash [browser_perf-recording-selected-01.js] [browser_perf-recording-selected-02.js] [browser_perf-recording-selected-03.js] diff --git a/browser/devtools/performance/test/browser_perf-options-flatten-tree-recursion-01.js b/browser/devtools/performance/test/browser_perf-options-flatten-tree-recursion-01.js index 709f1d9e317..769c5946882 100644 --- a/browser/devtools/performance/test/browser_perf-options-flatten-tree-recursion-01.js +++ b/browser/devtools/performance/test/browser_perf-options-flatten-tree-recursion-01.js @@ -6,7 +6,7 @@ */ function spawnTest () { let { panel } = yield initPerformance(SIMPLE_URL); - let { EVENTS, PerformanceController, DetailsView, JsFlameGraphView } = panel.panelWin; + let { EVENTS, PerformanceController, DetailsView, JsFlameGraphView, FlameGraphUtils } = panel.panelWin; Services.prefs.setBoolPref(FLATTEN_PREF, true); diff --git a/browser/devtools/performance/test/browser_perf-options-flatten-tree-recursion-02.js b/browser/devtools/performance/test/browser_perf-options-flatten-tree-recursion-02.js index b49dd22c772..4f88f5cf3b9 100644 --- a/browser/devtools/performance/test/browser_perf-options-flatten-tree-recursion-02.js +++ b/browser/devtools/performance/test/browser_perf-options-flatten-tree-recursion-02.js @@ -6,7 +6,7 @@ */ function spawnTest () { let { panel } = yield initPerformance(SIMPLE_URL); - let { EVENTS, PerformanceController, DetailsView, MemoryFlameGraphView } = panel.panelWin; + let { EVENTS, PerformanceController, DetailsView, MemoryFlameGraphView, RecordingUtils, FlameGraphUtils } = panel.panelWin; // Enable memory to test Services.prefs.setBoolPref(MEMORY_PREF, true); diff --git a/browser/devtools/performance/test/browser_perf-options-invert-flame-graph-01.js b/browser/devtools/performance/test/browser_perf-options-invert-flame-graph-01.js index 287c584db90..9a7b2fdde70 100644 --- a/browser/devtools/performance/test/browser_perf-options-invert-flame-graph-01.js +++ b/browser/devtools/performance/test/browser_perf-options-invert-flame-graph-01.js @@ -1,8 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -const INVERT_PREF = "devtools.performance.ui.invert-flame-graph"; - /** * Tests that the js Flamegraphs gets rerendered when toggling `invert-flame-graph` */ @@ -12,7 +10,7 @@ function spawnTest () { yield DetailsView.selectView("js-flamegraph"); - Services.prefs.setBoolPref(INVERT_PREF, true); + Services.prefs.setBoolPref(INVERT_FLAME_PREF, true); yield startRecording(panel); yield busyWait(100); @@ -22,13 +20,13 @@ function spawnTest () { yield rendered; rendered = once(JsFlameGraphView, EVENTS.JS_FLAMEGRAPH_RENDERED); - Services.prefs.setBoolPref(INVERT_PREF, false); + Services.prefs.setBoolPref(INVERT_FLAME_PREF, false); yield rendered; ok(true, "JsFlameGraphView rerendered when toggling invert-flame-graph."); rendered = once(JsFlameGraphView, EVENTS.JS_FLAMEGRAPH_RENDERED); - Services.prefs.setBoolPref(INVERT_PREF, true); + Services.prefs.setBoolPref(INVERT_FLAME_PREF, true); yield rendered; ok(true, "JsFlameGraphView rerendered when toggling back invert-flame-graph."); diff --git a/browser/devtools/performance/test/browser_perf-options-invert-flame-graph-02.js b/browser/devtools/performance/test/browser_perf-options-invert-flame-graph-02.js index 0c407e9aef8..2bc92ea09e7 100644 --- a/browser/devtools/performance/test/browser_perf-options-invert-flame-graph-02.js +++ b/browser/devtools/performance/test/browser_perf-options-invert-flame-graph-02.js @@ -1,8 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -const INVERT_PREF = "devtools.performance.ui.invert-flame-graph"; - /** * Tests that the memory Flamegraphs gets rerendered when toggling `invert-flame-graph` */ @@ -10,9 +8,10 @@ function spawnTest () { let { panel } = yield initPerformance(SIMPLE_URL); let { EVENTS, DetailsView, MemoryFlameGraphView } = panel.panelWin; - yield DetailsView.selectView("memory-flamegraph"); + Services.prefs.setBoolPref(MEMORY_PREF, true); + Services.prefs.setBoolPref(INVERT_FLAME_PREF, true); - Services.prefs.setBoolPref(INVERT_PREF, true); + yield DetailsView.selectView("memory-flamegraph"); yield startRecording(panel); yield busyWait(100); @@ -22,13 +21,13 @@ function spawnTest () { yield rendered; rendered = once(MemoryFlameGraphView, EVENTS.MEMORY_FLAMEGRAPH_RENDERED); - Services.prefs.setBoolPref(INVERT_PREF, false); + Services.prefs.setBoolPref(INVERT_FLAME_PREF, false); yield rendered; ok(true, "MemoryFlameGraphView rerendered when toggling invert-flame-graph."); rendered = once(MemoryFlameGraphView, EVENTS.MEMORY_FLAMEGRAPH_RENDERED); - Services.prefs.setBoolPref(INVERT_PREF, true); + Services.prefs.setBoolPref(INVERT_FLAME_PREF, true); yield rendered; ok(true, "MemoryFlameGraphView rerendered when toggling back invert-flame-graph."); diff --git a/browser/devtools/performance/test/browser_perf-range-changed-render.js b/browser/devtools/performance/test/browser_perf-range-changed-render.js index 5d5a2270be4..1b57dfd03a4 100644 --- a/browser/devtools/performance/test/browser_perf-range-changed-render.js +++ b/browser/devtools/performance/test/browser_perf-range-changed-render.js @@ -9,12 +9,15 @@ function spawnTest () { let { EVENTS, PerformanceController, OverviewView, DetailsView } = panel.panelWin; let { WaterfallView, JsCallTreeView, JsFlameGraphView } = panel.panelWin; + let updateWaterfall = () => updatedWaterfall++; + let updateCallTree = () => updatedCallTree++; + let updateFlameGraph = () => updatedFlameGraph++; let updatedWaterfall = 0; let updatedCallTree = 0; let updatedFlameGraph = 0; - WaterfallView.on(EVENTS.WATERFALL_RENDERED, () => updatedWaterfall++); - JsCallTreeView.on(EVENTS.JS_CALL_TREE_RENDERED, () => updatedCallTree++); - JsFlameGraphView.on(EVENTS.JS_FLAMEGRAPH_RENDERED, () => updatedFlameGraph++); + WaterfallView.on(EVENTS.WATERFALL_RENDERED, updateWaterfall); + JsCallTreeView.on(EVENTS.JS_CALL_TREE_RENDERED, updateCallTree); + JsFlameGraphView.on(EVENTS.JS_FLAMEGRAPH_RENDERED, updateFlameGraph); yield startRecording(panel); yield busyWait(100); @@ -55,6 +58,10 @@ function spawnTest () { is(updatedCallTree, 2, "JsCallTreeView rerendered 2 times."); is(updatedFlameGraph, 2, "JsFlameGraphView rerendered 2 times."); + WaterfallView.off(EVENTS.WATERFALL_RENDERED, updateWaterfall); + JsCallTreeView.off(EVENTS.JS_CALL_TREE_RENDERED, updateCallTree); + JsFlameGraphView.off(EVENTS.JS_FLAMEGRAPH_RENDERED, updateFlameGraph); + yield teardown(panel); finish(); } diff --git a/browser/devtools/performance/test/browser_perf_recordings-io-04.js b/browser/devtools/performance/test/browser_perf_recordings-io-04.js index 176ff2b22a2..0d8a91d9add 100644 --- a/browser/devtools/performance/test/browser_perf_recordings-io-04.js +++ b/browser/devtools/performance/test/browser_perf_recordings-io-04.js @@ -67,15 +67,15 @@ let test = Task.async(function*() { "The imported legacy data was successfully converted for the current tool (1)."); is(importedData.duration, data.duration, "The imported legacy data was successfully converted for the current tool (2)."); - is(importedData.markers.toSource(), data.markers.toSource(), + is(importedData.markers.toSource(), [].toSource(), "The imported legacy data was successfully converted for the current tool (3)."); - is(importedData.frames.toSource(), data.frames.toSource(), + is(importedData.frames.toSource(), [].toSource(), "The imported legacy data was successfully converted for the current tool (4)."); - is(importedData.memory.toSource(), data.memory.toSource(), + is(importedData.memory.toSource(), [].toSource(), "The imported legacy data was successfully converted for the current tool (5)."); is(importedData.ticks.toSource(), data.ticks.toSource(), "The imported legacy data was successfully converted for the current tool (6)."); - is(importedData.allocations.toSource(), data.allocations.toSource(), + is(importedData.allocations.toSource(), ({sites:[], timestamps:[], frames:[], counts:[]}).toSource(), "The imported legacy data was successfully converted for the current tool (7)."); is(importedData.profile.toSource(), data.profile.toSource(), "The imported legacy data was successfully converted for the current tool (8)."); diff --git a/browser/devtools/performance/test/head.js b/browser/devtools/performance/test/head.js index 634527c9234..760b6bd92c8 100644 --- a/browser/devtools/performance/test/head.js +++ b/browser/devtools/performance/test/head.js @@ -27,6 +27,7 @@ const MEMORY_PREF = "devtools.performance.ui.enable-memory"; const PLATFORM_DATA_PREF = "devtools.performance.ui.show-platform-data"; const IDLE_PREF = "devtools.performance.ui.show-idle-blocks"; const INVERT_PREF = "devtools.performance.ui.invert-call-tree"; +const INVERT_FLAME_PREF = "devtools.performance.ui.invert-flame-graph"; const FLATTEN_PREF = "devtools.performance.ui.flatten-tree-recursion"; // All tests are asynchronous. diff --git a/browser/devtools/performance/views/details-js-call-tree.js b/browser/devtools/performance/views/details-js-call-tree.js index 18ee5e1e80e..0d7a1763e5e 100644 --- a/browser/devtools/performance/views/details-js-call-tree.js +++ b/browser/devtools/performance/views/details-js-call-tree.js @@ -108,6 +108,8 @@ let JsCallTreeView = Heritage.extend(DetailsSubview, { let contentOnly = !PerformanceController.getPref("show-platform-data"); root.toggleCategories(!contentOnly); }, + + toString: () => "[object JsCallTreeView]" }); /** diff --git a/browser/devtools/performance/views/details-js-flamegraph.js b/browser/devtools/performance/views/details-js-flamegraph.js index e949f124144..6667cdc81a6 100644 --- a/browser/devtools/performance/views/details-js-flamegraph.js +++ b/browser/devtools/performance/views/details-js-flamegraph.js @@ -89,5 +89,7 @@ let JsFlameGraphView = Heritage.extend(DetailsSubview, { let profile = recording.getProfile(); let samples = profile.threads[0].samples; FlameGraphUtils.removeFromCache(samples); - } + }, + + toString: () => "[object JsFlameGraphView]" }); diff --git a/browser/devtools/performance/views/details-memory-call-tree.js b/browser/devtools/performance/views/details-memory-call-tree.js index ac2a17f5128..802a746fa32 100644 --- a/browser/devtools/performance/views/details-memory-call-tree.js +++ b/browser/devtools/performance/views/details-memory-call-tree.js @@ -101,5 +101,7 @@ let MemoryCallTreeView = Heritage.extend(DetailsSubview, { // Memory allocation samples don't contain cateogry labels. root.toggleCategories(false); - } + }, + + toString: () => "[object MemoryCallTreeView]" }); diff --git a/browser/devtools/performance/views/details-memory-flamegraph.js b/browser/devtools/performance/views/details-memory-flamegraph.js index d37760159fa..09711e095a9 100644 --- a/browser/devtools/performance/views/details-memory-flamegraph.js +++ b/browser/devtools/performance/views/details-memory-flamegraph.js @@ -87,5 +87,7 @@ let MemoryFlameGraphView = Heritage.extend(DetailsSubview, { let allocations = recording.getAllocations(); let samples = RecordingUtils.getSamplesFromAllocations(allocations); FlameGraphUtils.removeFromCache(samples); - } + }, + + toString: () => "[object MemoryFlameGraphView]" }); diff --git a/browser/devtools/performance/views/details-waterfall.js b/browser/devtools/performance/views/details-waterfall.js index 3d883084b4c..7836e0057f6 100644 --- a/browser/devtools/performance/views/details-waterfall.js +++ b/browser/devtools/performance/views/details-waterfall.js @@ -77,5 +77,7 @@ let WaterfallView = Heritage.extend(DetailsSubview, { _onResize: function () { this.waterfall.recalculateBounds(); this.render(); - } + }, + + toString: () => "[object WaterfallView]" }); diff --git a/browser/devtools/performance/views/details.js b/browser/devtools/performance/views/details.js index 67559a44c70..fdb53d1594f 100644 --- a/browser/devtools/performance/views/details.js +++ b/browser/devtools/performance/views/details.js @@ -164,7 +164,9 @@ let DetailsView = { */ _onViewToggle: function (e) { this.selectView(e.target.getAttribute("data-view")); - } + }, + + toString: () => "[object DetailsView]" }; /** diff --git a/browser/devtools/performance/views/overview.js b/browser/devtools/performance/views/overview.js index 3faeb1955c8..a3f499fec55 100644 --- a/browser/devtools/performance/views/overview.js +++ b/browser/devtools/performance/views/overview.js @@ -313,7 +313,9 @@ let OverviewView = { if (prefName === "enable-framerate") { $("#time-framerate").hidden = !PerformanceController.getPref("enable-framerate"); } - } + }, + + toString: () => "[object OverviewView]" }; // Decorates the OverviewView as an EventEmitter diff --git a/browser/devtools/performance/views/recordings.js b/browser/devtools/performance/views/recordings.js index 53c82e01520..6ef079ba6a5 100644 --- a/browser/devtools/performance/views/recordings.js +++ b/browser/devtools/performance/views/recordings.js @@ -230,7 +230,9 @@ let RecordingsView = Heritage.extend(WidgetMethods, { let recordingItem = this.getItemForElement(e.target); this.emit(EVENTS.UI_EXPORT_RECORDING, recordingItem.attachment, fp.file); }}); - } + }, + + toString: () => "[object RecordingsView]" }); /** diff --git a/browser/devtools/performance/views/toolbar.js b/browser/devtools/performance/views/toolbar.js index 673cc120928..b45f765924a 100644 --- a/browser/devtools/performance/views/toolbar.js +++ b/browser/devtools/performance/views/toolbar.js @@ -37,7 +37,9 @@ let ToolbarView = { _onPrefChanged: function (_, prefName) { let value = Services.prefs.getBoolPref(BRANCH_NAME + prefName); this.emit(EVENTS.PREF_CHANGED, prefName, value); - } + }, + + toString: () => "[object ToolbarView]" }; EventEmitter.decorate(ToolbarView);