Back out ea871fc76f16 (bug 903131) for test_aboutmemory6.xul crashes
authorPhil Ringnalda <philringnalda@gmail.com>
Sat, 01 Feb 2014 01:43:38 -0800
changeset 182524 5eb195ad921a1ade734e0cda8f8779d5293f22c3
parent 182523 4fe634bea8def966c6830481fe40dbac4ba3f57c
child 182525 02302b3cdd847b428fdce428e2dbce3ae56b75b1
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs903131
milestone29.0a1
backs outea871fc76f16020ffb56a9a984be33df13f82142
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Back out ea871fc76f16 (bug 903131) for test_aboutmemory6.xul crashes
dom/ipc/ContentChild.cpp
toolkit/components/aboutmemory/content/aboutMemory.js
toolkit/components/aboutmemory/tests/chrome.ini
toolkit/components/aboutmemory/tests/test_aboutmemory6.xul
xpcom/base/nsCycleCollector.cpp
xpcom/base/nsICycleCollectorListener.idl
xpcom/base/nsIMemoryInfoDumper.idl
xpcom/base/nsMemoryInfoDumper.cpp
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -549,19 +549,18 @@ ContentChild::RecvDumpMemoryInfoToTempDi
 
 bool
 ContentChild::RecvDumpGCAndCCLogsToFile(const nsString& aIdentifier,
                                         const bool& aDumpAllTraces,
                                         const bool& aDumpChildProcesses)
 {
     nsCOMPtr<nsIMemoryInfoDumper> dumper = do_GetService("@mozilla.org/memory-info-dumper;1");
 
-    nsString gcLogPath, ccLogPath;
     dumper->DumpGCAndCCLogsToFile(aIdentifier, aDumpAllTraces,
-                                  aDumpChildProcesses, gcLogPath, ccLogPath);
+                                  aDumpChildProcesses);
     return true;
 }
 
 PCompositorChild*
 ContentChild::AllocPCompositorChild(mozilla::ipc::Transport* aTransport,
                                     base::ProcessId aOtherProcess)
 {
     return CompositorChild::Create(aTransport, aOtherProcess);
--- a/toolkit/components/aboutmemory/content/aboutMemory.js
+++ b/toolkit/components/aboutmemory/content/aboutMemory.js
@@ -278,23 +278,16 @@ function onLoad()
   const GCDesc = "Do a global garbage collection.";
   const CCDesc = "Do a cycle collection.";
   const MMDesc = "Send three \"heap-minimize\" notifications in a " +
                  "row.  Each notification triggers a global garbage " +
                  "collection followed by a cycle collection, and causes the " +
                  "process to reduce memory usage in other ways, e.g. by " +
                  "flushing various caches.";
 
-  const GCAndCCLogDesc = "Save garbage collection log and concise cycle " +
-                         "collection log.\n" +
-                         "WARNING: These logs may be large (>1GB).";
-  const GCAndCCAllLogDesc = "Save garbage collection log and verbose cycle " +
-                            "collection log.\n" +
-                            "WARNING: These logs may be large (>1GB).";
-
   let ops = appendElement(header, "div", "");
 
   let row1 = appendElement(ops, "div", "opsRow");
 
   let labelDiv =
    appendElementWithText(row1, "div", "opsRowLabel", "Show memory reports");
   let label = appendElementWithText(labelDiv, "label", "");
   gVerbose = appendElement(label, "input", "");
@@ -320,29 +313,20 @@ function onLoad()
 
   let row3 = appendElement(ops, "div", "opsRow");
 
   appendElementWithText(row3, "div", "opsRowLabel", "Free memory");
   appendButton(row3, GCDesc, doGC,  "GC");
   appendButton(row3, CCDesc, doCC,  "CC");
   appendButton(row3, MMDesc, doMMU, "Minimize memory usage");
 
-  let row4 = appendElement(ops, "div", "opsRow");
-
-  appendElementWithText(row4, "div", "opsRowLabel", "Save GC & CC logs");
-  appendButton(row4, GCAndCCLogDesc,
-               saveGCLogAndConciseCCLog, "Save concise", 'saveLogsConcise');
-  appendButton(row4, GCAndCCAllLogDesc,
-               saveGCLogAndVerboseCCLog, "Save verbose", 'saveLogsVerbose');
-
   // Generate the main div, where content ("section" divs) will go.  It's
   // hidden at first.
 
   gMain = appendElement(document.body, 'div', '');
-  gMain.id = 'mainDiv';
 
   // Generate the footer.  It's hidden at first.
 
   gFooter = appendElement(document.body, 'div', 'ancillary hidden');
 
   let a = appendElementWithText(gFooter, "a", "option",
                                 "Troubleshooting information");
   a.href = "about:support";
@@ -396,49 +380,16 @@ function doMMU()
     () => updateMainAndFooter("Memory minimization completed", HIDE_FOOTER));
 }
 
 function doMeasure()
 {
   updateAboutMemoryFromReporters();
 }
 
