Bug 717611 - Add nsConsoleService::ResetWindow to clear messages for a given window id; r=baku.
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Mon, 04 Mar 2019 10:01:01 +0000
changeset 520487 6da9d84ec24327d87748021aae54ef5321e5f3f5
parent 520486 f25fac04788d3ac6d2b442021bcf2eb74f423e18
child 520488 60f0673455422eaa889831badf9810b99e4070e6
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs717611
milestone67.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 717611 - Add nsConsoleService::ResetWindow to clear messages for a given window id; r=baku. This will allow devtools to clear cached error messages, like we already can with ConsoleAPI messages. Differential Revision: https://phabricator.services.mozilla.com/D21693
xpcom/base/nsConsoleService.cpp
xpcom/base/nsIConsoleService.idl
--- a/xpcom/base/nsConsoleService.cpp
+++ b/xpcom/base/nsConsoleService.cpp
@@ -448,16 +448,24 @@ nsConsoleService::Reset() {
    */
   MutexAutoLock lock(mLock);
 
   ClearMessages();
   return NS_OK;
 }
 
 NS_IMETHODIMP
+nsConsoleService::ResetWindow(uint64_t windowInnerId) {
+  MOZ_RELEASE_ASSERT(NS_IsMainThread());
+
+  ClearMessagesForWindowID(windowInnerId);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
 nsConsoleService::Observe(nsISupports* aSubject, const char* aTopic,
                           const char16_t* aData) {
   if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
     // Dump all our messages, in case any are cycle collected.
     Reset();
     // We could remove ourselves from the observer service, but it is about to
     // drop all observers anyways, so why bother.
   } else if (!strcmp(aTopic, "inner-window-destroyed")) {
--- a/xpcom/base/nsIConsoleService.idl
+++ b/xpcom/base/nsIConsoleService.idl
@@ -39,16 +39,21 @@ interface nsIConsoleService : nsISupport
      * Each registered listener should also be unregistered.
      */
     void unregisterListener(in nsIConsoleListener listener);
 
     /**
      * Clear the message buffer (e.g. for privacy reasons).
      */
     void reset();
+
+    /**
+     * Clear the message buffer for a given window.
+     */
+    void resetWindow(in uint64_t windowInnerId);
 };
 
 
 %{ C++
 #define NS_CONSOLESERVICE_CID \
 { 0x7e3ff85c, 0x1dd2, 0x11b2, { 0x8d, 0x4b, 0xeb, 0x45, 0x2c, 0xb0, 0xff, 0x40 }}
 
 #define NS_CONSOLESERVICE_CONTRACTID "@mozilla.org/consoleservice;1"