Bug 1494195 - Back out bug 1491946, using '.fxsnapshot.gz' for memory heap snapshots. r=fitzgen
authorJim Blandy <jimb@mozilla.com>
Thu, 11 Oct 2018 15:13:47 -0700
changeset 489530 7f35ad97d197adc2af2ecda9d8749f8df7cb2b1f
parent 489529 6e0139775220f26e08be6494978e64617f4220d2
child 489550 1f2c8a6231564cbc7db6d7e9e21433007f508804
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersfitzgen
bugs1494195, 1491946
milestone64.0a1
Bug 1494195 - Back out bug 1491946, using '.fxsnapshot.gz' for memory heap snapshots. r=fitzgen
devtools/client/locales/en-US/memory.properties
devtools/client/memory/actions/io.js
devtools/client/memory/test/unit/head.js
devtools/client/memory/utils.js
devtools/shared/heapsnapshot/HeapSnapshot.cpp
devtools/shared/heapsnapshot/HeapSnapshot.h
devtools/shared/heapsnapshot/HeapSnapshotFileUtils.js
dom/chrome-webidl/ChromeUtils.webidl
--- a/devtools/client/locales/en-US/memory.properties
+++ b/devtools/client/locales/en-US/memory.properties
@@ -22,17 +22,17 @@ snapshot.io.delete=Delete
 # displayed when saving a snapshot to disk.
 snapshot.io.save.window=Save Snapshot
 
 # LOCALIZATION NOTE (snapshot.io.import.window): The title for the window
 # displayed when importing a snapshot form disk.
 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
 # megabytes) in a snapshot. %S represents the value, rounded to 2 decimal
 # points.
 aggregate.mb=%S MB
 
 # LOCALIZATION NOTE (snapshot-title.loading): The title for a snapshot before
--- a/devtools/client/memory/actions/io.js
+++ b/devtools/client/memory/actions/io.js
@@ -14,18 +14,17 @@ const {
 } = require("./snapshot");
 const VALID_EXPORT_STATES = [states.SAVED, states.READ];
 
 exports.pickFileAndExportSnapshot = function(snapshot) {
   return async function(dispatch, getState) {
     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",
     });
 
     if (!outputFile) {
       return;
     }
 
     await dispatch(exportSnapshot(snapshot, outputFile.path));
@@ -49,18 +48,17 @@ const exportSnapshot = exports.exportSna
     dispatch({ type: actions.EXPORT_SNAPSHOT_END, snapshot });
   };
 };
 
 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",
     });
 
     if (!input) {
       return;
     }
 
     await dispatch(importSnapshotAndCensus(heapWorker, input.path));
--- a/devtools/client/memory/test/unit/head.js
+++ b/devtools/client/memory/test/unit/head.js
@@ -121,15 +121,15 @@ function waitUntilCensusState(store, get
                     (census && census.state === state);
            });
   };
   info(`Waiting for snapshots' censuses to be of state: ${expected}`);
   return waitUntilState(store, predicate);
 }
 
 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);
   ok(stat.size === 0, "new file is 0 bytes at start");
   return destPath;
 }
--- a/devtools/client/memory/utils.js
+++ b/devtools/client/memory/utils.js
@@ -37,19 +37,18 @@ const {
  * @return {String}
  */
 exports.getSnapshotTitle = function(snapshot) {
   if (!snapshot.creationTime) {
     return L10N.getStr("snapshot-title.loading");
   }
 
   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);
   return date.toLocaleTimeString(void 0, {
     year: "2-digit",
     month: "2-digit",
     day: "2-digit",
     hour12: false
--- a/devtools/shared/heapsnapshot/HeapSnapshot.cpp
+++ b/devtools/shared/heapsnapshot/HeapSnapshot.cpp
@@ -1444,32 +1444,32 @@ HeapSnapshot::CreateUniqueCoreDumpFile(E
     return nullptr;
 
   nsAutoString tempPath;
   rv = file->GetPath(tempPath);
   if (NS_WARN_IF(rv.Failed()))
     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;
 
   rv = file->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0666);
   if (NS_WARN_IF(rv.Failed()))
     return nullptr;
 
   rv = file->GetPath(outFilePath);
   if (NS_WARN_IF(rv.Failed()))
       return nullptr;
 
   // 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();
 }
 
 // Deletion policy for cleaning up PHeapSnapshotTempFileHelperChild pointers.
 class DeleteHeapSnapshotTempFileHelperChild
 {
 public:
--- a/devtools/shared/heapsnapshot/HeapSnapshot.h
+++ b/devtools/shared/heapsnapshot/HeapSnapshot.h
@@ -111,17 +111,17 @@ public:
   // core dump. Do NOT take ownership of the buffer, only borrow it for the
   // duration of the call.
   static already_AddRefed<HeapSnapshot> Create(JSContext* cx,
                                                dom::GlobalObject& global,
                                                const uint8_t* buffer,
                                                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<nsIFile> CreateUniqueCoreDumpFile(ErrorResult& rv,
                                                             const TimeStamp& now,
                                                             nsAString& outFilePath,
                                                             nsAString& outSnapshotId);
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(HeapSnapshot)
--- a/devtools/shared/heapsnapshot/HeapSnapshotFileUtils.js
+++ b/devtools/shared/heapsnapshot/HeapSnapshotFileUtils.js
@@ -10,30 +10,30 @@
 // attempting to open heap snapshot files and not `~/.ssh/id_rsa`, for
 // example. Therefore, the RDP only talks about snapshot ids, or transfering the
 // bulk file data. A file path can be recovered from a snapshot id, which allows
 // one to check for the presence of the heap snapshot file on the local file
 // system, but we don't have to worry about opening arbitrary files.
 //
 // 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.
 
 "use strict";
 
 const { Ci } = require("chrome");
 loader.lazyRequireGetter(this, "FileUtils",
                          "resource://gre/modules/FileUtils.jsm", true);
 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`);
 }
 
 /**
  * Get a unique temp file path for a new heap snapshot. The file is guaranteed
  * not to exist before this call.
  *
  * @returns String
  */
@@ -58,17 +58,17 @@ function isValidSnapshotFileId(snapshotI
  * @returns String | null
  */
 exports.getHeapSnapshotTempFilePath = function(snapshotId) {
   // Don't want anyone sneaking "../../../.." strings into the snapshot id and
   // trying to make us open arbitrary files.
   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");
 };
 
 /**
  * Return true if we have the heap snapshot file for the given snapshot id on
  * the local file system. False is returned otherwise.
  *
  * @returns Promise<Boolean>
  */
--- a/dom/chrome-webidl/ChromeUtils.webidl
+++ b/dom/chrome-webidl/ChromeUtils.webidl
@@ -31,27 +31,27 @@ namespace ChromeUtils {
    * Serialize a snapshot of the heap graph, as seen by |JS::ubi::Node| and
    * restricted by |boundaries|, and write it to the provided file path.
    *
    * @param boundaries        The portion of the heap graph to write.
    *
    * @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);
 
   /**
    * This is the same as saveHeapSnapshot, but with a different return value.
    *
    * @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);
 
   /**
    * Deserialize a core dump into a HeapSnapshot.
    *
    * @param filePath          The file path to read the heap snapshot from.