-function saveGCLogAndConciseCCLog()
-{
-  dumpGCLogAndCCLog(false);
-}
-
-function saveGCLogAndVerboseCCLog()
-{
-  dumpGCLogAndCCLog(true);
-}
-
-function dumpGCLogAndCCLog(aVerbose)
-{
-  let gcLogPath = {};
-  let ccLogPath = {};
-
-  let dumper = Cc["@mozilla.org/memory-info-dumper;1"]
-                .getService(Ci.nsIMemoryInfoDumper);
-
-  updateMainAndFooter("Saving logs...", HIDE_FOOTER);
-
-  dumper.dumpGCAndCCLogsToFile("", aVerbose, /* dumpChildProcesses = */ false,
-                               gcLogPath, ccLogPath);
-
-  updateMainAndFooter("", HIDE_FOOTER);
-  let section = appendElement(gMain, 'div', "section");
-  appendElementWithText(section, 'div', "",
-                        "Saved GC log to " + gcLogPath.value);
-
-  let ccLogType = aVerbose ? "verbose" : "concise";
-  appendElementWithText(section, 'div', "",
-                        "Saved " + ccLogType + " CC log to " + ccLogPath.value);
-}
-
 /**
  * Top-level function that does the work of generating the page from the memory
  * reporters.
  */
 function updateAboutMemoryFromReporters()
 {
   updateMainAndFooter("Measuring...", HIDE_FOOTER);
 
--- a/toolkit/components/aboutmemory/tests/chrome.ini
+++ b/toolkit/components/aboutmemory/tests/chrome.ini
@@ -6,12 +6,11 @@ support-files =
   memory-reports-good.json
   remote.xul
 
 [test_aboutmemory.xul]
 [test_aboutmemory2.xul]
 [test_aboutmemory3.xul]
 [test_aboutmemory4.xul]
 [test_aboutmemory5.xul]
-[test_aboutmemory6.xul]
 [test_memoryReporters.xul]
 [test_memoryReporters2.xul]
 [test_sqliteMultiReporter.xul]
deleted file mode 100644
--- a/toolkit/components/aboutmemory/tests/test_aboutmemory6.xul
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
-<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
-<window title="about:memory"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
-  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
-
-  <!-- This file tests the saving of GC and CC logs in both concise and
-       verbose formats. -->
-
-  <!-- test results are displayed in the html:body -->
-  <body xmlns="http://www.w3.org/1999/xhtml"></body>
-
-  <iframe id="amFrame"  height="400" src="about:memory"></iframe>
-
-  <script type="application/javascript">
-  <![CDATA[
-  "use strict";
-
-  const Cc = Components.classes;
-  const Ci = Components.interfaces;
-
-  function onFocus() {
-    let frame = document.getElementById("amFrame");
-    frame.focus();
-
-    // Checks that a file exists on the local file system and removes it if it
-    // is present.
-    function checkForFileAndRemove(aFilename) {
-      let localFile = Cc["@mozilla.org/file/local;1"]
-                        .createInstance(Ci.nsILocalFile);
-      localFile.initWithPath(aFilename);
-
-      let exists = localFile.exists();
-      if (exists) {
-        localFile.remove(/* recursive = */ false);
-      }
-
-      return exists;
-    }
-
-    // Given a save log button, triggers the action and checks if both CC & GC
-    // logs were written to disk.
-    function saveLogs(aLogButton, aCCLogType)
-    {
-      // trigger the log saving
-      aLogButton.click();
-
-      // mainDiv
-      // |-> section
-      //        | -> div gc log path
-      //        | -> div cc log path
-      let mainDiv = frame.contentWindow.document.getElementById("mainDiv");
-      let logNodes = mainDiv.childNodes[0];
-
-      // we expect 2 logs listed
-      let numOfLogs = logNodes.childNodes.length;
-      ok(numOfLogs == 2, "two log entries generated")
-
-      // grab the path portion of the text
-      let gcLogPath = logNodes.childNodes[0].textContent
-                        .replace("Saved GC log to ", "");
-      let ccLogPath = logNodes.childNodes[1].textContent
-                        .replace("Saved " + aCCLogType + " CC log to ", "");
-
-      // check that the files actually exist
-      ok(checkForFileAndRemove(gcLogPath), "GC log file exists");
-      ok(checkForFileAndRemove(ccLogPath), "CC log file exists");
-    }
-
-    // get the log buttons to test
-    let saveConcise = frame.contentWindow.document
-                        .getElementById("saveLogsConcise");
-    let saveVerbose = frame.contentWindow.document
-                        .getElementById("saveLogsVerbose");
-
-    saveLogs(saveConcise, "concise");
-    saveLogs(saveVerbose, "verbose");
-
-    SimpleTest.finish();
-  }
-
-  SimpleTest.waitForFocus(onFocus);
-  SimpleTest.waitForExplicitFinish();
-  ]]>
-  </script>
-</window>
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -1402,28 +1402,16 @@ public:
     }
 
     NS_IMETHOD SetFilenameIdentifier(const nsAString& aIdentifier)
     {
         mFilenameIdentifier = aIdentifier;
         return NS_OK;
     }
 
