From f65583d27c4543f86b640a0866e5d329dbdc4aba Mon Sep 17 00:00:00 2001 From: Wilhem Barbier Date: Thu, 13 Aug 2015 08:52:57 -0700 Subject: [PATCH] Bug 1161698 - Set the label as the filename when importing a performance recording r=jsantell --HG-- extra : rebase_source : d91e37b61d7ee21039dc74bf3dd2491478d938aa --- .../test/browser_perf_recordings-io-01.js | 20 +++++++++---------- toolkit/devtools/performance/io.js | 4 ++++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/browser/devtools/performance/test/browser_perf_recordings-io-01.js b/browser/devtools/performance/test/browser_perf_recordings-io-01.js index 2faa1a7f01c5..9a8f8d2c331f 100644 --- a/browser/devtools/performance/test/browser_perf_recordings-io-01.js +++ b/browser/devtools/performance/test/browser_perf_recordings-io-01.js @@ -61,24 +61,24 @@ let test = Task.async(function*() { let importedData = PerformanceController.getCurrentRecording().getAllData(); - is(importedData.label, originalData.label, - "The imported data is identical to the original data (1)."); + is(importedData.label, "tmpprofile", + "The label is identical to the filename without its extension."); is(importedData.duration, originalData.duration, - "The imported data is identical to the original data (2)."); + "The imported data is identical to the original data (1)."); is(importedData.markers.toSource(), originalData.markers.toSource(), - "The imported data is identical to the original data (3)."); + "The imported data is identical to the original data (2)."); is(importedData.memory.toSource(), originalData.memory.toSource(), - "The imported data is identical to the original data (4)."); + "The imported data is identical to the original data (3)."); is(importedData.ticks.toSource(), originalData.ticks.toSource(), - "The imported data is identical to the original data (5)."); + "The imported data is identical to the original data (4)."); is(importedData.allocations.toSource(), originalData.allocations.toSource(), - "The imported data is identical to the original data (6)."); + "The imported data is identical to the original data (5)."); is(importedData.profile.toSource(), originalData.profile.toSource(), - "The imported data is identical to the original data (7)."); + "The imported data is identical to the original data (6)."); is(importedData.configuration.withTicks, originalData.configuration.withTicks, - "The imported data is identical to the original data (8)."); + "The imported data is identical to the original data (7)."); is(importedData.configuration.withMemory, originalData.configuration.withMemory, - "The imported data is identical to the original data (9)."); + "The imported data is identical to the original data (8)."); yield teardown(panel); finish(); diff --git a/toolkit/devtools/performance/io.js b/toolkit/devtools/performance/io.js index 32dd2e5d48e8..ab30a8bf802f 100644 --- a/toolkit/devtools/performance/io.js +++ b/toolkit/devtools/performance/io.js @@ -104,6 +104,10 @@ function loadRecordingFromFile (file) { if (recordingData.profile.meta.version === 2) { RecordingUtils.deflateProfile(recordingData.profile); } + if(!recordingData.label) { + // set it to the filename without its extension + recordingData.label = file.leafName.replace(/\..+$/, ''); + } deferred.resolve(recordingData); });