From 4c4f2bf1a37b242acdd9c601bf7598aeb44dd2d1 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Thu, 11 Oct 2018 15:13:47 -0700 Subject: [PATCH] Bug 1494195 - Back out bug 1491946, using '.fxsnapshot.gz' for memory heap snapshots. r=fitzgen --- devtools/client/locales/en-US/memory.properties | 2 +- devtools/client/memory/actions/io.js | 6 ++---- devtools/client/memory/test/unit/head.js | 2 +- devtools/client/memory/utils.js | 5 ++--- devtools/shared/heapsnapshot/HeapSnapshot.cpp | 4 ++-- devtools/shared/heapsnapshot/HeapSnapshot.h | 2 +- devtools/shared/heapsnapshot/HeapSnapshotFileUtils.js | 8 ++++---- dom/chrome-webidl/ChromeUtils.webidl | 4 ++-- 8 files changed, 15 insertions(+), 18 deletions(-) diff --git a/devtools/client/locales/en-US/memory.properties b/devtools/client/locales/en-US/memory.properties index abb00f23e62e..5dcc77375466 100644 --- a/devtools/client/locales/en-US/memory.properties +++ b/devtools/client/locales/en-US/memory.properties @@ -27,7 +27,7 @@ snapshot.io.save.window=Save Snapshot snapshot.io.import.window=Import Snapshot # LOCALIZATION NOTE (snapshot.io.filter): The title for the filter used to -# filter file types (*.fxsnapshot.gz) +# filter file types (*.fxsnapshot) snapshot.io.filter=Firefox Snapshots # LOCALIZATION NOTE (aggregate.mb): The label annotating the number of bytes (in diff --git a/devtools/client/memory/actions/io.js b/devtools/client/memory/actions/io.js index 2b3e77daf279..eca5b0bc5915 100644 --- a/devtools/client/memory/actions/io.js +++ b/devtools/client/memory/actions/io.js @@ -19,8 +19,7 @@ exports.pickFileAndExportSnapshot = function(snapshot) { const outputFile = await openFilePicker({ title: L10N.getFormatStr("snapshot.io.save.window"), defaultName: OS.Path.basename(snapshot.path), - filters: [[L10N.getFormatStr("snapshot.io.filter"), - "*.fxsnapshot; *.fxsnapshot.gz"]], + filters: [[L10N.getFormatStr("snapshot.io.filter"), "*.fxsnapshot"]], mode: "save", }); @@ -54,8 +53,7 @@ exports.pickFileAndImportSnapshotAndCensus = function(heapWorker) { return async function(dispatch, getState) { const input = await openFilePicker({ title: L10N.getFormatStr("snapshot.io.import.window"), - filters: [[L10N.getFormatStr("snapshot.io.filter"), - "*.fxsnapshot; *.fxsnapshot.gz"]], + filters: [[L10N.getFormatStr("snapshot.io.filter"), "*.fxsnapshot"]], mode: "open", }); diff --git a/devtools/client/memory/test/unit/head.js b/devtools/client/memory/test/unit/head.js index c5d03532d267..b14064f0e6e9 100644 --- a/devtools/client/memory/test/unit/head.js +++ b/devtools/client/memory/test/unit/head.js @@ -126,7 +126,7 @@ function waitUntilCensusState(store, getCensus, expected) { } async function createTempFile() { - const file = FileUtils.getFile("TmpD", ["tmp.fxsnapshot.gz"]); + const file = FileUtils.getFile("TmpD", ["tmp.fxsnapshot"]); file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); const destPath = file.path; const stat = await OS.File.stat(destPath); diff --git a/devtools/client/memory/utils.js b/devtools/client/memory/utils.js index 07bb810bba3f..d0135fb6b878 100644 --- a/devtools/client/memory/utils.js +++ b/devtools/client/memory/utils.js @@ -42,9 +42,8 @@ exports.getSnapshotTitle = function(snapshot) { } if (snapshot.imported) { - // Strip out the extension if it's the expected ".fxsnapshot.gz" - // (".gz" optional) - return OS.Path.basename(snapshot.path.replace(/\.fxsnapshot(?:\.gz)?$/, "")); + // Strip out the extension if it's the expected ".fxsnapshot" + return OS.Path.basename(snapshot.path.replace(/\.fxsnapshot$/, "")); } const date = new Date(snapshot.creationTime / 1000); diff --git a/devtools/shared/heapsnapshot/HeapSnapshot.cpp b/devtools/shared/heapsnapshot/HeapSnapshot.cpp index 11d25daa1533..157d67dd5196 100644 --- a/devtools/shared/heapsnapshot/HeapSnapshot.cpp +++ b/devtools/shared/heapsnapshot/HeapSnapshot.cpp @@ -1449,7 +1449,7 @@ HeapSnapshot::CreateUniqueCoreDumpFile(ErrorResult& rv, return nullptr; auto ms = msSinceProcessCreation(now); - rv = file->AppendNative(nsPrintfCString("%lu.fxsnapshot.gz", ms)); + rv = file->AppendNative(nsPrintfCString("%lu.fxsnapshot", ms)); if (NS_WARN_IF(rv.Failed())) return nullptr; @@ -1464,7 +1464,7 @@ HeapSnapshot::CreateUniqueCoreDumpFile(ErrorResult& rv, // The snapshot ID must be computed in the process that created the // temp file, because TmpD may not be the same in all processes. outSnapshotId.Assign(Substring(outFilePath, tempPath.Length() + 1, - outFilePath.Length() - tempPath.Length() - sizeof(".fxsnapshot.gz"))); + outFilePath.Length() - tempPath.Length() - sizeof(".fxsnapshot"))); return file.forget(); } diff --git a/devtools/shared/heapsnapshot/HeapSnapshot.h b/devtools/shared/heapsnapshot/HeapSnapshot.h index 9b330a243a6d..d045bfdfdf8b 100644 --- a/devtools/shared/heapsnapshot/HeapSnapshot.h +++ b/devtools/shared/heapsnapshot/HeapSnapshot.h @@ -116,7 +116,7 @@ public: uint32_t size, ErrorResult& rv); - // Creates the `$TEMP_DIR/XXXXXX-XXX.fxsnapshot.gz` core dump file that heap + // Creates the `$TEMP_DIR/XXXXXX-XXX.fxsnapshot` core dump file that heap // snapshots are serialized into. static already_AddRefed CreateUniqueCoreDumpFile(ErrorResult& rv, const TimeStamp& now, diff --git a/devtools/shared/heapsnapshot/HeapSnapshotFileUtils.js b/devtools/shared/heapsnapshot/HeapSnapshotFileUtils.js index 313714fece70..a30c3fdd8f0d 100644 --- a/devtools/shared/heapsnapshot/HeapSnapshotFileUtils.js +++ b/devtools/shared/heapsnapshot/HeapSnapshotFileUtils.js @@ -15,8 +15,8 @@ // // The heap snapshot file path conventions permits the following forms: // -// $TEMP_DIRECTORY/XXXXXXXXXX.fxsnapshot.gz -// $TEMP_DIRECTORY/XXXXXXXXXX-XXXXX.fxsnapshot.gz +// $TEMP_DIRECTORY/XXXXXXXXXX.fxsnapshot +// $TEMP_DIRECTORY/XXXXXXXXXX-XXXXX.fxsnapshot // // Where the strings of "X" are zero or more digits. @@ -28,7 +28,7 @@ loader.lazyRequireGetter(this, "FileUtils", loader.lazyRequireGetter(this, "OS", "resource://gre/modules/osfile.jsm", true); function getHeapSnapshotFileTemplate() { - return OS.Path.join(OS.Constants.Path.tmpDir, `${Date.now()}.fxsnapshot.gz`); + return OS.Path.join(OS.Constants.Path.tmpDir, `${Date.now()}.fxsnapshot`); } /** @@ -63,7 +63,7 @@ exports.getHeapSnapshotTempFilePath = function(snapshotId) { if (!isValidSnapshotFileId(snapshotId)) { return null; } - return OS.Path.join(OS.Constants.Path.tmpDir, snapshotId + ".fxsnapshot.gz"); + return OS.Path.join(OS.Constants.Path.tmpDir, snapshotId + ".fxsnapshot"); }; /** diff --git a/dom/chrome-webidl/ChromeUtils.webidl b/dom/chrome-webidl/ChromeUtils.webidl index 70580df76d83..20c3076478c8 100644 --- a/dom/chrome-webidl/ChromeUtils.webidl +++ b/dom/chrome-webidl/ChromeUtils.webidl @@ -36,7 +36,7 @@ namespace ChromeUtils { * @returns The path to the file the heap snapshot was written * to. This is guaranteed to be within the temp * directory and its file name will match the regexp - * `\d+(\-\d+)?\.fxsnapshot.gz`. + * `\d+(\-\d+)?\.fxsnapshot`. */ [Throws] DOMString saveHeapSnapshot(optional HeapSnapshotBoundaries boundaries); @@ -46,7 +46,7 @@ namespace ChromeUtils { * * @returns The snapshot ID of the file. This is the file name * without the temp directory or the trailing - * `.fxsnapshot.gz`. + * `.fxsnapshot`. */ [Throws] DOMString saveHeapSnapshotGetId(optional HeapSnapshotBoundaries boundaries);