-    NS_IMETHOD GetGcLogPath(nsAString &aPath)
-    {
-      aPath = mGCLogPath;
-      return NS_OK;
-    }
-
-    NS_IMETHOD GetCcLogPath(nsAString &aPath)
-    {
-      aPath = mCCLogPath;
-      return NS_OK;
-    }
-
     NS_IMETHOD Begin()
     {
         mCurrentAddress.AssignLiteral("0x");
         ClearDescribers();
         if (mDisableLog) {
             return NS_OK;
         }
 
@@ -1466,18 +1454,16 @@ public:
             do_GetService(NS_CONSOLESERVICE_CONTRACTID);
         if (cs) {
             nsAutoString gcLogPath;
             gcLogFileFinalDestination->GetPath(gcLogPath);
 
             nsString msg = NS_LITERAL_STRING("Garbage Collector log dumped to ") +
                            gcLogPath;
             cs->LogStringMessage(msg.get());
-
-            mGCLogPath = gcLogPath;
         }
 
         // Open a file for dumping the CC graph.  We again prefix with
         // "incomplete-".
         mOutFile = CreateTempFile("incomplete-cc-edges");
         if (NS_WARN_IF(!mOutFile))
             return NS_ERROR_UNEXPECTED;
         MOZ_ASSERT(!mStream);
@@ -1625,18 +1611,16 @@ public:
                 do_GetService(NS_CONSOLESERVICE_CONTRACTID);
             if (cs) {
                 nsAutoString ccLogPath;
                 logFileFinalDestination->GetPath(ccLogPath);
 
                 nsString msg = NS_LITERAL_STRING("Cycle Collector log dumped to ") +
                                ccLogPath;
                 cs->LogStringMessage(msg.get());
-
-                mCCLogPath = ccLogPath;
             }
         }
         return NS_OK;
     }
     NS_IMETHOD ProcessNext(nsICycleCollectorHandler* aHandler,
                            bool* aCanContinue)
     {
         if (NS_WARN_IF(!aHandler) || NS_WARN_IF(!mWantAfterProcessing))
@@ -1724,18 +1708,16 @@ private:
     }
 
     FILE *mStream;
     nsCOMPtr<nsIFile> mOutFile;
     bool mWantAllTraces;
     bool mDisableLog;
     bool mWantAfterProcessing;
     nsString mFilenameIdentifier;
