Backed out changeset 2c56aed63687 (bug 1219482) to hopefully fix the intermittent hazard failures CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Fri, 29 Jan 2016 10:15:38 -0800
changeset 320582 ebc3fa14b72acc7139173ee9933948a6bec0f7de
parent 320581 5e5b76d866341d47db93066b393af616b1e78f43
child 320583 08eddf3af53186d5408afa2a40d82eb6e7c243aa
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1219482
milestone47.0a1
backs out2c56aed636871f91344dc412131675141964a840
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
Backed out changeset 2c56aed63687 (bug 1219482) to hopefully fix the intermittent hazard failures CLOSED TREE
docshell/base/nsDocShell.cpp
docshell/shistory/nsSHistory.cpp
extensions/auth/nsAuth.h
extensions/auth/nsAuthFactory.cpp
extensions/gio/nsGIOProtocolHandler.cpp
extensions/pref/autoconfig/src/nsAutoConfig.cpp
extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp
extensions/pref/autoconfig/src/nsReadConfig.cpp
hal/Hal.cpp
hal/HalLog.h
ipc/chromium/src/base/logging.cc
ipc/chromium/src/base/logging.h
js/xpconnect/loader/mozJSComponentLoader.cpp
js/xpconnect/src/XPCLog.cpp
js/xpconnect/src/nsXPConnect.cpp
modules/libjar/nsJARChannel.cpp
parser/htmlparser/nsExpatDriver.cpp
rdf/base/nsCompositeDataSource.cpp
rdf/base/nsInMemoryDataSource.cpp
rdf/base/nsRDFContentSink.cpp
rdf/base/nsRDFService.cpp
rdf/base/nsRDFXMLDataSource.cpp
storage/VacuumManager.cpp
storage/mozStorageAsyncStatement.cpp
storage/mozStorageConnection.cpp
storage/mozStoragePrivateHelpers.cpp
storage/mozStorageStatement.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -261,19 +261,19 @@ static uint32_t gValidateOrigin = 0xffff
 
 // Hint for native dispatch of events on how long to delay after
 // all documents have loaded in milliseconds before favoring normal
 // native event dispatch priorites over performance
 // Can be overridden with docshell.event_starvation_delay_hint pref.
 #define NS_EVENT_STARVATION_DELAY_HINT 2000
 
 #ifdef DEBUG
-static mozilla::LazyLogModule gDocShellLog("nsDocShell");
+static PRLogModuleInfo* gDocShellLog;
 #endif
