Bug 1521191, part 3 - Add a function to create a negative leak. r=froydnj
☠☠ backed out by 044a86a4032c ☠ ☠
authorAndrew McCreight <continuation@gmail.com>
Thu, 24 Jan 2019 21:29:40 +0000
changeset 515509 3782d011cc9f7d2b146c634d9bb07337c1494b2d
parent 515508 38d3da4804d7a15fe363ab159045ab361b21beee
child 515510 138e162d2778d37a1b3cc474aade64647bbc1bd6
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1521191
milestone66.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 1521191, part 3 - Add a function to create a negative leak. r=froydnj This is needed to test the test harness's handling of a negative leak being reported by the XPCOM leak checker. Depends on D17535 Differential Revision: https://phabricator.services.mozilla.com/D17536
js/xpconnect/idl/xpccomponents.idl
js/xpconnect/src/XPCComponents.cpp
--- a/js/xpconnect/idl/xpccomponents.idl
+++ b/js/xpconnect/idl/xpccomponents.idl
@@ -325,16 +325,22 @@ interface nsIXPCComponents_Utils : nsISu
 
     /*
      * In an NS_FREE_PERMANENT_DATA build, intentionally leak a C++ object. This
      * is needed to test leak checking.
      */
     void intentionallyLeak();
 
     /*
+     * In a debug build, cause the XPCOM leak checker to report a negative leak.
+     * This is needed to test leak checking.
+     */
+    void intentionallyLeakNegatively();
+
+    /*
      * In a debug build, make XPCOM not print out a bloat log in this process.
      * This is needed to test leak checking.
      */
     void disableDumpStatistics();
 
     [implicit_jscontext]
     jsval getJSTestingFunctions();
 
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -1754,16 +1754,26 @@ nsXPCComponents_Utils::IntentionallyLeak
   Unused << new IntentionallyLeakedObject();
   return NS_OK;
 #else
   return NS_ERROR_NOT_IMPLEMENTED;
 #endif
 }
 
 NS_IMETHODIMP
+nsXPCComponents_Utils::IntentionallyLeakNegatively() {
+#ifdef DEBUG
+  MOZ_COUNT_DTOR(IntentionallyLeakedObject);
+  return NS_OK;
+#else
+  return NS_ERROR_NOT_IMPLEMENTED;
+#endif
+}
+
+NS_IMETHODIMP
 nsXPCComponents_Utils::DisableDumpStatistics() {
 #ifdef DEBUG
   nsTraceRefcnt::DisableDumpStatistics();
   return NS_OK;
 #else
   return NS_ERROR_NOT_IMPLEMENTED;
 #endif
 }