diff --git a/browser/devtools/performance/modules/logic/recording-model.js b/browser/devtools/performance/modules/logic/recording-model.js index 5fd125b388e..3d829fca2cb 100644 --- a/browser/devtools/performance/modules/logic/recording-model.js +++ b/browser/devtools/performance/modules/logic/recording-model.js @@ -371,9 +371,8 @@ RecordingModel.prototype = { case "allocations": { if (!config.withAllocations) { break; } let [{ sites, timestamps, frames, counts }] = data; - let timeOffset = this._memoryStartTime * 1000; - let timeScale = 1000; - RecordingUtils.offsetAndScaleTimestamps(timestamps, timeOffset, timeScale); + let timeOffset = this._memoryStartTime; + RecordingUtils.offsetAndScaleTimestamps(timestamps, timeOffset); pushAll(this._allocations.sites, sites); pushAll(this._allocations.timestamps, timestamps); pushAll(this._allocations.frames, frames); diff --git a/browser/devtools/performance/modules/logic/recording-utils.js b/browser/devtools/performance/modules/logic/recording-utils.js index f74007ced37..5d033e5cc2e 100644 --- a/browser/devtools/performance/modules/logic/recording-utils.js +++ b/browser/devtools/performance/modules/logic/recording-utils.js @@ -106,7 +106,9 @@ function offsetMarkerTimes(markers, timeOffset) { function offsetAndScaleTimestamps(timestamps, timeOffset, timeScale) { for (let i = 0, len = timestamps.length; i < len; i++) { timestamps[i] -= timeOffset; - timestamps[i] /= timeScale; + if (timeScale) { + timestamps[i] /= timeScale; + } } } diff --git a/browser/devtools/performance/test/browser.ini b/browser/devtools/performance/test/browser.ini index 13e157fa8f2..119e62e3aea 100644 --- a/browser/devtools/performance/test/browser.ini +++ b/browser/devtools/performance/test/browser.ini @@ -2,6 +2,7 @@ tags = devtools subsuite = devtools support-files = + doc_allocs.html doc_force_cc.html doc_force_gc.html doc_innerHTML.html diff --git a/browser/devtools/performance/test/browser_perf-details-memory-calltree-render.js b/browser/devtools/performance/test/browser_perf-details-memory-calltree-render.js index be67422352c..db486aedbb7 100644 --- a/browser/devtools/performance/test/browser_perf-details-memory-calltree-render.js +++ b/browser/devtools/performance/test/browser_perf-details-memory-calltree-render.js @@ -5,14 +5,14 @@ * Tests that the memory call tree view renders content after recording. */ function* spawnTest() { - let { panel } = yield initPerformance(SIMPLE_URL); - let { EVENTS, DetailsView, MemoryCallTreeView } = panel.panelWin; + let { panel } = yield initPerformance(ALLOCS_URL); + let { EVENTS, $$, PerformanceController, DetailsView, MemoryCallTreeView } = panel.panelWin; // Enable memory to test. Services.prefs.setBoolPref(ALLOCATIONS_PREF, true); yield startRecording(panel); - yield busyWait(100); + yield waitUntil(() => PerformanceController.getCurrentRecording().getAllocations().timestamps.length); yield stopRecording(panel); let rendered = once(MemoryCallTreeView, EVENTS.MEMORY_CALL_TREE_RENDERED); @@ -22,6 +22,8 @@ function* spawnTest() { ok(true, "MemoryCallTreeView rendered after recording is stopped."); + ok($$("#memory-calltree-view .call-tree-item").length, "there are several allocations rendered."); + yield startRecording(panel); yield busyWait(100); diff --git a/browser/devtools/performance/test/doc_allocs.html b/browser/devtools/performance/test/doc_allocs.html new file mode 100644 index 00000000000..fced65094b2 --- /dev/null +++ b/browser/devtools/performance/test/doc_allocs.html @@ -0,0 +1,25 @@ + + + + +
+ +