-    nsString mGCLogPath;
-    nsString mCCLogPath;
     nsCString mCurrentAddress;
     mozilla::LinkedList<CCGraphDescriber> mDescribers;
 };
 
 NS_IMPL_ISUPPORTS1(nsCycleCollectorLogger, nsICycleCollectorListener)
 
 nsresult
 nsCycleCollectorLoggerConstructor(nsISupports* aOuter,
--- a/xpcom/base/nsICycleCollectorListener.idl
+++ b/xpcom/base/nsICycleCollectorListener.idl
@@ -45,22 +45,16 @@ interface nsICycleCollectorListener : ns
     // The default implementation of this interface will print out
     // a log to a file unless disableLog is set to true.
     attribute boolean disableLog;
     attribute boolean wantAfterProcessing;
 
     // This string will appear somewhere in the log's filename.
     attribute AString filenameIdentifier;
 
-    // This string will indicate the full path of the GC log if enabled.
-    readonly attribute AString gcLogPath;
-
-    // This string will indicate the full path of the CC log if enabled.
-    readonly attribute AString ccLogPath;
-
     void begin();
     void noteRefCountedObject (in unsigned long long aAddress,
 			       in unsigned long aRefCount,
 			       in string aObjectDescription);
     void noteGCedObject (in unsigned long long aAddress,
 			 in boolean aMarked,
 			 in string aObjectDescription,
 			 in unsigned long long aCompartmentAddress);
--- a/xpcom/base/nsIMemoryInfoDumper.idl
+++ b/xpcom/base/nsIMemoryInfoDumper.idl
@@ -147,19 +147,13 @@ interface nsIMemoryInfoDumper : nsISuppo
    *   helpful when trying to understand why a particular object is alive.  For
    *   example, a non-traces-log will skip references held by an active
    *   document; if your object is being held alive by such a document, you
    *   probably want to see those references.
    *
    * @param aDumpChildProcesses indicates whether we should call
    *   DumpGCAndCCLogsToFile in our child processes.  If so, the child processes
    *   will dump their children, and so on.
-   *
-   * @param aGCLogPath The full path of the file that the GC log was written to.
-   *
-   * @param aCCLogPath The full path of the file that the CC log was written to.
    */
   void dumpGCAndCCLogsToFile(in AString aIdentifier,
                              in bool aDumpAllTraces,
-                             in bool aDumpChildProcesses,
-                             out AString aGCLogPath,
-                             out AString aCCLogPath);
+                             in bool aDumpChildProcesses);
 };
--- a/xpcom/base/nsMemoryInfoDumper.cpp
+++ b/xpcom/base/nsMemoryInfoDumper.cpp
@@ -92,19 +92,18 @@ public:
     , mDumpChildProcesses(aDumpChildProcesses)
   {}
 
   NS_IMETHOD Run()
   {
     nsCOMPtr<nsIMemoryInfoDumper> dumper =
       do_GetService("@mozilla.org/memory-info-dumper;1");
 
-    nsString ccLogPath, gcLogPath;
-    dumper->DumpGCAndCCLogsToFile(mIdentifier, mDumpAllTraces,
-                                  mDumpChildProcesses, gcLogPath, ccLogPath);
+    dumper->DumpGCAndCCLogsToFile(
+      mIdentifier, mDumpAllTraces, mDumpChildProcesses);
     return NS_OK;
   }
 
 private:
   const nsString mIdentifier;
   const bool mDumpAllTraces;
   const bool mDumpChildProcesses;
 };
@@ -569,21 +568,20 @@ EnsureNonEmptyIdentifier(nsAString& aIde
   // If the identifier is empty, set it to the number of whole seconds since the
   // epoch.  This identifier will appear in the files that this process
   // generates and also the files generated by this process's children, allowing
   // us to identify which files are from the same memory report request.
   aIdentifier.AppendInt(static_cast<int64_t>(PR_Now()) / 1000000);
 }
 
 NS_IMETHODIMP
-nsMemoryInfoDumper::DumpGCAndCCLogsToFile(const nsAString& aIdentifier,
-                                          bool aDumpAllTraces,
-                                          bool aDumpChildProcesses,
-                                          nsAString& aGCLogPath,
-                                          nsAString& aCCLogPath)
+nsMemoryInfoDumper::DumpGCAndCCLogsToFile(
+  const nsAString& aIdentifier,
+  bool aDumpAllTraces,
+  bool aDumpChildProcesses)
 {
   nsString identifier(aIdentifier);
   EnsureNonEmptyIdentifier(identifier);
 
   if (aDumpChildProcesses) {
     nsTArray<ContentParent*> children;
     ContentParent::GetAll(children);
     for (uint32_t i = 0; i < children.Length(); i++) {
@@ -598,20 +596,16 @@ nsMemoryInfoDumper::DumpGCAndCCLogsToFil
 
   if (aDumpAllTraces) {
     nsCOMPtr<nsICycleCollectorListener> allTracesLogger;
     logger->AllTraces(getter_AddRefs(allTracesLogger));
     logger = allTracesLogger;
   }
 
   nsJSContext::CycleCollectNow(logger);
-
-  logger->GetGcLogPath(aGCLogPath);
-  logger->GetCcLogPath(aCCLogPath);
-
   return NS_OK;
 }
 
 namespace mozilla {
 
 #define DUMP(o, s) \
   do { \
     nsresult rv = (o)->Write(s); \