-static mozilla::LazyLogModule gDocShellLeakLog("nsDocShellLeak");;
+static PRLogModuleInfo* gDocShellLeakLog;
 
 const char kBrandBundleURL[]      = "chrome://branding/locale/brand.properties";
 const char kAppstringsBundleURL[] = "chrome://global/locale/appstrings.properties";
 
 static void
 FavorPerformanceHint(bool aPerfOverStarvation)
 {
   nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
@@ -813,17 +813,27 @@ nsDocShell::nsDocShell()
   mHistoryID = ++gDocshellIDCounter;
   if (gDocShellCount++ == 0) {
     NS_ASSERTION(sURIFixup == nullptr,
                  "Huh, sURIFixup not null in first nsDocShell ctor!");
 
     CallGetService(NS_URIFIXUP_CONTRACTID, &sURIFixup);
   }
 
-  MOZ_LOG(gDocShellLeakLog, LogLevel::Debug, ("DOCSHELL %p created\n", this));
+#ifdef DEBUG
+  if (!gDocShellLog) {
+    gDocShellLog = PR_NewLogModule("nsDocShell");
+  }
+#endif
+  if (!gDocShellLeakLog) {
+    gDocShellLeakLog = PR_NewLogModule("nsDocShellLeak");
+  }
+  if (gDocShellLeakLog) {
+    MOZ_LOG(gDocShellLeakLog, LogLevel::Debug, ("DOCSHELL %p created\n", this));
+  }
 
 #ifdef DEBUG
   // We're counting the number of |nsDocShells| to help find leaks
   ++gNumberOfDocShells;
   if (!PR_GetEnv("MOZ_QUIET")) {
     printf_stderr("++DOCSHELL %p == %ld [pid = %d] [id = %llu]\n",
                   (void*)this,
                   gNumberOfDocShells,
--- a/docshell/shistory/nsSHistory.cpp
+++ b/docshell/shistory/nsSHistory.cpp
@@ -54,29 +54,36 @@ static PRCList gSHistoryList;
 // Max viewers allowed total, across all SHistory objects - negative default
 // means we will calculate how many viewers to cache based on total memory
 int32_t nsSHistory::sHistoryMaxTotalViewers = -1;
 
 // A counter that is used to be able to know the order in which
 // entries were touched, so that we can evict older entries first.
 static uint32_t gTouchCounter = 0;
 
-static LazyLogModule gSHistoryLog("nsSHistory");
-
-#define LOG(format) MOZ_LOG(gSHistoryLog, mozilla::LogLevel::Debug, format)
+static PRLogModuleInfo*
+GetSHistoryLog()
+{
+  static PRLogModuleInfo* sLog;
+  if (!sLog) {
+    sLog = PR_NewLogModule("nsSHistory");
+  }
+  return sLog;
+}
+#define LOG(format) MOZ_LOG(GetSHistoryLog(), mozilla::LogLevel::Debug, format)
 
 // This macro makes it easier to print a log message which includes a URI's
 // spec.  Example use:
 //
 //  nsIURI *uri = [...];
 //  LOG_SPEC(("The URI is %s.", _spec), uri);
 //
 #define LOG_SPEC(format, uri)                              \
   PR_BEGIN_MACRO                                           \
-    if (MOZ_LOG_TEST(gSHistoryLog, LogLevel::Debug)) {     \
+    if (MOZ_LOG_TEST(GetSHistoryLog(), LogLevel::Debug)) {     \
       nsAutoCString _specStr(NS_LITERAL_CSTRING("(null)"));\
       if (uri) {                                           \
         uri->GetSpec(_specStr);                            \
       }                                                    \
       const char* _spec = _specStr.get();                  \
       LOG(format);                                         \
     }                                                      \
   PR_END_MACRO
@@ -84,17 +91,17 @@ static LazyLogModule gSHistoryLog("nsSHi
 // This macro makes it easy to log a message including an SHEntry's URI.
 // For example:
 //
 //  nsCOMPtr<nsISHEntry> shentry = [...];
 //  LOG_SHENTRY_SPEC(("shentry %p has uri %s.", shentry.get(), _spec), shentry);
 //
 #define LOG_SHENTRY_SPEC(format, shentry)                  \
   PR_BEGIN_MACRO                                           \
-    if (MOZ_LOG_TEST(gSHistoryLog, LogLevel::Debug)) {     \
+    if (MOZ_LOG_TEST(GetSHistoryLog(), LogLevel::Debug)) {     \
       nsCOMPtr<nsIURI> uri;                                \
       shentry->GetURI(getter_AddRefs(uri));                \
       LOG_SPEC(format, uri);                               \
     }                                                      \
   PR_END_MACRO
 
 // Iterates over all registered session history listeners.
 #define ITERATE_LISTENERS(body)                            \
--- a/extensions/auth/nsAuth.h
+++ b/extensions/auth/nsAuth.h
@@ -15,13 +15,13 @@ enum pType {
 #include "mozilla/Logging.h"
 
 //
 // in order to do logging, the following environment variables need to be set:
 // 
 //      set NSPR_LOG_MODULES=negotiateauth:4
 //      set NSPR_LOG_FILE=negotiateauth.log
 //
-extern mozilla::LazyLogModule gNegotiateLog;
+extern PRLogModuleInfo* gNegotiateLog;
 
 #define LOG(args) MOZ_LOG(gNegotiateLog, mozilla::LogLevel::Debug, args)
 
 #endif /* !defined( nsAuth_h__ ) */
--- a/extensions/auth/nsAuthFactory.cpp
+++ b/extensions/auth/nsAuthFactory.cpp
@@ -215,22 +215,23 @@ static const mozilla::Module::ContractID
   { NS_AUTH_MODULE_CONTRACTID_PREFIX "sys-ntlm", &kNS_SAMBANTLMAUTH_CID },
 #endif
   { NS_HTTP_AUTHENTICATOR_CONTRACTID_PREFIX "negotiate", &kNS_HTTPNEGOTIATEAUTH_CID },
   { NS_AUTH_MODULE_CONTRACTID_PREFIX "sasl-gssapi", &kNS_AUTHSASL_CID },
   { nullptr }
 };
 
 //-----------------------------------------------------------------------------
-mozilla::LazyLogModule gNegotiateLog("negotiateauth");
+PRLogModuleInfo *gNegotiateLog;
 
 // setup nspr logging ...
 static nsresult
 InitNegotiateAuth()
 {
+  gNegotiateLog = PR_NewLogModule("negotiateauth");
   return NS_OK;
 }
 
 static void
 DestroyNegotiateAuth()
 {
   nsAuthGSSAPI::Shutdown();
 }
--- a/extensions/gio/nsGIOProtocolHandler.cpp
+++ b/extensions/gio/nsGIOProtocolHandler.cpp
@@ -32,17 +32,17 @@
 #include <algorithm>
 
 #define MOZ_GIO_SCHEME              "moz-gio"
 #define MOZ_GIO_SUPPORTED_PROTOCOLS "network.gio.supported-protocols"
 
 //-----------------------------------------------------------------------------
 
 // NSPR_LOG_MODULES=gio:5
-static mozilla::LazyLogModule sGIOLog("gio");
+static PRLogModuleInfo *sGIOLog;
 #define LOG(args) MOZ_LOG(sGIOLog, mozilla::LogLevel::Debug, args)
 
 
 //-----------------------------------------------------------------------------
 static nsresult
 MapGIOResult(gint code) 
 {
   switch (code)
@@ -906,16 +906,18 @@ class nsGIOProtocolHandler final : publi
     nsCString mSupportedProtocols;
 };
 
 NS_IMPL_ISUPPORTS(nsGIOProtocolHandler, nsIProtocolHandler, nsIObserver)
 
 nsresult
 nsGIOProtocolHandler::Init()
 {
+  sGIOLog = PR_NewLogModule("gio");
+
   nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
   if (prefs)
   {
     InitSupportedProtocolsPref(prefs);
     prefs->AddObserver(MOZ_GIO_SUPPORTED_PROTOCOLS, this, false);
   }
 
   return NS_OK;
--- a/extensions/pref/autoconfig/src/nsAutoConfig.cpp
+++ b/extensions/pref/autoconfig/src/nsAutoConfig.cpp
@@ -21,17 +21,17 @@
 #include "nsNetUtil.h"
 #include "nspr.h"
 #include <algorithm>
 
 #include "mozilla/Logging.h"
 
 using mozilla::LogLevel;
 
-mozilla::LazyLogModule MCD("MCD");
+PRLogModuleInfo *MCD;
 
 extern nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length,
                                           const char *filename, 
                                           bool bGlobalContext, 
                                           bool bCallbacks, 
                                           bool skipFirstLine);
 
 // nsISupports Implementation
--- a/extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp
+++ b/extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp
@@ -14,17 +14,17 @@
 #include "mozilla/Attributes.h"
 #include "mozilla/Maybe.h"
 #include "nsContentUtils.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsJSPrincipals.h"
 #include "nsIScriptError.h"
 #include "jswrapper.h"
 
-extern mozilla::LazyLogModule MCD;
+extern PRLogModuleInfo *MCD;
 using mozilla::AutoSafeJSContext;
 
 //*****************************************************************************
 
 static JS::PersistentRooted<JSObject *> autoconfigSb;
 
 nsresult CentralizedAdminPrefManagerInit()
 {
--- a/extensions/pref/autoconfig/src/nsReadConfig.cpp
+++ b/extensions/pref/autoconfig/src/nsReadConfig.cpp
@@ -21,17 +21,17 @@
 #include "nsNetUtil.h"
 #include "prmem.h"
 #include "nsString.h"
 #include "nsCRT.h"
 #include "nspr.h"
 #include "nsXULAppAPI.h"
 #include "nsContentUtils.h"
 
-extern mozilla::LazyLogModule MCD;
+extern PRLogModuleInfo *MCD;
 
 extern nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length,
                                           const char *filename, 
                                           bool bGlobalContext, 
                                           bool bCallbacks, 
                                           bool skipFirstLine);
 extern nsresult CentralizedAdminPrefManagerInit();
 extern nsresult CentralizedAdminPrefManagerFinish();
@@ -70,16 +70,18 @@ static void DisplayError(void)
 
 // nsISupports Implementation
 
 NS_IMPL_ISUPPORTS(nsReadConfig, nsIReadConfig, nsIObserver)
 
 nsReadConfig::nsReadConfig() :
     mRead(false)
 {
+    if (!MCD)
+      MCD = PR_NewLogModule("MCD");
 }
 
 nsresult nsReadConfig::Init()
 {
     nsresult rv;
     
     nsCOMPtr<nsIObserverService> observerService = 
         do_GetService("@mozilla.org/observer-service;1", &rv);
--- a/hal/Hal.cpp
+++ b/hal/Hal.cpp
@@ -56,20 +56,23 @@ using namespace mozilla::dom;
     } else {                                      \
       return hal_impl::_call;                     \
     }                                             \
   } while (0)
 
 namespace mozilla {
 namespace hal {
 
-mozilla::LogModule *
+PRLogModuleInfo *
 GetHalLog()
 {
-  static mozilla::LazyLogModule sHalLog("hal");
+  static PRLogModuleInfo *sHalLog;
+  if (!sHalLog) {
+    sHalLog = PR_NewLogModule("hal");
+  }
   return sHalLog;
 }
 
 namespace {
 
 void
 AssertMainThread()
 {
--- a/hal/HalLog.h
+++ b/hal/HalLog.h
@@ -15,17 +15,17 @@
  * This should be considered a private include and not used in non-HAL code.
  * To enable logging in non-debug builds define the PR_FORCE_LOG macro here.
  */
 
 namespace mozilla {
 
 namespace hal {
 
-mozilla::LogModule *GetHalLog();
+extern PRLogModuleInfo *GetHalLog();
 #define HAL_LOG(...) \
   MOZ_LOG(mozilla::hal::GetHalLog(), LogLevel::Debug, (__VA_ARGS__))
 #define HAL_ERR(...) \
   MOZ_LOG(mozilla::hal::GetHalLog(), LogLevel::Error, (__VA_ARGS__))
 
 } // namespace hal
 
 } // namespace mozilla
--- a/ipc/chromium/src/base/logging.cc
+++ b/ipc/chromium/src/base/logging.cc
@@ -37,33 +37,41 @@ Logger::~Logger()
     break;
 
   case LOG_FATAL:
     prlevel = LogLevel::Error;
     xpcomlevel = NS_DEBUG_ABORT;
     break;
   }
 
-  MOZ_LOG(gChromiumPRLog, prlevel, ("%s:%i: %s", mFile, mLine, mMsg ? mMsg : "<no message>"));
+  MOZ_LOG(GetLog(), prlevel, ("%s:%i: %s", mFile, mLine, mMsg ? mMsg : "<no message>"));
   if (xpcomlevel != -1)
     NS_DebugBreak(xpcomlevel, mMsg, NULL, mFile, mLine);
 
   PR_Free(mMsg);
 }
 
 void
 Logger::printf(const char* fmt, ...)
 {
   va_list args;
   va_start(args, fmt);
   mMsg = PR_vsprintf_append(mMsg, fmt, args);
   va_end(args);
 }
 
-LazyLogModule Logger::gChromiumPRLog("chromium");
+PRLogModuleInfo* Logger::gChromiumPRLog;
+
+PRLogModuleInfo* Logger::GetLog()
+{
+  if (!gChromiumPRLog)
+    gChromiumPRLog = PR_NewLogModule("chromium");
+  return gChromiumPRLog;
+}
+
 } // namespace mozilla 
 
 mozilla::Logger&
 operator<<(mozilla::Logger& log, const char* s)
 {
   log.printf("%s", s);
   return log;
 }
--- a/ipc/chromium/src/base/logging.h
+++ b/ipc/chromium/src/base/logging.h
@@ -40,18 +40,18 @@ public:
   { }
 
   ~Logger();
 
   // not private so that the operator<< overloads can get to it
   void printf(const char* fmt, ...);
 
 private:
-  static mozilla::LazyLogModule gChromiumPRLog;
-//  static PRLogModuleInfo* GetLog();
+  static PRLogModuleInfo* gChromiumPRLog;
+  static PRLogModuleInfo* GetLog();
 
   LogSeverity mSeverity;
   const char* mFile;
   int mLine;
   char* mMsg;
 
   DISALLOW_EVIL_CONSTRUCTORS(Logger);
 };
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -66,17 +66,17 @@ static const char kJSCachePrefix[] = "js
 /**
  * Buffer sizes for serialization and deserialization of scripts.
  * FIXME: bug #411579 (tune this macro!) Last updated: Jan 2008
  */
 #define XPC_SERIALIZATION_BUFFER_SIZE   (64 * 1024)
 #define XPC_DESERIALIZATION_BUFFER_SIZE (12 * 8192)
 
 // NSPR_LOG_MODULES=JSComponentLoader:5
-static LazyLogModule gJSCLLog("JSComponentLoader");
+static PRLogModuleInfo* gJSCLLog;
 
 #define LOG(args) MOZ_LOG(gJSCLLog, mozilla::LogLevel::Debug, args)
 
 // Components.utils.import error messages
 #define ERROR_SCOPE_OBJ "%s - Second argument must be an object."
 #define ERROR_NOT_PRESENT "%s - EXPORTED_SYMBOLS is not present."
 #define ERROR_NOT_AN_ARRAY "%s - EXPORTED_SYMBOLS is not an array."
 #define ERROR_GETTING_ARRAY_LENGTH "%s - Error getting array length of EXPORTED_SYMBOLS."
@@ -193,16 +193,20 @@ mozJSComponentLoader::mozJSComponentLoad
     : mModules(16),
       mImports(16),
       mInProgressImports(16),
       mInitialized(false),
       mReuseLoaderGlobal(false)
 {
     MOZ_ASSERT(!sSelf, "mozJSComponentLoader should be a singleton");
 
+    if (!gJSCLLog) {
+        gJSCLLog = PR_NewLogModule("JSComponentLoader");
+    }
+
     sSelf = this;
 }
 
 #define ENSURE_DEP(name) { nsresult rv = Ensure##name(); NS_ENSURE_SUCCESS(rv, rv); }
 #define ENSURE_DEPS(...) MOZ_FOR_EACH(ENSURE_DEP, (), (__VA_ARGS__));
 #define BEGIN_ENSURE(self, ...) { \
     if (m##self) \
         return NS_OK; \
--- a/js/xpconnect/src/XPCLog.cpp
+++ b/js/xpconnect/src/XPCLog.cpp
@@ -20,37 +20,40 @@
 #define LINE_LEN        200
 #define INDENT_FACTOR   2
 
 #define CAN_RUN (g_InitState == 1 || (g_InitState == 0 && Init()))
 
 static char*    g_Spaces;
 static int      g_InitState = 0;
 static int      g_Indent = 0;
-static mozilla::LazyLogModule g_LogMod("xpclog");
+static PRLogModuleInfo* g_LogMod = nullptr;
 
 static bool Init()
 {
+    g_LogMod = PR_NewLogModule("xpclog");
     g_Spaces = new char[SPACE_COUNT+1];
-    if (!g_Spaces || !MOZ_LOG_TEST(g_LogMod,LogLevel::Error)) {
+    if (!g_LogMod || !g_Spaces || !MOZ_LOG_TEST(g_LogMod,LogLevel::Error)) {
         g_InitState = 1;
         XPC_Log_Finish();
         return false;
     }
     memset(g_Spaces, ' ', SPACE_COUNT);
     g_Spaces[SPACE_COUNT] = 0;
     g_InitState = 1;
     return true;
 }
 
 void
 XPC_Log_Finish()
 {
     if (g_InitState == 1) {
         delete [] g_Spaces;
+        // we'd like to properly cleanup the LogModule, but nspr owns that
+        g_LogMod = nullptr;
     }
     g_InitState = -1;
 }
 
 void
 XPC_Log_print(const char* fmt, ...)
 {
     va_list ap;
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -197,17 +197,17 @@ xpc::ErrorReport::Init(JSErrorReport* aR
     mSourceLine = static_cast<const char16_t*>(aReport->uclinebuf);
 
     mLineNumber = aReport->lineno;
     mColumn = aReport->column;
     mFlags = aReport->flags;
     mIsMuted = aReport->isMuted;
 }
 
-static LazyLogModule gJSDiagnostics("JSDiagnostics");
+static PRLogModuleInfo* gJSDiagnostics;
 
 void
 xpc::ErrorReport::LogToConsole()
 {
   LogToConsoleWithStack(nullptr);
 }
 void
 xpc::ErrorReport::LogToConsoleWithStack(JS::HandleObject aStack)
@@ -227,20 +227,25 @@ xpc::ErrorReport::LogToConsoleWithStack(
         error.AppendInt(mLineNumber, 10);
         error.AppendLiteral(": ");
         error.Append(NS_LossyConvertUTF16toASCII(mErrorMsg));
 
         fprintf(stderr, "%s\n", error.get());
         fflush(stderr);
     }
 
-    MOZ_LOG(gJSDiagnostics,
-            JSREPORT_IS_WARNING(mFlags) ? LogLevel::Warning : LogLevel::Error,
-            ("file %s, line %u\n%s", NS_LossyConvertUTF16toASCII(mFileName).get(),
-             mLineNumber, NS_LossyConvertUTF16toASCII(mErrorMsg).get()));
+    // Log to the PR Log Module.
+    if (!gJSDiagnostics)
+        gJSDiagnostics = PR_NewLogModule("JSDiagnostics");
+    if (gJSDiagnostics) {
+        MOZ_LOG(gJSDiagnostics,
+                JSREPORT_IS_WARNING(mFlags) ? LogLevel::Warning : LogLevel::Error,
+                ("file %s, line %u\n%s", NS_LossyConvertUTF16toASCII(mFileName).get(),
+                 mLineNumber, NS_LossyConvertUTF16toASCII(mErrorMsg).get()));
+    }
 
     // Log to the console. We do this last so that we can simply return if
     // there's no console service without affecting the other reporting
     // mechanisms.
     nsCOMPtr<nsIConsoleService> consoleService =
       do_GetService(NS_CONSOLESERVICE_CONTRACTID);
 
     nsCOMPtr<nsIScriptError> errorObject;
--- a/modules/libjar/nsJARChannel.cpp
+++ b/modules/libjar/nsJARChannel.cpp
@@ -43,17 +43,17 @@ static NS_DEFINE_CID(kZipReaderCID, NS_Z
 // own LOG macro below.)
 #ifdef LOG
 #undef LOG
 #endif
 
 //
 // set NSPR_LOG_MODULES=nsJarProtocol:5
 //
-static LazyLogModule gJarProtocolLog("nsJarProtocol");
+static PRLogModuleInfo *gJarProtocolLog = nullptr;
 
 #define LOG(args)     MOZ_LOG(gJarProtocolLog, mozilla::LogLevel::Debug, args)
 #define LOG_ENABLED() MOZ_LOG_TEST(gJarProtocolLog, mozilla::LogLevel::Debug)
 
 //-----------------------------------------------------------------------------
 // nsJARInputThunk
 //
 // this class allows us to do some extra work on the stream transport thread.
@@ -198,16 +198,19 @@ nsJARChannel::nsJARChannel()
     , mContentLength(-1)
     , mLoadFlags(LOAD_NORMAL)
     , mStatus(NS_OK)
     , mIsPending(false)
     , mIsUnsafe(true)
     , mOpeningRemote(false)
     , mBlockRemoteFiles(false)
 {
+    if (!gJarProtocolLog)
+        gJarProtocolLog = PR_NewLogModule("nsJarProtocol");
+
     mBlockRemoteFiles = Preferences::GetBool("network.jar.block-remote-files", false);
 
     // hold an owning reference to the jar handler
     NS_ADDREF(gJarHandler);
 }
 
 nsJARChannel::~nsJARChannel()
 {
--- a/parser/htmlparser/nsExpatDriver.cpp
+++ b/parser/htmlparser/nsExpatDriver.cpp
@@ -35,17 +35,24 @@
 
 using mozilla::fallible;
 using mozilla::LogLevel;
 
 #define kExpatSeparatorChar 0xFFFF
 
 static const char16_t kUTF16[] = { 'U', 'T', 'F', '-', '1', '6', '\0' };
 
-static mozilla::LazyLogModule gExpatDriverLog("expatdriver");
+static PRLogModuleInfo *
+GetExpatDriverLog()
+{
+  static PRLogModuleInfo *sLog;
+  if (!sLog)
+    sLog = PR_NewLogModule("expatdriver");
+  return sLog;
+}
 
 /***************************** EXPAT CALL BACKS ******************************/
 // The callback handlers that get called from the expat parser.
 
 static void
 Driver_HandleXMLDeclaration(void *aUserData,
                             const XML_Char *aVersion,
                             const XML_Char *aEncoding,
@@ -1047,17 +1054,17 @@ nsExpatDriver::ConsumeToken(nsScanner& a
   nsScannerIterator start = currentExpatPosition;
   start.advance(mExpatBuffered);
 
   // This is the end of the last buffer (at this point, more data could come in
   // later).
   nsScannerIterator end;
   aScanner.EndReading(end);
 
-  MOZ_LOG(gExpatDriverLog, LogLevel::Debug,
+  MOZ_LOG(GetExpatDriverLog(), LogLevel::Debug,
          ("Remaining in expat's buffer: %i, remaining in scanner: %i.",
           mExpatBuffered, Distance(start, end)));
 
   // We want to call Expat if we have more buffers, or if we know there won't
   // be more buffers (and so we want to flush the remaining data), or if we're
   // currently blocked and there's data in Expat's buffer.
   while (start != end || (mIsFinalChunk && !mMadeFinalCallToExpat) ||
          (BlockedOrInterrupted() && mExpatBuffered > 0)) {
@@ -1068,37 +1075,37 @@ nsExpatDriver::ConsumeToken(nsScanner& a
     uint32_t length;
     if (blocked || noMoreBuffers) {
       // If we're blocked we just resume Expat so we don't need a buffer, if
       // there aren't any more buffers we pass a null buffer to Expat.
       buffer = nullptr;
       length = 0;
 
       if (blocked) {
-        MOZ_LOG(gExpatDriverLog, LogLevel::Debug,
+        MOZ_LOG(GetExpatDriverLog(), LogLevel::Debug,
                ("Resuming Expat, will parse data remaining in Expat's "
                 "buffer.\nContent of Expat's buffer:\n-----\n%s\n-----\n",
                 NS_ConvertUTF16toUTF8(currentExpatPosition.get(),
                                       mExpatBuffered).get()));
       }
       else {
         NS_ASSERTION(mExpatBuffered == Distance(currentExpatPosition, end),
                      "Didn't pass all the data to Expat?");
-        MOZ_LOG(gExpatDriverLog, LogLevel::Debug,
+        MOZ_LOG(GetExpatDriverLog(), LogLevel::Debug,
                ("Last call to Expat, will parse data remaining in Expat's "
                 "buffer.\nContent of Expat's buffer:\n-----\n%s\n-----\n",
                 NS_ConvertUTF16toUTF8(currentExpatPosition.get(),
                                       mExpatBuffered).get()));
       }
     }
     else {
       buffer = start.get();
       length = uint32_t(start.size_forward());
 
-      MOZ_LOG(gExpatDriverLog, LogLevel::Debug,
+      MOZ_LOG(GetExpatDriverLog(), LogLevel::Debug,
              ("Calling Expat, will parse data remaining in Expat's buffer and "
               "new data.\nContent of Expat's buffer:\n-----\n%s\n-----\nNew "
               "data:\n-----\n%s\n-----\n",
               NS_ConvertUTF16toUTF8(currentExpatPosition.get(),
                                     mExpatBuffered).get(),
               NS_ConvertUTF16toUTF8(start.get(), length).get()));
     }
 
@@ -1128,17 +1135,17 @@ nsExpatDriver::ConsumeToken(nsScanner& a
         // data.
         AppendUnicodeTo(oldExpatPosition, currentExpatPosition, mLastLine);
       }
     }
 
     mExpatBuffered += length - consumed;
 
     if (BlockedOrInterrupted()) {
-      MOZ_LOG(gExpatDriverLog, LogLevel::Debug,
+      MOZ_LOG(GetExpatDriverLog(), LogLevel::Debug,
              ("Blocked or interrupted parser (probably for loading linked "
               "stylesheets or scripts)."));
 
       aScanner.SetPosition(currentExpatPosition, true);
       aScanner.Mark();
 
       return mInternalState;
     }
@@ -1189,17 +1196,17 @@ nsExpatDriver::ConsumeToken(nsScanner& a
     // (e.g. if we spun the event loop in an inline script). Reload end now
     // to compensate.
     aScanner.EndReading(end);
   }
 
   aScanner.SetPosition(currentExpatPosition, true);
   aScanner.Mark();
 
-  MOZ_LOG(gExpatDriverLog, LogLevel::Debug,
+  MOZ_LOG(GetExpatDriverLog(), LogLevel::Debug,
          ("Remaining in expat's buffer: %i, remaining in scanner: %i.",
           mExpatBuffered, Distance(currentExpatPosition, end)));
 
   return NS_SUCCEEDED(mInternalState) ? kEOF : NS_OK;
 }
 
 NS_IMETHODIMP
 nsExpatDriver::WillBuildModel(const CParserContext& aParserContext,
--- a/rdf/base/nsCompositeDataSource.cpp
+++ b/rdf/base/nsCompositeDataSource.cpp
@@ -40,17 +40,17 @@
 #include "rdf.h"
 #include "nsCycleCollectionParticipant.h"
 
 #include "nsEnumeratorUtils.h"
 
 #include "mozilla/Logging.h"
 #include "prprf.h"
 #include <stdio.h>
-mozilla::LazyLogModule nsRDFLog("RDF");
+PRLogModuleInfo* nsRDFLog = nullptr;
 
 //----------------------------------------------------------------------
 //
 // CompositeDataSourceImpl
 //
 
 class CompositeEnumeratorImpl;
 class CompositeArcsInOutEnumeratorImpl;
@@ -485,16 +485,18 @@ NS_NewRDFCompositeDataSource(nsIRDFCompo
 }
 
 
 CompositeDataSourceImpl::CompositeDataSourceImpl(void)
 	: mAllowNegativeAssertions(true),
 	  mCoalesceDuplicateArcs(true),
       mUpdateBatchNest(0)
 {
+    if (nsRDFLog == nullptr) 
+        nsRDFLog = PR_NewLogModule("RDF");
 }
 
 //----------------------------------------------------------------------
 //
 // nsISupports interface
 //
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(CompositeDataSourceImpl)
--- a/rdf/base/nsInMemoryDataSource.cpp
+++ b/rdf/base/nsInMemoryDataSource.cpp
@@ -347,20 +347,20 @@ public:
                  nsIRDFResource* asource,
                  nsIRDFResource* aProperty,
                  nsIRDFNode* aTarget,
                  bool aTruthValue = true);
 
     bool    mPropagateChanges;
 
 private:
-    static mozilla::LazyLogModule gLog;
+    static PRLogModuleInfo* gLog;
 };
 
-mozilla::LazyLogModule InMemoryDataSource::gLog("InMemoryDataSource");
+PRLogModuleInfo* InMemoryDataSource::gLog;
 
 //----------------------------------------------------------------------
 //
 // InMemoryAssertionEnumeratorImpl
 //
 
 /**
  * InMemoryAssertionEnumeratorImpl
@@ -738,16 +738,19 @@ InMemoryDataSource::InMemoryDataSource(n
     , mReverseArcs(PLDHashTable::StubOps(), sizeof(Entry))
     , mNumObservers(0)
     , mReadCount(0)
 {
     NS_INIT_AGGREGATED(aOuter);
 
     mPropagateChanges = true;
     MOZ_COUNT_CTOR(InMemoryDataSource);
+
+    if (! gLog)
+        gLog = PR_NewLogModule("InMemoryDataSource");
 }
 
 
 InMemoryDataSource::~InMemoryDataSource()
 {
 #ifdef DEBUG_REFS
     --gInstanceCount;
     fprintf(stdout, "%d - RDF: InMemoryDataSource\n", gInstanceCount);
--- a/rdf/base/nsRDFContentSink.cpp
+++ b/rdf/base/nsRDFContentSink.cpp
@@ -221,30 +221,30 @@ protected:
         RDFContentSinkParseMode  mParseMode;
     };
 
     nsAutoTArray<RDFContextStackElement, 8>* mContextStack;
 
     nsCOMPtr<nsIURI> mDocumentURL;
 
 private:
-    static mozilla::LazyLogModule gLog;
+    static PRLogModuleInfo* gLog;
 };
 
 int32_t         RDFContentSinkImpl::gRefCnt = 0;
 nsIRDFService*  RDFContentSinkImpl::gRDFService;
 nsIRDFContainerUtils* RDFContentSinkImpl::gRDFContainerUtils;
 nsIRDFResource* RDFContentSinkImpl::kRDF_type;
 nsIRDFResource* RDFContentSinkImpl::kRDF_instanceOf;
 nsIRDFResource* RDFContentSinkImpl::kRDF_Alt;
 nsIRDFResource* RDFContentSinkImpl::kRDF_Bag;
 nsIRDFResource* RDFContentSinkImpl::kRDF_Seq;
 nsIRDFResource* RDFContentSinkImpl::kRDF_nextVal;
 
-mozilla::LazyLogModule RDFContentSinkImpl::gLog("nsRDFContentSink");
+PRLogModuleInfo* RDFContentSinkImpl::gLog;
 
 ////////////////////////////////////////////////////////////////////////
 
 #define RDF_ATOM(name_, value_) nsIAtom* RDFContentSinkImpl::name_;
 #include "nsRDFContentSinkAtomList.h"
 #undef RDF_ATOM
 
 #define RDF_ATOM(name_, value_) NS_STATIC_ATOM_BUFFER(name_##_buffer, value_)
@@ -285,16 +285,19 @@ RDFContentSinkImpl::RDFContentSinkImpl()
                                           &kRDF_nextVal);
         }
 
         NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
         rv = CallGetService(kRDFContainerUtilsCID, &gRDFContainerUtils);
 
         NS_RegisterStaticAtoms(rdf_atoms);
     }
+
+    if (! gLog)
+        gLog = PR_NewLogModule("nsRDFContentSink");
 }
 
 
 RDFContentSinkImpl::~RDFContentSinkImpl()
 {
 #ifdef DEBUG_REFS
     --gInstanceCount;
     fprintf(stdout, "%d - RDF: RDFContentSinkImpl\n", gInstanceCount);
--- a/rdf/base/nsRDFService.cpp
+++ b/rdf/base/nsRDFService.cpp
@@ -66,17 +66,17 @@ static NS_DEFINE_CID(kRDFXMLDataSourceCI
 static NS_DEFINE_CID(kRDFDefaultResourceCID,  NS_RDFDEFAULTRESOURCE_CID);
 
 static NS_DEFINE_IID(kIRDFLiteralIID,         NS_IRDFLITERAL_IID);
 static NS_DEFINE_IID(kIRDFDateIID,         NS_IRDFDATE_IID);
 static NS_DEFINE_IID(kIRDFIntIID,         NS_IRDFINT_IID);
 static NS_DEFINE_IID(kIRDFNodeIID,            NS_IRDFNODE_IID);
 static NS_DEFINE_IID(kISupportsIID,           NS_ISUPPORTS_IID);
 
-static LazyLogModule gLog("nsRDFService");
+static PRLogModuleInfo* gLog = nullptr;
 
 class BlobImpl;
 
 // These functions are copied from nsprpub/lib/ds/plhash.c, with one
 // change to free the key in DataSourceFreeEntry.
 // XXX sigh, why were DefaultAllocTable et. al. declared static, anyway?
 
 static void *
@@ -743,16 +743,19 @@ RDFServiceImpl::Init()
 
     if (! mNamedDataSources)
         return NS_ERROR_OUT_OF_MEMORY;
 
     mDefaultResourceFactory = do_GetClassObject(kRDFDefaultResourceCID, &rv);
     NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get default resource factory");
     if (NS_FAILED(rv)) return rv;
 
+    if (! gLog)
+        gLog = PR_NewLogModule("nsRDFService");
+
     return NS_OK;
 }
 
 
 RDFServiceImpl::~RDFServiceImpl()
 {
     if (mNamedDataSources) {
         PL_HashTableDestroy(mNamedDataSources);
--- a/rdf/base/nsRDFXMLDataSource.cpp
+++ b/rdf/base/nsRDFXMLDataSource.cpp
@@ -130,17 +130,17 @@ protected:
     nsCOMPtr<nsIURI>    mURL;
     nsCOMPtr<nsIStreamListener> mListener;
     nsNameSpaceMap      mNameSpaces;
 
     // pseudo-constants
     static int32_t gRefCnt;
     static nsIRDFService* gRDFService;
 
-    static mozilla::LazyLogModule gLog;
+    static PRLogModuleInfo* gLog;
 
     nsresult Init();
     RDFXMLDataSourceImpl(void);
     virtual ~RDFXMLDataSourceImpl(void);
     nsresult rdfXMLFlush(nsIURI *aURI);
 
     friend nsresult
     NS_NewRDFXMLDataSource(nsIRDFDataSource** aResult);
@@ -354,17 +354,17 @@ public:
 protected:
     nsresult
     BlockingParse(nsIURI* aURL, nsIStreamListener* aConsumer);
 };
 
 int32_t         RDFXMLDataSourceImpl::gRefCnt = 0;
 nsIRDFService*  RDFXMLDataSourceImpl::gRDFService;
 
-mozilla::LazyLogModule RDFXMLDataSourceImpl::gLog("nsRDFXMLDataSource");
+PRLogModuleInfo* RDFXMLDataSourceImpl::gLog;
 
 static const char kFileURIPrefix[] = "file:";
 static const char kResourceURIPrefix[] = "resource:";
 
 
 //----------------------------------------------------------------------
 
 nsresult
@@ -392,16 +392,18 @@ NS_NewRDFXMLDataSource(nsIRDFDataSource*
 }
 
 
 RDFXMLDataSourceImpl::RDFXMLDataSourceImpl(void)
     : mIsWritable(true),
       mIsDirty(false),
       mLoadState(eLoadState_Unloaded)
 {
+    if (! gLog)
+        gLog = PR_NewLogModule("nsRDFXMLDataSource");
 }
 
 
 nsresult
 RDFXMLDataSourceImpl::Init()
 {
     nsresult rv;
     NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
--- a/storage/VacuumManager.cpp
+++ b/storage/VacuumManager.cpp
@@ -34,17 +34,17 @@
 
 // This preferences root will contain last vacuum timestamps (in seconds) for
 // each database.  The database filename is used as a key.
 #define PREF_VACUUM_BRANCH "storage.vacuum.last."
 
 // Time between subsequent vacuum calls for a certain database.
 #define VACUUM_INTERVAL_SECONDS 30 * 86400 // 30 days.
 
-extern mozilla::LazyLogModule gStorageLog;
+extern PRLogModuleInfo *gStorageLog;
 
 namespace mozilla {
 namespace storage {
 
 namespace {
 
 ////////////////////////////////////////////////////////////////////////////////
 //// BaseCallback
--- a/storage/mozStorageAsyncStatement.cpp
+++ b/storage/mozStorageAsyncStatement.cpp
@@ -22,17 +22,17 @@
 #include "mozStorageAsyncStatementParams.h"
 #include "mozStoragePrivateHelpers.h"
 #include "mozStorageStatementRow.h"
 #include "mozStorageStatement.h"
 #include "nsDOMClassInfo.h"
 
 #include "mozilla/Logging.h"
 
-extern mozilla::LazyLogModule gStorageLog;
+extern PRLogModuleInfo *gStorageLog;
 
 namespace mozilla {
 namespace storage {
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsIClassInfo
 
 NS_IMPL_CI_INTERFACE_GETTER(AsyncStatement,
--- a/storage/mozStorageConnection.cpp
+++ b/storage/mozStorageConnection.cpp
@@ -44,17 +44,17 @@
 #include "nsProxyRelease.h"
 #include <algorithm>
 
 #define MIN_AVAILABLE_BYTES_PER_CHUNKED_GROWTH 524288000 // 500 MiB
 
 // Maximum size of the pages cache per connection.
 #define MAX_CACHE_SIZE_KIBIBYTES 2048 // 2 MiB
 
-mozilla::LazyLogModule gStorageLog("mozStorage");
+PRLogModuleInfo* gStorageLog = nullptr;
 
 // Checks that the protected code is running on the main-thread only if the
 // connection was also opened on it.
 #ifdef DEBUG
 #define CHECK_MAINTHREAD_ABUSE() \
   do { \
     nsCOMPtr<nsIThread> mainThread = do_GetMainThread(); \
     NS_WARN_IF_FALSE(threadOpenedOn == mainThread || !NS_IsMainThread(), \
@@ -687,16 +687,19 @@ Connection::initializeInternal()
   if (mTelemetryFilename.IsEmpty()) {
     mTelemetryFilename = getFilename();
     MOZ_ASSERT(!mTelemetryFilename.IsEmpty());
   }
 
   // Properly wrap the database handle's mutex.
   sharedDBMutex.initWithMutex(sqlite3_db_mutex(mDBConn));
 
+  if (!gStorageLog)
+    gStorageLog = ::PR_NewLogModule("mozStorage");
+
   // SQLite tracing can slow down queries (especially long queries)
   // significantly. Don't trace unless the user is actively monitoring SQLite.
   if (MOZ_LOG_TEST(gStorageLog, LogLevel::Debug)) {
     ::sqlite3_trace(mDBConn, tracefunc, this);
 
     MOZ_LOG(gStorageLog, LogLevel::Debug, ("Opening connection to '%s' (%p)",
                                         mTelemetryFilename.get(), this));
   }
--- a/storage/mozStoragePrivateHelpers.cpp
+++ b/storage/mozStoragePrivateHelpers.cpp
@@ -19,17 +19,17 @@
 
 #include "Variant.h"
 #include "mozStoragePrivateHelpers.h"
 #include "mozIStorageStatement.h"
 #include "mozIStorageCompletionCallback.h"
 #include "mozIStorageBindingParams.h"
 
 #include "mozilla/Logging.h"
-extern mozilla::LazyLogModule gStorageLog;
+extern PRLogModuleInfo* gStorageLog;
 
 namespace mozilla {
 namespace storage {
 
 nsresult
 convertResultCode(int aSQLiteResultCode)
 {
   // Drop off the extended result bits of the result code.
--- a/storage/mozStorageStatement.cpp
+++ b/storage/mozStorageStatement.cpp
@@ -23,17 +23,17 @@
 #include "mozStorageStatementRow.h"
 #include "mozStorageStatement.h"
 #include "GeckoProfiler.h"
 #include "nsDOMClassInfo.h"
 
 #include "mozilla/Logging.h"
 
 
-extern mozilla::LazyLogModule gStorageLog;
+extern PRLogModuleInfo* gStorageLog;
 
 namespace mozilla {
 namespace storage {
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsIClassInfo
 
 NS_IMPL_CI_INTERFACE_GETTER(Statement,