Bug 1127645 - Remove "Read from clipboard" button from about:memory. r=mccr8.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 02 Feb 2015 16:44:48 -0800
changeset 227133 37b690aca6a4599ff016a0caecb6065550f92a46
parent 227132 70855643209a586a4b21cdc8b5cdf2ff26e703bb
child 227134 bd6d23ec747c80e2a962e9f6a6a22891b3b699cd
push id55023
push usernnethercote@mozilla.com
push dateTue, 03 Feb 2015 04:07:18 +0000
treeherdermozilla-inbound@37b690aca6a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1127645, 859603
milestone38.0a1
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
Bug 1127645 - Remove "Read from clipboard" button from about:memory. r=mccr8. Now that memory reports are gzipped by default (not to mention *huge* when unzipped), this button is no longer useful. A "load from URL" button (bug 859603) would be much better, but for now let's just remove the useless functionality so it doesn't get in the way.
toolkit/components/aboutmemory/content/aboutMemory.js
--- a/toolkit/components/aboutmemory/content/aboutMemory.js
+++ b/toolkit/components/aboutmemory/content/aboutMemory.js
@@ -272,17 +272,16 @@ function onLoad()
       updateAboutMemoryFromTwoFiles(filename1, file.mozFullPath);
     }
   });
 
   const CuDesc = "Measure current memory reports and show.";
   const LdDesc = "Load memory reports from file and show.";
   const DfDesc = "Load memory report data from two files and show the " +
                  "difference.";
-  const RdDesc = "Read memory reports from the clipboard and show.";
 
   const SvDesc = "Save memory reports to file.";
 
   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 " +
@@ -316,18 +315,16 @@ function onLoad()
 
   const kEllipsis = "\u2026";
 
   // The "measureButton" id is used for testing.
   appendButton(row1, CuDesc, doMeasure, "Measure", "measureButton");
   appendButton(row1, LdDesc, () => fileInput1.click(), "Load" + kEllipsis);
   appendButton(row1, DfDesc, () => fileInput2.click(),
                "Load and diff" + kEllipsis);
-  appendButton(row1, RdDesc, updateAboutMemoryFromClipboard,
-               "Read from clipboard");
 
   let row2 = appendElement(ops, "div", "opsRow");
 
   let labelDiv2 =
     appendElementWithText(row2, "div", "opsRowLabel", "Save memory reports");
   appendButton(row2, SvDesc, saveReportsToFile, "Measure and save" + kEllipsis);
 
   // XXX: this isn't a great place for this checkbox, but I can't think of
@@ -700,46 +697,16 @@ function updateAboutMemoryFromTwoFiles(a
         gIsDiff = false;
       } catch (ex) {
         handleException(ex);
       }
     });
   });
 }
 
-/**
- * Like updateAboutMemoryFromFile(), but gets its data from the clipboard
- * instead of a file.
- */
-function updateAboutMemoryFromClipboard()
-{
-  // Get the clipboard's contents.
-  let transferable = Cc["@mozilla.org/widget/transferable;1"]
-                       .createInstance(Ci.nsITransferable);
-  let loadContext = window.QueryInterface(Ci.nsIInterfaceRequestor)
-                          .getInterface(Ci.nsIWebNavigation)
-                          .QueryInterface(Ci.nsILoadContext);
-  transferable.init(loadContext);
-  transferable.addDataFlavor('text/unicode');
-  Services.clipboard.getData(transferable, Ci.nsIClipboard.kGlobalClipboard);
-
-  var cbData = {};
-  try {
-    transferable.getTransferData('text/unicode', cbData,
-                                 /* out dataLen (ignored) */ {});
-    let cbString = cbData.value.QueryInterface(Ci.nsISupportsString).data;
-
-    // Success!  Now use the string to generate about:memory.
-    updateAboutMemoryFromJSONString(cbString);
-
-  } catch (ex) {
-    handleException(ex);
-  }
-}
-
 //---------------------------------------------------------------------------
 
 // Something unlikely to appear in a process name.
 let kProcessPathSep = "^:^:^";
 
 // Short for "diff report".
 function DReport(aKind, aUnits, aAmount, aDescription, aNMerged, aPresence)
 {