Bug 1046841 - Convert xpcom/build/ to Gecko style. r=froydnj
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Wed, 13 Aug 2014 11:45:37 -0700
changeset 220983 4399b34c52596fe8828d2506a02e641f4c878813
parent 220982 6fbd6981ccbf3704a517f2db9ae94f44a825c2fc
child 220984 32ac8061e8868cb3d1ee7a5ade2f71ab4a5c7704
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1046841
milestone34.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 1046841 - Convert xpcom/build/ to Gecko style. r=froydnj
xpcom/build/BinaryPath.h
xpcom/build/FileLocation.cpp
xpcom/build/FileLocation.h
xpcom/build/FrozenFunctions.cpp
xpcom/build/IOInterposer.cpp
xpcom/build/IOInterposer.h
xpcom/build/IOInterposerPrivate.h
xpcom/build/LateWriteChecks.cpp
xpcom/build/LateWriteChecks.h
xpcom/build/MainThreadIOLogger.cpp
xpcom/build/NSPRInterposer.cpp
xpcom/build/Omnijar.cpp
xpcom/build/Omnijar.h
xpcom/build/PoisonIOInterposer.h
xpcom/build/PoisonIOInterposerBase.cpp
xpcom/build/PoisonIOInterposerMac.cpp
xpcom/build/PoisonIOInterposerStub.cpp
xpcom/build/PoisonIOInterposerWin.cpp
xpcom/build/ServiceList.h
xpcom/build/Services.cpp
xpcom/build/nsWindowsDllInterceptor.h
xpcom/build/nsXPCOM.h
xpcom/build/nsXPCOMCID.h
xpcom/build/nsXPCOMPrivate.h
xpcom/build/nsXPCOMStrings.cpp
xpcom/build/nsXPComInit.cpp
xpcom/build/nsXREAppData.h
xpcom/build/nsXULAppAPI.h
xpcom/build/perfprobe.cpp
xpcom/build/perfprobe.h
--- a/xpcom/build/BinaryPath.h
+++ b/xpcom/build/BinaryPath.h
@@ -12,145 +12,160 @@
 #include <CoreFoundation/CoreFoundation.h>
 #elif defined(XP_UNIX)
 #include <sys/stat.h>
 #include <string.h>
 #endif
 
 namespace mozilla {
 
-class BinaryPath {
+class BinaryPath
+{
 public:
 #ifdef XP_WIN
-  static nsresult Get(const char *argv0, char aResult[MAXPATHLEN])
+  static nsresult Get(const char* argv0, char aResult[MAXPATHLEN])
   {
     wchar_t wide_path[MAXPATHLEN];
     nsresult rv = GetW(argv0, wide_path);
-    if (NS_FAILED(rv))
+    if (NS_FAILED(rv)) {
       return rv;
+    }
     WideCharToMultiByte(CP_UTF8, 0, wide_path, -1,
                         aResult, MAXPATHLEN, nullptr, nullptr);
     return NS_OK;
   }
 
 private:
-  static nsresult GetW(const char *argv0, wchar_t aResult[MAXPATHLEN])
+  static nsresult GetW(const char* argv0, wchar_t aResult[MAXPATHLEN])
   {
-    if (::GetModuleFileNameW(0, aResult, MAXPATHLEN))
+    if (::GetModuleFileNameW(0, aResult, MAXPATHLEN)) {
       return NS_OK;
+    }
     return NS_ERROR_FAILURE;
   }
 
 #elif defined(XP_MACOSX)
-  static nsresult Get(const char *argv0, char aResult[MAXPATHLEN])
+  static nsresult Get(const char* argv0, char aResult[MAXPATHLEN])
   {
     // Works even if we're not bundled.
     CFBundleRef appBundle = CFBundleGetMainBundle();
-    if (!appBundle)
+    if (!appBundle) {
       return NS_ERROR_FAILURE;
+    }
 
     CFURLRef executableURL = CFBundleCopyExecutableURL(appBundle);
-    if (!executableURL)
+    if (!executableURL) {
       return NS_ERROR_FAILURE;
+    }
 
     nsresult rv;
-    if (CFURLGetFileSystemRepresentation(executableURL, false, (UInt8 *)aResult, MAXPATHLEN))
+    if (CFURLGetFileSystemRepresentation(executableURL, false, (UInt8*)aResult,
+                                         MAXPATHLEN)) {
       rv = NS_OK;
-    else
+    } else {
       rv = NS_ERROR_FAILURE;
+    }
     CFRelease(executableURL);
     return rv;
   }
 
 #elif defined(ANDROID)
-  static nsresult Get(const char *argv0, char aResult[MAXPATHLEN])
+  static nsresult Get(const char* argv0, char aResult[MAXPATHLEN])
   {
     // On Android, we use the GRE_HOME variable that is set by the Java
     // bootstrap code.
-    const char *greHome = getenv("GRE_HOME");
+    const char* greHome = getenv("GRE_HOME");
 #if defined(MOZ_WIDGET_GONK)
-    if (!greHome)
+    if (!greHome) {
       greHome = "/system/b2g";
+    }
 #endif
 
-    if (!greHome)
+    if (!greHome) {
       return NS_ERROR_FAILURE;
+    }
 
     snprintf(aResult, MAXPATHLEN, "%s/%s", greHome, "dummy");
-    aResult[MAXPATHLEN-1] = '\0';
+    aResult[MAXPATHLEN - 1] = '\0';
     return NS_OK;
   }
 
 #elif defined(XP_UNIX)
-  static nsresult Get(const char *argv0, char aResult[MAXPATHLEN])
+  static nsresult Get(const char* aArgv0, char aResult[MAXPATHLEN])
   {
     struct stat fileStat;
     // on unix, there is no official way to get the path of the current binary.
     // instead of using the MOZILLA_FIVE_HOME hack, which doesn't scale to
     // multiple applications, we will try a series of techniques:
     //
     // 1) use realpath() on argv[0], which works unless we're loaded from the
     //    PATH. Only do so if argv[0] looks like a path (contains a /).
     // 2) manually walk through the PATH and look for ourself
     // 3) give up
-    if (strchr(argv0, '/') && realpath(argv0, aResult) &&
-        stat(aResult, &fileStat) == 0)
+    if (strchr(aArgv0, '/') && realpath(aArgv0, aResult) &&
+        stat(aResult, &fileStat) == 0) {
       return NS_OK;
+    }
 
-    const char *path = getenv("PATH");
-    if (!path)
+    const char* path = getenv("PATH");
+    if (!path) {
       return NS_ERROR_FAILURE;
+    }
 
-    char *pathdup = strdup(path);
-    if (!pathdup)
+    char* pathdup = strdup(path);
+    if (!pathdup) {
       return NS_ERROR_OUT_OF_MEMORY;
+    }
 
     bool found = false;
-    char *token = strtok(pathdup, ":");
+    char* token = strtok(pathdup, ":");
     while (token) {
       char tmpPath[MAXPATHLEN];
-      sprintf(tmpPath, "%s/%s", token, argv0);
+      sprintf(tmpPath, "%s/%s", token, aArgv0);
       if (realpath(tmpPath, aResult) && stat(aResult, &fileStat) == 0) {
         found = true;
         break;
       }
       token = strtok(nullptr, ":");
     }
     free(pathdup);
-    if (found)
+    if (found) {
       return NS_OK;
+    }
     return NS_ERROR_FAILURE;
   }
 
 #else
 #error Oops, you need platform-specific code here
 #endif
 
 public:
-  static nsresult GetFile(const char *argv0, nsIFile* *aResult)
+  static nsresult GetFile(const char* aArgv0, nsIFile** aResult)
   {
     nsCOMPtr<nsIFile> lf;
 #ifdef XP_WIN
     wchar_t exePath[MAXPATHLEN];
-    nsresult rv = GetW(argv0, exePath);
+    nsresult rv = GetW(aArgv0, exePath);
 #else
     char exePath[MAXPATHLEN];
-    nsresult rv = Get(argv0, exePath);
+    nsresult rv = Get(aArgv0, exePath);
 #endif
-    if (NS_FAILED(rv))
+    if (NS_FAILED(rv)) {
       return rv;
+    }
 #ifdef XP_WIN
     rv = NS_NewLocalFile(nsDependentString(exePath), true,
                          getter_AddRefs(lf));
 #else
     rv = NS_NewNativeLocalFile(nsDependentCString(exePath), true,
                                getter_AddRefs(lf));
 #endif
-    if (NS_FAILED(rv))
+    if (NS_FAILED(rv)) {
       return rv;
+    }
     NS_ADDREF(*aResult = lf);
     return NS_OK;
   }
 };
 
 }
 
 #endif /* mozilla_BinaryPath_h */
--- a/xpcom/build/FileLocation.cpp
+++ b/xpcom/build/FileLocation.cpp
@@ -11,195 +11,204 @@ namespace mozilla {
 FileLocation::FileLocation()
 {
 }
 
 FileLocation::~FileLocation()
 {
 }
 
-FileLocation::FileLocation(nsIFile* file)
+FileLocation::FileLocation(nsIFile* aFile)
 {
-  Init(file);
+  Init(aFile);
 }
 
-FileLocation::FileLocation(nsIFile* file, const char *path)
+FileLocation::FileLocation(nsIFile* aFile, const char* aPath)
 {
-  Init(file, path);
+  Init(aFile, aPath);
 }
 
-FileLocation::FileLocation(const FileLocation &file, const char *path)
+FileLocation::FileLocation(const FileLocation& aFile, const char* aPath)
 {
-  if (file.IsZip()) {
-    if (file.mBaseFile) {
-      Init(file.mBaseFile, file.mPath.get());
+  if (aFile.IsZip()) {
+    if (aFile.mBaseFile) {
+      Init(aFile.mBaseFile, aFile.mPath.get());
     } else {
-      Init(file.mBaseZip, file.mPath.get());
+      Init(aFile.mBaseZip, aFile.mPath.get());
     }
-    if (path) {
+    if (aPath) {
       int32_t i = mPath.RFindChar('/');
       if (kNotFound == i) {
         mPath.Truncate(0);
       } else {
         mPath.Truncate(i + 1);
       }
-      mPath += path;
+      mPath += aPath;
     }
   } else {
-    if (path) {
+    if (aPath) {
       nsCOMPtr<nsIFile> cfile;
-      file.mBaseFile->GetParent(getter_AddRefs(cfile));
+      aFile.mBaseFile->GetParent(getter_AddRefs(cfile));
 
 #if defined(XP_WIN)
-      nsAutoCString pathStr(path);
-      char *p;
+      nsAutoCString pathStr(aPath);
+      char* p;
       uint32_t len = pathStr.GetMutableData(&p);
       for (; len; ++p, --len) {
         if ('/' == *p) {
-            *p = '\\';
+          *p = '\\';
         }
       }
       cfile->AppendRelativeNativePath(pathStr);
 #else
-      cfile->AppendRelativeNativePath(nsDependentCString(path));
+      cfile->AppendRelativeNativePath(nsDependentCString(aPath));
 #endif
       Init(cfile);
     } else {
-      Init(file.mBaseFile);
+      Init(aFile.mBaseFile);
     }
   }
 }
 
 void
-FileLocation::Init(nsIFile* file)
+FileLocation::Init(nsIFile* aFile)
 {
   mBaseZip = nullptr;
-  mBaseFile = file;
+  mBaseFile = aFile;
   mPath.Truncate();
 }
 
 void
-FileLocation::Init(nsIFile* file, const char* path)
+FileLocation::Init(nsIFile* aFile, const char* aPath)
 {
   mBaseZip = nullptr;
-  mBaseFile = file;
-  mPath = path;
+  mBaseFile = aFile;
+  mPath = aPath;
 }
 
 void
-FileLocation::Init(nsZipArchive* zip, const char* path)
+FileLocation::Init(nsZipArchive* aZip, const char* aPath)
 {
-  mBaseZip = zip;
+  mBaseZip = aZip;
   mBaseFile = nullptr;
-  mPath = path;
+  mPath = aPath;
 }
 
 void
-FileLocation::GetURIString(nsACString &result) const
+FileLocation::GetURIString(nsACString& aResult) const
 {
   if (mBaseFile) {
-    net_GetURLSpecFromActualFile(mBaseFile, result);
+    net_GetURLSpecFromActualFile(mBaseFile, aResult);
   } else if (mBaseZip) {
     nsRefPtr<nsZipHandle> handler = mBaseZip->GetFD();
-    handler->mFile.GetURIString(result);
+    handler->mFile.GetURIString(aResult);
   }
   if (IsZip()) {
-    result.Insert("jar:", 0);
-    result += "!/";
-    result += mPath;
+    aResult.Insert("jar:", 0);
+    aResult += "!/";
+    aResult += mPath;
   }
 }
 
 already_AddRefed<nsIFile>
 FileLocation::GetBaseFile()
 {
   if (IsZip() && mBaseZip) {
     nsRefPtr<nsZipHandle> handler = mBaseZip->GetFD();
-    if (handler)
+    if (handler) {
       return handler->mFile.GetBaseFile();
+    }
     return nullptr;
   }
 
   nsCOMPtr<nsIFile> file = mBaseFile;
   return file.forget();
 }
 
 bool
-FileLocation::Equals(const FileLocation &file) const
+FileLocation::Equals(const FileLocation& aFile) const
 {
-  if (mPath != file.mPath)
+  if (mPath != aFile.mPath) {
     return false;
-
-  if (mBaseFile && file.mBaseFile) {
-    bool eq;
-    return NS_SUCCEEDED(mBaseFile->Equals(file.mBaseFile, &eq)) && eq;
   }
 
-  const FileLocation *a = this, *b = &file;
+  if (mBaseFile && aFile.mBaseFile) {
+    bool eq;
+    return NS_SUCCEEDED(mBaseFile->Equals(aFile.mBaseFile, &eq)) && eq;
+  }
+
+  const FileLocation* a = this;
+  const FileLocation* b = &aFile;
   if (a->mBaseZip) {
     nsRefPtr<nsZipHandle> handler = a->mBaseZip->GetFD();
     a = &handler->mFile;
   }
   if (b->mBaseZip) {
     nsRefPtr<nsZipHandle> handler = b->mBaseZip->GetFD();
     b = &handler->mFile;
   }
   return a->Equals(*b);
 }
 
 nsresult
-FileLocation::GetData(Data &data)
+FileLocation::GetData(Data& aData)
 {
   if (!IsZip()) {
-    return mBaseFile->OpenNSPRFileDesc(PR_RDONLY, 0444, &data.mFd.rwget());
+    return mBaseFile->OpenNSPRFileDesc(PR_RDONLY, 0444, &aData.mFd.rwget());
   }
-  data.mZip = mBaseZip;
-  if (!data.mZip) {
-    data.mZip = new nsZipArchive();
-    data.mZip->OpenArchive(mBaseFile);
+  aData.mZip = mBaseZip;
+  if (!aData.mZip) {
+    aData.mZip = new nsZipArchive();
+    aData.mZip->OpenArchive(mBaseFile);
   }
-  data.mItem = data.mZip->GetItem(mPath.get());
-  if (data.mItem)
+  aData.mItem = aData.mZip->GetItem(mPath.get());
+  if (aData.mItem) {
     return NS_OK;
+  }
   return NS_ERROR_FILE_UNRECOGNIZED_PATH;
 }
 
 nsresult
-FileLocation::Data::GetSize(uint32_t *result)
+FileLocation::Data::GetSize(uint32_t* aResult)
 {
   if (mFd) {
     PRFileInfo64 fileInfo;
-    if (PR_SUCCESS != PR_GetOpenFileInfo64(mFd, &fileInfo))
+    if (PR_SUCCESS != PR_GetOpenFileInfo64(mFd, &fileInfo)) {
       return NS_ErrorAccordingToNSPR();
+    }
 
-    if (fileInfo.size > int64_t(UINT32_MAX))
+    if (fileInfo.size > int64_t(UINT32_MAX)) {
       return NS_ERROR_FILE_TOO_BIG;
+    }
 
-    *result = fileInfo.size;
+    *aResult = fileInfo.size;
     return NS_OK;
   } else if (mItem) {
-    *result = mItem->RealSize();
+    *aResult = mItem->RealSize();
     return NS_OK;
   }
   return NS_ERROR_NOT_INITIALIZED;
 }
 
 nsresult
-FileLocation::Data::Copy(char *buf, uint32_t len)
+FileLocation::Data::Copy(char* aBuf, uint32_t aLen)
 {
   if (mFd) {
-    for (uint32_t totalRead = 0; totalRead < len; ) {
-      int32_t read = PR_Read(mFd, buf + totalRead, XPCOM_MIN(len - totalRead, uint32_t(INT32_MAX)));
-      if (read < 0)
+    for (uint32_t totalRead = 0; totalRead < aLen;) {
+      int32_t read = PR_Read(mFd, aBuf + totalRead,
+                             XPCOM_MIN(aLen - totalRead, uint32_t(INT32_MAX)));
+      if (read < 0) {
         return NS_ErrorAccordingToNSPR();
+      }
       totalRead += read;
     }
     return NS_OK;
   } else if (mItem) {
-    nsZipCursor cursor(mItem, mZip, reinterpret_cast<uint8_t *>(buf), len, true);
+    nsZipCursor cursor(mItem, mZip, reinterpret_cast<uint8_t*>(aBuf),
+                       aLen, true);
     uint32_t readLen;
     cursor.Copy(&readLen);
-    return (readLen == len) ? NS_OK : NS_ERROR_FILE_CORRUPTED;
+    return (readLen == aLen) ? NS_OK : NS_ERROR_FILE_CORRUPTED;
   }
   return NS_ERROR_NOT_INITIALIZED;
 }
 
 } /* namespace mozilla */
--- a/xpcom/build/FileLocation.h
+++ b/xpcom/build/FileLocation.h
@@ -31,110 +31,101 @@ public:
    * of a file path.
    */
   FileLocation();
   ~FileLocation();
 
   /**
    * Constructor for plain files
    */
-  explicit FileLocation(nsIFile *file);
+  explicit FileLocation(nsIFile* aFile);
 
   /**
    * Constructors for path within an archive. The archive can be given either
    * as nsIFile or nsZipArchive.
    */
-  FileLocation(nsIFile *zip, const char *path);
+  FileLocation(nsIFile* aZip, const char* aPath);
 
-  FileLocation(nsZipArchive *zip, const char *path);
+  FileLocation(nsZipArchive* aZip, const char* aPath);
 
   /**
    * Creates a new file location relative to another one.
    */
-  FileLocation(const FileLocation &file, const char *path = nullptr);
+  FileLocation(const FileLocation& aFile, const char* aPath = nullptr);
 
   /**
    * Initialization functions corresponding to constructors
    */
-  void Init(nsIFile *file);
+  void Init(nsIFile* aFile);
 
-  void Init(nsIFile *zip, const char *path);
+  void Init(nsIFile* aZip, const char* aPath);
 
-  void Init(nsZipArchive *zip, const char *path);
+  void Init(nsZipArchive* aZip, const char* aPath);
 
   /**
    * Returns an URI string corresponding to the file location
    */
-  void GetURIString(nsACString &result) const;
+  void GetURIString(nsACString& aResult) const;
 
   /**
    * Returns the base file of the location, where base file is defined as:
    * - The file itself when the location is on a filesystem
    * - The archive file when the location is in an archive
    * - The outer archive file when the location is in an archive in an archive
    */
   already_AddRefed<nsIFile> GetBaseFile();
 
   /**
    * Returns whether the "base file" (see GetBaseFile) is an archive
    */
-  bool IsZip() const
-  {
-    return !mPath.IsEmpty();
-  }
+  bool IsZip() const { return !mPath.IsEmpty(); }
 
   /**
    * Returns the path within the archive, when within an archive
    */
-  void GetPath(nsACString &result) const
-  {
-    result = mPath;
-  }
+  void GetPath(nsACString& aResult) const { aResult = mPath; }
 
   /**
    * Boolean value corresponding to whether the file location is initialized
    * or not.
    */
-  operator bool() const
-  {
-    return mBaseFile || mBaseZip;
-  }
+  operator bool() const { return mBaseFile || mBaseZip; }
 
   /**
    * Returns whether another FileLocation points to the same resource
    */
-  bool Equals(const FileLocation &file) const;
+  bool Equals(const FileLocation& aFile) const;
 
   /**
    * Data associated with a FileLocation.
    */
   class Data
   {
   public:
     /**
      * Returns the data size
      */
-    nsresult GetSize(uint32_t *result);
+    nsresult GetSize(uint32_t* aResult);
 
     /**
      * Copies the data in the given buffer
      */
-    nsresult Copy(char *buf, uint32_t len);
+    nsresult Copy(char* aBuf, uint32_t aLen);
   protected:
     friend class FileLocation;
-    nsZipItem *mItem;
+    nsZipItem* mItem;
     nsRefPtr<nsZipArchive> mZip;
     mozilla::AutoFDClose mFd;
   };
 
   /**
    * Returns the data associated with the resource pointed at by the file
    * location.
    */
-  nsresult GetData(Data &data);
+  nsresult GetData(Data& aData);
 private:
   nsCOMPtr<nsIFile> mBaseFile;
   nsRefPtr<nsZipArchive> mBaseZip;
   nsCString mPath;
 }; /* class FileLocation */
 
 } /* namespace mozilla */
 
--- a/xpcom/build/FrozenFunctions.cpp
+++ b/xpcom/build/FrozenFunctions.cpp
@@ -6,128 +6,131 @@
 #include "nsXPCOMPrivate.h"
 #include "nsXPCOMStrings.h"
 #include "xptcall.h"
 
 #include <string.h>
 
 /**
  * Private Method to register an exit routine.  This method
- * used to allow you to setup a callback that will be called from 
- * the NS_ShutdownXPCOM function after all services and 
+ * used to allow you to setup a callback that will be called from
+ * the NS_ShutdownXPCOM function after all services and
  * components have gone away. It was fatally flawed in that the component
  * DLL could be released before the exit function was called; it is now a
  * stub implementation that does nothing.
  */
 XPCOM_API(nsresult)
-NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine, uint32_t priority);
+NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine aExitRoutine, uint32_t aPriority);
 
 XPCOM_API(nsresult)
-NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine);
+NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine aExitRoutine);
 
 static const XPCOMFunctions kFrozenFunctions = {
-    XPCOM_GLUE_VERSION,
-    sizeof(XPCOMFunctions),
-    &NS_InitXPCOM2,
-    &NS_ShutdownXPCOM,
-    &NS_GetServiceManager,
-    &NS_GetComponentManager,
-    &NS_GetComponentRegistrar,
-    &NS_GetMemoryManager,
-    &NS_NewLocalFile,
-    &NS_NewNativeLocalFile,
-    &NS_RegisterXPCOMExitRoutine,
-    &NS_UnregisterXPCOMExitRoutine,
+  XPCOM_GLUE_VERSION,
+  sizeof(XPCOMFunctions),
+  &NS_InitXPCOM2,
+  &NS_ShutdownXPCOM,
+  &NS_GetServiceManager,
+  &NS_GetComponentManager,
+  &NS_GetComponentRegistrar,
+  &NS_GetMemoryManager,
+  &NS_NewLocalFile,
+  &NS_NewNativeLocalFile,
+  &NS_RegisterXPCOMExitRoutine,
+  &NS_UnregisterXPCOMExitRoutine,
 
-    // these functions were added post 1.4
-    &NS_GetDebug,
-    nullptr,
+  // these functions were added post 1.4
+  &NS_GetDebug,
+  nullptr,
 
-    // these functions were added post 1.6
-    &NS_StringContainerInit,
-    &NS_StringContainerFinish,
-    &NS_StringGetData,
-    &NS_StringSetData,
-    &NS_StringSetDataRange,
-    &NS_StringCopy,
-    &NS_CStringContainerInit,
-    &NS_CStringContainerFinish,
-    &NS_CStringGetData,
-    &NS_CStringSetData,
-    &NS_CStringSetDataRange,
-    &NS_CStringCopy,
-    &NS_CStringToUTF16,
-    &NS_UTF16ToCString,
-    &NS_StringCloneData,
-    &NS_CStringCloneData,
+  // these functions were added post 1.6
+  &NS_StringContainerInit,
+  &NS_StringContainerFinish,
+  &NS_StringGetData,
+  &NS_StringSetData,
+  &NS_StringSetDataRange,
+  &NS_StringCopy,
+  &NS_CStringContainerInit,
+  &NS_CStringContainerFinish,
+  &NS_CStringGetData,
+  &NS_CStringSetData,
+  &NS_CStringSetDataRange,
+  &NS_CStringCopy,
+  &NS_CStringToUTF16,
+  &NS_UTF16ToCString,
+  &NS_StringCloneData,
+  &NS_CStringCloneData,
 
-    // these functions were added post 1.7 (post Firefox 1.0)
-    &NS_Alloc,
-    &NS_Realloc,
-    &NS_Free,
-    &NS_StringContainerInit2,
-    &NS_CStringContainerInit2,
-    &NS_StringGetMutableData,
-    &NS_CStringGetMutableData,
-    nullptr,
+  // these functions were added post 1.7 (post Firefox 1.0)
+  &NS_Alloc,
+  &NS_Realloc,
+  &NS_Free,
+  &NS_StringContainerInit2,
+  &NS_CStringContainerInit2,
+  &NS_StringGetMutableData,
+  &NS_CStringGetMutableData,
+  nullptr,
 
-    // these functions were added post 1.8
-    &NS_DebugBreak,
-    &NS_LogInit,
-    &NS_LogTerm,
-    &NS_LogAddRef,
-    &NS_LogRelease,
-    &NS_LogCtor,
-    &NS_LogDtor,
-    &NS_LogCOMPtrAddRef,
-    &NS_LogCOMPtrRelease,
-    &NS_GetXPTCallStub,
-    &NS_DestroyXPTCallStub,
-    &NS_InvokeByIndex,
-    nullptr,
-    nullptr,
-    &NS_StringSetIsVoid,
-    &NS_StringGetIsVoid,
-    &NS_CStringSetIsVoid,
-    &NS_CStringGetIsVoid,
+  // these functions were added post 1.8
+  &NS_DebugBreak,
+  &NS_LogInit,
+  &NS_LogTerm,
+  &NS_LogAddRef,
+  &NS_LogRelease,
+  &NS_LogCtor,
+  &NS_LogDtor,
+  &NS_LogCOMPtrAddRef,
+  &NS_LogCOMPtrRelease,
+  &NS_GetXPTCallStub,
+  &NS_DestroyXPTCallStub,
+  &NS_InvokeByIndex,
+  nullptr,
+  nullptr,
+  &NS_StringSetIsVoid,
+  &NS_StringGetIsVoid,
+  &NS_CStringSetIsVoid,
+  &NS_CStringGetIsVoid,
 
-    // these functions were added post 1.9, but then made obsolete
-    nullptr,
-    nullptr,
+  // these functions were added post 1.9, but then made obsolete
+  nullptr,
+  nullptr,
 
-    &NS_CycleCollectorSuspect3,
+  &NS_CycleCollectorSuspect3,
 };
 
 EXPORT_XPCOM_API(nsresult)
-NS_GetFrozenFunctions(XPCOMFunctions *functions, const char* /* libraryPath */)
+NS_GetFrozenFunctions(XPCOMFunctions* aFunctions, const char* /* aLibraryPath */)
 {
-    if (!functions)
-        return NS_ERROR_OUT_OF_MEMORY;
+  if (!aFunctions) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
 
-    if (functions->version != XPCOM_GLUE_VERSION)
-        return NS_ERROR_FAILURE;
+  if (aFunctions->version != XPCOM_GLUE_VERSION) {
+    return NS_ERROR_FAILURE;
+  }
 
-    uint32_t size = functions->size;
-    if (size > sizeof(XPCOMFunctions))
-        size = sizeof(XPCOMFunctions);
+  uint32_t size = aFunctions->size;
+  if (size > sizeof(XPCOMFunctions)) {
+    size = sizeof(XPCOMFunctions);
+  }
 
-    size -= offsetof(XPCOMFunctions, init);
+  size -= offsetof(XPCOMFunctions, init);
 
-    memcpy(&functions->init, &kFrozenFunctions.init, size);
+  memcpy(&aFunctions->init, &kFrozenFunctions.init, size);
 
-    return NS_OK;
+  return NS_OK;
 }
 
 /*
  * Stubs for nsXPCOMPrivate.h
  */
 
 EXPORT_XPCOM_API(nsresult)
-NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine, uint32_t priority)
+NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine aExitRoutine, uint32_t aPriority)
 {
   return NS_OK;
 }
 
 EXPORT_XPCOM_API(nsresult)
-NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine)
+NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine aExitRoutine)
 {
   return NS_OK;
 }
--- a/xpcom/build/IOInterposer.cpp
+++ b/xpcom/build/IOInterposer.cpp
@@ -21,44 +21,44 @@
 #include "PoisonIOInterposer.h"
 
 using namespace mozilla;
 
 namespace {
 
 /** Find if a vector contains a specific element */
 template<class T>
-bool VectorContains(const std::vector<T>& vector, const T& element)
+bool
+VectorContains(const std::vector<T>& aVector, const T& aElement)
 {
-  return std::find(vector.begin(), vector.end(), element) != vector.end();
+  return std::find(aVector.begin(), aVector.end(), aElement) != aVector.end();
 }
 
 /** Remove element from a vector */
 template<class T>
-void VectorRemove(std::vector<T>& vector, const T& element)
+void
+VectorRemove(std::vector<T>& aVector, const T& aElement)
 {
-  typename std::vector<T>::iterator newEnd = std::remove(vector.begin(),
-                                                         vector.end(), element);
-  vector.erase(newEnd, vector.end());
+  typename std::vector<T>::iterator newEnd =
+    std::remove(aVector.begin(), aVector.end(), aElement);
+  aVector.erase(newEnd, aVector.end());
 }
 
 /** Lists of Observers */
 struct ObserverLists
 {
 private:
   ~ObserverLists() {}
 
 public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ObserverLists)
 
-  ObserverLists()
-  {
-  }
+  ObserverLists() {}
 
-  ObserverLists(ObserverLists const & aOther)
+  ObserverLists(ObserverLists const& aOther)
     : mCreateObservers(aOther.mCreateObservers)
     , mReadObservers(aOther.mReadObservers)
     , mWriteObservers(aOther.mWriteObservers)
     , mFSyncObservers(aOther.mFSyncObservers)
     , mStatObservers(aOther.mStatObservers)
     , mCloseObservers(aOther.mCloseObservers)
     , mStageObservers(aOther.mStageObservers)
   {
@@ -87,104 +87,77 @@ public:
     MOZ_COUNT_CTOR(PerThreadData);
   }
 
   ~PerThreadData()
   {
     MOZ_COUNT_DTOR(PerThreadData);
   }
 
-  void
-  CallObservers(IOInterposeObserver::Observation& aObservation)
+  void CallObservers(IOInterposeObserver::Observation& aObservation)
   {
     // Prevent recursive reporting.
     if (mIsHandlingObservation) {
       return;
     }
 
     mIsHandlingObservation = true;
     // Decide which list of observers to inform
     std::vector<IOInterposeObserver*>* observers = nullptr;
     switch (aObservation.ObservedOperation()) {
       case IOInterposeObserver::OpCreateOrOpen:
-        {
-          observers = &mObserverLists->mCreateObservers;
-        }
+        observers = &mObserverLists->mCreateObservers;
         break;
       case IOInterposeObserver::OpRead:
-        {
-          observers = &mObserverLists->mReadObservers;
-        }
+        observers = &mObserverLists->mReadObservers;
         break;
       case IOInterposeObserver::OpWrite:
-        {
-          observers = &mObserverLists->mWriteObservers;
-        }
+        observers = &mObserverLists->mWriteObservers;
         break;
       case IOInterposeObserver::OpFSync:
-        {
-          observers = &mObserverLists->mFSyncObservers;
-        }
+        observers = &mObserverLists->mFSyncObservers;
         break;
       case IOInterposeObserver::OpStat:
-        {
-          observers = &mObserverLists->mStatObservers;
-        }
+        observers = &mObserverLists->mStatObservers;
         break;
       case IOInterposeObserver::OpClose:
-        {
-          observers = &mObserverLists->mCloseObservers;
-        }
+        observers = &mObserverLists->mCloseObservers;
         break;
       case IOInterposeObserver::OpNextStage:
-        {
-          observers = &mObserverLists->mStageObservers;
-        }
+        observers = &mObserverLists->mStageObservers;
         break;
-      default:
-        {
-          // Invalid IO operation, see documentation comment for
-          // IOInterposer::Report()
-          MOZ_ASSERT(false);
-          // Just ignore it in non-debug builds.
-          return;
-        }
+      default: {
+        // Invalid IO operation, see documentation comment for
+        // IOInterposer::Report()
+        MOZ_ASSERT(false);
+        // Just ignore it in non-debug builds.
+        return;
+      }
     }
     MOZ_ASSERT(observers);
 
     // Inform observers
-    for (std::vector<IOInterposeObserver*>::iterator i = observers->begin(),
-         e = observers->end(); i != e; ++i)
-    {
+    for (auto i = observers->begin(), e = observers->end(); i != e; ++i) {
       (*i)->Observe(aObservation);
     }
     mIsHandlingObservation = false;
   }
 
-  inline uint32_t
-  GetCurrentGeneration() const
-  {
-    return mCurrentGeneration;
-  }
+  inline uint32_t GetCurrentGeneration() const { return mCurrentGeneration; }
 
-  inline bool
-  IsMainThread() const
-  {
-    return mIsMainThread;
-  }
+  inline bool IsMainThread() const { return mIsMainThread; }
 
-  inline void
-  SetObserverLists(uint32_t aNewGeneration, RefPtr<ObserverLists>& aNewLists)
+  inline void SetObserverLists(uint32_t aNewGeneration,
+                               RefPtr<ObserverLists>& aNewLists)
   {
     mCurrentGeneration = aNewGeneration;
     mObserverLists = aNewLists;
   }
 
-  inline void
-  ClearObserverLists()
+  inline void ClearObserverLists()
   {
     if (mObserverLists) {
       mCurrentGeneration = 0;
       mObserverLists = nullptr;
     }
   }
 
 private:
@@ -204,24 +177,20 @@ public:
     MOZ_COUNT_CTOR(MasterList);
   }
 
   ~MasterList()
   {
     MOZ_COUNT_DTOR(MasterList);
   }
 
-  inline void
-  Disable()
-  {
-    mIsEnabled = false;
-  }
+  inline void Disable() { mIsEnabled = false; }
 
-  void
-  Register(IOInterposeObserver::Operation aOp, IOInterposeObserver* aObserver)
+  void Register(IOInterposeObserver::Operation aOp,
+                IOInterposeObserver* aObserver)
   {
     IOInterposer::AutoLock lock(mLock);
 
     ObserverLists* newLists = nullptr;
     if (mObserverLists) {
       newLists = new ObserverLists(*mObserverLists);
     } else {
       newLists = new ObserverLists();
@@ -252,102 +221,106 @@ public:
         !VectorContains(newLists->mCloseObservers, aObserver)) {
       newLists->mCloseObservers.push_back(aObserver);
     }
     if (aOp & IOInterposeObserver::OpNextStage &&
         !VectorContains(newLists->mStageObservers, aObserver)) {
       newLists->mStageObservers.push_back(aObserver);
     }
     mObserverLists = newLists;
-    mObservedOperations = (IOInterposeObserver::Operation)
-                            (mObservedOperations | aOp);
+    mObservedOperations =
+      (IOInterposeObserver::Operation)(mObservedOperations | aOp);
 
     mCurrentGeneration++;
   }
 
-  void
-  Unregister(IOInterposeObserver::Operation aOp, IOInterposeObserver* aObserver)
+  void Unregister(IOInterposeObserver::Operation aOp,
+                  IOInterposeObserver* aObserver)
   {
     IOInterposer::AutoLock lock(mLock);
 
     ObserverLists* newLists = nullptr;
     if (mObserverLists) {
       newLists = new ObserverLists(*mObserverLists);
     } else {
       newLists = new ObserverLists();
     }
 
     if (aOp & IOInterposeObserver::OpCreateOrOpen) {
       VectorRemove(newLists->mCreateObservers, aObserver);
       if (newLists->mCreateObservers.empty()) {
-        mObservedOperations = (IOInterposeObserver::Operation)
-                         (mObservedOperations &
-                          ~IOInterposeObserver::OpCreateOrOpen);
+        mObservedOperations =
+          (IOInterposeObserver::Operation)(mObservedOperations &
+                                           ~IOInterposeObserver::OpCreateOrOpen);
       }
     }
     if (aOp & IOInterposeObserver::OpRead) {
       VectorRemove(newLists->mReadObservers, aObserver);
       if (newLists->mReadObservers.empty()) {
-        mObservedOperations = (IOInterposeObserver::Operation)
-                         (mObservedOperations & ~IOInterposeObserver::OpRead);
+        mObservedOperations =
+          (IOInterposeObserver::Operation)(mObservedOperations &
+                                           ~IOInterposeObserver::OpRead);
       }
     }
     if (aOp & IOInterposeObserver::OpWrite) {
       VectorRemove(newLists->mWriteObservers, aObserver);
       if (newLists->mWriteObservers.empty()) {
-        mObservedOperations = (IOInterposeObserver::Operation)
-                         (mObservedOperations & ~IOInterposeObserver::OpWrite);
+        mObservedOperations =
+          (IOInterposeObserver::Operation)(mObservedOperations &
+                                           ~IOInterposeObserver::OpWrite);
       }
     }
     if (aOp & IOInterposeObserver::OpFSync) {
       VectorRemove(newLists->mFSyncObservers, aObserver);
       if (newLists->mFSyncObservers.empty()) {
-        mObservedOperations = (IOInterposeObserver::Operation)
-                         (mObservedOperations & ~IOInterposeObserver::OpFSync);
+        mObservedOperations =
+          (IOInterposeObserver::Operation)(mObservedOperations &
+                                           ~IOInterposeObserver::OpFSync);
       }
     }
     if (aOp & IOInterposeObserver::OpStat) {
       VectorRemove(newLists->mStatObservers, aObserver);
       if (newLists->mStatObservers.empty()) {
-        mObservedOperations = (IOInterposeObserver::Operation)
-                         (mObservedOperations & ~IOInterposeObserver::OpStat);
+        mObservedOperations =
+          (IOInterposeObserver::Operation)(mObservedOperations &
+                                           ~IOInterposeObserver::OpStat);
       }
     }
     if (aOp & IOInterposeObserver::OpClose) {
       VectorRemove(newLists->mCloseObservers, aObserver);
       if (newLists->mCloseObservers.empty()) {
-        mObservedOperations = (IOInterposeObserver::Operation)
-                         (mObservedOperations & ~IOInterposeObserver::OpClose);
+        mObservedOperations =
+          (IOInterposeObserver::Operation)(mObservedOperations &
+                                           ~IOInterposeObserver::OpClose);
       }
     }
     if (aOp & IOInterposeObserver::OpNextStage) {
       VectorRemove(newLists->mStageObservers, aObserver);
       if (newLists->mStageObservers.empty()) {
-        mObservedOperations = (IOInterposeObserver::Operation)
-                         (mObservedOperations & ~IOInterposeObserver::OpNextStage);
+        mObservedOperations =
+          (IOInterposeObserver::Operation)(mObservedOperations &
+                                           ~IOInterposeObserver::OpNextStage);
       }
     }
     mObserverLists = newLists;
     mCurrentGeneration++;
   }
 
-  void
-  Update(PerThreadData &aPtd)
+  void Update(PerThreadData& aPtd)
   {
     if (mCurrentGeneration == aPtd.GetCurrentGeneration()) {
       return;
     }
     // If the generation counts don't match then we need to update the current
     // thread's observer list with the new master list.
     IOInterposer::AutoLock lock(mLock);
     aPtd.SetObserverLists(mCurrentGeneration, mObserverLists);
   }
 
-  inline bool
-  IsObservedOperation(IOInterposeObserver::Operation aOp)
+  inline bool IsObservedOperation(IOInterposeObserver::Operation aOp)
   {
     // The quick reader may observe that no locks are being employed here,
     // hence the result of the operations is truly undefined. However, most
     // computers will usually return either true or false, which is good enough.
     // It is not a problem if we occasionally report more or less IO than is
     // actually occurring.
     return mIsEnabled && !!(mObservedOperations & aOp);
   }
@@ -408,17 +381,17 @@ IOInterposeObserver::Observation::Observ
   , mReference(aReference)
   , mShouldReport(false)
 {
 }
 
 const char*
 IOInterposeObserver::Observation::ObservedOperationString() const
 {
-  switch(mOperation) {
+  switch (mOperation) {
     case OpCreateOrOpen:
       return "create/open";
     case OpRead:
       return "read";
     case OpWrite:
       return "write";
     case OpFSync:
       return "fsync";
@@ -448,18 +421,18 @@ IOInterposer::Init()
   // Don't initialize twice...
   if (sMasterList) {
     return true;
   }
   if (!sThreadLocalData.init()) {
     return false;
   }
 #if defined(XP_WIN)
-  bool isMainThread = XRE_GetWindowsEnvironment() !=
-                        WindowsEnvironmentType_Metro;
+  bool isMainThread =
+    XRE_GetWindowsEnvironment() != WindowsEnvironmentType_Metro;
 #else
   bool isMainThread = true;
 #endif
   RegisterCurrentThread(isMainThread);
   sMasterList = new MasterList();
 
   MainThreadIOLogger::Init();
 
@@ -474,17 +447,17 @@ IOInterposer::Init()
 }
 
 bool
 IOInterposeObserver::IsMainThread()
 {
   if (!sThreadLocalData.initialized()) {
     return false;
   }
-  PerThreadData *ptd = sThreadLocalData.get();
+  PerThreadData* ptd = sThreadLocalData.get();
   if (!ptd) {
     return false;
   }
   return ptd->IsMainThread();
 }
 
 void
 IOInterposer::Clear()
--- a/xpcom/build/IOInterposer.h
+++ b/xpcom/build/IOInterposer.h
@@ -56,71 +56,51 @@ public:
      */
     Observation(Operation aOperation, const TimeStamp& aStart,
                 const TimeStamp& aEnd, const char* aReference);
 
     /**
      * Operation observed, this is one of the individual Operation values.
      * Combinations of these flags are only used when registering observers.
      */
-    Operation ObservedOperation() const
-    {
-      return mOperation;
-    }
+    Operation ObservedOperation() const { return mOperation; }
 
     /**
      * Return the observed operation as a human-readable string.
      */
     const char* ObservedOperationString() const;
 
     /** Time at which the I/O operation was started */
-    TimeStamp Start() const
-    {
-      return mStart;
-    }
+    TimeStamp Start() const { return mStart; }
 
     /**
      * Time at which the I/O operation ended, for asynchronous methods this is
      * the time at which the call initiating the asynchronous request returned.
      */
-    TimeStamp End() const
-    {
-      return mEnd;
-    }
+    TimeStamp End() const { return mEnd; }
 
     /**
      * Duration of the operation, for asynchronous I/O methods this is the
      * duration of the call initiating the asynchronous request.
      */
-    TimeDuration Duration() const
-    {
-      return mEnd - mStart;
-    }
+    TimeDuration Duration() const { return mEnd - mStart; }
 
     /**
      * IO reference, function name or name of component (sqlite) that did IO
      * this is in addition the generic operation. This attribute may be platform
      * specific, but should only take a finite number of distinct values.
      * E.g. sqlite-commit, CreateFile, NtReadFile, fread, fsync, mmap, etc.
      * I.e. typically the platform specific function that did the IO.
      */
-    const char* Reference() const
-    {
-      return mReference;
-    }
+    const char* Reference() const { return mReference; }
 
     /** Request filename associated with the I/O operation, null if unknown */
-    virtual const char16_t* Filename()
-    {
-      return nullptr;
-    }
+    virtual const char16_t* Filename() { return nullptr; }
 
-    virtual ~Observation()
-    {
-    }
+    virtual ~Observation() {}
 
   protected:
     void
     Report();
 
     Operation   mOperation;
     TimeStamp   mStart;
     TimeStamp   mEnd;
@@ -135,145 +115,141 @@ public:
    * likely to cause recursion :)
    * At least, see PoisonIOInterposer.h and register your handle as a debug file
    * even, if you don't initialize the poison IO interposer, someone else might.
    *
    * Remark: Observations may occur on any thread.
    */
   virtual void Observe(Observation& aObservation) = 0;
 
-  virtual ~IOInterposeObserver()
-  {
-  }
+  virtual ~IOInterposeObserver() {}
 
 protected:
   /**
    * We don't use NS_IsMainThread() because we need to be able to determine the
    * main thread outside of XPCOM Initialization. IOInterposer observers should
    * call this function instead.
    */
   static bool IsMainThread();
 };
 
 /**
  * These functions are responsible for ensuring that events are routed to the
  * appropriate observers.
  */
-namespace IOInterposer
-{
-  /**
-   * This function must be called from the main-thread when no other threads are
-   * running before any of the other methods on this class may be used.
-   *
-   * IO reports can however, safely assume that IsObservedOperation() will
-   * return false until the IOInterposer is initialized.
-   *
-   * Remark, it's safe to call this method multiple times, so just call it when
-   * you to utilize IO interposing.
-   *
-   * Using the IOInterposerInit class is preferred to calling this directly.
-   */
-  bool Init();
+namespace IOInterposer {
+
+/**
+ * This function must be called from the main-thread when no other threads are
+ * running before any of the other methods on this class may be used.
+ *
+ * IO reports can however, safely assume that IsObservedOperation() will
+ * return false until the IOInterposer is initialized.
+ *
+ * Remark, it's safe to call this method multiple times, so just call it when
+ * you to utilize IO interposing.
+ *
+ * Using the IOInterposerInit class is preferred to calling this directly.
+ */
+bool Init();
 
-  /**
-   * This function must be called from the main thread, and furthermore
-   * it must be called when no other threads are executing. Effectively
-   * restricting us to calling it only during shutdown.
-   *
-   * Callers should take care that no other consumers are subscribed to events,
-   * as these events will stop when this function is called.
-   *
-   * In practice, we don't use this method as the IOInterposer is used for
-   * late-write checks.
-   */
-  void Clear();
+/**
+ * This function must be called from the main thread, and furthermore
+ * it must be called when no other threads are executing. Effectively
+ * restricting us to calling it only during shutdown.
+ *
+ * Callers should take care that no other consumers are subscribed to events,
+ * as these events will stop when this function is called.
+ *
+ * In practice, we don't use this method as the IOInterposer is used for
+ * late-write checks.
+ */
+void Clear();
 
-  /**
-   * This function immediately disables IOInterposer functionality in a fast,
-   * thread-safe manner. Primarily for use by the crash reporter.
-   */
-  void Disable();
+/**
+ * This function immediately disables IOInterposer functionality in a fast,
+ * thread-safe manner. Primarily for use by the crash reporter.
+ */
+void Disable();
 
-  /**
-   * Report IO to registered observers.
-   * Notice that the reported operation must be either OpRead, OpWrite or
-   * OpFSync. You are not allowed to report an observation with OpWriteFSync or
-   * OpAll, these are just auxiliary values for use with Register().
-   *
-   * If the IO call you're reporting does multiple things, write and fsync, you
-   * can choose to call Report() twice once with write and once with FSync. You
-   * may not call Report() with OpWriteFSync! The Observation::mOperation
-   * attribute is meant to be generic, not perfect.
-   *
-   * Notice that there is no reason to report an observation with an operation
-   * which is not being observed. Use IsObservedOperation() to check if the
-   * operation you are about to report is being observed. This is especially
-   * important if you are constructing expensive observations containing
-   * filename and full-path.
-   *
-   * Remark: Init() must be called before any IO is reported. But
-   * IsObservedOperation() will return false until Init() is called.
-   */
-  void Report(IOInterposeObserver::Observation& aObservation);
+/**
+ * Report IO to registered observers.
+ * Notice that the reported operation must be either OpRead, OpWrite or
+ * OpFSync. You are not allowed to report an observation with OpWriteFSync or
+ * OpAll, these are just auxiliary values for use with Register().
+ *
+ * If the IO call you're reporting does multiple things, write and fsync, you
+ * can choose to call Report() twice once with write and once with FSync. You
+ * may not call Report() with OpWriteFSync! The Observation::mOperation
+ * attribute is meant to be generic, not perfect.
+ *
+ * Notice that there is no reason to report an observation with an operation
+ * which is not being observed. Use IsObservedOperation() to check if the
+ * operation you are about to report is being observed. This is especially
+ * important if you are constructing expensive observations containing
+ * filename and full-path.
+ *
+ * Remark: Init() must be called before any IO is reported. But
+ * IsObservedOperation() will return false until Init() is called.
+ */
+void Report(IOInterposeObserver::Observation& aObservation);
 
-  /**
-   * Return whether or not an operation is observed. Reporters should not
-   * report operations that are not being observed by anybody. This mechanism
-   * allows us to avoid reporting I/O when no observers are registered.
-   */
-  bool IsObservedOperation(IOInterposeObserver::Operation aOp);
+/**
+ * Return whether or not an operation is observed. Reporters should not
+ * report operations that are not being observed by anybody. This mechanism
+ * allows us to avoid reporting I/O when no observers are registered.
+ */
+bool IsObservedOperation(IOInterposeObserver::Operation aOp);
 
-  /**
-   * Register IOInterposeObserver, the observer object will receive all
-   * observations for the given operation aOp.
-   *
-   * Remark: Init() must be called before observers are registered.
-   */
-  void Register(IOInterposeObserver::Operation aOp,
+/**
+ * Register IOInterposeObserver, the observer object will receive all
+ * observations for the given operation aOp.
+ *
+ * Remark: Init() must be called before observers are registered.
+ */
+void Register(IOInterposeObserver::Operation aOp,
+              IOInterposeObserver* aObserver);
+
+/**
+ * Unregister an IOInterposeObserver for a given operation
+ * Remark: It is always safe to unregister for all operations, even if yoú
+ * didn't register for them all.
+ * I.e. IOInterposer::Unregister(IOInterposeObserver::OpAll, aObserver)
+ *
+ * Remark: Init() must be called before observers are unregistered.
+ */
+void Unregister(IOInterposeObserver::Operation aOp,
                 IOInterposeObserver* aObserver);
 
-  /**
-   * Unregister an IOInterposeObserver for a given operation
-   * Remark: It is always safe to unregister for all operations, even if yoú
-   * didn't register for them all.
-   * I.e. IOInterposer::Unregister(IOInterposeObserver::OpAll, aObserver)
-   *
-   * Remark: Init() must be called before observers are unregistered.
-   */
-  void Unregister(IOInterposeObserver::Operation aOp,
-                  IOInterposeObserver* aObserver);
+/**
+ * Registers the current thread with the IOInterposer. This must be done to
+ * ensure that per-thread data is created in an orderly fashion.
+ * We could have written this to initialize that data lazily, however this
+ * could have unintended consequences if a thread that is not aware of
+ * IOInterposer was implicitly registered: its per-thread data would never
+ * be deleted because it would not know to unregister itself.
+ *
+ * @param aIsMainThread true if IOInterposer should treat the current thread
+ *                      as the main thread.
+ */
+void RegisterCurrentThread(bool aIsMainThread = false);
 
-  /**
-   * Registers the current thread with the IOInterposer. This must be done to
-   * ensure that per-thread data is created in an orderly fashion.
-   * We could have written this to initialize that data lazily, however this
-   * could have unintended consequences if a thread that is not aware of
-   * IOInterposer was implicitly registered: its per-thread data would never
-   * be deleted because it would not know to unregister itself.
-   *
-   * @param aIsMainThread true if IOInterposer should treat the current thread
-   *                      as the main thread.
-   */
-  void
-  RegisterCurrentThread(bool aIsMainThread = false);
+/**
+ * Unregisters the current thread with the IOInterposer. This is important
+ * to call when a thread is shutting down because it cleans up data that
+ * is stored in a TLS slot.
+ */
+void UnregisterCurrentThread();
 
-  /**
-   * Unregisters the current thread with the IOInterposer. This is important
-   * to call when a thread is shutting down because it cleans up data that
-   * is stored in a TLS slot.
-   */
-  void
-  UnregisterCurrentThread();
+/**
+ * Called to inform observers that the process has transitioned out of the
+ * startup stage or into the shutdown stage. Main thread only.
+ */
+void EnteringNextStage();
 
-  /**
-   * Called to inform observers that the process has transitioned out of the
-   * startup stage or into the shutdown stage. Main thread only.
-   */
-  void
-  EnteringNextStage();
 } // namespace IOInterposer
 
 class IOInterposerInit
 {
 public:
   IOInterposerInit()
   {
 #if defined(MOZ_ENABLE_PROFILER_SPS)
--- a/xpcom/build/IOInterposerPrivate.h
+++ b/xpcom/build/IOInterposerPrivate.h
@@ -66,17 +66,17 @@ public:
 private:
   PRLock*    mLock;
   PRCondVar* mCondVar;
 };
 
 class MonitorAutoLock
 {
 public:
-  explicit MonitorAutoLock(Monitor &aMonitor)
+  explicit MonitorAutoLock(Monitor& aMonitor)
     : mMonitor(aMonitor)
   {
     mMonitor.Lock();
   }
 
   ~MonitorAutoLock()
   {
     mMonitor.Unlock();
@@ -94,17 +94,17 @@ public:
 
 private:
   Monitor&  mMonitor;
 };
 
 class MonitorAutoUnlock
 {
 public:
-  explicit MonitorAutoUnlock(Monitor &aMonitor)
+  explicit MonitorAutoUnlock(Monitor& aMonitor)
     : mMonitor(aMonitor)
   {
     mMonitor.Unlock();
   }
 
   ~MonitorAutoUnlock()
   {
     mMonitor.Lock();
--- a/xpcom/build/LateWriteChecks.cpp
+++ b/xpcom/build/LateWriteChecks.cpp
@@ -42,78 +42,81 @@ using namespace mozilla;
 
 /*************************** Auxiliary Declarations ***************************/
 
 // This a wrapper over a file descriptor that provides a Printf method and
 // computes the sha1 of the data that passes through it.
 class SHA1Stream
 {
 public:
-    explicit SHA1Stream(FILE *stream)
-      : mFile(stream)
-    {
-      MozillaRegisterDebugFILE(mFile);
-    }
+  explicit SHA1Stream(FILE* aStream)
+    : mFile(aStream)
+  {
+    MozillaRegisterDebugFILE(mFile);
+  }
 
-    void Printf(const char *aFormat, ...)
-    {
-        MOZ_ASSERT(mFile);
-        va_list list;
-        va_start(list, aFormat);
-        nsAutoCString str;
-        str.AppendPrintf(aFormat, list);
-        va_end(list);
-        mSHA1.update(str.get(), str.Length());
-        fwrite(str.get(), 1, str.Length(), mFile);
-    }
-    void Finish(SHA1Sum::Hash &aHash)
-    {
-        int fd = fileno(mFile);
-        fflush(mFile);
-        MozillaUnRegisterDebugFD(fd);
-        fclose(mFile);
-        mSHA1.finish(aHash);
-        mFile = nullptr;
-    }
+  void Printf(const char* aFormat, ...)
+  {
+    MOZ_ASSERT(mFile);
+    va_list list;
+    va_start(list, aFormat);
+    nsAutoCString str;
+    str.AppendPrintf(aFormat, list);
+    va_end(list);
+    mSHA1.update(str.get(), str.Length());
+    fwrite(str.get(), 1, str.Length(), mFile);
+  }
+  void Finish(SHA1Sum::Hash& aHash)
+  {
+    int fd = fileno(mFile);
+    fflush(mFile);
+    MozillaUnRegisterDebugFD(fd);
+    fclose(mFile);
+    mSHA1.finish(aHash);
+    mFile = nullptr;
+  }
 private:
-    FILE *mFile;
-    SHA1Sum mSHA1;
+  FILE* mFile;
+  SHA1Sum mSHA1;
 };
 
-static void RecordStackWalker(void *aPC, void *aSP, void *aClosure)
+static void
+RecordStackWalker(void* aPC, void* aSP, void* aClosure)
 {
-    std::vector<uintptr_t> *stack =
-        static_cast<std::vector<uintptr_t>*>(aClosure);
-    stack->push_back(reinterpret_cast<uintptr_t>(aPC));
+  std::vector<uintptr_t>* stack =
+    static_cast<std::vector<uintptr_t>*>(aClosure);
+  stack->push_back(reinterpret_cast<uintptr_t>(aPC));
 }
 
 /**************************** Late-Write Observer  ****************************/
 
 /**
  * An implementation of IOInterposeObserver to be registered with IOInterposer.
  * This observer logs all writes as late writes.
  */
 class LateWriteObserver MOZ_FINAL : public IOInterposeObserver
 {
 public:
   explicit LateWriteObserver(const char* aProfileDirectory)
     : mProfileDirectory(PL_strdup(aProfileDirectory))
   {
   }
-  ~LateWriteObserver() {
+  ~LateWriteObserver()
+  {
     PL_strfree(mProfileDirectory);
     mProfileDirectory = nullptr;
   }
 
   void Observe(IOInterposeObserver::Observation& aObservation);
 private:
   char* mProfileDirectory;
 };
 
-void LateWriteObserver::Observe(IOInterposeObserver::Observation& aOb)
+void
+LateWriteObserver::Observe(IOInterposeObserver::Observation& aOb)
 {
 #ifdef OBSERVE_LATE_WRITES
   // Crash if that is the shutdown check mode
   if (gShutdownChecks == SCM_CRASH) {
     MOZ_CRASH();
   }
 
   // If we have shutdown mode SCM_NOTHING or we can't record then abort
@@ -126,22 +129,22 @@ void LateWriteObserver::Observe(IOInterp
   std::vector<uintptr_t> rawStack;
 
   NS_StackWalk(RecordStackWalker, /* skipFrames */ 0, /* maxFrames */ 0,
                reinterpret_cast<void*>(&rawStack), 0, nullptr);
   Telemetry::ProcessedStack stack = Telemetry::GetStackAndModules(rawStack);
 
   nsPrintfCString nameAux("%s%s%s", mProfileDirectory,
                           NS_SLASH, "Telemetry.LateWriteTmpXXXXXX");
-  char *name;
+  char* name;
   nameAux.GetMutableData(&name);
 
   // We want the sha1 of the entire file, so please don't write to fd
   // directly; use sha1Stream.
-  FILE *stream;
+  FILE* stream;
 #ifdef XP_WIN
   HANDLE hFile;
   do {
     // mkstemp isn't supported so keep trying until we get a file
     int result = _mktemp_s(name, strlen(name) + 1);
     hFile = CreateFileA(name, GENERIC_WRITE, 0, nullptr, CREATE_NEW,
                         FILE_ATTRIBUTE_NORMAL, nullptr);
   } while (GetLastError() == ERROR_FILE_EXISTS);
@@ -170,18 +173,17 @@ void LateWriteObserver::Observe(IOInterp
     Telemetry::ProcessedStack::Module module = stack.GetModule(i);
     sha1Stream.Printf("%s %s\n", module.mBreakpadId.c_str(),
                       module.mName.c_str());
   }
 
   size_t numFrames = stack.GetStackSize();
   sha1Stream.Printf("%u\n", (unsigned)numFrames);
   for (size_t i = 0; i < numFrames; ++i) {
-    const Telemetry::ProcessedStack::Frame &frame =
-        stack.GetFrame(i);
+    const Telemetry::ProcessedStack::Frame& frame = stack.GetFrame(i);
     // NOTE: We write the offsets, while the atos tool expects a value with
     // the virtual address added. For example, running otool -l on the the firefox
     // binary shows
     //      cmd LC_SEGMENT_64
     //      cmdsize 632
     //      segname __TEXT
     //      vmaddr 0x0000000100000000
     // so to print the line matching the offset 123 one has to run
@@ -208,42 +210,45 @@ void LateWriteObserver::Observe(IOInterp
   PR_Rename(name, finalName.get());
 #endif
 }
 
 /******************************* Setup/Teardown *******************************/
 
 static StaticAutoPtr<LateWriteObserver> sLateWriteObserver;
 
-namespace mozilla{
+namespace mozilla {
 
-void InitLateWriteChecks()
+void
+InitLateWriteChecks()
 {
   nsCOMPtr<nsIFile> mozFile;
   NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(mozFile));
   if (mozFile) {
     nsAutoCString nativePath;
     nsresult rv = mozFile->GetNativePath(nativePath);
     if (NS_SUCCEEDED(rv) && nativePath.get()) {
       sLateWriteObserver = new LateWriteObserver(nativePath.get());
     }
   }
 }
 
-void BeginLateWriteChecks()
+void
+BeginLateWriteChecks()
 {
   if (sLateWriteObserver) {
     IOInterposer::Register(
       IOInterposeObserver::OpWriteFSync,
       sLateWriteObserver
     );
   }
 }
 
-void StopLateWriteChecks()
+void
+StopLateWriteChecks()
 {
   if (sLateWriteObserver) {
     IOInterposer::Unregister(
       IOInterposeObserver::OpAll,
       sLateWriteObserver
     );
     // Deallocation would not be thread-safe, and StopLateWriteChecks() is
     // called at shutdown and only in special cases.
--- a/xpcom/build/LateWriteChecks.h
+++ b/xpcom/build/LateWriteChecks.h
@@ -10,17 +10,18 @@
 // This file, along with LateWriteChecks.cpp, serves to check for and report
 // late writes. The idea is discover writes to the file system that happens
 // during shutdown such that these maybe be moved forward and the process may be
 // killed without waiting for static destructors.
 
 namespace mozilla {
 
 /** Different shutdown check modes */
-enum ShutdownChecksMode {
+enum ShutdownChecksMode
+{
   SCM_CRASH,      /** Crash on shutdown check failure */
   SCM_RECORD,     /** Record shutdown check violations */
   SCM_NOTHING     /** Don't attempt any shutdown checks */
 };
 
 /**
  * Current shutdown check mode.
  * This variable is defined and initialized in nsAppRunner.cpp
@@ -49,11 +50,11 @@ void BeginLateWriteChecks();
 
 /**
  * Stop recording all writes as late-writes, call this function when you want
  * late-write checks to stop. I.e. exception handling, or the special case on
  * Mac described in bug 826029.
  */
 void StopLateWriteChecks();
 
-} // mozilla
+} // namespace mozilla
 
 #endif // mozilla_LateWriteChecks_h
--- a/xpcom/build/MainThreadIOLogger.cpp
+++ b/xpcom/build/MainThreadIOLogger.cpp
@@ -23,26 +23,26 @@
 #include <prthread.h>
 #include <vector>
 
 namespace {
 
 struct ObservationWithStack
 {
   ObservationWithStack(mozilla::IOInterposeObserver::Observation& aObs,
-                       ProfilerBacktrace *aStack)
+                       ProfilerBacktrace* aStack)
     : mObservation(aObs)
     , mStack(aStack)
   {
     const char16_t* filename = aObs.Filename();
     if (filename) {
       mFilename = filename;
     }
   }
- 
+
   mozilla::IOInterposeObserver::Observation mObservation;
   ProfilerBacktrace*                        mStack;
   nsString                                  mFilename;
 };
 
 } // anonymous namespace
 
 namespace mozilla {
@@ -78,17 +78,18 @@ MainThreadIOLoggerImpl::MainThreadIOLogg
 {
 }
 
 MainThreadIOLoggerImpl::~MainThreadIOLoggerImpl()
 {
   if (!mIOThread) {
     return;
   }
-  { // Scope for lock
+  {
+    // Scope for lock
     IOInterposer::MonitorAutoLock lock(mMonitor);
     mShutdownRequired = true;
     lock.Notify();
   }
   PR_JoinThread(mIOThread);
   mIOThread = nullptr;
 }
 
@@ -128,35 +129,35 @@ MainThreadIOLoggerImpl::IOThreadFunc()
                            PR_IRUSR | PR_IWUSR | PR_IRGRP);
   if (!fd) {
     IOInterposer::MonitorAutoLock lock(mMonitor);
     mShutdownRequired = true;
     std::vector<ObservationWithStack>().swap(mObservations);
     return;
   }
   mLogStartTime = TimeStamp::Now();
-  { // Scope for lock
+  {
+    // Scope for lock
     IOInterposer::MonitorAutoLock lock(mMonitor);
     while (true) {
       while (!mShutdownRequired && mObservations.empty()) {
         lock.Wait();
       }
       if (mShutdownRequired) {
         break;
       }
       // Pull events off the shared array onto a local one
       std::vector<ObservationWithStack> observationsToWrite;
       observationsToWrite.swap(mObservations);
- 
+
       // Release the lock so that we're not holding anybody up during I/O
       IOInterposer::MonitorAutoUnlock unlock(mMonitor);
 
       // Now write the events.
-      for (std::vector<ObservationWithStack>::iterator
-             i = observationsToWrite.begin(), e = observationsToWrite.end();
+      for (auto i = observationsToWrite.begin(), e = observationsToWrite.end();
            i != e; ++i) {
         if (i->mObservation.ObservedOperation() == OpNextStage) {
           PR_fprintf(fd, "%f,NEXT-STAGE\n",
                      (TimeStamp::Now() - mLogStartTime).ToMilliseconds());
           continue;
         }
         double durationMs = i->mObservation.Duration().ToMilliseconds();
         nsAutoCString nativeFilename;
--- a/xpcom/build/NSPRInterposer.cpp
+++ b/xpcom/build/NSPRInterposer.cpp
@@ -33,76 +33,82 @@ public:
   }
 
   ~NSPRIOAutoObservation()
   {
     Report();
   }
 };
 
-PRStatus PR_CALLBACK interposedClose(PRFileDesc* aFd)
+PRStatus PR_CALLBACK
+interposedClose(PRFileDesc* aFd)
 {
   // If we don't have a valid original function pointer something is very wrong.
   NS_ASSERTION(sCloseFn, "NSPR IO Interposing: sCloseFn is NULL");
 
   NSPRIOAutoObservation timer(IOInterposeObserver::OpClose);
   return sCloseFn(aFd);
 }
 
-int32_t PR_CALLBACK interposedRead(PRFileDesc* aFd, void* aBuf, int32_t aAmt)
+int32_t PR_CALLBACK
+interposedRead(PRFileDesc* aFd, void* aBuf, int32_t aAmt)
 {
   // If we don't have a valid original function pointer something is very wrong.
   NS_ASSERTION(sReadFn, "NSPR IO Interposing: sReadFn is NULL");
 
   NSPRIOAutoObservation timer(IOInterposeObserver::OpRead);
   return sReadFn(aFd, aBuf, aAmt);
 }
 
-int32_t PR_CALLBACK interposedWrite(PRFileDesc* aFd, const void* aBuf,
-                                    int32_t aAmt)
+int32_t PR_CALLBACK
+interposedWrite(PRFileDesc* aFd, const void* aBuf, int32_t aAmt)
 {
   // If we don't have a valid original function pointer something is very wrong.
   NS_ASSERTION(sWriteFn, "NSPR IO Interposing: sWriteFn is NULL");
 
   NSPRIOAutoObservation timer(IOInterposeObserver::OpWrite);
   return sWriteFn(aFd, aBuf, aAmt);
 }
 
-PRStatus PR_CALLBACK interposedFSync(PRFileDesc* aFd)
+PRStatus PR_CALLBACK
+interposedFSync(PRFileDesc* aFd)
 {
   // If we don't have a valid original function pointer something is very wrong.
   NS_ASSERTION(sFSyncFn, "NSPR IO Interposing: sFSyncFn is NULL");
 
   NSPRIOAutoObservation timer(IOInterposeObserver::OpFSync);
   return sFSyncFn(aFd);
 }
 
-PRStatus PR_CALLBACK interposedFileInfo(PRFileDesc *aFd, PRFileInfo *aInfo)
+PRStatus PR_CALLBACK
+interposedFileInfo(PRFileDesc* aFd, PRFileInfo* aInfo)
 {
   // If we don't have a valid original function pointer something is very wrong.
   NS_ASSERTION(sFileInfoFn, "NSPR IO Interposing: sFileInfoFn is NULL");
 
   NSPRIOAutoObservation timer(IOInterposeObserver::OpStat);
   return sFileInfoFn(aFd, aInfo);
 }
 
-PRStatus PR_CALLBACK interposedFileInfo64(PRFileDesc *aFd, PRFileInfo64 *aInfo)
+PRStatus PR_CALLBACK
+interposedFileInfo64(PRFileDesc* aFd, PRFileInfo64* aInfo)
 {
   // If we don't have a valid original function pointer something is very wrong.
   NS_ASSERTION(sFileInfo64Fn, "NSPR IO Interposing: sFileInfo64Fn is NULL");
 
   NSPRIOAutoObservation timer(IOInterposeObserver::OpStat);
   return sFileInfo64Fn(aFd, aInfo);
 }
 
 } // anonymous namespace
 
 namespace mozilla {
 
-void InitNSPRIOInterposing()
+void
+InitNSPRIOInterposing()
 {
   // Check that we have not interposed any of the IO methods before
   MOZ_ASSERT(!sCloseFn && !sReadFn && !sWriteFn && !sFSyncFn && !sFileInfoFn &&
              !sFileInfo64Fn);
 
   // We can't actually use this assertion because we initialize this code
   // before XPCOM is initialized, so NS_IsMainThread() always returns false.
   // MOZ_ASSERT(NS_IsMainThread());
@@ -130,17 +136,18 @@ void InitNSPRIOInterposing()
   methods->close      = &interposedClose;
   methods->read       = &interposedRead;
   methods->write      = &interposedWrite;
   methods->fsync      = &interposedFSync;
   methods->fileInfo   = &interposedFileInfo;
   methods->fileInfo64 = &interposedFileInfo64;
 }
 
-void ClearNSPRIOInterposing()
+void
+ClearNSPRIOInterposing()
 {
   // If we have already cleared IO interposing, or not initialized it this is
   // actually bad.
   MOZ_ASSERT(sCloseFn && sReadFn && sWriteFn && sFSyncFn && sFileInfoFn &&
              sFileInfo64Fn);
 
   // Get IO methods from NSPR and const cast the structure so we can modify it.
   PRIOMethods* methods = const_cast<PRIOMethods*>(PR_GetFileMethods());
--- a/xpcom/build/Omnijar.cpp
+++ b/xpcom/build/Omnijar.cpp
@@ -8,162 +8,177 @@
 #include "nsDirectoryService.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsIFile.h"
 #include "nsZipArchive.h"
 #include "nsNetUtil.h"
 
 namespace mozilla {
 
-nsIFile *Omnijar::sPath[2] = { nullptr, nullptr };
-nsZipArchive *Omnijar::sReader[2] = { nullptr, nullptr };
+nsIFile* Omnijar::sPath[2] = { nullptr, nullptr };
+nsZipArchive* Omnijar::sReader[2] = { nullptr, nullptr };
 bool Omnijar::sInitialized = false;
 static bool sIsUnified = false;
 static bool sIsNested[2] = { false, false };
 
-static const char *sProp[2] =
-    { NS_GRE_DIR, NS_XPCOM_CURRENT_PROCESS_DIR };
+static const char* sProp[2] = {
+  NS_GRE_DIR, NS_XPCOM_CURRENT_PROCESS_DIR
+};
 
 #define SPROP(Type) ((Type == mozilla::Omnijar::GRE) ? sProp[GRE] : sProp[APP])
 
 void
 Omnijar::CleanUpOne(Type aType)
 {
-    if (sReader[aType]) {
-        sReader[aType]->CloseArchive();
-        NS_IF_RELEASE(sReader[aType]);
-    }
-    sReader[aType] = nullptr;
-    NS_IF_RELEASE(sPath[aType]);
+  if (sReader[aType]) {
+    sReader[aType]->CloseArchive();
+    NS_IF_RELEASE(sReader[aType]);
+  }
+  sReader[aType] = nullptr;
+  NS_IF_RELEASE(sPath[aType]);
 }
 
 void
-Omnijar::InitOne(nsIFile *aPath, Type aType)
+Omnijar::InitOne(nsIFile* aPath, Type aType)
 {
-    nsCOMPtr<nsIFile> file;
-    if (aPath) {
-        file = aPath;
-    } else {
-        nsCOMPtr<nsIFile> dir;
-        nsDirectoryService::gService->Get(SPROP(aType), NS_GET_IID(nsIFile), getter_AddRefs(dir));
-        NS_NAMED_LITERAL_CSTRING (kOmnijarName, NS_STRINGIFY(OMNIJAR_NAME));
-        if (NS_FAILED(dir->Clone(getter_AddRefs(file))) ||
-            NS_FAILED(file->AppendNative(kOmnijarName)))
-            return;
+  nsCOMPtr<nsIFile> file;
+  if (aPath) {
+    file = aPath;
+  } else {
+    nsCOMPtr<nsIFile> dir;
+    nsDirectoryService::gService->Get(SPROP(aType), NS_GET_IID(nsIFile),
+                                      getter_AddRefs(dir));
+    NS_NAMED_LITERAL_CSTRING(kOmnijarName, NS_STRINGIFY(OMNIJAR_NAME));
+    if (NS_FAILED(dir->Clone(getter_AddRefs(file))) ||
+        NS_FAILED(file->AppendNative(kOmnijarName))) {
+      return;
     }
-    bool isFile;
-    if (NS_FAILED(file->IsFile(&isFile)) || !isFile) {
-        // If we're not using an omni.jar for GRE, and we don't have an
-        // omni.jar for APP, check if both directories are the same.
-        if ((aType == APP) && (!sPath[GRE])) {
-            nsCOMPtr<nsIFile> greDir, appDir;
-            bool equals;
-            nsDirectoryService::gService->Get(SPROP(GRE), NS_GET_IID(nsIFile), getter_AddRefs(greDir));
-            nsDirectoryService::gService->Get(SPROP(APP), NS_GET_IID(nsIFile), getter_AddRefs(appDir));
-            if (NS_SUCCEEDED(greDir->Equals(appDir, &equals)) && equals)
-                sIsUnified = true;
-        }
-        return;
+  }
+  bool isFile;
+  if (NS_FAILED(file->IsFile(&isFile)) || !isFile) {
+    // If we're not using an omni.jar for GRE, and we don't have an
+    // omni.jar for APP, check if both directories are the same.
+    if ((aType == APP) && (!sPath[GRE])) {
+      nsCOMPtr<nsIFile> greDir, appDir;
+      bool equals;
+      nsDirectoryService::gService->Get(SPROP(GRE), NS_GET_IID(nsIFile),
+                                        getter_AddRefs(greDir));
+      nsDirectoryService::gService->Get(SPROP(APP), NS_GET_IID(nsIFile),
+                                        getter_AddRefs(appDir));
+      if (NS_SUCCEEDED(greDir->Equals(appDir, &equals)) && equals) {
+        sIsUnified = true;
+      }
     }
+    return;
+  }
 
-    bool equals;
-    if ((aType == APP) && (sPath[GRE]) &&
-        NS_SUCCEEDED(sPath[GRE]->Equals(file, &equals)) && equals) {
-        // If we're using omni.jar on both GRE and APP and their path
-        // is the same, we're in the unified case.
-        sIsUnified = true;
-        return;
-    }
+  bool equals;
+  if ((aType == APP) && (sPath[GRE]) &&
+      NS_SUCCEEDED(sPath[GRE]->Equals(file, &equals)) && equals) {
+    // If we're using omni.jar on both GRE and APP and their path
+    // is the same, we're in the unified case.
+    sIsUnified = true;
+    return;
+  }
 
-    nsRefPtr<nsZipArchive> zipReader = new nsZipArchive();
-    if (NS_FAILED(zipReader->OpenArchive(file))) {
-        return;
-    }
+  nsRefPtr<nsZipArchive> zipReader = new nsZipArchive();
+  if (NS_FAILED(zipReader->OpenArchive(file))) {
+    return;
+  }
 
-    nsRefPtr<nsZipHandle> handle;
-    if (NS_SUCCEEDED(nsZipHandle::Init(zipReader, NS_STRINGIFY(OMNIJAR_NAME), getter_AddRefs(handle)))) {
-        zipReader = new nsZipArchive();
-        if (NS_FAILED(zipReader->OpenArchive(handle)))
-            return;
-        sIsNested[aType] = true;
+  nsRefPtr<nsZipHandle> handle;
+  if (NS_SUCCEEDED(nsZipHandle::Init(zipReader, NS_STRINGIFY(OMNIJAR_NAME),
+                                     getter_AddRefs(handle)))) {
+    zipReader = new nsZipArchive();
+    if (NS_FAILED(zipReader->OpenArchive(handle))) {
+      return;
     }
+    sIsNested[aType] = true;
+  }
 
-    CleanUpOne(aType);
-    sReader[aType] = zipReader;
-    NS_IF_ADDREF(sReader[aType]);
-    sPath[aType] = file;
-    NS_IF_ADDREF(sPath[aType]);
+  CleanUpOne(aType);
+  sReader[aType] = zipReader;
+  NS_IF_ADDREF(sReader[aType]);
+  sPath[aType] = file;
+  NS_IF_ADDREF(sPath[aType]);
 }
 
 void
-Omnijar::Init(nsIFile *aGrePath, nsIFile *aAppPath)
+Omnijar::Init(nsIFile* aGrePath, nsIFile* aAppPath)
 {
-    InitOne(aGrePath, GRE);
-    InitOne(aAppPath, APP);
-    sInitialized = true;
+  InitOne(aGrePath, GRE);
+  InitOne(aAppPath, APP);
+  sInitialized = true;
 }
 
 void
 Omnijar::CleanUp()
 {
-    CleanUpOne(GRE);
-    CleanUpOne(APP);
-    sInitialized = false;
+  CleanUpOne(GRE);
+  CleanUpOne(APP);
+  sInitialized = false;
 }
 
 already_AddRefed<nsZipArchive>
-Omnijar::GetReader(nsIFile *aPath)
+Omnijar::GetReader(nsIFile* aPath)
 {
-    NS_ABORT_IF_FALSE(IsInitialized(), "Omnijar not initialized");
+  NS_ABORT_IF_FALSE(IsInitialized(), "Omnijar not initialized");
 
-    bool equals;
-    nsresult rv;
+  bool equals;
+  nsresult rv;
 
-    if (sPath[GRE] && !sIsNested[GRE]) {
-        rv = sPath[GRE]->Equals(aPath, &equals);
-        if (NS_SUCCEEDED(rv) && equals)
-            return GetReader(GRE);
+  if (sPath[GRE] && !sIsNested[GRE]) {
+    rv = sPath[GRE]->Equals(aPath, &equals);
+    if (NS_SUCCEEDED(rv) && equals) {
+      return GetReader(GRE);
     }
-    if (sPath[APP] && !sIsNested[APP]) {
-        rv = sPath[APP]->Equals(aPath, &equals);
-        if (NS_SUCCEEDED(rv) && equals)
-            return GetReader(APP);
+  }
+  if (sPath[APP] && !sIsNested[APP]) {
+    rv = sPath[APP]->Equals(aPath, &equals);
+    if (NS_SUCCEEDED(rv) && equals) {
+      return GetReader(APP);
     }
-    return nullptr;
+  }
+  return nullptr;
 }
 
 nsresult
-Omnijar::GetURIString(Type aType, nsACString &result)
+Omnijar::GetURIString(Type aType, nsACString& aResult)
 {
-    NS_ABORT_IF_FALSE(IsInitialized(), "Omnijar not initialized");
+  NS_ABORT_IF_FALSE(IsInitialized(), "Omnijar not initialized");
+
+  aResult.Truncate();
 
-    result.Truncate();
+  // Return an empty string for APP in the unified case.
+  if ((aType == APP) && sIsUnified) {
+    return NS_OK;
+  }
 
-    // Return an empty string for APP in the unified case.
-    if ((aType == APP) && sIsUnified) {
-        return NS_OK;
+  nsAutoCString omniJarSpec;
+  if (sPath[aType]) {
+    nsresult rv = NS_GetURLSpecFromActualFile(sPath[aType], omniJarSpec);
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
     }
 
-    nsAutoCString omniJarSpec;
-    if (sPath[aType]) {
-        nsresult rv = NS_GetURLSpecFromActualFile(sPath[aType], omniJarSpec);
-        if (NS_WARN_IF(NS_FAILED(rv)))
-            return rv;
-
-        result = "jar:";
-        if (sIsNested[aType])
-            result += "jar:";
-        result += omniJarSpec;
-        result += "!";
-        if (sIsNested[aType])
-            result += "/" NS_STRINGIFY(OMNIJAR_NAME) "!";
-    } else {
-        nsCOMPtr<nsIFile> dir;
-        nsDirectoryService::gService->Get(SPROP(aType), NS_GET_IID(nsIFile), getter_AddRefs(dir));
-        nsresult rv = NS_GetURLSpecFromActualFile(dir, result);
-        if (NS_WARN_IF(NS_FAILED(rv)))
-            return rv;
+    aResult = "jar:";
+    if (sIsNested[aType]) {
+      aResult += "jar:";
+    }
+    aResult += omniJarSpec;
+    aResult += "!";
+    if (sIsNested[aType]) {
+      aResult += "/" NS_STRINGIFY(OMNIJAR_NAME) "!";
     }
-    result += "/";
-    return NS_OK;
+  } else {
+    nsCOMPtr<nsIFile> dir;
+    nsDirectoryService::gService->Get(SPROP(aType), NS_GET_IID(nsIFile),
+                                      getter_AddRefs(dir));
+    nsresult rv = NS_GetURLSpecFromActualFile(dir, aResult);
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
+    }
+  }
+  aResult += "/";
+  return NS_OK;
 }
 
 } /* namespace mozilla */
--- a/xpcom/build/Omnijar.h
+++ b/xpcom/build/Omnijar.h
@@ -11,121 +11,115 @@
 #include "nsString.h"
 #include "nsIFile.h"
 #include "nsZipArchive.h"
 
 class nsIURI;
 
 namespace mozilla {
 
-class Omnijar {
+class Omnijar
+{
 private:
-/**
- * Store an nsIFile for an omni.jar. We can store two paths here, one
- * for GRE (corresponding to resource://gre/) and one for APP
- * (corresponding to resource:/// and resource://app/), but only
- * store one when both point to the same location (unified).
- */
-static nsIFile *sPath[2];
+  /**
+   * Store an nsIFile for an omni.jar. We can store two paths here, one
+   * for GRE (corresponding to resource://gre/) and one for APP
+   * (corresponding to resource:/// and resource://app/), but only
+   * store one when both point to the same location (unified).
+   */
+  static nsIFile* sPath[2];
 
-/**
- * Cached nsZipArchives for the corresponding sPath
- */
-static nsZipArchive *sReader[2];
+  /**
+   * Cached nsZipArchives for the corresponding sPath
+   */
+  static nsZipArchive* sReader[2];
 
-/**
- * Has Omnijar::Init() been called?
- */
-static bool sInitialized;
+  /**
+   * Has Omnijar::Init() been called?
+   */
+  static bool sInitialized;
 
 public:
-enum Type {
+  enum Type
+  {
     GRE = 0,
     APP = 1
-};
+  };
 
-/**
- * Returns whether SetBase has been called at least once with
- * a valid nsIFile
- */
-static inline bool
-IsInitialized()
-{
-    return sInitialized;
-}
+  /**
+   * Returns whether SetBase has been called at least once with
+   * a valid nsIFile
+   */
+  static inline bool IsInitialized() { return sInitialized; }
 
-/**
- * Initializes the Omnijar API with the given directory or file for GRE and
- * APP. Each of the paths given can be:
- * - a file path, pointing to the omnijar file,
- * - a directory path, pointing to a directory containing an "omni.jar" file,
- * - nullptr for autodetection of an "omni.jar" file.
- */
-static void Init(nsIFile *aGrePath = nullptr, nsIFile *aAppPath = nullptr);
+  /**
+   * Initializes the Omnijar API with the given directory or file for GRE and
+   * APP. Each of the paths given can be:
+   * - a file path, pointing to the omnijar file,
+   * - a directory path, pointing to a directory containing an "omni.jar" file,
+   * - nullptr for autodetection of an "omni.jar" file.
+   */
+  static void Init(nsIFile* aGrePath = nullptr, nsIFile* aAppPath = nullptr);
 
-/**
- * Cleans up the Omnijar API
- */
-static void CleanUp();
+  /**
+   * Cleans up the Omnijar API
+   */
+  static void CleanUp();
 
-/**
- * Returns an nsIFile pointing to the omni.jar file for GRE or APP.
- * Returns nullptr when there is no corresponding omni.jar.
- * Also returns nullptr for APP in the unified case.
- */
-static inline already_AddRefed<nsIFile>
-GetPath(Type aType)
-{
+  /**
+   * Returns an nsIFile pointing to the omni.jar file for GRE or APP.
+   * Returns nullptr when there is no corresponding omni.jar.
+   * Also returns nullptr for APP in the unified case.
+   */
+  static inline already_AddRefed<nsIFile> GetPath(Type aType)
+  {
     NS_ABORT_IF_FALSE(IsInitialized(), "Omnijar not initialized");
     nsCOMPtr<nsIFile> path = sPath[aType];
     return path.forget();
-}
+  }
 
-/**
- * Returns whether GRE or APP use an omni.jar. Returns PR_False for
- * APP when using an omni.jar in the unified case.
- */
-static inline bool
-HasOmnijar(Type aType)
-{
+  /**
+   * Returns whether GRE or APP use an omni.jar. Returns PR_False for
+   * APP when using an omni.jar in the unified case.
+   */
+  static inline bool HasOmnijar(Type aType)
+  {
     NS_ABORT_IF_FALSE(IsInitialized(), "Omnijar not initialized");
     return !!sPath[aType];
-}
+  }
 
-/**
- * Returns a nsZipArchive pointer for the omni.jar file for GRE or
- * APP. Returns nullptr in the same cases GetPath() would.
- */
-static inline already_AddRefed<nsZipArchive>
-GetReader(Type aType)
-{
+  /**
+   * Returns a nsZipArchive pointer for the omni.jar file for GRE or
+   * APP. Returns nullptr in the same cases GetPath() would.
+   */
+  static inline already_AddRefed<nsZipArchive> GetReader(Type aType)
+  {
     NS_ABORT_IF_FALSE(IsInitialized(), "Omnijar not initialized");
     nsRefPtr<nsZipArchive> reader = sReader[aType];
     return reader.forget();
-}
+  }
 
-/**
- * Returns a nsZipArchive pointer for the given path IAOI the given
- * path is the omni.jar for either GRE or APP.
- */
-static already_AddRefed<nsZipArchive> GetReader(nsIFile *aPath);
+  /**
+   * Returns a nsZipArchive pointer for the given path IAOI the given
+   * path is the omni.jar for either GRE or APP.
+   */
+  static already_AddRefed<nsZipArchive> GetReader(nsIFile* aPath);
 
-/**
- * Returns the URI string corresponding to the omni.jar or directory
- * for GRE or APP. i.e. jar:/path/to/omni.jar!/ for omni.jar and
- * /path/to/base/dir/ otherwise. Returns an empty string for APP in
- * the unified case.
- * The returned URI is guaranteed to end with a slash.
- */
-static nsresult GetURIString(Type aType, nsACString &result);
+  /**
+   * Returns the URI string corresponding to the omni.jar or directory
+   * for GRE or APP. i.e. jar:/path/to/omni.jar!/ for omni.jar and
+   * /path/to/base/dir/ otherwise. Returns an empty string for APP in
+   * the unified case.
+   * The returned URI is guaranteed to end with a slash.
+   */
+  static nsresult GetURIString(Type aType, nsACString& aResult);
 
 private:
-/**
- * Used internally, respectively by Init() and CleanUp()
- */
-static void InitOne(nsIFile *aPath, Type aType);
-static void CleanUpOne(Type aType);
-
+  /**
+   * Used internally, respectively by Init() and CleanUp()
+   */
+  static void InitOne(nsIFile* aPath, Type aType);
+  static void CleanUpOne(Type aType);
 }; /* class Omnijar */
 
 } /* namespace mozilla */
 
 #endif /* mozilla_Omnijar_h */
--- a/xpcom/build/PoisonIOInterposer.h
+++ b/xpcom/build/PoisonIOInterposer.h
@@ -8,26 +8,26 @@
 #define mozilla_PoisonIOInterposer_h
 
 #include "mozilla/Types.h"
 #include <stdio.h>
 
 MOZ_BEGIN_EXTERN_C
 
 /** Register file descriptor to be ignored by poisoning IO interposer */
-void MozillaRegisterDebugFD(int fd);
+void MozillaRegisterDebugFD(int aFd);
 
 /** Register file to be ignored by poisoning IO interposer */
-void MozillaRegisterDebugFILE(FILE *f);
+void MozillaRegisterDebugFILE(FILE* aFile);
 
 /** Unregister file descriptor from being ignored by poisoning IO interposer */
-void MozillaUnRegisterDebugFD(int fd);
+void MozillaUnRegisterDebugFD(int aFd);
 
 /** Unregister file from being ignored by poisoning IO interposer */
-void MozillaUnRegisterDebugFILE(FILE *f);
+void MozillaUnRegisterDebugFILE(FILE* aFile);
 
 MOZ_END_EXTERN_C
 
 #if defined(XP_WIN) || defined(XP_MACOSX)
 
 #ifdef __cplusplus
 namespace mozilla {
 
@@ -62,20 +62,20 @@ void ClearPoisonIOInterposer();
 
 } // namespace mozilla
 #endif /* __cplusplus */
 
 #else /* XP_WIN || XP_MACOSX */
 
 #ifdef __cplusplus
 namespace mozilla {
-inline bool IsDebugFile(intptr_t aFileID){ return true; }
-inline void InitPoisonIOInterposer(){}
-inline void ClearPoisonIOInterposer(){}
+inline bool IsDebugFile(intptr_t aFileID) { return true; }
+inline void InitPoisonIOInterposer() {}
+inline void ClearPoisonIOInterposer() {}
 #ifdef XP_MACOSX
-inline void OnlyReportDirtyWrites(){}
+inline void OnlyReportDirtyWrites() {}
 #endif /* XP_MACOSX */
 } // namespace mozilla
 #endif /* __cplusplus */
 
 #endif /* XP_WIN || XP_MACOSX */
 
 #endif // mozilla_PoisonIOInterposer_h
--- a/xpcom/build/PoisonIOInterposerBase.cpp
+++ b/xpcom/build/PoisonIOInterposerBase.cpp
@@ -10,90 +10,100 @@
 #include <algorithm>
 #include <vector>
 
 #include "PoisonIOInterposer.h"
 
 // Auxiliary method to convert file descriptors to ids
 #if defined(XP_WIN32)
 #include <io.h>
-inline intptr_t FileDescriptorToID(int aFd) {
+inline intptr_t
+FileDescriptorToID(int aFd)
+{
   return _get_osfhandle(aFd);
 }
 #else
-inline intptr_t FileDescriptorToID(int aFd) {
+inline intptr_t
+FileDescriptorToID(int aFd)
+{
   return aFd;
 }
 #endif /* if not XP_WIN32 */
 
 using namespace mozilla;
 
 namespace {
-struct DebugFilesAutoLockTraits {
-  typedef PRLock *type;
-  const static type empty() {
-    return nullptr;
-  }
-  const static void release(type aL) {
-    PR_Unlock(aL);
-  }
+struct DebugFilesAutoLockTraits
+{
+  typedef PRLock* type;
+  const static type empty() { return nullptr; }
+  const static void release(type aL) { PR_Unlock(aL); }
 };
 
-class DebugFilesAutoLock : public Scoped<DebugFilesAutoLockTraits> {
-  static PRLock *Lock;
+class DebugFilesAutoLock : public Scoped<DebugFilesAutoLockTraits>
+{
+  static PRLock* Lock;
 public:
   static void Clear();
-  static PRLock *getDebugFileIDsLock() {
+  static PRLock* getDebugFileIDsLock()
+  {
     // On windows this static is not thread safe, but we know that the first
     // call is from
     // * An early registration of a debug FD or
     // * The call to InitWritePoisoning.
     // Since the early debug FDs are logs created early in the main thread
     // and no writes are trapped before InitWritePoisoning, we are safe.
     if (!Lock) {
       Lock = PR_NewLock();
     }
 
     // We have to use something lower level than a mutex. If we don't, we
     // can get recursive in here when called from logging a call to free.
     return Lock;
   }
 
-  DebugFilesAutoLock() :
-    Scoped<DebugFilesAutoLockTraits>(getDebugFileIDsLock()) {
+  DebugFilesAutoLock()
+    : Scoped<DebugFilesAutoLockTraits>(getDebugFileIDsLock())
+  {
     PR_Lock(get());
   }
 };
 
-PRLock *DebugFilesAutoLock::Lock;
-void DebugFilesAutoLock::Clear() {
+PRLock* DebugFilesAutoLock::Lock;
+void
+DebugFilesAutoLock::Clear()
+{
   MOZ_ASSERT(Lock != nullptr);
   Lock = nullptr;
 }
 
 // Return a vector used to hold the IDs of the current debug files. On unix
 // an ID is a file descriptor. On Windows it is a file HANDLE.
-std::vector<intptr_t>* getDebugFileIDs() {
+std::vector<intptr_t>*
+getDebugFileIDs()
+{
   PR_ASSERT_CURRENT_THREAD_OWNS_LOCK(DebugFilesAutoLock::getDebugFileIDsLock());
   // We have to use new as some write happen during static destructors
   // so an static std::vector might be destroyed while we still need it.
-  static std::vector<intptr_t> *DebugFileIDs = new std::vector<intptr_t>();
+  static std::vector<intptr_t>* DebugFileIDs = new std::vector<intptr_t>();
   return DebugFileIDs;
 }
 
 } // anonymous namespace
 
-namespace mozilla{
+namespace mozilla {
 
 // Auxiliary Method to test if a file descriptor is registered to be ignored
 // by the poisoning IO interposer
-bool IsDebugFile(intptr_t aFileID) {
+bool
+IsDebugFile(intptr_t aFileID)
+{
   DebugFilesAutoLock lockedScope;
 
-  std::vector<intptr_t> &Vec = *getDebugFileIDs();
+  std::vector<intptr_t>& Vec = *getDebugFileIDs();
   return std::find(Vec.begin(), Vec.end(), aFileID) != Vec.end();
 }
 
 // Clean-up for the registered debug files.
 // We should probably make sure all debug files are unregistered instead.
 // But as the poison IO interposer is used for late-write checks we're not
 // disabling it at any point yet. So Really no need for this.
 //
@@ -107,44 +117,52 @@ bool IsDebugFile(intptr_t aFileID) {
 //   }
 //   PR_DestroyLock(Lock);
 // }
 
 } // namespace mozilla
 
 extern "C" {
 
-  void MozillaRegisterDebugFD(int fd) {
-    intptr_t fileId = FileDescriptorToID(fd);
-    DebugFilesAutoLock lockedScope;
-    std::vector<intptr_t> &Vec = *getDebugFileIDs();
-    MOZ_ASSERT(std::find(Vec.begin(), Vec.end(), fileId) == Vec.end());
-    Vec.push_back(fileId);
-  }
+void
+MozillaRegisterDebugFD(int aFd)
+{
+  intptr_t fileId = FileDescriptorToID(aFd);
+  DebugFilesAutoLock lockedScope;
+  std::vector<intptr_t>& Vec = *getDebugFileIDs();
+  MOZ_ASSERT(std::find(Vec.begin(), Vec.end(), fileId) == Vec.end());
+  Vec.push_back(fileId);
+}
 
-  void MozillaRegisterDebugFILE(FILE *f) {
-    int fd = fileno(f);
-    if (fd == 1 || fd == 2) {
-      return;
-    }
-    MozillaRegisterDebugFD(fd);
+void
+MozillaRegisterDebugFILE(FILE* aFile)
+{
+  int fd = fileno(aFile);
+  if (fd == 1 || fd == 2) {
+    return;
   }
+  MozillaRegisterDebugFD(fd);
+}
 
-  void MozillaUnRegisterDebugFD(int fd) {
-    DebugFilesAutoLock lockedScope;
-    intptr_t fileId = FileDescriptorToID(fd);
-    std::vector<intptr_t> &Vec = *getDebugFileIDs();
-    std::vector<intptr_t>::iterator i =
-      std::find(Vec.begin(), Vec.end(), fileId);
-    MOZ_ASSERT(i != Vec.end());
-    Vec.erase(i);
-  }
+void
+MozillaUnRegisterDebugFD(int aFd)
+{
+  DebugFilesAutoLock lockedScope;
+  intptr_t fileId = FileDescriptorToID(aFd);
+  std::vector<intptr_t>& Vec = *getDebugFileIDs();
+  std::vector<intptr_t>::iterator i =
+    std::find(Vec.begin(), Vec.end(), fileId);
+  MOZ_ASSERT(i != Vec.end());
+  Vec.erase(i);
+}
 
-  void MozillaUnRegisterDebugFILE(FILE *f) {
-    int fd = fileno(f);
-    if (fd == 1 || fd == 2) {
-      return;
-    }
-    fflush(f);
-    MozillaUnRegisterDebugFD(fd);
+void
+MozillaUnRegisterDebugFILE(FILE* aFile)
+{
+  int fd = fileno(aFile);
+  if (fd == 1 || fd == 2) {
+    return;
   }
+  fflush(aFile);
+  MozillaUnRegisterDebugFD(fd);
+}
 
-}
\ No newline at end of file
+}  // extern "C"
--- a/xpcom/build/PoisonIOInterposerMac.cpp
+++ b/xpcom/build/PoisonIOInterposerMac.cpp
@@ -38,18 +38,18 @@ using namespace mozilla;
 
 // Bit tracking if poisoned writes are enabled
 static bool sIsEnabled = false;
 
 // Check if writes are dirty before reporting IO
 static bool sOnlyReportDirtyWrites = false;
 
 // Routines for write validation
-bool IsValidWrite(int fd, const void *wbuf, size_t count);
-bool IsIPCWrite(int fd, const struct stat &buf);
+bool IsValidWrite(int aFd, const void* aWbuf, size_t aCount);
+bool IsIPCWrite(int aFd, const struct stat& aBuf);
 
 /******************************** IO AutoTimer ********************************/
 
 /**
  * RAII class for timing the duration of an I/O call and reporting the result
  * to the IOInterposeObserver API.
  */
 class MacIOAutoObservation : public IOInterposeObserver::Observation
@@ -60,17 +60,17 @@ public:
                                        !IsDebugFile(aFd))
     , mFd(aFd)
     , mHasQueriedFilename(false)
     , mFilename(nullptr)
   {
   }
 
   MacIOAutoObservation(IOInterposeObserver::Operation aOp, int aFd,
-                       const void *aBuf, size_t aCount)
+                       const void* aBuf, size_t aCount)
     : IOInterposeObserver::Observation(aOp, sReference, sIsEnabled &&
                                        !IsDebugFile(aFd) &&
                                        IsValidWrite(aFd, aBuf, aCount))
     , mFd(aFd)
     , mHasQueriedFilename(false)
     , mFilename(nullptr)
   {
   }
@@ -92,17 +92,18 @@ private:
   bool                mHasQueriedFilename;
   char16_t*           mFilename;
   static const char*  sReference;
 };
 
 const char* MacIOAutoObservation::sReference = "PoisonIOInterposer";
 
 // Get filename for this observation
-const char16_t* MacIOAutoObservation::Filename()
+const char16_t*
+MacIOAutoObservation::Filename()
 {
   // If mHasQueriedFilename is true, then we already have it
   if (mHasQueriedFilename) {
     return mFilename;
   }
   char filename[MAXPATHLEN];
   if (fcntl(mFd, F_GETPATH, filename) != -1) {
     mFilename = UTF8ToNewUnicode(nsDependentCString(filename));
@@ -114,236 +115,259 @@ const char16_t* MacIOAutoObservation::Fi
   // Return filename
   return mFilename;
 }
 
 /****************************** Write Validation ******************************/
 
 // We want to detect "actual" writes, not IPC. Some IPC mechanisms are
 // implemented with file descriptors, so filter them out.
-bool IsIPCWrite(int fd, const struct stat &buf) {
-  if ((buf.st_mode & S_IFMT) == S_IFIFO) {
+bool
+IsIPCWrite(int aFd, const struct stat& aBuf)
+{
+  if ((aBuf.st_mode & S_IFMT) == S_IFIFO) {
     return true;
   }
 
-  if ((buf.st_mode & S_IFMT) != S_IFSOCK) {
+  if ((aBuf.st_mode & S_IFMT) != S_IFSOCK) {
     return false;
   }
 
   sockaddr_storage address;
   socklen_t len = sizeof(address);
-  if (getsockname(fd, (sockaddr*) &address, &len) != 0) {
-    return true; // Ignore the fd if we can't find what it is.
+  if (getsockname(aFd, (sockaddr*)&address, &len) != 0) {
+    return true; // Ignore the aFd if we can't find what it is.
   }
 
   return address.ss_family == AF_UNIX;
 }
 
 // We want to report actual disk IO not things that don't move bits on the disk
-bool IsValidWrite(int fd, const void *wbuf, size_t count)
+bool
+IsValidWrite(int aFd, const void* aWbuf, size_t aCount)
 {
   // Ignore writes of zero bytes, Firefox does some during shutdown.
-  if (count == 0) {
+  if (aCount == 0) {
     return false;
   }
 
   {
     struct stat buf;
-    int rv = fstat(fd, &buf);
+    int rv = fstat(aFd, &buf);
     if (rv != 0) {
       return true;
     }
 
-    if (IsIPCWrite(fd, buf)) {
+    if (IsIPCWrite(aFd, buf)) {
       return false;
     }
   }
 
-  // For writev we pass a nullptr wbuf. We should only get here from
-  // dbm, and it uses write, so assert that we have wbuf.
-  if (!wbuf) {
+  // For writev we pass a nullptr aWbuf. We should only get here from
+  // dbm, and it uses write, so assert that we have aWbuf.
+  if (!aWbuf) {
     return true;
   }
 
   // Break, here if we're allowed to report non-dirty writes
-  if(!sOnlyReportDirtyWrites) {
+  if (!sOnlyReportDirtyWrites) {
     return true;
   }
 
   // As a really bad hack, accept writes that don't change the on disk
   // content. This is needed because dbm doesn't keep track of dirty bits
   // and can end up writing the same data to disk twice. Once when the
   // user (nss) asks it to sync and once when closing the database.
-  ScopedFreePtr<void> wbuf2(malloc(count));
+  ScopedFreePtr<void> wbuf2(malloc(aCount));
   if (!wbuf2) {
     return true;
   }
-  off_t pos = lseek(fd, 0, SEEK_CUR);
+  off_t pos = lseek(aFd, 0, SEEK_CUR);
   if (pos == -1) {
     return true;
   }
-  ssize_t r = read(fd, wbuf2, count);
-  if (r < 0 || (size_t)r != count) {
+  ssize_t r = read(aFd, wbuf2, aCount);
+  if (r < 0 || (size_t)r != aCount) {
     return true;
   }
-  int cmp = memcmp(wbuf, wbuf2, count);
+  int cmp = memcmp(aWbuf, wbuf2, aCount);
   if (cmp != 0) {
     return true;
   }
-  off_t pos2 = lseek(fd, pos, SEEK_SET);
+  off_t pos2 = lseek(aFd, pos, SEEK_SET);
   if (pos2 != pos) {
     return true;
   }
 
   // Otherwise this is not a valid write
   return false;
 }
 
 /*************************** Function Interception  ***************************/
 
 /** Structure for declaration of function override */
-struct FuncData {
-  const char *Name;      // Name of the function for the ones we use dlsym
-  const void *Wrapper;   // The function that we will replace 'Function' with
-  void *Function;        // The function that will be replaced with 'Wrapper'
-  void *Buffer;          // Will point to the jump buffer that lets us call
+struct FuncData
+{
+  const char* Name;      // Name of the function for the ones we use dlsym
+  const void* Wrapper;   // The function that we will replace 'Function' with
+  void* Function;        // The function that will be replaced with 'Wrapper'
+  void* Buffer;          // Will point to the jump buffer that lets us call
                          // 'Function' after it has been replaced.
 };
 
 // Wrap aio_write. We have not seen it before, so just assert/report it.
-typedef ssize_t (*aio_write_t)(struct aiocb *aiocbp);
-ssize_t wrap_aio_write(struct aiocb *aiocbp);
-FuncData aio_write_data = { 0, (void*) wrap_aio_write, (void*) aio_write };
-ssize_t wrap_aio_write(struct aiocb *aiocbp) {
-  MacIOAutoObservation timer(IOInterposeObserver::OpWrite, aiocbp->aio_fildes);
+typedef ssize_t (*aio_write_t)(struct aiocb* aAioCbp);
+ssize_t wrap_aio_write(struct aiocb* aAioCbp);
+FuncData aio_write_data = { 0, (void*)wrap_aio_write, (void*)aio_write };
+ssize_t
+wrap_aio_write(struct aiocb* aAioCbp)
+{
+  MacIOAutoObservation timer(IOInterposeObserver::OpWrite,
+                             aAioCbp->aio_fildes);
 
-  aio_write_t old_write = (aio_write_t) aio_write_data.Buffer;
-  return old_write(aiocbp);
+  aio_write_t old_write = (aio_write_t)aio_write_data.Buffer;
+  return old_write(aAioCbp);
 }
 
 // Wrap pwrite-like functions.
 // We have not seen them before, so just assert/report it.
-typedef ssize_t (*pwrite_t)(int fd, const void *buf, size_t nbyte, off_t offset);
-template<FuncData &foo>
-ssize_t wrap_pwrite_temp(int fd, const void *buf, size_t nbyte, off_t offset) {
-  MacIOAutoObservation timer(IOInterposeObserver::OpWrite, fd);
-  pwrite_t old_write = (pwrite_t) foo.Buffer;
-  return old_write(fd, buf, nbyte, offset);
+typedef ssize_t (*pwrite_t)(int aFd, const void* buf, size_t aNumBytes,
+                            off_t aOffset);
+template<FuncData& foo>
+ssize_t
+wrap_pwrite_temp(int aFd, const void* aBuf, size_t aNumBytes, off_t aOffset)
+{
+  MacIOAutoObservation timer(IOInterposeObserver::OpWrite, aFd);
+  pwrite_t old_write = (pwrite_t)foo.Buffer;
+  return old_write(aFd, aBuf, aNumBytes, aOffset);
 }
 
 // Define a FuncData for a pwrite-like functions.
 #define DEFINE_PWRITE_DATA(X, NAME)                                        \
 FuncData X ## _data = { NAME, (void*) wrap_pwrite_temp<X ## _data> };      \
 
 // This exists everywhere.
 DEFINE_PWRITE_DATA(pwrite, "pwrite")
 // These exist on 32 bit OS X
 DEFINE_PWRITE_DATA(pwrite_NOCANCEL_UNIX2003, "pwrite$NOCANCEL$UNIX2003");
 DEFINE_PWRITE_DATA(pwrite_UNIX2003, "pwrite$UNIX2003");
 // This exists on 64 bit OS X
 DEFINE_PWRITE_DATA(pwrite_NOCANCEL, "pwrite$NOCANCEL");
 
 
-typedef ssize_t (*writev_t)(int fd, const struct iovec *iov, int iovcnt);
-template<FuncData &foo>
-ssize_t wrap_writev_temp(int fd, const struct iovec *iov, int iovcnt) {
-  MacIOAutoObservation timer(IOInterposeObserver::OpWrite, fd, nullptr, iovcnt);
-  writev_t old_write = (writev_t) foo.Buffer;
-  return old_write(fd, iov, iovcnt);
+typedef ssize_t (*writev_t)(int aFd, const struct iovec* aIov, int aIovCount);
+template<FuncData& foo>
+ssize_t
+wrap_writev_temp(int aFd, const struct iovec* aIov, int aIovCount)
+{
+  MacIOAutoObservation timer(IOInterposeObserver::OpWrite, aFd, nullptr,
+                             aIovCount);
+  writev_t old_write = (writev_t)foo.Buffer;
+  return old_write(aFd, aIov, aIovCount);
 }
 
 // Define a FuncData for a writev-like functions.
 #define DEFINE_WRITEV_DATA(X, NAME)                                   \
 FuncData X ## _data = { NAME, (void*) wrap_writev_temp<X ## _data> }; \
 
 // This exists everywhere.
 DEFINE_WRITEV_DATA(writev, "writev");
 // These exist on 32 bit OS X
 DEFINE_WRITEV_DATA(writev_NOCANCEL_UNIX2003, "writev$NOCANCEL$UNIX2003");
 DEFINE_WRITEV_DATA(writev_UNIX2003, "writev$UNIX2003");
 // This exists on 64 bit OS X
 DEFINE_WRITEV_DATA(writev_NOCANCEL, "writev$NOCANCEL");
 
-typedef ssize_t (*write_t)(int fd, const void *buf, size_t count);
-template<FuncData &foo>
-ssize_t wrap_write_temp(int fd, const void *buf, size_t count) {
-  MacIOAutoObservation timer(IOInterposeObserver::OpWrite, fd, buf, count);
-  write_t old_write = (write_t) foo.Buffer;
-  return old_write(fd, buf, count);
+typedef ssize_t (*write_t)(int aFd, const void* aBuf, size_t aCount);
+template<FuncData& foo>
+ssize_t
+wrap_write_temp(int aFd, const void* aBuf, size_t aCount)
+{
+  MacIOAutoObservation timer(IOInterposeObserver::OpWrite, aFd, aBuf, aCount);
+  write_t old_write = (write_t)foo.Buffer;
+  return old_write(aFd, aBuf, aCount);
 }
 
 // Define a FuncData for a write-like functions.
 #define DEFINE_WRITE_DATA(X, NAME)                                   \
 FuncData X ## _data = { NAME, (void*) wrap_write_temp<X ## _data> }; \
 
 // This exists everywhere.
 DEFINE_WRITE_DATA(write, "write");
 // These exist on 32 bit OS X
 DEFINE_WRITE_DATA(write_NOCANCEL_UNIX2003, "write$NOCANCEL$UNIX2003");
 DEFINE_WRITE_DATA(write_UNIX2003, "write$UNIX2003");
 // This exists on 64 bit OS X
 DEFINE_WRITE_DATA(write_NOCANCEL, "write$NOCANCEL");
 
-FuncData *Functions[] = { &aio_write_data,
+FuncData* Functions[] = {
+  &aio_write_data,
 
-                          &pwrite_data,
-                          &pwrite_NOCANCEL_UNIX2003_data,
-                          &pwrite_UNIX2003_data,
-                          &pwrite_NOCANCEL_data,
+  &pwrite_data,
+  &pwrite_NOCANCEL_UNIX2003_data,
+  &pwrite_UNIX2003_data,
+  &pwrite_NOCANCEL_data,
 
-                          &write_data,
-                          &write_NOCANCEL_UNIX2003_data,
-                          &write_UNIX2003_data,
-                          &write_NOCANCEL_data,
+  &write_data,
+  &write_NOCANCEL_UNIX2003_data,
+  &write_UNIX2003_data,
+  &write_NOCANCEL_data,
 
-                          &writev_data,
-                          &writev_NOCANCEL_UNIX2003_data,
-                          &writev_UNIX2003_data,
-                          &writev_NOCANCEL_data};
+  &writev_data,
+  &writev_NOCANCEL_UNIX2003_data,
+  &writev_UNIX2003_data,
+  &writev_NOCANCEL_data
+};
 
 const int NumFunctions = ArrayLength(Functions);
 
 } // anonymous namespace
 
 /******************************** IO Poisoning ********************************/
 
 namespace mozilla {
 
-void InitPoisonIOInterposer() {
+void
+InitPoisonIOInterposer()
+{
   // Enable reporting from poisoned write methods
   sIsEnabled = true;
 
   // Make sure we only poison writes once!
   static bool WritesArePoisoned = false;
   if (WritesArePoisoned) {
     return;
   }
   WritesArePoisoned = true;
 
   // stdout and stderr are OK.
   MozillaRegisterDebugFD(1);
   MozillaRegisterDebugFD(2);
 
   for (int i = 0; i < NumFunctions; ++i) {
-    FuncData *d = Functions[i];
+    FuncData* d = Functions[i];
     if (!d->Function) {
       d->Function = dlsym(RTLD_DEFAULT, d->Name);
     }
     if (!d->Function) {
       continue;
     }
     DebugOnly<mach_error_t> t = mach_override_ptr(d->Function, d->Wrapper,
-                                       &d->Buffer);
+                                                  &d->Buffer);
     MOZ_ASSERT(t == err_none);
   }
 }
 
-void OnlyReportDirtyWrites() {
+void
+OnlyReportDirtyWrites()
+{
   sOnlyReportDirtyWrites = true;
 }
 
-void ClearPoisonIOInterposer() {
+void
+ClearPoisonIOInterposer()
+{
   // Not sure how or if we can unpoison the functions. Would be nice, but no
   // worries we won't need to do this anyway.
   sIsEnabled = false;
 }
 
 } // namespace mozilla
--- a/xpcom/build/PoisonIOInterposerStub.cpp
+++ b/xpcom/build/PoisonIOInterposerStub.cpp
@@ -3,14 +3,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <stdio.h>
 
 extern "C" {
 
-  void MozillaRegisterDebugFD(int fd) {}
-  void MozillaRegisterDebugFILE(FILE *f) {}
-  void MozillaUnRegisterDebugFD(int fd) {}
-  void MozillaUnRegisterDebugFILE(FILE *f) {}
+void MozillaRegisterDebugFD(int aFd) {}
+void MozillaRegisterDebugFILE(FILE* aFile) {}
+void MozillaUnRegisterDebugFD(int aFd) {}
+void MozillaUnRegisterDebugFILE(FILE* aFile) {}
 
-}
\ No newline at end of file
+}  // extern "C"
--- a/xpcom/build/PoisonIOInterposerWin.cpp
+++ b/xpcom/build/PoisonIOInterposerWin.cpp
@@ -34,128 +34,120 @@ namespace {
 static bool sIOPoisoned = false;
 
 /************************ Internal NT API Declarations ************************/
 
 /*
  * Function pointer declaration for internal NT routine to create/open files.
  * For documentation on the NtCreateFile routine, see MSDN.
  */
-typedef NTSTATUS (NTAPI *NtCreateFileFn)(
-  OUT   PHANDLE                 aFileHandle,
-  IN    ACCESS_MASK             aDesiredAccess,
-  IN    POBJECT_ATTRIBUTES      aObjectAttributes,
-  OUT   PIO_STATUS_BLOCK        aIoStatusBlock,
-  IN    PLARGE_INTEGER          aAllocationSize,
-  IN    ULONG                   aFileAttributes,
-  IN    ULONG                   aShareAccess,
-  IN    ULONG                   aCreateDisposition,
-  IN    ULONG                   aCreateOptions,
-  IN    PVOID                   aEaBuffer,
-  IN    ULONG                   aEaLength
-);
+typedef NTSTATUS (NTAPI* NtCreateFileFn)(
+  PHANDLE aFileHandle,
+  ACCESS_MASK aDesiredAccess,
+  POBJECT_ATTRIBUTES aObjectAttributes,
+  PIO_STATUS_BLOCK aIoStatusBlock,
+  PLARGE_INTEGER aAllocationSize,
+  ULONG aFileAttributes,
+  ULONG aShareAccess,
+  ULONG aCreateDisposition,
+  ULONG aCreateOptions,
+  PVOID aEaBuffer,
+  ULONG aEaLength);
 
 /**
  * Function pointer declaration for internal NT routine to read data from file.
  * For documentation on the NtReadFile routine, see ZwReadFile on MSDN.
  */
-typedef NTSTATUS (NTAPI *NtReadFileFn)(
-  IN    HANDLE                  aFileHandle,
-  IN    HANDLE                  aEvent,
-  IN    PIO_APC_ROUTINE         aApc,
-  IN    PVOID                   aApcCtx,
-  OUT   PIO_STATUS_BLOCK        aIoStatus,
-  OUT   PVOID                   aBuffer,
-  IN    ULONG                   aLength,
-  IN    PLARGE_INTEGER          aOffset,
-  IN    PULONG                  aKey
-);
+typedef NTSTATUS (NTAPI* NtReadFileFn)(
+  HANDLE aFileHandle,
+  HANDLE aEvent,
+  PIO_APC_ROUTINE aApc,
+  PVOID aApcCtx,
+  PIO_STATUS_BLOCK aIoStatus,
+  PVOID aBuffer,
+  ULONG aLength,
+  PLARGE_INTEGER aOffset,
+  PULONG aKey);
 
 /**
  * Function pointer declaration for internal NT routine to read data from file.
  * No documentation exists, see wine sources for details.
  */
 typedef NTSTATUS (NTAPI* NtReadFileScatterFn)(
-  IN    HANDLE                  aFileHandle,
-  IN    HANDLE                  aEvent,
-  IN    PIO_APC_ROUTINE         aApc,
-  IN    PVOID                   aApcCtx,
-  OUT   PIO_STATUS_BLOCK        aIoStatus,
-  IN    FILE_SEGMENT_ELEMENT*   aSegments,
-  IN    ULONG                   aLength,
-  IN    PLARGE_INTEGER          aOffset,
-  IN    PULONG                  aKey
-);
+  HANDLE aFileHandle,
+  HANDLE aEvent,
+  PIO_APC_ROUTINE aApc,
+  PVOID aApcCtx,
+  PIO_STATUS_BLOCK aIoStatus,
+  FILE_SEGMENT_ELEMENT* aSegments,
+  ULONG aLength,
+  PLARGE_INTEGER aOffset,
+  PULONG aKey);
 
 /**
  * Function pointer declaration for internal NT routine to write data to file.
  * For documentation on the NtWriteFile routine, see ZwWriteFile on MSDN.
  */
-typedef NTSTATUS (NTAPI *NtWriteFileFn)(
-  IN    HANDLE                  aFileHandle,
-  IN    HANDLE                  aEvent,
-  IN    PIO_APC_ROUTINE         aApc,
-  IN    PVOID                   aApcCtx,
-  OUT   PIO_STATUS_BLOCK        aIoStatus,
-  IN    PVOID                   aBuffer,
-  IN    ULONG                   aLength,
-  IN    PLARGE_INTEGER          aOffset,
-  IN    PULONG                  aKey
-);
+typedef NTSTATUS (NTAPI* NtWriteFileFn)(
+  HANDLE aFileHandle,
+  HANDLE aEvent,
+  PIO_APC_ROUTINE aApc,
+  PVOID aApcCtx,
+  PIO_STATUS_BLOCK aIoStatus,
+  PVOID aBuffer,
+  ULONG aLength,
+  PLARGE_INTEGER aOffset,
+  PULONG aKey);
 
 /**
  * Function pointer declaration for internal NT routine to write data to file.
  * No documentation exists, see wine sources for details.
  */
-typedef NTSTATUS (NTAPI *NtWriteFileGatherFn)(
-  IN    HANDLE                  aFileHandle,
-  IN    HANDLE                  aEvent,
-  IN    PIO_APC_ROUTINE         aApc,
-  IN    PVOID                   aApcCtx,
-  OUT   PIO_STATUS_BLOCK        aIoStatus,
-  IN    FILE_SEGMENT_ELEMENT*   aSegments,
-  IN    ULONG                   aLength,
-  IN    PLARGE_INTEGER          aOffset,
-  IN    PULONG                  aKey
-);
+typedef NTSTATUS (NTAPI* NtWriteFileGatherFn)(
+  HANDLE aFileHandle,
+  HANDLE aEvent,
+  PIO_APC_ROUTINE aApc,
+  PVOID aApcCtx,
+  PIO_STATUS_BLOCK aIoStatus,
+  FILE_SEGMENT_ELEMENT* aSegments,
+  ULONG aLength,
+  PLARGE_INTEGER aOffset,
+  PULONG aKey);
 
 /**
  * Function pointer declaration for internal NT routine to flush to disk.
  * For documentation on the NtFlushBuffersFile routine, see ZwFlushBuffersFile
  * on MSDN.
  */
-typedef NTSTATUS (NTAPI *NtFlushBuffersFileFn)(
-  IN    HANDLE                  aFileHandle,
-  OUT   PIO_STATUS_BLOCK        aIoStatusBlock
-);
+typedef NTSTATUS (NTAPI* NtFlushBuffersFileFn)(
+  HANDLE aFileHandle,
+  PIO_STATUS_BLOCK aIoStatusBlock);
 
 typedef struct _FILE_NETWORK_OPEN_INFORMATION* PFILE_NETWORK_OPEN_INFORMATION;
 /**
  * Function pointer delaration for internal NT routine to query file attributes.
  * (equivalent to stat)
  */
-typedef NTSTATUS (NTAPI *NtQueryFullAttributesFileFn)(
-  IN    POBJECT_ATTRIBUTES      aObjectAttributes,
-  OUT   PFILE_NETWORK_OPEN_INFORMATION  aFileInformation
-);
+typedef NTSTATUS (NTAPI* NtQueryFullAttributesFileFn)(
+  POBJECT_ATTRIBUTES aObjectAttributes,
+  PFILE_NETWORK_OPEN_INFORMATION aFileInformation);
 
 /*************************** Auxiliary Declarations ***************************/
 
 /**
  * RAII class for timing the duration of an I/O call and reporting the result
  * to the IOInterposeObserver API.
  */
 class WinIOAutoObservation : public IOInterposeObserver::Observation
 {
 public:
   WinIOAutoObservation(IOInterposeObserver::Operation aOp,
                        HANDLE aFileHandle, const LARGE_INTEGER* aOffset)
-    : IOInterposeObserver::Observation(aOp, sReference,
-                                       !IsDebugFile(reinterpret_cast<intptr_t>(
-                                           aFileHandle)))
+    : IOInterposeObserver::Observation(
+        aOp, sReference, !IsDebugFile(reinterpret_cast<intptr_t>(aFileHandle)))
     , mFileHandle(aFileHandle)
     , mHasQueriedFilename(false)
     , mFilename(nullptr)
   {
     if (mShouldReport) {
       mOffset.QuadPart = aOffset ? aOffset->QuadPart : 0;
     }
   }
@@ -195,268 +187,255 @@ private:
   bool                mHasQueriedFilename;
   char16_t*           mFilename;
   static const char*  sReference;
 };
 
 const char* WinIOAutoObservation::sReference = "PoisonIOInterposer";
 
 // Get filename for this observation
-const char16_t* WinIOAutoObservation::Filename()
+const char16_t*
+WinIOAutoObservation::Filename()
 {
   // If mHasQueriedFilename is true, then filename is already stored in mFilename
   if (mHasQueriedFilename) {
     return mFilename;
   }
 
   nsAutoString utf16Filename;
   if (HandleToFilename(mFileHandle, mOffset, utf16Filename)) {
     // Heap allocate with leakable memory
     mFilename = ToNewUnicode(utf16Filename);
   }
   mHasQueriedFilename = true;
-  
+
   // Return filename
   return mFilename;
 }
 
 /*************************** IO Interposing Methods ***************************/
 
 // Function pointers to original functions
 static NtCreateFileFn         gOriginalNtCreateFile;
 static NtReadFileFn           gOriginalNtReadFile;
 static NtReadFileScatterFn    gOriginalNtReadFileScatter;
 static NtWriteFileFn          gOriginalNtWriteFile;
 static NtWriteFileGatherFn    gOriginalNtWriteFileGather;
 static NtFlushBuffersFileFn   gOriginalNtFlushBuffersFile;
 static NtQueryFullAttributesFileFn gOriginalNtQueryFullAttributesFile;
 
-static NTSTATUS NTAPI InterposedNtCreateFile(
-  PHANDLE                 aFileHandle,
-  ACCESS_MASK             aDesiredAccess,
-  POBJECT_ATTRIBUTES      aObjectAttributes,
-  PIO_STATUS_BLOCK        aIoStatusBlock,
-  PLARGE_INTEGER          aAllocationSize,
-  ULONG                   aFileAttributes,
-  ULONG                   aShareAccess,
-  ULONG                   aCreateDisposition,
-  ULONG                   aCreateOptions,
-  PVOID                   aEaBuffer,
-  ULONG                   aEaLength
-)
+static NTSTATUS NTAPI
+InterposedNtCreateFile(PHANDLE aFileHandle,
+                       ACCESS_MASK aDesiredAccess,
+                       POBJECT_ATTRIBUTES aObjectAttributes,
+                       PIO_STATUS_BLOCK aIoStatusBlock,
+                       PLARGE_INTEGER aAllocationSize,
+                       ULONG aFileAttributes,
+                       ULONG aShareAccess,
+                       ULONG aCreateDisposition,
+                       ULONG aCreateOptions,
+                       PVOID aEaBuffer,
+                       ULONG aEaLength)
 {
   // Report IO
-  const wchar_t* buf = aObjectAttributes ?
-                         aObjectAttributes->ObjectName->Buffer :
-                         L"";
-  uint32_t len = aObjectAttributes ?
-                   aObjectAttributes->ObjectName->Length / sizeof(WCHAR) :
-                   0;
+  const wchar_t* buf =
+    aObjectAttributes ? aObjectAttributes->ObjectName->Buffer : L"";
+  uint32_t len =
+    aObjectAttributes ? aObjectAttributes->ObjectName->Length / sizeof(WCHAR) :
+                        0;
   nsDependentSubstring filename(buf, len);
   WinIOAutoObservation timer(IOInterposeObserver::OpCreateOrOpen, filename);
 
   // Something is badly wrong if this function is undefined
   MOZ_ASSERT(gOriginalNtCreateFile);
 
   // Execute original function
-  return gOriginalNtCreateFile(
-    aFileHandle,
-    aDesiredAccess,
-    aObjectAttributes,
-    aIoStatusBlock,
-    aAllocationSize,
-    aFileAttributes,
-    aShareAccess,
-    aCreateDisposition,
-    aCreateOptions,
-    aEaBuffer,
-    aEaLength
-  );
+  return gOriginalNtCreateFile(aFileHandle,
+                               aDesiredAccess,
+                               aObjectAttributes,
+                               aIoStatusBlock,
+                               aAllocationSize,
+                               aFileAttributes,
+                               aShareAccess,
+                               aCreateDisposition,
+                               aCreateOptions,
+                               aEaBuffer,
+                               aEaLength);
 }
 
-static NTSTATUS NTAPI InterposedNtReadFile(
-  HANDLE                  aFileHandle,
-  HANDLE                  aEvent,
-  PIO_APC_ROUTINE         aApc,
-  PVOID                   aApcCtx,
-  PIO_STATUS_BLOCK        aIoStatus,
-  PVOID                   aBuffer,
-  ULONG                   aLength,
-  PLARGE_INTEGER          aOffset,
-  PULONG                  aKey)
+static NTSTATUS NTAPI
+InterposedNtReadFile(HANDLE aFileHandle,
+                     HANDLE aEvent,
+                     PIO_APC_ROUTINE aApc,
+                     PVOID aApcCtx,
+                     PIO_STATUS_BLOCK aIoStatus,
+                     PVOID aBuffer,
+                     ULONG aLength,
+                     PLARGE_INTEGER aOffset,
+                     PULONG aKey)
 {
   // Report IO
   WinIOAutoObservation timer(IOInterposeObserver::OpRead, aFileHandle, aOffset);
 
   // Something is badly wrong if this function is undefined
   MOZ_ASSERT(gOriginalNtReadFile);
 
   // Execute original function
-  return gOriginalNtReadFile(
-    aFileHandle,
-    aEvent,
-    aApc,
-    aApcCtx,
-    aIoStatus,
-    aBuffer,
-    aLength,
-    aOffset,
-    aKey
-  );
+  return gOriginalNtReadFile(aFileHandle,
+                             aEvent,
+                             aApc,
+                             aApcCtx,
+                             aIoStatus,
+                             aBuffer,
+                             aLength,
+                             aOffset,
+                             aKey);
 }
 
-static NTSTATUS NTAPI InterposedNtReadFileScatter(
-  HANDLE                  aFileHandle,
-  HANDLE                  aEvent,
-  PIO_APC_ROUTINE         aApc,
-  PVOID                   aApcCtx,
-  PIO_STATUS_BLOCK        aIoStatus,
-  FILE_SEGMENT_ELEMENT*   aSegments,
-  ULONG                   aLength,
-  PLARGE_INTEGER          aOffset,
-  PULONG                  aKey)
+static NTSTATUS NTAPI
+InterposedNtReadFileScatter(HANDLE aFileHandle,
+                            HANDLE aEvent,
+                            PIO_APC_ROUTINE aApc,
+                            PVOID aApcCtx,
+                            PIO_STATUS_BLOCK aIoStatus,
+                            FILE_SEGMENT_ELEMENT* aSegments,
+                            ULONG aLength,
+                            PLARGE_INTEGER aOffset,
+                            PULONG aKey)
 {
   // Report IO
   WinIOAutoObservation timer(IOInterposeObserver::OpRead, aFileHandle, aOffset);
 
   // Something is badly wrong if this function is undefined
   MOZ_ASSERT(gOriginalNtReadFileScatter);
 
   // Execute original function
-  return gOriginalNtReadFileScatter(
-    aFileHandle,
-    aEvent,
-    aApc,
-    aApcCtx,
-    aIoStatus,
-    aSegments,
-    aLength,
-    aOffset,
-    aKey
-  );
+  return gOriginalNtReadFileScatter(aFileHandle,
+                                    aEvent,
+                                    aApc,
+                                    aApcCtx,
+                                    aIoStatus,
+                                    aSegments,
+                                    aLength,
+                                    aOffset,
+                                    aKey);
 }
 
 // Interposed NtWriteFile function
-static NTSTATUS NTAPI InterposedNtWriteFile(
-  HANDLE                        aFileHandle,
-  HANDLE                        aEvent,
-  PIO_APC_ROUTINE               aApc,
-  PVOID                         aApcCtx,
-  PIO_STATUS_BLOCK              aIoStatus,
-  PVOID                         aBuffer,
-  ULONG                         aLength,
-  PLARGE_INTEGER                aOffset,
-  PULONG                        aKey)
+static NTSTATUS NTAPI
+InterposedNtWriteFile(HANDLE aFileHandle,
+                      HANDLE aEvent,
+                      PIO_APC_ROUTINE aApc,
+                      PVOID aApcCtx,
+                      PIO_STATUS_BLOCK aIoStatus,
+                      PVOID aBuffer,
+                      ULONG aLength,
+                      PLARGE_INTEGER aOffset,
+                      PULONG aKey)
 {
   // Report IO
   WinIOAutoObservation timer(IOInterposeObserver::OpWrite, aFileHandle,
                              aOffset);
 
   // Something is badly wrong if this function is undefined
   MOZ_ASSERT(gOriginalNtWriteFile);
 
   // Execute original function
-  return gOriginalNtWriteFile(
-    aFileHandle,
-    aEvent,
-    aApc,
-    aApcCtx,
-    aIoStatus,
-    aBuffer,
-    aLength,
-    aOffset,
-    aKey
-  );
+  return gOriginalNtWriteFile(aFileHandle,
+                              aEvent,
+                              aApc,
+                              aApcCtx,
+                              aIoStatus,
+                              aBuffer,
+                              aLength,
+                              aOffset,
+                              aKey);
 }
 
 // Interposed NtWriteFileGather function
-static NTSTATUS NTAPI InterposedNtWriteFileGather(
-  HANDLE                        aFileHandle,
-  HANDLE                        aEvent,
-  PIO_APC_ROUTINE               aApc,
-  PVOID                         aApcCtx,
-  PIO_STATUS_BLOCK              aIoStatus,
-  FILE_SEGMENT_ELEMENT*         aSegments,
-  ULONG                         aLength,
-  PLARGE_INTEGER                aOffset,
-  PULONG                        aKey)
+static NTSTATUS NTAPI
+InterposedNtWriteFileGather(HANDLE aFileHandle,
+                            HANDLE aEvent,
+                            PIO_APC_ROUTINE aApc,
+                            PVOID aApcCtx,
+                            PIO_STATUS_BLOCK aIoStatus,
+                            FILE_SEGMENT_ELEMENT* aSegments,
+                            ULONG aLength,
+                            PLARGE_INTEGER aOffset,
+                            PULONG aKey)
 {
   // Report IO
   WinIOAutoObservation timer(IOInterposeObserver::OpWrite, aFileHandle,
                              aOffset);
 
   // Something is badly wrong if this function is undefined
   MOZ_ASSERT(gOriginalNtWriteFileGather);
 
   // Execute original function
-  return gOriginalNtWriteFileGather(
-    aFileHandle,
-    aEvent,
-    aApc,
-    aApcCtx,
-    aIoStatus,
-    aSegments,
-    aLength,
-    aOffset,
-    aKey
-  );
+  return gOriginalNtWriteFileGather(aFileHandle,
+                                    aEvent,
+                                    aApc,
+                                    aApcCtx,
+                                    aIoStatus,
+                                    aSegments,
+                                    aLength,
+                                    aOffset,
+                                    aKey);
 }
 
-static NTSTATUS NTAPI InterposedNtFlushBuffersFile(
-  HANDLE                          aFileHandle,
-  PIO_STATUS_BLOCK                aIoStatusBlock)
+static NTSTATUS NTAPI
+InterposedNtFlushBuffersFile(HANDLE aFileHandle,
+                             PIO_STATUS_BLOCK aIoStatusBlock)
 {
   // Report IO
   WinIOAutoObservation timer(IOInterposeObserver::OpFSync, aFileHandle,
                              nullptr);
 
   // Something is badly wrong if this function is undefined
   MOZ_ASSERT(gOriginalNtFlushBuffersFile);
 
   // Execute original function
-  return gOriginalNtFlushBuffersFile(
-    aFileHandle,
-    aIoStatusBlock
-  );
+  return gOriginalNtFlushBuffersFile(aFileHandle,
+                                     aIoStatusBlock);
 }
 
-static NTSTATUS NTAPI InterposedNtQueryFullAttributesFile(
-  POBJECT_ATTRIBUTES              aObjectAttributes,
-  PFILE_NETWORK_OPEN_INFORMATION  aFileInformation)
+static NTSTATUS NTAPI
+InterposedNtQueryFullAttributesFile(
+    POBJECT_ATTRIBUTES aObjectAttributes,
+    PFILE_NETWORK_OPEN_INFORMATION aFileInformation)
 {
   // Report IO
-  const wchar_t* buf = aObjectAttributes ?
-                         aObjectAttributes->ObjectName->Buffer :
-                         L"";
-  uint32_t len = aObjectAttributes ?
-                   aObjectAttributes->ObjectName->Length / sizeof(WCHAR) :
-                   0;
+  const wchar_t* buf =
+    aObjectAttributes ? aObjectAttributes->ObjectName->Buffer : L"";
+  uint32_t len =
+    aObjectAttributes ? aObjectAttributes->ObjectName->Length / sizeof(WCHAR) :
+                        0;
   nsDependentSubstring filename(buf, len);
   WinIOAutoObservation timer(IOInterposeObserver::OpStat, filename);
 
   // Something is badly wrong if this function is undefined
   MOZ_ASSERT(gOriginalNtQueryFullAttributesFile);
 
   // Execute original function
-  return gOriginalNtQueryFullAttributesFile(
-    aObjectAttributes,
-    aFileInformation
-  );
+  return gOriginalNtQueryFullAttributesFile(aObjectAttributes,
+                                            aFileInformation);
 }
 
 } // anonymous namespace
 
 /******************************** IO Poisoning ********************************/
 
 // Windows DLL interceptor
 static WindowsDllInterceptor sNtDllInterceptor;
 
 namespace mozilla {
 
-void InitPoisonIOInterposer() {
+void
+InitPoisonIOInterposer()
+{
   // Don't poison twice... as this function may only be invoked on the main
   // thread when no other threads are running, it safe to allow multiple calls
   // to InitPoisonIOInterposer() without complaining (ie. failing assertions).
   if (sIOPoisoned) {
     return;
   }
   sIOPoisoned = true;
 
@@ -464,51 +443,46 @@ void InitPoisonIOInterposer() {
   MozillaRegisterDebugFD(1);
   MozillaRegisterDebugFD(2);
 
   // Initialize dll interceptor and add hooks
   sNtDllInterceptor.Init("ntdll.dll");
   sNtDllInterceptor.AddHook(
     "NtCreateFile",
     reinterpret_cast<intptr_t>(InterposedNtCreateFile),
-    reinterpret_cast<void**>(&gOriginalNtCreateFile)
-  );
+    reinterpret_cast<void**>(&gOriginalNtCreateFile));
   sNtDllInterceptor.AddHook(
     "NtReadFile",
     reinterpret_cast<intptr_t>(InterposedNtReadFile),
-    reinterpret_cast<void**>(&gOriginalNtReadFile)
-  );
+    reinterpret_cast<void**>(&gOriginalNtReadFile));
   sNtDllInterceptor.AddHook(
     "NtReadFileScatter",
     reinterpret_cast<intptr_t>(InterposedNtReadFileScatter),
-    reinterpret_cast<void**>(&gOriginalNtReadFileScatter)
-  );
+    reinterpret_cast<void**>(&gOriginalNtReadFileScatter));
   sNtDllInterceptor.AddHook(
     "NtWriteFile",
     reinterpret_cast<intptr_t>(InterposedNtWriteFile),
-    reinterpret_cast<void**>(&gOriginalNtWriteFile)
-  );
+    reinterpret_cast<void**>(&gOriginalNtWriteFile));
   sNtDllInterceptor.AddHook(
     "NtWriteFileGather",
     reinterpret_cast<intptr_t>(InterposedNtWriteFileGather),
-    reinterpret_cast<void**>(&gOriginalNtWriteFileGather)
-  );
+    reinterpret_cast<void**>(&gOriginalNtWriteFileGather));
   sNtDllInterceptor.AddHook(
     "NtFlushBuffersFile",
     reinterpret_cast<intptr_t>(InterposedNtFlushBuffersFile),
-    reinterpret_cast<void**>(&gOriginalNtFlushBuffersFile)
-  );
+    reinterpret_cast<void**>(&gOriginalNtFlushBuffersFile));
   sNtDllInterceptor.AddHook(
     "NtQueryFullAttributesFile",
     reinterpret_cast<intptr_t>(InterposedNtQueryFullAttributesFile),
-    reinterpret_cast<void**>(&gOriginalNtQueryFullAttributesFile)
-  );
+    reinterpret_cast<void**>(&gOriginalNtQueryFullAttributesFile));
 }
 
-void ClearPoisonIOInterposer() {
+void
+ClearPoisonIOInterposer()
+{
   MOZ_ASSERT(false);
   if (sIOPoisoned) {
     // Destroy the DLL interceptor
     sIOPoisoned = false;
     sNtDllInterceptor = WindowsDllInterceptor();
   }
 }
 
--- a/xpcom/build/ServiceList.h
+++ b/xpcom/build/ServiceList.h
@@ -1,29 +1,40 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 // IWYU pragma: private, include "mozilla/Services.h"
 
 #ifdef ACCESSIBILITY
-MOZ_SERVICE(AccessibilityService, nsIAccessibilityService, "@mozilla.org/accessibilityService;1")
+MOZ_SERVICE(AccessibilityService, nsIAccessibilityService,
+            "@mozilla.org/accessibilityService;1")
 #endif
-MOZ_SERVICE(ChromeRegistryService, nsIChromeRegistry, "@mozilla.org/chrome/chrome-registry;1")
-MOZ_SERVICE(ToolkitChromeRegistryService, nsIToolkitChromeRegistry, "@mozilla.org/chrome/chrome-registry;1")
-MOZ_SERVICE(XULChromeRegistryService, nsIXULChromeRegistry, "@mozilla.org/chrome/chrome-registry;1")
-MOZ_SERVICE(XULOverlayProviderService, nsIXULOverlayProvider, "@mozilla.org/chrome/chrome-registry;1")
-MOZ_SERVICE(IOService, nsIIOService, "@mozilla.org/network/io-service;1")
-MOZ_SERVICE(ObserverService, nsIObserverService, "@mozilla.org/observer-service;1")
-MOZ_SERVICE(StringBundleService, nsIStringBundleService, "@mozilla.org/intl/stringbundle;1")
-MOZ_SERVICE(XPConnect, nsIXPConnect, "@mozilla.org/js/xpc/XPConnect;1")
-MOZ_SERVICE(InDOMUtils, inIDOMUtils, "@mozilla.org/inspector/dom-utils;1")
-MOZ_SERVICE(PermissionManager, nsIPermissionManager, "@mozilla.org/permissionmanager;1");
+MOZ_SERVICE(ChromeRegistryService, nsIChromeRegistry,
+            "@mozilla.org/chrome/chrome-registry;1")
+MOZ_SERVICE(ToolkitChromeRegistryService, nsIToolkitChromeRegistry,
+            "@mozilla.org/chrome/chrome-registry;1")
+MOZ_SERVICE(XULChromeRegistryService, nsIXULChromeRegistry,
+            "@mozilla.org/chrome/chrome-registry;1")
+MOZ_SERVICE(XULOverlayProviderService, nsIXULOverlayProvider,
+            "@mozilla.org/chrome/chrome-registry;1")
+MOZ_SERVICE(IOService, nsIIOService,
+            "@mozilla.org/network/io-service;1")
+MOZ_SERVICE(ObserverService, nsIObserverService,
+            "@mozilla.org/observer-service;1")
+MOZ_SERVICE(StringBundleService, nsIStringBundleService,
+            "@mozilla.org/intl/stringbundle;1")
+MOZ_SERVICE(XPConnect, nsIXPConnect,
+            "@mozilla.org/js/xpc/XPConnect;1")
+MOZ_SERVICE(InDOMUtils, inIDOMUtils,
+            "@mozilla.org/inspector/dom-utils;1")
+MOZ_SERVICE(PermissionManager, nsIPermissionManager,
+            "@mozilla.org/permissionmanager;1");
 
 #ifdef MOZ_USE_NAMESPACE
-namespace mozilla
-{
+namespace mozilla {
 #endif
 
-MOZ_SERVICE(HistoryService, IHistory, "@mozilla.org/browser/history;1")
+MOZ_SERVICE(HistoryService, IHistory,
+            "@mozilla.org/browser/history;1")
 
 #ifdef MOZ_USE_NAMESPACE
 }
 #endif
--- a/xpcom/build/Services.cpp
+++ b/xpcom/build/Services.cpp
@@ -54,16 +54,16 @@ using namespace mozilla::services;
   }
 
 #include "ServiceList.h"
 #undef MOZ_SERVICE
 
 /**
  * Clears service cache, sets gXPCOMShuttingDown
  */
-void 
+void
 mozilla::services::Shutdown()
 {
   gXPCOMShuttingDown = true;
 #define MOZ_SERVICE(NAME, TYPE, CONTRACT_ID) NS_IF_RELEASE(g##NAME);
 #include "ServiceList.h"
 #undef MOZ_SERVICE
 }
--- a/xpcom/build/nsWindowsDllInterceptor.h
+++ b/xpcom/build/nsWindowsDllInterceptor.h
@@ -62,17 +62,17 @@
 
 #include <stdint.h>
 
 namespace mozilla {
 namespace internal {
 
 class WindowsDllNopSpacePatcher
 {
-  typedef unsigned char *byteptr_t;
+  typedef unsigned char* byteptr_t;
   HMODULE mModule;
 
   // Dumb array for remembering the addresses of functions we've patched.
   // (This should be nsTArray, but non-XPCOM code uses this class.)
   static const size_t maxPatchedFns = 128;
   byteptr_t mPatchedFns[maxPatchedFns];
   int mPatchedFnsLen;
 
@@ -104,260 +104,264 @@ public:
 
       // I don't think this is actually necessary, but it can't hurt.
       FlushInstructionCache(GetCurrentProcess(),
                             /* ignored */ nullptr,
                             /* ignored */ 0);
     }
   }
 
-  void Init(const char *modulename)
+  void Init(const char* aModuleName)
   {
-    mModule = LoadLibraryExA(modulename, nullptr, 0);
+    mModule = LoadLibraryExA(aModuleName, nullptr, 0);
     if (!mModule) {
-      //printf("LoadLibraryEx for '%s' failed\n", modulename);
+      //printf("LoadLibraryEx for '%s' failed\n", aModuleName);
       return;
     }
   }
 
 #if defined(_M_IX86)
-  bool AddHook(const char *pname, intptr_t hookDest, void **origFunc)
+  bool AddHook(const char* aName, intptr_t aHookDest, void** aOrigFunc)
   {
-    if (!mModule)
+    if (!mModule) {
       return false;
+    }
 
     if (mPatchedFnsLen == maxPatchedFns) {
       // printf ("No space for hook in mPatchedFns.\n");
       return false;
     }
 
-    byteptr_t fn = reinterpret_cast<byteptr_t>(GetProcAddress(mModule, pname));
+    byteptr_t fn = reinterpret_cast<byteptr_t>(GetProcAddress(mModule, aName));
     if (!fn) {
       //printf ("GetProcAddress failed\n");
       return false;
     }
-  
+
     // Ensure we can read and write starting at fn - 5 (for the long jmp we're
     // going to write) and ending at fn + 2 (for the short jmp up to the long
     // jmp).
     DWORD op;
-    if (!VirtualProtectEx(GetCurrentProcess(), fn - 5, 7, PAGE_EXECUTE_READWRITE, &op)) {
+    if (!VirtualProtectEx(GetCurrentProcess(), fn - 5, 7,
+                          PAGE_EXECUTE_READWRITE, &op)) {
       //printf ("VirtualProtectEx failed! %d\n", GetLastError());
       return false;
     }
 
-    bool rv = WriteHook(fn, hookDest, origFunc);
-    
+    bool rv = WriteHook(fn, aHookDest, aOrigFunc);
+
     // Re-protect, and we're done.
     VirtualProtectEx(GetCurrentProcess(), fn - 5, 7, op, &op);
 
     if (rv) {
       mPatchedFns[mPatchedFnsLen] = fn;
       mPatchedFnsLen++;
     }
 
     return rv;
   }
 
-  bool WriteHook(byteptr_t fn, intptr_t hookDest, void **origFunc)
+  bool WriteHook(byteptr_t aFn, intptr_t aHookDest, void** aOrigFunc)
   {
-    // Check that the 5 bytes before fn are NOP's or INT 3's,
-    // and that the 2 bytes after fn are mov(edi, edi).
+    // Check that the 5 bytes before aFn are NOP's or INT 3's,
+    // and that the 2 bytes after aFn are mov(edi, edi).
     //
-    // It's safe to read fn[-5] because we set it to PAGE_EXECUTE_READWRITE
+    // It's safe to read aFn[-5] because we set it to PAGE_EXECUTE_READWRITE
     // before calling WriteHook.
 
     for (int i = -5; i <= -1; i++) {
-      if (fn[i] != 0x90 && fn[i] != 0xcc) // nop or int 3
+      if (aFn[i] != 0x90 && aFn[i] != 0xcc) { // nop or int 3
         return false;
+      }
     }
 
     // mov edi, edi.  Yes, there are two ways to encode the same thing:
     //
     //   0x89ff == mov r/m, r
     //   0x8bff == mov r, r/m
     //
     // where "r" is register and "r/m" is register or memory.  Windows seems to
     // use 8bff; I include 89ff out of paranoia.
-    if ((fn[0] != 0x8b && fn[0] != 0x89) || fn[1] != 0xff) {
+    if ((aFn[0] != 0x8b && aFn[0] != 0x89) || aFn[1] != 0xff) {
       return false;
     }
 
     // Write a long jump into the space above the function.
-    fn[-5] = 0xe9; // jmp
-    *((intptr_t*)(fn - 4)) = hookDest - (uintptr_t)(fn); // target displacement
+    aFn[-5] = 0xe9; // jmp
+    *((intptr_t*)(aFn - 4)) = aHookDest - (uintptr_t)(aFn); // target displacement
 
-    // Set origFunc here, because after this point, hookDest might be called,
-    // and hookDest might use the origFunc pointer.
-    *origFunc = fn + 2;
+    // Set aOrigFunc here, because after this point, aHookDest might be called,
+    // and aHookDest might use the aOrigFunc pointer.
+    *aOrigFunc = aFn + 2;
 
     // Short jump up into our long jump.
-    *((uint16_t*)(fn)) = 0xf9eb; // jmp $-5
+    *((uint16_t*)(aFn)) = 0xf9eb; // jmp $-5
 
     // I think this routine is safe without this, but it can't hurt.
     FlushInstructionCache(GetCurrentProcess(),
                           /* ignored */ nullptr,
                           /* ignored */ 0);
 
     return true;
   }
 #else
-  bool AddHook(const char *pname, intptr_t hookDest, void **origFunc)
+  bool AddHook(const char* aName, intptr_t aHookDest, void** aOrigFunc)
   {
     // Not implemented except on x86-32.
     return false;
   }
 #endif
 };
 
 class WindowsDllDetourPatcher
 {
-  typedef unsigned char *byteptr_t;
+  typedef unsigned char* byteptr_t;
 public:
-  WindowsDllDetourPatcher() 
+  WindowsDllDetourPatcher()
     : mModule(0), mHookPage(0), mMaxHooks(0), mCurHooks(0)
   {
   }
 
   ~WindowsDllDetourPatcher()
   {
     int i;
     byteptr_t p;
     for (i = 0, p = mHookPage; i < mCurHooks; i++, p += kHookSize) {
 #if defined(_M_IX86)
       size_t nBytes = 1 + sizeof(intptr_t);
 #elif defined(_M_X64)
       size_t nBytes = 2 + sizeof(intptr_t);
 #else
 #error "Unknown processor type"
 #endif
-      byteptr_t origBytes = *((byteptr_t *)p);
+      byteptr_t origBytes = *((byteptr_t*)p);
       // ensure we can modify the original code
       DWORD op;
-      if (!VirtualProtectEx(GetCurrentProcess(), origBytes, nBytes, PAGE_EXECUTE_READWRITE, &op)) {
+      if (!VirtualProtectEx(GetCurrentProcess(), origBytes, nBytes,
+                            PAGE_EXECUTE_READWRITE, &op)) {
         //printf ("VirtualProtectEx failed! %d\n", GetLastError());
         continue;
       }
       // Remove the hook by making the original function jump directly
       // in the trampoline.
-      intptr_t dest = (intptr_t)(p + sizeof(void *));
+      intptr_t dest = (intptr_t)(p + sizeof(void*));
 #if defined(_M_IX86)
-      *((intptr_t*)(origBytes+1)) = dest - (intptr_t)(origBytes+5); // target displacement
+      *((intptr_t*)(origBytes + 1)) =
+        dest - (intptr_t)(origBytes + 5); // target displacement
 #elif defined(_M_X64)
-      *((intptr_t*)(origBytes+2)) = dest;
+      *((intptr_t*)(origBytes + 2)) = dest;
 #else
 #error "Unknown processor type"
 #endif
       // restore protection; if this fails we can't really do anything about it
       VirtualProtectEx(GetCurrentProcess(), origBytes, nBytes, op, &op);
     }
   }
 
-  void Init(const char *modulename, int nhooks = 0)
+  void Init(const char* aModuleName, int aNumHooks = 0)
   {
-    if (mModule)
+    if (mModule) {
       return;
+    }
 
-    mModule = LoadLibraryExA(modulename, nullptr, 0);
+    mModule = LoadLibraryExA(aModuleName, nullptr, 0);
     if (!mModule) {
-      //printf("LoadLibraryEx for '%s' failed\n", modulename);
+      //printf("LoadLibraryEx for '%s' failed\n", aModuleName);
       return;
     }
 
     int hooksPerPage = 4096 / kHookSize;
-    if (nhooks == 0)
-      nhooks = hooksPerPage;
-
-    mMaxHooks = nhooks + (hooksPerPage % nhooks);
+    if (aNumHooks == 0) {
+      aNumHooks = hooksPerPage;
+    }
 
-    mHookPage = (byteptr_t) VirtualAllocEx(GetCurrentProcess(), nullptr,
-             mMaxHooks * kHookSize,
-             MEM_COMMIT | MEM_RESERVE,
-             PAGE_EXECUTE_READWRITE);
+    mMaxHooks = aNumHooks + (hooksPerPage % aNumHooks);
 
+    mHookPage = (byteptr_t)VirtualAllocEx(GetCurrentProcess(), nullptr,
+                                          mMaxHooks * kHookSize,
+                                          MEM_COMMIT | MEM_RESERVE,
+                                          PAGE_EXECUTE_READWRITE);
     if (!mHookPage) {
       mModule = 0;
       return;
     }
   }
 
-  bool Initialized()
-  {
-    return !!mModule;
-  }
+  bool Initialized() { return !!mModule; }
 
   void LockHooks()
   {
-    if (!mModule)
+    if (!mModule) {
       return;
+    }
 
     DWORD op;
-    VirtualProtectEx(GetCurrentProcess(), mHookPage, mMaxHooks * kHookSize, PAGE_EXECUTE_READ, &op);
+    VirtualProtectEx(GetCurrentProcess(), mHookPage, mMaxHooks * kHookSize,
+                     PAGE_EXECUTE_READ, &op);
 
     mModule = 0;
   }
 
-  bool AddHook(const char *pname, intptr_t hookDest, void **origFunc)
+  bool AddHook(const char* aName, intptr_t aHookDest, void** aOrigFunc)
   {
-    if (!mModule)
+    if (!mModule) {
       return false;
+    }
 
-    void *pAddr = (void *) GetProcAddress(mModule, pname);
+    void* pAddr = (void*)GetProcAddress(mModule, aName);
     if (!pAddr) {
       //printf ("GetProcAddress failed\n");
       return false;
     }
 
-    CreateTrampoline(pAddr, hookDest, origFunc);
-    if (!*origFunc) {
+    CreateTrampoline(pAddr, aHookDest, aOrigFunc);
+    if (!*aOrigFunc) {
       //printf ("CreateTrampoline failed\n");
       return false;
     }
 
     return true;
   }
 
 protected:
   const static int kPageSize = 4096;
   const static int kHookSize = 128;
 
   HMODULE mModule;
   byteptr_t mHookPage;
   int mMaxHooks;
   int mCurHooks;
 
-  void CreateTrampoline(void *origFunction,
-                        intptr_t dest,
-                        void **outTramp)
+  void CreateTrampoline(void* aOrigFunction, intptr_t aDest, void** aOutTramp)
   {
-    *outTramp = nullptr;
+    *aOutTramp = nullptr;
 
     byteptr_t tramp = FindTrampolineSpace();
-    if (!tramp)
+    if (!tramp) {
       return;
+    }
 
-    byteptr_t origBytes = (byteptr_t) origFunction;
+    byteptr_t origBytes = (byteptr_t)aOrigFunction;
 
     int nBytes = 0;
     int pJmp32 = -1;
 
 #if defined(_M_IX86)
     while (nBytes < 5) {
       // Understand some simple instructions that might be found in a
       // prologue; we might need to extend this as necessary.
       //
       // Note!  If we ever need to understand jump instructions, we'll
       // need to rewrite the displacement argument.
       if (origBytes[nBytes] >= 0x88 && origBytes[nBytes] <= 0x8B) {
         // various MOVs
-        unsigned char b = origBytes[nBytes+1];
+        unsigned char b = origBytes[nBytes + 1];
         if (((b & 0xc0) == 0xc0) ||
             (((b & 0xc0) == 0x00) &&
-             ((b & 0x07) != 0x04) && ((b & 0x07) != 0x05)))
-        {
+             ((b & 0x07) != 0x04) && ((b & 0x07) != 0x05))) {
           // REG=r, R/M=r or REG=r, R/M=[r]
           nBytes += 2;
         } else if ((b & 0xc0) == 0x40) {
           if ((b & 0x07) == 0x04) {
             // REG=r, R/M=[SIB + disp8]
             nBytes += 4;
           } else {
             // REG=r, R/M=[r + disp8]
@@ -367,17 +371,17 @@ protected:
           // complex MOV, bail
           return;
         }
       } else if (origBytes[nBytes] == 0xB8) {
         // MOV 0xB8: http://ref.x86asm.net/coder32.html#xB8
         nBytes += 5;
       } else if (origBytes[nBytes] == 0x83) {
         // ADD|ODR|ADC|SBB|AND|SUB|XOR|CMP r/m, imm8
-        unsigned char b = origBytes[nBytes+1];
+        unsigned char b = origBytes[nBytes + 1];
         if ((b & 0xc0) == 0xc0) {
           // ADD|ODR|ADC|SBB|AND|SUB|XOR|CMP r, imm8
           nBytes += 3;
         } else {
           // bail
           return;
         }
       } else if (origBytes[nBytes] == 0x68) {
@@ -398,23 +402,24 @@ protected:
         return;
       }
     }
 #elif defined(_M_X64)
     byteptr_t directJmpAddr;
 
     while (nBytes < 13) {
 
-      // if found JMP 32bit offset, next bytes must be NOP 
+      // if found JMP 32bit offset, next bytes must be NOP
       if (pJmp32 >= 0) {
-        if (origBytes[nBytes++] != 0x90)
+        if (origBytes[nBytes++] != 0x90) {
           return;
+        }
 
         continue;
-      } 
+      }
       if (origBytes[nBytes] == 0x0f) {
         nBytes++;
         if (origBytes[nBytes] == 0x1f) {
           // nop (multibyte)
           nBytes++;
           if ((origBytes[nBytes] & 0xc0) == 0x40 &&
               (origBytes[nBytes] & 0x7) == 0x04) {
             nBytes += 3;
@@ -449,40 +454,42 @@ protected:
           nBytes += 2;
         } else {
           return;
         }
       } else if ((origBytes[nBytes] & 0xfb) == 0x48) {
         // REX.W | REX.WR
         nBytes++;
 
-        if (origBytes[nBytes] == 0x81 && (origBytes[nBytes+1] & 0xf8) == 0xe8) {
+        if (origBytes[nBytes] == 0x81 &&
+            (origBytes[nBytes + 1] & 0xf8) == 0xe8) {
           // sub r, dword
           nBytes += 6;
         } else if (origBytes[nBytes] == 0x83 &&
-                  (origBytes[nBytes+1] & 0xf8) == 0xe8) {
+                   (origBytes[nBytes + 1] & 0xf8) == 0xe8) {
           // sub r, byte
           nBytes += 3;
         } else if (origBytes[nBytes] == 0x83 &&
-                  (origBytes[nBytes+1] & 0xf8) == 0x60) {
+                   (origBytes[nBytes + 1] & 0xf8) == 0x60) {
           // and [r+d], imm8
           nBytes += 5;
         } else if ((origBytes[nBytes] & 0xfd) == 0x89) {
           // MOV r/m64, r64 | MOV r64, r/m64
-          if ((origBytes[nBytes+1] & 0xc0) == 0x40) {
-            if ((origBytes[nBytes+1] & 0x7) == 0x04) {
+          if ((origBytes[nBytes + 1] & 0xc0) == 0x40) {
+            if ((origBytes[nBytes + 1] & 0x7) == 0x04) {
               // R/M=[SIB+disp8], REG=r64
               nBytes += 4;
             } else {
               // R/M=[r64+disp8], REG=r64
               nBytes += 3;
             }
-          } else if (((origBytes[nBytes+1] & 0xc0) == 0xc0) ||
-                     (((origBytes[nBytes+1] & 0xc0) == 0x00) &&
-                      ((origBytes[nBytes+1] & 0x07) != 0x04) && ((origBytes[nBytes+1] & 0x07) != 0x05))) {
+          } else if (((origBytes[nBytes + 1] & 0xc0) == 0xc0) ||
+                     (((origBytes[nBytes + 1] & 0xc0) == 0x00) &&
+                      ((origBytes[nBytes + 1] & 0x07) != 0x04) &&
+                      ((origBytes[nBytes + 1] & 0x07) != 0x05))) {
             // REG=r64, R/M=r64 or REG=r64, R/M=[r64]
             nBytes += 2;
           } else {
             // complex MOV
             return;
           }
         } else if (origBytes[nBytes] == 0xc7) {
           // MOV r/m64, imm32
@@ -491,21 +498,23 @@ protected:
             // ModR/W + SIB + disp8 + imm32
             nBytes += 8;
           } else {
             return;
           }
         } else if (origBytes[nBytes] == 0xff) {
           pJmp32 = nBytes - 1;
           // JMP /4
-          if ((origBytes[nBytes+1] & 0xc0) == 0x0 &&
-              (origBytes[nBytes+1] & 0x07) == 0x5) {
+          if ((origBytes[nBytes + 1] & 0xc0) == 0x0 &&
+              (origBytes[nBytes + 1] & 0x07) == 0x5) {
             // [rip+disp32]
             // convert JMP 32bit offset to JMP 64bit direct
-            directJmpAddr = (byteptr_t)*((uint64_t*)(origBytes + nBytes + 6 + (*((int32_t*)(origBytes + nBytes + 2)))));
+            directJmpAddr =
+              (byteptr_t)*((uint64_t*)(origBytes + nBytes + 6 +
+                                       (*((int32_t*)(origBytes + nBytes + 2)))));
             nBytes += 6;
           } else {
             // not support yet!
             return;
           }
         } else {
           // not support yet!
           return;
@@ -546,167 +555,172 @@ protected:
 
     if (nBytes > 100) {
       //printf ("Too big!");
       return;
     }
 
     // We keep the address of the original function in the first bytes of
     // the trampoline buffer
-    *((void **)tramp) = origFunction;
-    tramp += sizeof(void *);
+    *((void**)tramp) = aOrigFunction;
+    tramp += sizeof(void*);
 
-    memcpy(tramp, origFunction, nBytes);
+    memcpy(tramp, aOrigFunction, nBytes);
 
     // OrigFunction+N, the target of the trampoline
     byteptr_t trampDest = origBytes + nBytes;
 
 #if defined(_M_IX86)
     if (pJmp32 >= 0) {
       // Jump directly to the original target of the jump instead of jumping to the
       // original function.
       // Adjust jump target displacement to jump location in the trampoline.
-      *((intptr_t*)(tramp+pJmp32+1)) += origBytes - tramp;
+      *((intptr_t*)(tramp + pJmp32 + 1)) += origBytes - tramp;
     } else {
       tramp[nBytes] = 0xE9; // jmp
-      *((intptr_t*)(tramp+nBytes+1)) = (intptr_t)trampDest - (intptr_t)(tramp+nBytes+5); // target displacement
+      *((intptr_t*)(tramp + nBytes + 1)) =
+        (intptr_t)trampDest - (intptr_t)(tramp + nBytes + 5); // target displacement
     }
 #elif defined(_M_X64)
-    // If JMP32 opcode found, we don't insert to trampoline jump 
+    // If JMP32 opcode found, we don't insert to trampoline jump
     if (pJmp32 >= 0) {
       // mov r11, address
       tramp[pJmp32]   = 0x49;
-      tramp[pJmp32+1] = 0xbb;
-      *((intptr_t*)(tramp+pJmp32+2)) = (intptr_t)directJmpAddr;
+      tramp[pJmp32 + 1] = 0xbb;
+      *((intptr_t*)(tramp + pJmp32 + 2)) = (intptr_t)directJmpAddr;
 
       // jmp r11
-      tramp[pJmp32+10] = 0x41;
-      tramp[pJmp32+11] = 0xff;
-      tramp[pJmp32+12] = 0xe3;
+      tramp[pJmp32 + 10] = 0x41;
+      tramp[pJmp32 + 11] = 0xff;
+      tramp[pJmp32 + 12] = 0xe3;
     } else {
       // mov r11, address
       tramp[nBytes] = 0x49;
-      tramp[nBytes+1] = 0xbb;
-      *((intptr_t*)(tramp+nBytes+2)) = (intptr_t)trampDest;
+      tramp[nBytes + 1] = 0xbb;
+      *((intptr_t*)(tramp + nBytes + 2)) = (intptr_t)trampDest;
 
       // jmp r11
-      tramp[nBytes+10] = 0x41;
-      tramp[nBytes+11] = 0xff;
-      tramp[nBytes+12] = 0xe3;
+      tramp[nBytes + 10] = 0x41;
+      tramp[nBytes + 11] = 0xff;
+      tramp[nBytes + 12] = 0xe3;
     }
 #endif
 
     // The trampoline is now valid.
-    *outTramp = tramp;
+    *aOutTramp = tramp;
 
     // ensure we can modify the original code
     DWORD op;
-    if (!VirtualProtectEx(GetCurrentProcess(), origFunction, nBytes, PAGE_EXECUTE_READWRITE, &op)) {
+    if (!VirtualProtectEx(GetCurrentProcess(), aOrigFunction, nBytes,
+                          PAGE_EXECUTE_READWRITE, &op)) {
       //printf ("VirtualProtectEx failed! %d\n", GetLastError());
       return;
     }
 
 #if defined(_M_IX86)
     // now modify the original bytes
     origBytes[0] = 0xE9; // jmp
-    *((intptr_t*)(origBytes+1)) = dest - (intptr_t)(origBytes+5); // target displacement
+    *((intptr_t*)(origBytes + 1)) =
+      aDest - (intptr_t)(origBytes + 5); // target displacement
 #elif defined(_M_X64)
     // mov r11, address
     origBytes[0] = 0x49;
     origBytes[1] = 0xbb;
 
-    *((intptr_t*)(origBytes+2)) = dest;
+    *((intptr_t*)(origBytes + 2)) = aDest;
 
     // jmp r11
     origBytes[10] = 0x41;
     origBytes[11] = 0xff;
     origBytes[12] = 0xe3;
 #endif
 
     // restore protection; if this fails we can't really do anything about it
-    VirtualProtectEx(GetCurrentProcess(), origFunction, nBytes, op, &op);
+    VirtualProtectEx(GetCurrentProcess(), aOrigFunction, nBytes, op, &op);
   }
 
   byteptr_t FindTrampolineSpace()
   {
-    if (mCurHooks >= mMaxHooks)
+    if (mCurHooks >= mMaxHooks) {
       return 0;
+    }
 
-    byteptr_t p = mHookPage + mCurHooks*kHookSize;
+    byteptr_t p = mHookPage + mCurHooks * kHookSize;
 
     mCurHooks++;
 
     return p;
   }
 };
 
 } // namespace internal
 
 class WindowsDllInterceptor
 {
   internal::WindowsDllNopSpacePatcher mNopSpacePatcher;
   internal::WindowsDllDetourPatcher mDetourPatcher;
 
-  const char *mModuleName;
+  const char* mModuleName;
   int mNHooks;
 
 public:
   WindowsDllInterceptor()
     : mModuleName(nullptr)
     , mNHooks(0)
   {}
 
-  void Init(const char *moduleName, int nhooks = 0)
+  void Init(const char* aModuleName, int aNumHooks = 0)
   {
     if (mModuleName) {
       return;
     }
 
-    mModuleName = moduleName;
-    mNHooks = nhooks;
-    mNopSpacePatcher.Init(moduleName);
+    mModuleName = aModuleName;
+    mNHooks = aNumHooks;
+    mNopSpacePatcher.Init(aModuleName);
 
     // Lazily initialize mDetourPatcher, since it allocates memory and we might
     // not need it.
   }
 
   void LockHooks()
   {
-    if (mDetourPatcher.Initialized())
+    if (mDetourPatcher.Initialized()) {
       mDetourPatcher.LockHooks();
+    }
   }
 
-  bool AddHook(const char *pname, intptr_t hookDest, void **origFunc)
+  bool AddHook(const char* aName, intptr_t aHookDest, void** aOrigFunc)
   {
     // Use a nop space patch if possible, otherwise fall back to a detour.
     // This should be the preferred method for adding hooks.
 
     if (!mModuleName) {
       return false;
     }
 
-    if (mNopSpacePatcher.AddHook(pname, hookDest, origFunc)) {
+    if (mNopSpacePatcher.AddHook(aName, aHookDest, aOrigFunc)) {
       return true;
     }
 
-    return AddDetour(pname, hookDest, origFunc);
+    return AddDetour(aName, aHookDest, aOrigFunc);
   }
 
-  bool AddDetour(const char *pname, intptr_t hookDest, void **origFunc)
+  bool AddDetour(const char* aName, intptr_t aHookDest, void** aOrigFunc)
   {
     // Generally, code should not call this method directly. Use AddHook unless
     // there is a specific need to avoid nop space patches.
 
     if (!mModuleName) {
       return false;
     }
 
     if (!mDetourPatcher.Initialized()) {
       mDetourPatcher.Init(mModuleName, mNHooks);
     }
 
-    return mDetourPatcher.AddHook(pname, hookDest, origFunc);
+    return mDetourPatcher.AddHook(aName, aHookDest, aOrigFunc);
   }
 };
 
 } // namespace mozilla
 
 #endif /* NS_WINDOWS_DLL_INTERCEPTOR_H_ */
--- a/xpcom/build/nsXPCOM.h
+++ b/xpcom/build/nsXPCOM.h
@@ -36,218 +36,203 @@ namespace mozilla {
 struct Module;
 }
 #endif
 
 /**
  * Initialises XPCOM. You must call one of the NS_InitXPCOM methods
  * before proceeding to use xpcom. The one exception is that you may
  * call NS_NewLocalFile to create a nsIFile.
- * 
- * @note Use <CODE>NS_NewLocalFile</CODE> or <CODE>NS_NewNativeLocalFile</CODE> 
+ *
+ * @note Use <CODE>NS_NewLocalFile</CODE> or <CODE>NS_NewNativeLocalFile</CODE>
  *       to create the file object you supply as the bin directory path in this
- *       call. The function may be safely called before the rest of XPCOM or 
+ *       call. The function may be safely called before the rest of XPCOM or
  *       embedding has been initialised.
  *
- * @param result           The service manager.  You may pass null.
+ * @param aResult          The service manager.  You may pass null.
  *
- * @param binDirectory     The directory containing the component
+ * @param aBinDirectory    The directory containing the component
  *                         registry and runtime libraries;
  *                         or use <CODE>nullptr</CODE> to use the working
  *                         directory.
  *
- * @param appFileLocationProvider The object to be used by Gecko that specifies
- *                         to Gecko where to find profiles, the component
- *                         registry preferences and so on; or use
+ * @param aAppFileLocationProvider The object to be used by Gecko that
+ *                         specifies to Gecko where to find profiles, the
+ *                         component registry preferences and so on; or use
  *                         <CODE>nullptr</CODE> for the default behaviour.
  *
  * @see NS_NewLocalFile
  * @see nsIFile
  * @see nsIDirectoryServiceProvider
  *
  * @return NS_OK for success;
  *         NS_ERROR_NOT_INITIALIZED if static globals were not initialized,
  *         which can happen if XPCOM is reloaded, but did not completly
  *         shutdown. Other error codes indicate a failure during
  *         initialisation.
  */
 XPCOM_API(nsresult)
-NS_InitXPCOM2(nsIServiceManager* *result, 
-              nsIFile* binDirectory,
-              nsIDirectoryServiceProvider* appFileLocationProvider);
+NS_InitXPCOM2(nsIServiceManager** aResult,
+              nsIFile* aBinDirectory,
+              nsIDirectoryServiceProvider* aAppFileLocationProvider);
 
 /**
  * Shutdown XPCOM. You must call this method after you are finished
- * using xpcom. 
+ * using xpcom.
  *
- * @param servMgr           The service manager which was returned by NS_InitXPCOM.
+ * @param aServMgr          The service manager which was returned by NS_InitXPCOM.
  *                          This will release servMgr.  You may pass null.
  *
  * @return NS_OK for success;
  *         other error codes indicate a failure during initialisation.
- *
  */
-XPCOM_API(nsresult)
-NS_ShutdownXPCOM(nsIServiceManager* servMgr);
+XPCOM_API(nsresult) NS_ShutdownXPCOM(nsIServiceManager* aServMgr);
 
 
 /**
  * Public Method to access to the service manager.
- * 
- * @param result Interface pointer to the service manager 
+ *
+ * @param aResult Interface pointer to the service manager
  *
  * @return NS_OK for success;
  *         other error codes indicate a failure during initialisation.
- *
  */
-XPCOM_API(nsresult)
-NS_GetServiceManager(nsIServiceManager* *result);
+XPCOM_API(nsresult) NS_GetServiceManager(nsIServiceManager** aResult);
 
 /**
  * Public Method to access to the component manager.
- * 
- * @param result Interface pointer to the service 
+ *
+ * @param aResult Interface pointer to the service
  *
  * @return NS_OK for success;
  *         other error codes indicate a failure during initialisation.
- *
  */
-XPCOM_API(nsresult)
-NS_GetComponentManager(nsIComponentManager* *result);
+XPCOM_API(nsresult) NS_GetComponentManager(nsIComponentManager** aResult);
 
 
 /**
  * Public Method to access to the component registration manager.
  *
- * @param result Interface pointer to the service
+ * @param aResult Interface pointer to the service
  *
  * @return NS_OK for success;
  *         other error codes indicate a failure during initialisation.
- *
  */
-XPCOM_API(nsresult)
-NS_GetComponentRegistrar(nsIComponentRegistrar* *result);
+XPCOM_API(nsresult) NS_GetComponentRegistrar(nsIComponentRegistrar** aResult);
 
 /**
  * Public Method to access to the memory manager.  See nsIMemory
- * 
- * @param result Interface pointer to the memory manager 
+ *
+ * @param aResult Interface pointer to the memory manager
  *
  * @return NS_OK for success;
  *         other error codes indicate a failure during initialisation.
- *
  */
-XPCOM_API(nsresult)
-NS_GetMemoryManager(nsIMemory* *result);
+XPCOM_API(nsresult) NS_GetMemoryManager(nsIMemory** aResult);
 
 /**
  * Public Method to create an instance of a nsIFile.  This function
  * may be called prior to NS_InitXPCOM.
- * 
- *   @param path       
- *       A string which specifies a full file path to a 
+ *
+ *   @param aPath
+ *       A string which specifies a full file path to a
  *       location.  Relative paths will be treated as an
- *       error (NS_ERROR_FILE_UNRECOGNIZED_PATH).       
- *       |NS_NewNativeLocalFile|'s path must be in the 
+ *       error (NS_ERROR_FILE_UNRECOGNIZED_PATH).
+ *       |NS_NewNativeLocalFile|'s path must be in the
  *       filesystem charset.
- *   @param followLinks
+ *   @param aFollowLinks
  *       This attribute will determine if the nsLocalFile will auto
  *       resolve symbolic links.  By default, this value will be false
  *       on all non unix systems.  On unix, this attribute is effectively
- *       a noop.  
- * @param result Interface pointer to a new instance of an nsIFile 
+ *       a noop.
+ * @param aResult Interface pointer to a new instance of an nsIFile
  *
  * @return NS_OK for success;
  *         other error codes indicate a failure.
  */
 
 #ifdef __cplusplus
 
-XPCOM_API(nsresult)
-NS_NewLocalFile(const nsAString &path, 
-                bool followLinks, 
-                nsIFile* *result);
+XPCOM_API(nsresult) NS_NewLocalFile(const nsAString& aPath,
+                                    bool aFollowLinks,
+                                    nsIFile** aResult);
 
-XPCOM_API(nsresult)
-NS_NewNativeLocalFile(const nsACString &path, 
-                      bool followLinks, 
-                      nsIFile* *result);
+XPCOM_API(nsresult) NS_NewNativeLocalFile(const nsACString& aPath,
+                                          bool aFollowLinks,
+                                          nsIFile** aResult);
 
 #endif
 
 /**
  * Allocates a block of memory of a particular size. If the memory cannot
  * be allocated (because of an out-of-memory condition), the process aborts.
  *
- * @param size   The size of the block to allocate
+ * @param aSize  The size of the block to allocate
  * @result       The block of memory
  * @note         This function is thread-safe.
  */
-XPCOM_API(void*)
-NS_Alloc(size_t size);
+XPCOM_API(void*) NS_Alloc(size_t aSize);
 
 /**
  * Reallocates a block of memory to a new size.
  *
- * @param ptr     The block of memory to reallocate. This block must originally
+ * @param aPtr    The block of memory to reallocate. This block must originally
                   have been allocated by NS_Alloc or NS_Realloc
- * @param size    The new size. If 0, frees the block like NS_Free
+ * @param aSize   The new size. If 0, frees the block like NS_Free
  * @result        The reallocated block of memory
  * @note          This function is thread-safe.
  *
- * If ptr is null, this function behaves like NS_Alloc.
- * If s is the size of the block to which ptr points, the first min(s, size)
- * bytes of ptr's block are copied to the new block. If the allocation
- * succeeds, ptr is freed and a pointer to the new block is returned. If the
+ * If aPtr is null, this function behaves like NS_Alloc.
+ * If s is the size of the block to which aPtr points, the first min(s, size)
+ * bytes of aPtr's block are copied to the new block. If the allocation
+ * succeeds, aPtr is freed and a pointer to the new block is returned. If the
  * allocation fails, the process aborts.
  */
-XPCOM_API(void*)
-NS_Realloc(void* ptr, size_t size);
+XPCOM_API(void*) NS_Realloc(void* aPtr, size_t aSize);
 
 /**
  * Frees a block of memory. Null is a permissible value, in which case no
  * action is taken.
  *
- * @param ptr   The block of memory to free. This block must originally have
+ * @param aPtr  The block of memory to free. This block must originally have
  *              been allocated by NS_Alloc or NS_Realloc
  * @note        This function is thread-safe.
  */
-XPCOM_API(void)
-NS_Free(void* ptr);
+XPCOM_API(void) NS_Free(void* aPtr);
 
 /**
  * Support for warnings, assertions, and debugging breaks.
  */
 
-enum {
-    NS_DEBUG_WARNING = 0,
-    NS_DEBUG_ASSERTION = 1,
-    NS_DEBUG_BREAK = 2,
-    NS_DEBUG_ABORT = 3
+enum
+{
+  NS_DEBUG_WARNING = 0,
+  NS_DEBUG_ASSERTION = 1,
+  NS_DEBUG_BREAK = 2,
+  NS_DEBUG_ABORT = 3
 };
 
 /**
  * Print a runtime assertion. This function is available in both debug and
  * release builds.
- * 
+ *
  * @note Based on the value of aSeverity and the XPCOM_DEBUG_BREAK
  * environment variable, this function may cause the application to
  * print the warning, print a stacktrace, break into a debugger, or abort
  * immediately.
  *
  * @param aSeverity A NS_DEBUG_* value
  * @param aStr   A readable error message (ASCII, may be null)
  * @param aExpr  The expression evaluated (may be null)
  * @param aFile  The source file containing the assertion (may be null)
  * @param aLine  The source file line number (-1 indicates no line number)
  */
-XPCOM_API(void)
-NS_DebugBreak(uint32_t aSeverity,
-              const char *aStr, const char *aExpr,
-              const char *aFile, int32_t aLine);
+XPCOM_API(void) NS_DebugBreak(uint32_t aSeverity,
+                              const char* aStr, const char* aExpr,
+                              const char* aFile, int32_t aLine);
 
 /**
  * Perform a stack-walk to a debugging log under various
  * circumstances. Used to aid debugging of leaked object graphs.
  *
  * The NS_Log* functions are available in both debug and release
  * builds of XPCOM, but the output will be useless unless binary
  * debugging symbols for all modules in the stacktrace are available.
@@ -255,86 +240,81 @@ NS_DebugBreak(uint32_t aSeverity,
 
 /**
  * By default, refcount logging is enabled at NS_InitXPCOM and
  * refcount statistics are printed at NS_ShutdownXPCOM. NS_LogInit and
  * NS_LogTerm allow applications to enable logging earlier and delay
  * printing of logging statistics. They should always be used as a
  * matched pair.
  */
-XPCOM_API(void)
-NS_LogInit();
+XPCOM_API(void) NS_LogInit();
 
-XPCOM_API(void)
-NS_LogTerm();
+XPCOM_API(void) NS_LogTerm();
 
 /**
  * Log construction and destruction of objects. Processing tools can use the
  * stacktraces printed by these functions to identify objects that are being
  * leaked.
  *
  * @param aPtr          A pointer to the concrete object.
  * @param aTypeName     The class name of the type
  * @param aInstanceSize The size of the type
  */
 
-XPCOM_API(void)
-NS_LogCtor(void *aPtr, const char *aTypeName, uint32_t aInstanceSize);
+XPCOM_API(void) NS_LogCtor(void* aPtr, const char* aTypeName,
+                           uint32_t aInstanceSize);
 
-XPCOM_API(void)
-NS_LogDtor(void *aPtr, const char *aTypeName, uint32_t aInstanceSize);
+XPCOM_API(void) NS_LogDtor(void* aPtr, const char* aTypeName,
+                           uint32_t aInstanceSize);
 
 /**
  * Log a stacktrace when an XPCOM object's refcount is incremented or
  * decremented. Processing tools can use the stacktraces printed by these
  * functions to identify objects that were leaked due to XPCOM references.
  *
  * @param aPtr          A pointer to the concrete object
  * @param aNewRefCnt    The new reference count.
  * @param aTypeName     The class name of the type
  * @param aInstanceSize The size of the type
  */
-XPCOM_API(void)
-NS_LogAddRef(void *aPtr, nsrefcnt aNewRefCnt,
-             const char *aTypeName, uint32_t aInstanceSize);
+XPCOM_API(void) NS_LogAddRef(void* aPtr, nsrefcnt aNewRefCnt,
+                             const char* aTypeName, uint32_t aInstanceSize);
 
-XPCOM_API(void)
-NS_LogRelease(void *aPtr, nsrefcnt aNewRefCnt, const char *aTypeName);
+XPCOM_API(void) NS_LogRelease(void* aPtr, nsrefcnt aNewRefCnt,
+                              const char* aTypeName);
 
 /**
  * Log reference counting performed by COMPtrs. Processing tools can
  * use the stacktraces printed by these functions to simplify reports
  * about leaked objects generated from the data printed by
  * NS_LogAddRef/NS_LogRelease.
  *
  * @param aCOMPtr the address of the COMPtr holding a strong reference
  * @param aObject the object being referenced by the COMPtr
  */
 
-XPCOM_API(void)
-NS_LogCOMPtrAddRef(void *aCOMPtr, nsISupports *aObject);
+XPCOM_API(void) NS_LogCOMPtrAddRef(void* aCOMPtr, nsISupports* aObject);
 
-XPCOM_API(void)
-NS_LogCOMPtrRelease(void *aCOMPtr, nsISupports *aObject);
+XPCOM_API(void) NS_LogCOMPtrRelease(void* aCOMPtr, nsISupports* aObject);
 
 /**
  * The XPCOM cycle collector analyzes and breaks reference cycles between
  * participating XPCOM objects. All objects in the cycle must implement
  * nsCycleCollectionParticipant to break cycles correctly.
  */
 
 #ifdef __cplusplus
 
 class nsCycleCollectionParticipant;
 class nsCycleCollectingAutoRefCnt;
 
-XPCOM_API(void)
-NS_CycleCollectorSuspect3(void *n, nsCycleCollectionParticipant *p,
-                          nsCycleCollectingAutoRefCnt *aRefCnt,
-                          bool* aShouldDelete);
+XPCOM_API(void) NS_CycleCollectorSuspect3(void* aPtr,
+                                          nsCycleCollectionParticipant* aCp,
+                                          nsCycleCollectingAutoRefCnt* aRefCnt,
+                                          bool* aShouldDelete);
 
 #endif
 
 /**
  * Categories (in the category manager service) used by XPCOM:
  */
 
 /**
@@ -403,12 +383,11 @@ NS_CycleCollectorSuspect3(void *n, nsCyc
 /**
  * This topic is notified when an a category was cleared in the category
  * manager. The subject of the notification will be the category manager,
  * and the data will be the name of the cleared category.
  * The notification will occur on the main thread.
  */
 #define NS_XPCOM_CATEGORY_CLEARED_OBSERVER_ID "xpcom-category-cleared"
 
-XPCOM_API(nsresult)
-NS_GetDebug(nsIDebug* *result);
+XPCOM_API(nsresult) NS_GetDebug(nsIDebug** aResult);
 
 #endif
--- a/xpcom/build/nsXPCOMCID.h
+++ b/xpcom/build/nsXPCOMCID.h
@@ -3,40 +3,40 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsXPCOMCID_h__
 #define nsXPCOMCID_h__
 
 /**
  * XPCOM Directory Service Contract ID
- *   The directory service provides ways to obtain file system locations. The 
+ *   The directory service provides ways to obtain file system locations. The
  *   directory service is a singleton.
  *
  *   This contract supports the nsIDirectoryService and the nsIProperties
  *   interfaces.
  *
  */
 #define NS_DIRECTORY_SERVICE_CONTRACTID "@mozilla.org/file/directory_service;1"
 
 /**
  * XPCOM File
- *   The file abstraction provides ways to obtain and access files and 
- *   directories located on the local system. 
+ *   The file abstraction provides ways to obtain and access files and
+ *   directories located on the local system.
  *
  *   This contract supports the nsIFile interface.
- *   This contract may also support platform specific interfaces such as 
+ *   This contract may also support platform specific interfaces such as
  *   nsILocalFileMac on platforms where additional interfaces are required.
  *
  */
 #define NS_LOCAL_FILE_CONTRACTID "@mozilla.org/file/local;1"
 
 /**
  * XPCOM Category Manager Contract ID
- *   The contract supports the nsICategoryManager interface. The 
+ *   The contract supports the nsICategoryManager interface. The
  *   category manager is a singleton.
  * The "enumerateCategory" method of nsICategoryManager will return an object
  * that implements nsIUTF8StringEnumerator. In addition, the enumerator will
  * return the entries in sorted order (sorted by byte comparison).
  */
 #define NS_CATEGORYMANAGER_CONTRACTID   "@mozilla.org/categorymanager;1"
 
 /**
@@ -86,18 +86,18 @@
 #define NS_CYCLE_COLLECTOR_LOGGER_CONTRACTID "@mozilla.org/cycle-collector-logger;1"
 
 /**
  * nsMessageLoop contract id
  */
 #define NS_MESSAGE_LOOP_CONTRACTID "@mozilla.org/message-loop;1"
 
 /**
- * The following are the CIDs and Contract IDs of the nsISupports wrappers for 
- * primative types.  
+ * The following are the CIDs and Contract IDs of the nsISupports wrappers for
+ * primative types.
  */
 #define NS_SUPPORTS_ID_CID \
 { 0xacf8dc40, 0x4a25, 0x11d3, \
 { 0x98, 0x90, 0x0, 0x60, 0x8, 0x96, 0x24, 0x22 } }
 #define NS_SUPPORTS_ID_CONTRACTID "@mozilla.org/supports-id;1"
 
 #define NS_SUPPORTS_CSTRING_CID \
 { 0xacf8dc41, 0x4a25, 0x11d3, \
--- a/xpcom/build/nsXPCOMPrivate.h
+++ b/xpcom/build/nsXPCOMPrivate.h
@@ -25,178 +25,203 @@ class nsPurpleBufferEntry;
 
 /**
  * During this shutdown notification all module loaders must unload XPCOM
  * modules.
  */
 #define NS_XPCOM_SHUTDOWN_LOADERS_OBSERVER_ID "xpcom-shutdown-loaders"
 
 // PUBLIC
-typedef nsresult   (* InitFunc)(nsIServiceManager* *result, nsIFile* binDirectory, nsIDirectoryServiceProvider* appFileLocationProvider);
-typedef nsresult   (* ShutdownFunc)(nsIServiceManager* servMgr);
-typedef nsresult   (* GetServiceManagerFunc)(nsIServiceManager* *result);
-typedef nsresult   (* GetComponentManagerFunc)(nsIComponentManager* *result);
-typedef nsresult   (* GetComponentRegistrarFunc)(nsIComponentRegistrar* *result);
-typedef nsresult   (* GetMemoryManagerFunc)(nsIMemory* *result);
-typedef nsresult   (* NewLocalFileFunc)(const nsAString &path, bool followLinks, nsIFile* *result);
-typedef nsresult   (* NewNativeLocalFileFunc)(const nsACString &path, bool followLinks, nsIFile* *result);
+typedef nsresult   (*InitFunc)(nsIServiceManager** aResult,
+                               nsIFile* aBinDirectory,
+                               nsIDirectoryServiceProvider* aAppFileLocationProvider);
+typedef nsresult   (*ShutdownFunc)(nsIServiceManager* aServMgr);
+typedef nsresult   (*GetServiceManagerFunc)(nsIServiceManager** aResult);
+typedef nsresult   (*GetComponentManagerFunc)(nsIComponentManager** aResult);
+typedef nsresult   (*GetComponentRegistrarFunc)(nsIComponentRegistrar** aResult);
+typedef nsresult   (*GetMemoryManagerFunc)(nsIMemory** aResult);
+typedef nsresult   (*NewLocalFileFunc)(const nsAString& aPath,
+                                       bool aFollowLinks, nsIFile** aResult);
+typedef nsresult   (*NewNativeLocalFileFunc)(const nsACString& aPath,
+                                             bool aFollowLinks,
+                                             nsIFile** aResult);
 
-typedef nsresult   (* GetDebugFunc)(nsIDebug* *result);
+typedef nsresult   (*GetDebugFunc)(nsIDebug** aResult);
 
-typedef nsresult   (* StringContainerInitFunc)(nsStringContainer&);
-typedef nsresult   (* StringContainerInit2Func)(nsStringContainer&, const char16_t *, uint32_t, uint32_t);
-typedef void       (* StringContainerFinishFunc)(nsStringContainer&);
-typedef uint32_t   (* StringGetDataFunc)(const nsAString&, const char16_t**, bool*);
-typedef uint32_t   (* StringGetMutableDataFunc)(nsAString&, uint32_t, char16_t**);
-typedef char16_t* (* StringCloneDataFunc)(const nsAString&);
-typedef nsresult   (* StringSetDataFunc)(nsAString&, const char16_t*, uint32_t);
-typedef nsresult   (* StringSetDataRangeFunc)(nsAString&, uint32_t, uint32_t, const char16_t*, uint32_t);
-typedef nsresult   (* StringCopyFunc)(nsAString &, const nsAString &);
-typedef void       (* StringSetIsVoidFunc)(nsAString &, const bool);
-typedef bool       (* StringGetIsVoidFunc)(const nsAString &);
+typedef nsresult   (*StringContainerInitFunc)(nsStringContainer&);
+typedef nsresult   (*StringContainerInit2Func)(nsStringContainer&,
+                                               const char16_t*,
+                                               uint32_t, uint32_t);
+typedef void       (*StringContainerFinishFunc)(nsStringContainer&);
+typedef uint32_t   (*StringGetDataFunc)(const nsAString&, const char16_t**,
+                                        bool*);
+typedef uint32_t   (*StringGetMutableDataFunc)(nsAString&, uint32_t,
+                                               char16_t**);
+typedef char16_t*  (*StringCloneDataFunc)(const nsAString&);
+typedef nsresult   (*StringSetDataFunc)(nsAString&, const char16_t*, uint32_t);
+typedef nsresult   (*StringSetDataRangeFunc)(nsAString&, uint32_t, uint32_t,
+                                             const char16_t*, uint32_t);
+typedef nsresult   (*StringCopyFunc)(nsAString&, const nsAString&);
+typedef void       (*StringSetIsVoidFunc)(nsAString&, const bool);
+typedef bool       (*StringGetIsVoidFunc)(const nsAString&);
 
-typedef nsresult   (* CStringContainerInitFunc)(nsCStringContainer&);
-typedef nsresult   (* CStringContainerInit2Func)(nsCStringContainer&, const char *, uint32_t, uint32_t);
-typedef void       (* CStringContainerFinishFunc)(nsCStringContainer&);
-typedef uint32_t   (* CStringGetDataFunc)(const nsACString&, const char**, bool*);
-typedef uint32_t   (* CStringGetMutableDataFunc)(nsACString&, uint32_t, char**);
-typedef char*      (* CStringCloneDataFunc)(const nsACString&);
-typedef nsresult   (* CStringSetDataFunc)(nsACString&, const char*, uint32_t);
-typedef nsresult   (* CStringSetDataRangeFunc)(nsACString&, uint32_t, uint32_t, const char*, uint32_t);
-typedef nsresult   (* CStringCopyFunc)(nsACString &, const nsACString &);
-typedef void       (* CStringSetIsVoidFunc)(nsACString &, const bool);
-typedef bool       (* CStringGetIsVoidFunc)(const nsACString &);
+typedef nsresult   (*CStringContainerInitFunc)(nsCStringContainer&);
+typedef nsresult   (*CStringContainerInit2Func)(nsCStringContainer&,
+                                                const char*,
+                                                uint32_t, uint32_t);
+typedef void       (*CStringContainerFinishFunc)(nsCStringContainer&);
+typedef uint32_t   (*CStringGetDataFunc)(const nsACString&, const char**,
+                                         bool*);
+typedef uint32_t   (*CStringGetMutableDataFunc)(nsACString&, uint32_t, char**);
+typedef char*      (*CStringCloneDataFunc)(const nsACString&);
+typedef nsresult   (*CStringSetDataFunc)(nsACString&, const char*, uint32_t);
+typedef nsresult   (*CStringSetDataRangeFunc)(nsACString&, uint32_t, uint32_t,
+                                              const char*, uint32_t);
+typedef nsresult   (*CStringCopyFunc)(nsACString&, const nsACString&);
+typedef void       (*CStringSetIsVoidFunc)(nsACString&, const bool);
+typedef bool       (*CStringGetIsVoidFunc)(const nsACString&);
 
-typedef nsresult   (* CStringToUTF16)(const nsACString &, nsCStringEncoding, nsAString &);
-typedef nsresult   (* UTF16ToCString)(const nsAString &, nsCStringEncoding, nsACString &);
+typedef nsresult   (*CStringToUTF16)(const nsACString&, nsCStringEncoding,
+                                     nsAString&);
+typedef nsresult   (*UTF16ToCString)(const nsAString&, nsCStringEncoding,
+                                     nsACString&);
 
-typedef void*      (* AllocFunc)(size_t size);
-typedef void*      (* ReallocFunc)(void* ptr, size_t size);
-typedef void       (* FreeFunc)(void* ptr);
+typedef void*      (*AllocFunc)(size_t aSize);
+typedef void*      (*ReallocFunc)(void* aPtr, size_t aSize);
+typedef void       (*FreeFunc)(void* aPtr);
 
-typedef void       (* DebugBreakFunc)(uint32_t aSeverity,
-                                      const char *aStr, const char *aExpr,
-                                      const char *aFile, int32_t aLine);
+typedef void       (*DebugBreakFunc)(uint32_t aSeverity,
+                                     const char* aStr, const char* aExpr,
+                                     const char* aFile, int32_t aLine);
+
+typedef void       (*xpcomVoidFunc)();
+typedef void       (*LogAddRefFunc)(void*, nsrefcnt, const char*, uint32_t);
+typedef void       (*LogReleaseFunc)(void*, nsrefcnt, const char*);
+typedef void       (*LogCtorFunc)(void*, const char*, uint32_t);
+typedef void       (*LogCOMPtrFunc)(void*, nsISupports*);
 
-typedef void       (* xpcomVoidFunc)();
-typedef void       (* LogAddRefFunc)(void*, nsrefcnt, const char*, uint32_t);
-typedef void       (* LogReleaseFunc)(void*, nsrefcnt, const char*);
-typedef void       (* LogCtorFunc)(void*, const char*, uint32_t);
-typedef void       (* LogCOMPtrFunc)(void*, nsISupports*);
-
-typedef nsresult   (* GetXPTCallStubFunc)(REFNSIID, nsIXPTCProxy*, nsISomeInterface**);
-typedef void       (* DestroyXPTCallStubFunc)(nsISomeInterface*);
-typedef nsresult   (* InvokeByIndexFunc)(nsISupports*, uint32_t, uint32_t, nsXPTCVariant*);
-typedef bool       (* CycleCollectorFunc)(nsISupports*);
+typedef nsresult   (*GetXPTCallStubFunc)(REFNSIID, nsIXPTCProxy*,
+                                         nsISomeInterface**);
+typedef void       (*DestroyXPTCallStubFunc)(nsISomeInterface*);
+typedef nsresult   (*InvokeByIndexFunc)(nsISupports*, uint32_t, uint32_t,
+                                        nsXPTCVariant*);
+typedef bool       (*CycleCollectorFunc)(nsISupports*);
 typedef nsPurpleBufferEntry*
-                   (* CycleCollectorSuspect2Func)(void*, nsCycleCollectionParticipant*);
-typedef bool       (* CycleCollectorForget2Func)(nsPurpleBufferEntry*);
-typedef void       (* CycleCollectorSuspect3Func)(void*, nsCycleCollectionParticipant*,nsCycleCollectingAutoRefCnt*,bool*);
+                   (*CycleCollectorSuspect2Func)(void*,
+                                                 nsCycleCollectionParticipant*);
+typedef bool       (*CycleCollectorForget2Func)(nsPurpleBufferEntry*);
+typedef void       (*CycleCollectorSuspect3Func)(void*,
+                                                 nsCycleCollectionParticipant*,
+                                                 nsCycleCollectingAutoRefCnt*,
+                                                 bool*);
 // PRIVATE AND DEPRECATED
 typedef NS_CALLBACK(XPCOMExitRoutine)(void);
 
-typedef nsresult   (* RegisterXPCOMExitRoutineFunc)(XPCOMExitRoutine exitRoutine, uint32_t priority);
-typedef nsresult   (* UnregisterXPCOMExitRoutineFunc)(XPCOMExitRoutine exitRoutine);
+typedef nsresult   (*RegisterXPCOMExitRoutineFunc)(XPCOMExitRoutine aExitRoutine,
+                                                   uint32_t aPriority);
+typedef nsresult   (*UnregisterXPCOMExitRoutineFunc)(XPCOMExitRoutine aExitRoutine);
 
-typedef struct XPCOMFunctions{
-    uint32_t version;
-    uint32_t size;
+typedef struct XPCOMFunctions
+{
+  uint32_t version;
+  uint32_t size;
 
-    InitFunc init;
-    ShutdownFunc shutdown;
-    GetServiceManagerFunc getServiceManager;
-    GetComponentManagerFunc getComponentManager;
-    GetComponentRegistrarFunc getComponentRegistrar;
-    GetMemoryManagerFunc getMemoryManager;
-    NewLocalFileFunc newLocalFile;
-    NewNativeLocalFileFunc newNativeLocalFile;
+  InitFunc init;
+  ShutdownFunc shutdown;
+  GetServiceManagerFunc getServiceManager;
+  GetComponentManagerFunc getComponentManager;
+  GetComponentRegistrarFunc getComponentRegistrar;
+  GetMemoryManagerFunc getMemoryManager;
+  NewLocalFileFunc newLocalFile;
+  NewNativeLocalFileFunc newNativeLocalFile;
 
-    RegisterXPCOMExitRoutineFunc registerExitRoutine;
-    UnregisterXPCOMExitRoutineFunc unregisterExitRoutine;
+  RegisterXPCOMExitRoutineFunc registerExitRoutine;
+  UnregisterXPCOMExitRoutineFunc unregisterExitRoutine;
 
-    // Added for Mozilla 1.5
-    GetDebugFunc getDebug;
-    void* getTraceRefcnt;
+  // Added for Mozilla 1.5
+  GetDebugFunc getDebug;
+  void* getTraceRefcnt;
 
-    // Added for Mozilla 1.7
-    StringContainerInitFunc stringContainerInit;
-    StringContainerFinishFunc stringContainerFinish;
-    StringGetDataFunc stringGetData;
-    StringSetDataFunc stringSetData;
-    StringSetDataRangeFunc stringSetDataRange;
-    StringCopyFunc stringCopy;
-    CStringContainerInitFunc cstringContainerInit;
-    CStringContainerFinishFunc cstringContainerFinish;
-    CStringGetDataFunc cstringGetData;
-    CStringSetDataFunc cstringSetData;
-    CStringSetDataRangeFunc cstringSetDataRange;
-    CStringCopyFunc cstringCopy;
-    CStringToUTF16 cstringToUTF16;
-    UTF16ToCString utf16ToCString;
-    StringCloneDataFunc stringCloneData;
-    CStringCloneDataFunc cstringCloneData;
+  // Added for Mozilla 1.7
+  StringContainerInitFunc stringContainerInit;
+  StringContainerFinishFunc stringContainerFinish;
+  StringGetDataFunc stringGetData;
+  StringSetDataFunc stringSetData;
+  StringSetDataRangeFunc stringSetDataRange;
+  StringCopyFunc stringCopy;
+  CStringContainerInitFunc cstringContainerInit;
+  CStringContainerFinishFunc cstringContainerFinish;
+  CStringGetDataFunc cstringGetData;
+  CStringSetDataFunc cstringSetData;
+  CStringSetDataRangeFunc cstringSetDataRange;
+  CStringCopyFunc cstringCopy;
+  CStringToUTF16 cstringToUTF16;
+  UTF16ToCString utf16ToCString;
+  StringCloneDataFunc stringCloneData;
+  CStringCloneDataFunc cstringCloneData;
 
-    // Added for Mozilla 1.8
-    AllocFunc allocFunc;
-    ReallocFunc reallocFunc;
-    FreeFunc freeFunc;
-    StringContainerInit2Func stringContainerInit2;
-    CStringContainerInit2Func cstringContainerInit2;
-    StringGetMutableDataFunc stringGetMutableData;
-    CStringGetMutableDataFunc cstringGetMutableData;
-    void* init3; // obsolete
+  // Added for Mozilla 1.8
+  AllocFunc allocFunc;
+  ReallocFunc reallocFunc;
+  FreeFunc freeFunc;
+  StringContainerInit2Func stringContainerInit2;
+  CStringContainerInit2Func cstringContainerInit2;
+  StringGetMutableDataFunc stringGetMutableData;
+  CStringGetMutableDataFunc cstringGetMutableData;
+  void* init3; // obsolete
 
-    // Added for Mozilla 1.9
-    DebugBreakFunc debugBreakFunc;
-    xpcomVoidFunc logInitFunc;
-    xpcomVoidFunc logTermFunc;
-    LogAddRefFunc logAddRefFunc;
-    LogReleaseFunc logReleaseFunc;
-    LogCtorFunc logCtorFunc;
-    LogCtorFunc logDtorFunc;
-    LogCOMPtrFunc logCOMPtrAddRefFunc;
-    LogCOMPtrFunc logCOMPtrReleaseFunc;
-    GetXPTCallStubFunc getXPTCallStubFunc;
-    DestroyXPTCallStubFunc destroyXPTCallStubFunc;
-    InvokeByIndexFunc invokeByIndexFunc;
-    CycleCollectorFunc cycleSuspectFunc; // obsolete: use cycleSuspect3Func
-    CycleCollectorFunc cycleForgetFunc; // obsolete
-    StringSetIsVoidFunc stringSetIsVoid;
-    StringGetIsVoidFunc stringGetIsVoid;
-    CStringSetIsVoidFunc cstringSetIsVoid;
-    CStringGetIsVoidFunc cstringGetIsVoid;
+  // Added for Mozilla 1.9
+  DebugBreakFunc debugBreakFunc;
+  xpcomVoidFunc logInitFunc;
+  xpcomVoidFunc logTermFunc;
+  LogAddRefFunc logAddRefFunc;
+  LogReleaseFunc logReleaseFunc;
+  LogCtorFunc logCtorFunc;
+  LogCtorFunc logDtorFunc;
+  LogCOMPtrFunc logCOMPtrAddRefFunc;
+  LogCOMPtrFunc logCOMPtrReleaseFunc;
+  GetXPTCallStubFunc getXPTCallStubFunc;
+  DestroyXPTCallStubFunc destroyXPTCallStubFunc;
+  InvokeByIndexFunc invokeByIndexFunc;
+  CycleCollectorFunc cycleSuspectFunc; // obsolete: use cycleSuspect3Func
+  CycleCollectorFunc cycleForgetFunc; // obsolete
+  StringSetIsVoidFunc stringSetIsVoid;
+  StringGetIsVoidFunc stringGetIsVoid;
+  CStringSetIsVoidFunc cstringSetIsVoid;
+  CStringGetIsVoidFunc cstringGetIsVoid;
 
-    // Added for Mozilla 1.9.1
-    CycleCollectorSuspect2Func cycleSuspect2Func; // obsolete: use cycleSuspect3Func
-    CycleCollectorForget2Func cycleForget2Func; // obsolete
+  // Added for Mozilla 1.9.1
+  CycleCollectorSuspect2Func cycleSuspect2Func; // obsolete: use cycleSuspect3Func
+  CycleCollectorForget2Func cycleForget2Func; // obsolete
 
-    CycleCollectorSuspect3Func cycleSuspect3Func;
+  CycleCollectorSuspect3Func cycleSuspect3Func;
 
 } XPCOMFunctions;
 
-typedef nsresult (*GetFrozenFunctionsFunc)(XPCOMFunctions *entryPoints, const char* libraryPath);
-XPCOM_API(nsresult)
-NS_GetFrozenFunctions(XPCOMFunctions *entryPoints, const char* libraryPath);
+typedef nsresult (*GetFrozenFunctionsFunc)(XPCOMFunctions* aEntryPoints,
+                                           const char* aLibraryPath);
+XPCOM_API(nsresult) NS_GetFrozenFunctions(XPCOMFunctions* aEntryPoints,
+                                          const char* aLibraryPath);
 
 
 namespace mozilla {
 
 /**
  * Shutdown XPCOM. You must call this method after you are finished
- * using xpcom. 
+ * using xpcom.
  *
- * @param servMgr           The service manager which was returned by NS_InitXPCOM.
+ * @param aServMgr          The service manager which was returned by NS_InitXPCOM.
  *                          This will release servMgr.  You may pass null.
  *
  * @return NS_OK for success;
  *         other error codes indicate a failure during shutdown
  *
  */
 nsresult
-ShutdownXPCOM(nsIServiceManager* servMgr);
+ShutdownXPCOM(nsIServiceManager* aServMgr);
 
 void SetICUMemoryFunctions();
 
 /**
  * C++ namespaced version of NS_LogTerm.
  */
 void LogTerm();
 
@@ -204,19 +229,19 @@ void LogTerm();
 
 
 // think hard before changing this
 #define XPCOM_GLUE_VERSION 1
 
 
 /* XPCOM Specific Defines
  *
- * XPCOM_DLL              - name of the loadable xpcom library on disk. 
+ * XPCOM_DLL              - name of the loadable xpcom library on disk.
  * XUL_DLL                - name of the loadable XUL library on disk
- * XPCOM_SEARCH_KEY       - name of the environment variable that can be 
+ * XPCOM_SEARCH_KEY       - name of the environment variable that can be
  *                          modified to include additional search paths.
  * GRE_CONF_NAME          - Name of the GRE Configuration file
  */
 
 #if defined(XP_WIN32)
 
 #define XPCOM_SEARCH_KEY  "PATH"
 #define GRE_CONF_NAME     "gre.config"
@@ -227,17 +252,17 @@ void LogTerm();
 #define LXUL_DLL          L"xul.dll"
 
 #else // Unix
 #include <limits.h> // for PATH_MAX
 
 #define XPCOM_DLL         XUL_DLL
 
 // you have to love apple..
-#ifdef XP_MACOSX  
+#ifdef XP_MACOSX
 #define XPCOM_SEARCH_KEY  "DYLD_LIBRARY_PATH"
 #define GRE_FRAMEWORK_NAME "XUL.framework"
 #define XUL_DLL            "XUL"
 #else
 #define XPCOM_SEARCH_KEY  "LD_LIBRARY_PATH"
 #define XUL_DLL   "libxul" MOZ_DLL_SUFFIX
 #endif
 
--- a/xpcom/build/nsXPCOMStrings.cpp
+++ b/xpcom/build/nsXPCOMStrings.cpp
@@ -7,343 +7,338 @@
 #include "nsCharTraits.h"
 
 #include "nsXPCOMStrings.h"
 #include "nsNativeCharsetUtils.h"
 
 /* ------------------------------------------------------------------------- */
 
 XPCOM_API(nsresult)
-NS_StringContainerInit(nsStringContainer &aContainer)
+NS_StringContainerInit(nsStringContainer& aContainer)
 {
   NS_ASSERTION(sizeof(nsStringContainer_base) >= sizeof(nsString),
-      "nsStringContainer is not large enough");
+               "nsStringContainer is not large enough");
 
   // use placement new to avoid heap allocating nsString object
   new (&aContainer) nsString();
 
   return NS_OK;
 }
 
 XPCOM_API(nsresult)
-NS_StringContainerInit2(nsStringContainer &aContainer,
-                        const char16_t   *aData,
-                        uint32_t           aDataLength,
-                        uint32_t           aFlags)
+NS_StringContainerInit2(nsStringContainer& aContainer,
+                        const char16_t* aData,
+                        uint32_t aDataLength,
+                        uint32_t aFlags)
 {
   NS_ASSERTION(sizeof(nsStringContainer_base) >= sizeof(nsString),
-      "nsStringContainer is not large enough");
+               "nsStringContainer is not large enough");
 
-  if (!aData)
-  {
+  if (!aData) {
     new (&aContainer) nsString();
-  }
-  else
-  {
-    if (aDataLength == UINT32_MAX)
-    {
-      if (NS_WARN_IF(aFlags & NS_STRING_CONTAINER_INIT_SUBSTRING))
-	return NS_ERROR_INVALID_ARG;
+  } else {
+    if (aDataLength == UINT32_MAX) {
+      if (NS_WARN_IF(aFlags & NS_STRING_CONTAINER_INIT_SUBSTRING)) {
+        return NS_ERROR_INVALID_ARG;
+      }
       aDataLength = nsCharTraits<char16_t>::length(aData);
     }
 
     if (aFlags & (NS_STRING_CONTAINER_INIT_DEPEND |
-                  NS_STRING_CONTAINER_INIT_ADOPT))
-    {
+                  NS_STRING_CONTAINER_INIT_ADOPT)) {
       uint32_t flags;
-      if (aFlags & NS_STRING_CONTAINER_INIT_SUBSTRING)
+      if (aFlags & NS_STRING_CONTAINER_INIT_SUBSTRING) {
         flags = nsSubstring::F_NONE;
-      else
+      } else {
         flags = nsSubstring::F_TERMINATED;
+      }
 
-      if (aFlags & NS_STRING_CONTAINER_INIT_ADOPT)
+      if (aFlags & NS_STRING_CONTAINER_INIT_ADOPT) {
         flags |= nsSubstring::F_OWNED;
+      }
 
-      new (&aContainer) nsSubstring(const_cast<char16_t *>(aData),
+      new (&aContainer) nsSubstring(const_cast<char16_t*>(aData),
                                     aDataLength, flags);
-    }
-    else
-    {
+    } else {
       new (&aContainer) nsString(aData, aDataLength);
     }
   }
 
   return NS_OK;
 }
 
 XPCOM_API(void)
-NS_StringContainerFinish(nsStringContainer &aContainer)
+NS_StringContainerFinish(nsStringContainer& aContainer)
 {
   // call the nsString dtor
-  reinterpret_cast<nsString *>(&aContainer)->~nsString();
+  reinterpret_cast<nsString*>(&aContainer)->~nsString();
 }
 
 /* ------------------------------------------------------------------------- */
 
 XPCOM_API(uint32_t)
-NS_StringGetData(const nsAString &aStr, const char16_t **aData,
-                 bool *aTerminated)
+NS_StringGetData(const nsAString& aStr, const char16_t** aData,
+                 bool* aTerminated)
 {
-  if (aTerminated)
+  if (aTerminated) {
     *aTerminated = aStr.IsTerminated();
+  }
 
   nsAString::const_iterator begin;
   aStr.BeginReading(begin);
   *aData = begin.get();
   return begin.size_forward();
 }
 
 XPCOM_API(uint32_t)
-NS_StringGetMutableData(nsAString &aStr, uint32_t aDataLength,
-                        char16_t **aData)
+NS_StringGetMutableData(nsAString& aStr, uint32_t aDataLength,
+                        char16_t** aData)
 {
   if (aDataLength != UINT32_MAX) {
     aStr.SetLength(aDataLength);
     if (aStr.Length() != aDataLength) {
       *aData = nullptr;
       return 0;
     }
   }
 
   nsAString::iterator begin;
   aStr.BeginWriting(begin);
   *aData = begin.get();
   return begin.size_forward();
 }
 
-XPCOM_API(char16_t *)
-NS_StringCloneData(const nsAString &aStr)
+XPCOM_API(char16_t*)
+NS_StringCloneData(const nsAString& aStr)
 {
   return ToNewUnicode(aStr);
 }
 
 XPCOM_API(nsresult)
-NS_StringSetData(nsAString &aStr, const char16_t *aData, uint32_t aDataLength)
+NS_StringSetData(nsAString& aStr, const char16_t* aData, uint32_t aDataLength)
 {
   aStr.Assign(aData, aDataLength);
   return NS_OK; // XXX report errors
 }
 
 XPCOM_API(nsresult)
-NS_StringSetDataRange(nsAString &aStr,
+NS_StringSetDataRange(nsAString& aStr,
                       uint32_t aCutOffset, uint32_t aCutLength,
-                      const char16_t *aData, uint32_t aDataLength)
+                      const char16_t* aData, uint32_t aDataLength)
 {
-  if (aCutOffset == UINT32_MAX)
-  {
+  if (aCutOffset == UINT32_MAX) {
     // append case
-    if (aData)
+    if (aData) {
       aStr.Append(aData, aDataLength);
+    }
     return NS_OK; // XXX report errors
   }
 
-  if (aCutLength == UINT32_MAX)
+  if (aCutLength == UINT32_MAX) {
     aCutLength = aStr.Length() - aCutOffset;
+  }
 
-  if (aData)
-  {
-    if (aDataLength == UINT32_MAX)
+  if (aData) {
+    if (aDataLength == UINT32_MAX) {
       aStr.Replace(aCutOffset, aCutLength, nsDependentString(aData));
-    else
+    } else {
       aStr.Replace(aCutOffset, aCutLength, Substring(aData, aDataLength));
+    }
+  } else {
+    aStr.Cut(aCutOffset, aCutLength);
   }
-  else
-    aStr.Cut(aCutOffset, aCutLength);
 
   return NS_OK; // XXX report errors
 }
 
 XPCOM_API(nsresult)
-NS_StringCopy(nsAString &aDest, const nsAString &aSrc)
+NS_StringCopy(nsAString& aDest, const nsAString& aSrc)
 {
   aDest.Assign(aSrc);
   return NS_OK; // XXX report errors
 }
 
 XPCOM_API(void)
-NS_StringSetIsVoid(nsAString &aStr, const bool aIsVoid)
+NS_StringSetIsVoid(nsAString& aStr, const bool aIsVoid)
 {
   aStr.SetIsVoid(aIsVoid);
 }
 
 XPCOM_API(bool)
-NS_StringGetIsVoid(const nsAString &aStr)
+NS_StringGetIsVoid(const nsAString& aStr)
 {
   return aStr.IsVoid();
 }
 
 /* ------------------------------------------------------------------------- */
 
 XPCOM_API(nsresult)
-NS_CStringContainerInit(nsCStringContainer &aContainer)
+NS_CStringContainerInit(nsCStringContainer& aContainer)
 {
   NS_ASSERTION(sizeof(nsStringContainer_base) >= sizeof(nsCString),
-      "nsCStringContainer is not large enough");
+               "nsCStringContainer is not large enough");
 
   // use placement new to avoid heap allocating nsCString object
   new (&aContainer) nsCString();
 
   return NS_OK;
 }
 
 XPCOM_API(nsresult)
-NS_CStringContainerInit2(nsCStringContainer &aContainer,
-                         const char         *aData,
-                         uint32_t            aDataLength,
-                         uint32_t            aFlags)
+NS_CStringContainerInit2(nsCStringContainer& aContainer,
+                         const char* aData,
+                         uint32_t aDataLength,
+                         uint32_t aFlags)
 {
   NS_ASSERTION(sizeof(nsStringContainer_base) >= sizeof(nsCString),
-      "nsStringContainer is not large enough");
+               "nsStringContainer is not large enough");
 
-  if (!aData)
-  {
+  if (!aData) {
     new (&aContainer) nsCString();
-  }
-  else
-  {
-    if (aDataLength == UINT32_MAX)
-    {
-      if (NS_WARN_IF(aFlags & NS_CSTRING_CONTAINER_INIT_SUBSTRING))
-	return NS_ERROR_INVALID_ARG;
+  } else {
+    if (aDataLength == UINT32_MAX) {
+      if (NS_WARN_IF(aFlags & NS_CSTRING_CONTAINER_INIT_SUBSTRING)) {
+        return NS_ERROR_INVALID_ARG;
+      }
       aDataLength = nsCharTraits<char>::length(aData);
     }
 
     if (aFlags & (NS_CSTRING_CONTAINER_INIT_DEPEND |
-                  NS_CSTRING_CONTAINER_INIT_ADOPT))
-    {
+                  NS_CSTRING_CONTAINER_INIT_ADOPT)) {
       uint32_t flags;
-      if (aFlags & NS_CSTRING_CONTAINER_INIT_SUBSTRING)
+      if (aFlags & NS_CSTRING_CONTAINER_INIT_SUBSTRING) {
         flags = nsCSubstring::F_NONE;
-      else
+      } else {
         flags = nsCSubstring::F_TERMINATED;
+      }
 
-      if (aFlags & NS_CSTRING_CONTAINER_INIT_ADOPT)
+      if (aFlags & NS_CSTRING_CONTAINER_INIT_ADOPT) {
         flags |= nsCSubstring::F_OWNED;
+      }
 
-      new (&aContainer) nsCSubstring(const_cast<char *>(aData),
+      new (&aContainer) nsCSubstring(const_cast<char*>(aData),
                                      aDataLength, flags);
-    }
-    else
-    {
+    } else {
       new (&aContainer) nsCString(aData, aDataLength);
     }
   }
 
   return NS_OK;
 }
 
 XPCOM_API(void)
-NS_CStringContainerFinish(nsCStringContainer &aContainer)
+NS_CStringContainerFinish(nsCStringContainer& aContainer)
 {
   // call the nsCString dtor
-  reinterpret_cast<nsCString *>(&aContainer)->~nsCString();
+  reinterpret_cast<nsCString*>(&aContainer)->~nsCString();
 }
 
 /* ------------------------------------------------------------------------- */
 
 XPCOM_API(uint32_t)
-NS_CStringGetData(const nsACString &aStr, const char **aData,
-                  bool *aTerminated)
+NS_CStringGetData(const nsACString& aStr, const char** aData,
+                  bool* aTerminated)
 {
-  if (aTerminated)
+  if (aTerminated) {
     *aTerminated = aStr.IsTerminated();
+  }
 
   nsACString::const_iterator begin;
   aStr.BeginReading(begin);
   *aData = begin.get();
   return begin.size_forward();
 }
 
 XPCOM_API(uint32_t)
-NS_CStringGetMutableData(nsACString &aStr, uint32_t aDataLength, char **aData)
+NS_CStringGetMutableData(nsACString& aStr, uint32_t aDataLength, char** aData)
 {
   if (aDataLength != UINT32_MAX) {
     aStr.SetLength(aDataLength);
     if (aStr.Length() != aDataLength) {
       *aData = nullptr;
       return 0;
     }
   }
 
   nsACString::iterator begin;
   aStr.BeginWriting(begin);
   *aData = begin.get();
   return begin.size_forward();
 }
 
-XPCOM_API(char *)
-NS_CStringCloneData(const nsACString &aStr)
+XPCOM_API(char*)
+NS_CStringCloneData(const nsACString& aStr)
 {
   return ToNewCString(aStr);
 }
 
 XPCOM_API(nsresult)
-NS_CStringSetData(nsACString &aStr, const char *aData, uint32_t aDataLength)
+NS_CStringSetData(nsACString& aStr, const char* aData, uint32_t aDataLength)
 {
   aStr.Assign(aData, aDataLength);
   return NS_OK; // XXX report errors
 }
 
 XPCOM_API(nsresult)
-NS_CStringSetDataRange(nsACString &aStr,
+NS_CStringSetDataRange(nsACString& aStr,
                        uint32_t aCutOffset, uint32_t aCutLength,
-                       const char *aData, uint32_t aDataLength)
+                       const char* aData, uint32_t aDataLength)
 {
-  if (aCutOffset == UINT32_MAX)
-  {
+  if (aCutOffset == UINT32_MAX) {
     // append case
-    if (aData)
+    if (aData) {
       aStr.Append(aData, aDataLength);
+    }
     return NS_OK; // XXX report errors
   }
 
-  if (aCutLength == UINT32_MAX)
+  if (aCutLength == UINT32_MAX) {
     aCutLength = aStr.Length() - aCutOffset;
+  }
 
-  if (aData)
-  {
-    if (aDataLength == UINT32_MAX)
+  if (aData) {
+    if (aDataLength == UINT32_MAX) {
       aStr.Replace(aCutOffset, aCutLength, nsDependentCString(aData));
-    else
+    } else {
       aStr.Replace(aCutOffset, aCutLength, Substring(aData, aDataLength));
+    }
+  } else {
+    aStr.Cut(aCutOffset, aCutLength);
   }
-  else
-    aStr.Cut(aCutOffset, aCutLength);
 
   return NS_OK; // XXX report errors
 }
 
 XPCOM_API(nsresult)
-NS_CStringCopy(nsACString &aDest, const nsACString &aSrc)
+NS_CStringCopy(nsACString& aDest, const nsACString& aSrc)
 {
   aDest.Assign(aSrc);
   return NS_OK; // XXX report errors
 }
 
 XPCOM_API(void)
-NS_CStringSetIsVoid(nsACString &aStr, const bool aIsVoid)
+NS_CStringSetIsVoid(nsACString& aStr, const bool aIsVoid)
 {
   aStr.SetIsVoid(aIsVoid);
 }
 
 XPCOM_API(bool)
-NS_CStringGetIsVoid(const nsACString &aStr)
+NS_CStringGetIsVoid(const nsACString& aStr)
 {
   return aStr.IsVoid();
 }
 
 /* ------------------------------------------------------------------------- */
 
 XPCOM_API(nsresult)
-NS_CStringToUTF16(const nsACString &aSrc,
+NS_CStringToUTF16(const nsACString& aSrc,
                   nsCStringEncoding aSrcEncoding,
-                  nsAString &aDest)
+                  nsAString& aDest)
 {
-  switch (aSrcEncoding)
-  {
+  switch (aSrcEncoding) {
     case NS_CSTRING_ENCODING_ASCII:
       CopyASCIItoUTF16(aSrc, aDest);
       break;
     case NS_CSTRING_ENCODING_UTF8:
       CopyUTF8toUTF16(aSrc, aDest);
       break;
     case NS_CSTRING_ENCODING_NATIVE_FILESYSTEM:
       NS_CopyNativeToUnicode(aSrc, aDest);
@@ -351,22 +346,21 @@ NS_CStringToUTF16(const nsACString &aSrc
     default:
       return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   return NS_OK; // XXX report errors
 }
 
 XPCOM_API(nsresult)
-NS_UTF16ToCString(const nsAString &aSrc,
+NS_UTF16ToCString(const nsAString& aSrc,
                   nsCStringEncoding aDestEncoding,
-                  nsACString &aDest)
+                  nsACString& aDest)
 {
-  switch (aDestEncoding)
-  {
+  switch (aDestEncoding) {
     case NS_CSTRING_ENCODING_ASCII:
       LossyCopyUTF16toASCII(aSrc, aDest);
       break;
     case NS_CSTRING_ENCODING_UTF8:
       CopyUTF16toUTF8(aSrc, aDest);
       break;
     case NS_CSTRING_ENCODING_NATIVE_FILESYSTEM:
       NS_CopyUnicodeToNative(aSrc, aDest);
--- a/xpcom/build/nsXPComInit.cpp
+++ b/xpcom/build/nsXPComInit.cpp
@@ -70,17 +70,17 @@
 #endif
 #include "nsDirectoryService.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsCategoryManager.h"
 #include "nsICategoryManager.h"
 #include "nsMultiplexInputStream.h"
 
 #include "nsStringStream.h"
-extern nsresult nsStringInputStreamConstructor(nsISupports *, REFNSIID, void **);
+extern nsresult nsStringInputStreamConstructor(nsISupports*, REFNSIID, void**);
 
 #include "nsAtomService.h"
 #include "nsAtomTable.h"
 #include "nsISupportsImpl.h"
 
 #include "nsHashPropertyBag.h"
 
 #include "nsUnicharInputStream.h"
@@ -169,17 +169,17 @@ static BackgroundHangMonitor* sMainHangM
 } /* anonymous namespace */
 
 // Registry Factory creation function defined in nsRegistry.cpp
 // We hook into this function locally to create and register the registry
 // Since noone outside xpcom needs to know about this and nsRegistry.cpp
 // does not have a local include file, we are putting this definition
 // here rather than in nsIRegistry.h
 extern nsresult NS_RegistryGetFactory(nsIFactory** aFactory);
-extern nsresult NS_CategoryManagerGetFactory( nsIFactory** );
+extern nsresult NS_CategoryManagerGetFactory(nsIFactory**);
 
 #ifdef XP_WIN
 extern nsresult CreateAnonTempFileRemover();
 #endif
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsProcess)
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsIDImpl)
@@ -232,503 +232,523 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsMemoryI
 
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStatusReporterManager, Init)
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsIOUtil)
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSecurityConsoleMessage)
 
 static nsresult
-nsThreadManagerGetSingleton(nsISupports* outer,
+nsThreadManagerGetSingleton(nsISupports* aOuter,
                             const nsIID& aIID,
-                            void* *aInstancePtr)
+                            void** aInstancePtr)
 {
-    NS_ASSERTION(aInstancePtr, "null outptr");
-    if (NS_WARN_IF(outer))
-        return NS_ERROR_NO_AGGREGATION;
+  NS_ASSERTION(aInstancePtr, "null outptr");
+  if (NS_WARN_IF(aOuter)) {
+    return NS_ERROR_NO_AGGREGATION;
+  }
 
-    return nsThreadManager::get()->QueryInterface(aIID, aInstancePtr);
+  return nsThreadManager::get()->QueryInterface(aIID, aInstancePtr);
 }
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsThreadPool)
 
 static nsresult
-nsXPTIInterfaceInfoManagerGetSingleton(nsISupports* outer,
+nsXPTIInterfaceInfoManagerGetSingleton(nsISupports* aOuter,
                                        const nsIID& aIID,
-                                       void* *aInstancePtr)
+                                       void** aInstancePtr)
 {
-    NS_ASSERTION(aInstancePtr, "null outptr");
-    if (NS_WARN_IF(outer))
-        return NS_ERROR_NO_AGGREGATION;
+  NS_ASSERTION(aInstancePtr, "null outptr");
+  if (NS_WARN_IF(aOuter)) {
+    return NS_ERROR_NO_AGGREGATION;
+  }
 
-    nsCOMPtr<nsIInterfaceInfoManager> iim
-        (XPTInterfaceInfoManager::GetSingleton());
-    if (!iim)
-        return NS_ERROR_FAILURE;
+  nsCOMPtr<nsIInterfaceInfoManager> iim(XPTInterfaceInfoManager::GetSingleton());
+  if (!iim) {
+    return NS_ERROR_FAILURE;
+  }
 
-    return iim->QueryInterface(aIID, aInstancePtr);
+  return iim->QueryInterface(aIID, aInstancePtr);
 }
 
 nsComponentManagerImpl* nsComponentManagerImpl::gComponentManager = nullptr;
 bool gXPCOMShuttingDown = false;
 bool gXPCOMThreadsShutDown = false;
 char16_t* gGREPath = nullptr;
 
 static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
 static NS_DEFINE_CID(kINIParserFactoryCID, NS_INIPARSERFACTORY_CID);
-static NS_DEFINE_CID(kSimpleUnicharStreamFactoryCID, NS_SIMPLE_UNICHAR_STREAM_FACTORY_CID);
+static NS_DEFINE_CID(kSimpleUnicharStreamFactoryCID,
+                     NS_SIMPLE_UNICHAR_STREAM_FACTORY_CID);
 
 NS_DEFINE_NAMED_CID(NS_CHROMEREGISTRY_CID);
 NS_DEFINE_NAMED_CID(NS_CHROMEPROTOCOLHANDLER_CID);
 
 NS_DEFINE_NAMED_CID(NS_SECURITY_CONSOLE_MESSAGE_CID);
 
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsChromeRegistry,
                                          nsChromeRegistry::GetSingleton)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsChromeProtocolHandler)
 
 #define NS_PERSISTENTPROPERTIES_CID NS_IPERSISTENTPROPERTIES_CID /* sigh */
 
 static already_AddRefed<nsIFactory>
-CreateINIParserFactory(const mozilla::Module& module,
-                       const mozilla::Module::CIDEntry& entry)
+CreateINIParserFactory(const mozilla::Module& aModule,
+                       const mozilla::Module::CIDEntry& aEntry)
 {
-    nsCOMPtr<nsIFactory> f = new nsINIParserFactory();
-    return f.forget();
+  nsCOMPtr<nsIFactory> f = new nsINIParserFactory();
+  return f.forget();
 }
 
 static already_AddRefed<nsIFactory>
-CreateUnicharStreamFactory(const mozilla::Module& module,
-                           const mozilla::Module::CIDEntry& entry)
+CreateUnicharStreamFactory(const mozilla::Module& aModule,
+                           const mozilla::Module::CIDEntry& aEntry)
 {
-    return already_AddRefed<nsIFactory>(
-            nsSimpleUnicharStreamFactory::GetInstance());
+  return already_AddRefed<nsIFactory>(
+           nsSimpleUnicharStreamFactory::GetInstance());
 }
 
 #define COMPONENT(NAME, Ctor) static NS_DEFINE_CID(kNS_##NAME##_CID, NS_##NAME##_CID);
 #include "XPCOMModule.inc"
 #undef COMPONENT
 
 #define COMPONENT(NAME, Ctor) { &kNS_##NAME##_CID, false, nullptr, Ctor },
 const mozilla::Module::CIDEntry kXPCOMCIDEntries[] = {
-    { &kComponentManagerCID, true, nullptr, nsComponentManagerImpl::Create },
-    { &kINIParserFactoryCID, false, CreateINIParserFactory },
-    { &kSimpleUnicharStreamFactoryCID, false, CreateUnicharStreamFactory },
+  { &kComponentManagerCID, true, nullptr, nsComponentManagerImpl::Create },
+  { &kINIParserFactoryCID, false, CreateINIParserFactory },
+  { &kSimpleUnicharStreamFactoryCID, false, CreateUnicharStreamFactory },
 #include "XPCOMModule.inc"
-    { &kNS_CHROMEREGISTRY_CID, false, nullptr, nsChromeRegistryConstructor },
-    { &kNS_CHROMEPROTOCOLHANDLER_CID, false, nullptr, nsChromeProtocolHandlerConstructor },
-    { &kNS_SECURITY_CONSOLE_MESSAGE_CID, false, nullptr, nsSecurityConsoleMessageConstructor },
-    { nullptr }
+  { &kNS_CHROMEREGISTRY_CID, false, nullptr, nsChromeRegistryConstructor },
+  { &kNS_CHROMEPROTOCOLHANDLER_CID, false, nullptr, nsChromeProtocolHandlerConstructor },
+  { &kNS_SECURITY_CONSOLE_MESSAGE_CID, false, nullptr, nsSecurityConsoleMessageConstructor },
+  { nullptr }
 };
 #undef COMPONENT
 
 #define COMPONENT(NAME, Ctor) { NS_##NAME##_CONTRACTID, &kNS_##NAME##_CID },
 const mozilla::Module::ContractIDEntry kXPCOMContracts[] = {
 #include "XPCOMModule.inc"
-    { NS_CHROMEREGISTRY_CONTRACTID, &kNS_CHROMEREGISTRY_CID },
-    { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "chrome", &kNS_CHROMEPROTOCOLHANDLER_CID },
-    { NS_INIPARSERFACTORY_CONTRACTID, &kINIParserFactoryCID },
-    { NS_SECURITY_CONSOLE_MESSAGE_CONTRACTID, &kNS_SECURITY_CONSOLE_MESSAGE_CID },
-    { nullptr }
+  { NS_CHROMEREGISTRY_CONTRACTID, &kNS_CHROMEREGISTRY_CID },
+  { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "chrome", &kNS_CHROMEPROTOCOLHANDLER_CID },
+  { NS_INIPARSERFACTORY_CONTRACTID, &kINIParserFactoryCID },
+  { NS_SECURITY_CONSOLE_MESSAGE_CONTRACTID, &kNS_SECURITY_CONSOLE_MESSAGE_CID },
+  { nullptr }
 };
 #undef COMPONENT
 
-const mozilla::Module kXPCOMModule = { mozilla::Module::kVersion, kXPCOMCIDEntries, kXPCOMContracts };
+const mozilla::Module kXPCOMModule = {
+  mozilla::Module::kVersion, kXPCOMCIDEntries, kXPCOMContracts
+};
 
 // gDebug will be freed during shutdown.
 static nsIDebug* gDebug = nullptr;
 
 EXPORT_XPCOM_API(nsresult)
-NS_GetDebug(nsIDebug** result)
+NS_GetDebug(nsIDebug** aResult)
 {
-    return nsDebugImpl::Create(nullptr,
-                               NS_GET_IID(nsIDebug),
-                               (void**) result);
+  return nsDebugImpl::Create(nullptr,  NS_GET_IID(nsIDebug), (void**)aResult);
 }
 
 EXPORT_XPCOM_API(nsresult)
-NS_InitXPCOM(nsIServiceManager* *result,
-                             nsIFile* binDirectory)
+NS_InitXPCOM(nsIServiceManager** aResult,
+             nsIFile* aBinDirectory)
 {
-    return NS_InitXPCOM2(result, binDirectory, nullptr);
+  return NS_InitXPCOM2(aResult, aBinDirectory, nullptr);
 }
 
-class ICUReporter MOZ_FINAL : public nsIMemoryReporter,
-                              public CountingAllocatorBase<ICUReporter>
+class ICUReporter MOZ_FINAL
+  : public nsIMemoryReporter
+  , public CountingAllocatorBase<ICUReporter>
 {
 public:
-    NS_DECL_ISUPPORTS
+  NS_DECL_ISUPPORTS
 
-    static void* Alloc(const void*, size_t size)
-    {
-        return CountingMalloc(size);
-    }
+  static void* Alloc(const void*, size_t aSize)
+  {
+    return CountingMalloc(aSize);
+  }
 
-    static void* Realloc(const void*, void* p, size_t size)
-    {
-        return CountingRealloc(p, size);
-    }
+  static void* Realloc(const void*, void* aPtr, size_t aSize)
+  {
+    return CountingRealloc(aPtr, aSize);
+  }
 
-    static void Free(const void*, void* p)
-    {
-        return CountingFree(p);
-    }
+  static void Free(const void*, void* aPtr)
+  {
+    return CountingFree(aPtr);
+  }
 
 private:
-    NS_IMETHODIMP
-    CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
-                   bool aAnonymize)
-    {
-        return MOZ_COLLECT_REPORT(
-            "explicit/icu", KIND_HEAP, UNITS_BYTES, MemoryAllocated(),
-            "Memory used by ICU, a Unicode and globalization support library.");
-    }
+  NS_IMETHODIMP
+  CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
+                 bool aAnonymize)
+  {
+    return MOZ_COLLECT_REPORT(
+      "explicit/icu", KIND_HEAP, UNITS_BYTES, MemoryAllocated(),
+      "Memory used by ICU, a Unicode and globalization support library.");
+  }
 
-    ~ICUReporter() {}
+  ~ICUReporter() {}
 };
 
 NS_IMPL_ISUPPORTS(ICUReporter, nsIMemoryReporter)
 
-/* static */ template<> Atomic<size_t> CountingAllocatorBase<ICUReporter>::sAmount(0);
+/* static */ template<> Atomic<size_t>
+CountingAllocatorBase<ICUReporter>::sAmount(0);
 
-class OggReporter MOZ_FINAL : public nsIMemoryReporter,
-                              public CountingAllocatorBase<OggReporter>
+class OggReporter MOZ_FINAL
+  : public nsIMemoryReporter
+  , public CountingAllocatorBase<OggReporter>
 {
 public:
-    NS_DECL_ISUPPORTS
+  NS_DECL_ISUPPORTS
 
 private:
-    NS_IMETHODIMP
-    CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
-                   bool aAnonymize)
-    {
-        return MOZ_COLLECT_REPORT(
-            "explicit/media/libogg", KIND_HEAP, UNITS_BYTES, MemoryAllocated(),
-            "Memory allocated through libogg for Ogg, Theora, and related media files.");
-    }
+  NS_IMETHODIMP
+  CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
+                 bool aAnonymize)
+  {
+    return MOZ_COLLECT_REPORT(
+      "explicit/media/libogg", KIND_HEAP, UNITS_BYTES, MemoryAllocated(),
+      "Memory allocated through libogg for Ogg, Theora, and related media files.");
+  }
 
-    ~OggReporter() {}
+  ~OggReporter() {}
 };
 
 NS_IMPL_ISUPPORTS(OggReporter, nsIMemoryReporter)
 
-/* static */ template<> Atomic<size_t> CountingAllocatorBase<OggReporter>::sAmount(0);
+/* static */ template<> Atomic<size_t>
+CountingAllocatorBase<OggReporter>::sAmount(0);
 
 #ifdef MOZ_VPX
-class VPXReporter MOZ_FINAL : public nsIMemoryReporter,
-                              public CountingAllocatorBase<VPXReporter>
+class VPXReporter MOZ_FINAL
+  : public nsIMemoryReporter
+  , public CountingAllocatorBase<VPXReporter>
 {
 public:
-    NS_DECL_ISUPPORTS
+  NS_DECL_ISUPPORTS
 
 private:
-    NS_IMETHODIMP
-    CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
-                   bool aAnonymize)
-    {
-        return MOZ_COLLECT_REPORT(
-            "explicit/media/libvpx", KIND_HEAP, UNITS_BYTES, MemoryAllocated(),
-            "Memory allocated through libvpx for WebM media files.");
-    }
+  NS_IMETHODIMP
+  CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
+                 bool aAnonymize)
+  {
+    return MOZ_COLLECT_REPORT(
+      "explicit/media/libvpx", KIND_HEAP, UNITS_BYTES, MemoryAllocated(),
+      "Memory allocated through libvpx for WebM media files.");
+  }
 
-    ~VPXReporter() {}
+  ~VPXReporter() {}
 };
 
 NS_IMPL_ISUPPORTS(VPXReporter, nsIMemoryReporter)
 
-/* static */ template<> Atomic<size_t> CountingAllocatorBase<VPXReporter>::sAmount(0);
+/* static */ template<> Atomic<size_t>
+CountingAllocatorBase<VPXReporter>::sAmount(0);
 #endif /* MOZ_VPX */
 
 #ifdef MOZ_WEBM
 class NesteggReporter MOZ_FINAL : public nsIMemoryReporter
                                 , public CountingAllocatorBase<NesteggReporter>
 {
 public:
-    NS_DECL_ISUPPORTS
+  NS_DECL_ISUPPORTS
 
 private:
-    NS_IMETHODIMP
-    CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
-                   bool aAnonymize)
-    {
-        return MOZ_COLLECT_REPORT(
-            "explicit/media/libnestegg", KIND_HEAP, UNITS_BYTES, MemoryAllocated(),
-            "Memory allocated through libnestegg for WebM media files.");
-    }
+  NS_IMETHODIMP
+  CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
+                 bool aAnonymize)
+  {
+    return MOZ_COLLECT_REPORT(
+      "explicit/media/libnestegg", KIND_HEAP, UNITS_BYTES, MemoryAllocated(),
+      "Memory allocated through libnestegg for WebM media files.");
+  }
 
-    ~NesteggReporter() {}
+  ~NesteggReporter() {}
 };
 
 NS_IMPL_ISUPPORTS(NesteggReporter, nsIMemoryReporter)
 
-/* static */ template<> Atomic<size_t> CountingAllocatorBase<NesteggReporter>::sAmount(0);
+/* static */ template<> Atomic<size_t>
+CountingAllocatorBase<NesteggReporter>::sAmount(0);
 #endif /* MOZ_WEBM */
 
 EXPORT_XPCOM_API(nsresult)
-NS_InitXPCOM2(nsIServiceManager* *result,
-              nsIFile* binDirectory,
-              nsIDirectoryServiceProvider* appFileLocationProvider)
+NS_InitXPCOM2(nsIServiceManager** aResult,
+              nsIFile* aBinDirectory,
+              nsIDirectoryServiceProvider* aAppFileLocationProvider)
 {
-    mozPoisonValueInit();
+  mozPoisonValueInit();
 
-    char aLocal;
-    profiler_init(&aLocal);
-    nsresult rv = NS_OK;
+  char aLocal;
+  profiler_init(&aLocal);
+  nsresult rv = NS_OK;
 
-     // We are not shutting down
-    gXPCOMShuttingDown = false;
+  // We are not shutting down
+  gXPCOMShuttingDown = false;
 
-    // Initialize the available memory tracker before other threads have had a
-    // chance to start up, because the initialization is not thread-safe.
-    mozilla::AvailableMemoryTracker::Init();
+  // Initialize the available memory tracker before other threads have had a
+  // chance to start up, because the initialization is not thread-safe.
+  mozilla::AvailableMemoryTracker::Init();
 
 #ifdef XP_UNIX
-    // Discover the current value of the umask, and save it where
-    // nsSystemInfo::Init can retrieve it when necessary.  There is no way
-    // to read the umask without changing it, and the setting is process-
-    // global, so this must be done while we are still single-threaded; the
-    // nsSystemInfo object is typically created much later, when some piece
-    // of chrome JS wants it.  The system call is specified as unable to fail.
-    nsSystemInfo::gUserUmask = ::umask(0777);
-    ::umask(nsSystemInfo::gUserUmask);
+  // Discover the current value of the umask, and save it where
+  // nsSystemInfo::Init can retrieve it when necessary.  There is no way
+  // to read the umask without changing it, and the setting is process-
+  // global, so this must be done while we are still single-threaded; the
+  // nsSystemInfo object is typically created much later, when some piece
+  // of chrome JS wants it.  The system call is specified as unable to fail.
+  nsSystemInfo::gUserUmask = ::umask(0777);
+  ::umask(nsSystemInfo::gUserUmask);
 #endif
 
-    NS_LogInit();
+  NS_LogInit();
+
+  // Set up chromium libs
+  NS_ASSERTION(!sExitManager && !sMessageLoop, "Bad logic!");
+
+  if (!AtExitManager::AlreadyRegistered()) {
+    sExitManager = new AtExitManager();
+  }
 
-    // Set up chromium libs
-    NS_ASSERTION(!sExitManager && !sMessageLoop, "Bad logic!");
+  if (!MessageLoop::current()) {
+    sMessageLoop = new MessageLoopForUI(MessageLoop::TYPE_MOZILLA_UI);
+    sMessageLoop->set_thread_name("Gecko");
+    // Set experimental values for main thread hangs:
+    // 512ms for transient hangs and 8192ms for permanent hangs
+    sMessageLoop->set_hang_timeouts(512, 8192);
+  }
 
-    if (!AtExitManager::AlreadyRegistered()) {
-        sExitManager = new AtExitManager();
+  if (XRE_GetProcessType() == GeckoProcessType_Default &&
+      !BrowserProcessSubThread::GetMessageLoop(BrowserProcessSubThread::IO)) {
+    scoped_ptr<BrowserProcessSubThread> ioThread(
+      new BrowserProcessSubThread(BrowserProcessSubThread::IO));
+
+    base::Thread::Options options;
+    options.message_loop_type = MessageLoop::TYPE_IO;
+    if (NS_WARN_IF(!ioThread->StartWithOptions(options))) {
+      return NS_ERROR_FAILURE;
     }
 
-    if (!MessageLoop::current()) {
-        sMessageLoop = new MessageLoopForUI(MessageLoop::TYPE_MOZILLA_UI);
-        sMessageLoop->set_thread_name("Gecko");
-        // Set experimental values for main thread hangs:
-        // 512ms for transient hangs and 8192ms for permanent hangs
-        sMessageLoop->set_hang_timeouts(512, 8192);
-    }
-
-    if (XRE_GetProcessType() == GeckoProcessType_Default &&
-        !BrowserProcessSubThread::GetMessageLoop(BrowserProcessSubThread::IO)) {
-        scoped_ptr<BrowserProcessSubThread> ioThread(
-            new BrowserProcessSubThread(BrowserProcessSubThread::IO));
+    sIOThread = ioThread.release();
+  }
 
-        base::Thread::Options options;
-        options.message_loop_type = MessageLoop::TYPE_IO;
-        if (NS_WARN_IF(!ioThread->StartWithOptions(options)))
-            return NS_ERROR_FAILURE;
-
-        sIOThread = ioThread.release();
-    }
+  // Establish the main thread here.
+  rv = nsThreadManager::get()->Init();
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return rv;
+  }
 
-    // Establish the main thread here.
-    rv = nsThreadManager::get()->Init();
-    if (NS_WARN_IF(NS_FAILED(rv)))
-        return rv;
-
-    // Set up the timer globals/timer thread
-    rv = nsTimerImpl::Startup();
-    if (NS_WARN_IF(NS_FAILED(rv)))
-        return rv;
+  // Set up the timer globals/timer thread
+  rv = nsTimerImpl::Startup();
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return rv;
+  }
 
 #ifndef ANDROID
-    // If the locale hasn't already been setup by our embedder,
-    // get us out of the "C" locale and into the system
-    if (strcmp(setlocale(LC_ALL, nullptr), "C") == 0)
-        setlocale(LC_ALL, "");
+  // If the locale hasn't already been setup by our embedder,
+  // get us out of the "C" locale and into the system
+  if (strcmp(setlocale(LC_ALL, nullptr), "C") == 0) {
+    setlocale(LC_ALL, "");
+  }
 #endif
 
 #if defined(XP_UNIX)
-    NS_StartupNativeCharsetUtils();
+  NS_StartupNativeCharsetUtils();
 #endif
 
-    NS_StartupLocalFile();
+  NS_StartupLocalFile();
 
-    StartupSpecialSystemDirectory();
+  StartupSpecialSystemDirectory();
 
-    nsDirectoryService::RealInit();
+  nsDirectoryService::RealInit();
 
-    bool value;
+  bool value;
+
+  if (aBinDirectory) {
+    rv = aBinDirectory->IsDirectory(&value);
 
-    if (binDirectory)
-    {
-        rv = binDirectory->IsDirectory(&value);
+    if (NS_SUCCEEDED(rv) && value) {
+      nsDirectoryService::gService->Set(NS_XPCOM_INIT_CURRENT_PROCESS_DIR,
+                                        aBinDirectory);
+    }
+  }
 
-        if (NS_SUCCEEDED(rv) && value) {
-            nsDirectoryService::gService->Set(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, binDirectory);
-        }
+  if (aAppFileLocationProvider) {
+    rv = nsDirectoryService::gService->RegisterProvider(aAppFileLocationProvider);
+    if (NS_FAILED(rv)) {
+      return rv;
     }
+  }
 
-    if (appFileLocationProvider) {
-        rv = nsDirectoryService::gService->RegisterProvider(appFileLocationProvider);
-        if (NS_FAILED(rv)) return rv;
-    }
+  nsCOMPtr<nsIFile> xpcomLib;
+  nsDirectoryService::gService->Get(NS_GRE_DIR,
+                                    NS_GET_IID(nsIFile),
+                                    getter_AddRefs(xpcomLib));
+  MOZ_ASSERT(xpcomLib);
 
-    nsCOMPtr<nsIFile> xpcomLib;
-    nsDirectoryService::gService->Get(NS_GRE_DIR,
-                                      NS_GET_IID(nsIFile),
-                                      getter_AddRefs(xpcomLib));
-    MOZ_ASSERT(xpcomLib);
+  // set gGREPath
+  nsAutoString path;
+  xpcomLib->GetPath(path);
+  gGREPath = ToNewUnicode(path);
+
+  xpcomLib->AppendNative(nsDependentCString(XPCOM_DLL));
+  nsDirectoryService::gService->Set(NS_XPCOM_LIBRARY_FILE, xpcomLib);
 
-    // set gGREPath
-    nsAutoString path;
-    xpcomLib->GetPath(path);
-    gGREPath = ToNewUnicode(path);
+  if (!mozilla::Omnijar::IsInitialized()) {
+    mozilla::Omnijar::Init();
+  }
 
-    xpcomLib->AppendNative(nsDependentCString(XPCOM_DLL));
-    nsDirectoryService::gService->Set(NS_XPCOM_LIBRARY_FILE, xpcomLib);
-
-    if (!mozilla::Omnijar::IsInitialized()) {
-        mozilla::Omnijar::Init();
+  if ((sCommandLineWasInitialized = !CommandLine::IsInitialized())) {
+#ifdef OS_WIN
+    CommandLine::Init(0, nullptr);
+#else
+    nsCOMPtr<nsIFile> binaryFile;
+    nsDirectoryService::gService->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
+                                      NS_GET_IID(nsIFile),
+                                      getter_AddRefs(binaryFile));
+    if (NS_WARN_IF(!binaryFile)) {
+      return NS_ERROR_FAILURE;
     }
 
-    if ((sCommandLineWasInitialized = !CommandLine::IsInitialized())) {
-#ifdef OS_WIN
-        CommandLine::Init(0, nullptr);
-#else
-        nsCOMPtr<nsIFile> binaryFile;
-        nsDirectoryService::gService->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
-                                          NS_GET_IID(nsIFile),
-                                          getter_AddRefs(binaryFile));
-        if (NS_WARN_IF(!binaryFile))
-            return NS_ERROR_FAILURE;
+    rv = binaryFile->AppendNative(NS_LITERAL_CSTRING("nonexistent-executable"));
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
+    }
 
-        rv = binaryFile->AppendNative(NS_LITERAL_CSTRING("nonexistent-executable"));
-        if (NS_WARN_IF(NS_FAILED(rv)))
-            return rv;
-
-        nsCString binaryPath;
-        rv = binaryFile->GetNativePath(binaryPath);
-        if (NS_WARN_IF(NS_FAILED(rv)))
-            return rv;
-
-        static char const *const argv = { strdup(binaryPath.get()) };
-        CommandLine::Init(1, &argv);
-#endif
+    nsCString binaryPath;
+    rv = binaryFile->GetNativePath(binaryPath);
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
     }
 
-    NS_ASSERTION(nsComponentManagerImpl::gComponentManager == nullptr, "CompMgr not null at init");
+    static char const* const argv = { strdup(binaryPath.get()) };
+    CommandLine::Init(1, &argv);
+#endif
+  }
 
-    // Create the Component/Service Manager
-    nsComponentManagerImpl::gComponentManager = new nsComponentManagerImpl();
-    NS_ADDREF(nsComponentManagerImpl::gComponentManager);
+  NS_ASSERTION(nsComponentManagerImpl::gComponentManager == nullptr,
+               "CompMgr not null at init");
 
-    // Global cycle collector initialization.
-    if (!nsCycleCollector_init()) {
-        return NS_ERROR_UNEXPECTED;
-    }
+  // Create the Component/Service Manager
+  nsComponentManagerImpl::gComponentManager = new nsComponentManagerImpl();
+  NS_ADDREF(nsComponentManagerImpl::gComponentManager);
 
-    // And start it up for this thread too.
-    nsCycleCollector_startup();
+  // Global cycle collector initialization.
+  if (!nsCycleCollector_init()) {
+    return NS_ERROR_UNEXPECTED;
+  }
 
-    // Register ICU memory functions.  This really shouldn't be necessary: the
-    // JS engine should do this on its own inside JS_Init, and memory-reporting
-    // code should call a JSAPI function to observe ICU memory usage.  But we
-    // can't define the alloc/free functions in the JS engine, because it can't
-    // depend on the XPCOM-based memory reporting goop.  So for now, we have
-    // this oddness.
-    mozilla::SetICUMemoryFunctions();
+  // And start it up for this thread too.
+  nsCycleCollector_startup();
 
-    // Do the same for libogg.
-    ogg_set_mem_functions(OggReporter::CountingMalloc,
-                          OggReporter::CountingCalloc,
-                          OggReporter::CountingRealloc,
-                          OggReporter::CountingFree);
+  // Register ICU memory functions.  This really shouldn't be necessary: the
+  // JS engine should do this on its own inside JS_Init, and memory-reporting
+  // code should call a JSAPI function to observe ICU memory usage.  But we
+  // can't define the alloc/free functions in the JS engine, because it can't
+  // depend on the XPCOM-based memory reporting goop.  So for now, we have
+  // this oddness.
+  mozilla::SetICUMemoryFunctions();
+
+  // Do the same for libogg.
+  ogg_set_mem_functions(OggReporter::CountingMalloc,
+                        OggReporter::CountingCalloc,
+                        OggReporter::CountingRealloc,
+                        OggReporter::CountingFree);
 
 #if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)
-    // And for VPX.
-    vpx_mem_set_functions(VPXReporter::CountingMalloc,
-                          VPXReporter::CountingCalloc,
-                          VPXReporter::CountingRealloc,
-                          VPXReporter::CountingFree,
-                          memcpy,
-                          memset,
-                          memmove);
+  // And for VPX.
+  vpx_mem_set_functions(VPXReporter::CountingMalloc,
+                        VPXReporter::CountingCalloc,
+                        VPXReporter::CountingRealloc,
+                        VPXReporter::CountingFree,
+                        memcpy,
+                        memset,
+                        memmove);
 #endif
 
 #ifdef MOZ_WEBM
-    // And for libnestegg.
-    nestegg_set_halloc_func(NesteggReporter::CountingRealloc);
+  // And for libnestegg.
+  nestegg_set_halloc_func(NesteggReporter::CountingRealloc);
 #endif
 
-    // Initialize the JS engine.
-    if (!JS_Init()) {
-        NS_RUNTIMEABORT("JS_Init failed");
-    }
+  // Initialize the JS engine.
+  if (!JS_Init()) {
+    NS_RUNTIMEABORT("JS_Init failed");
+  }
 
-    rv = nsComponentManagerImpl::gComponentManager->Init();
-    if (NS_FAILED(rv))
-    {
-        NS_RELEASE(nsComponentManagerImpl::gComponentManager);
-        return rv;
-    }
+  rv = nsComponentManagerImpl::gComponentManager->Init();
+  if (NS_FAILED(rv)) {
+    NS_RELEASE(nsComponentManagerImpl::gComponentManager);
+    return rv;
+  }
 
-    if (result) {
-        NS_ADDREF(*result = nsComponentManagerImpl::gComponentManager);
-    }
+  if (aResult) {
+    NS_ADDREF(*aResult = nsComponentManagerImpl::gComponentManager);
+  }
+
+  // The iimanager constructor searches and registers XPT files.
+  // (We trigger the singleton's lazy construction here to make that happen.)
+  (void)XPTInterfaceInfoManager::GetSingleton();
 
-    // The iimanager constructor searches and registers XPT files.
-    // (We trigger the singleton's lazy construction here to make that happen.)
-    (void) XPTInterfaceInfoManager::GetSingleton();
+  // After autoreg, but before we actually instantiate any components,
+  // add any services listed in the "xpcom-directory-providers" category
+  // to the directory service.
+  nsDirectoryService::gService->RegisterCategoryProviders();
 
-    // After autoreg, but before we actually instantiate any components,
-    // add any services listed in the "xpcom-directory-providers" category
-    // to the directory service.
-    nsDirectoryService::gService->RegisterCategoryProviders();
+  // Force layout to spin up so that nsContentUtils is available for cx stack
+  // munging.
+  nsCOMPtr<nsISupports> componentLoader =
+    do_GetService("@mozilla.org/moz/jsloader;1");
 
-    // Force layout to spin up so that nsContentUtils is available for cx stack
-    // munging.
-    nsCOMPtr<nsISupports> componentLoader = do_GetService("@mozilla.org/moz/jsloader;1");
-
-    mozilla::scache::StartupCache::GetSingleton();
-    mozilla::AvailableMemoryTracker::Activate();
+  mozilla::scache::StartupCache::GetSingleton();
+  mozilla::AvailableMemoryTracker::Activate();
 
-    // Notify observers of xpcom autoregistration start
-    NS_CreateServicesFromCategory(NS_XPCOM_STARTUP_CATEGORY,
-                                  nullptr,
-                                  NS_XPCOM_STARTUP_OBSERVER_ID);
+  // Notify observers of xpcom autoregistration start
+  NS_CreateServicesFromCategory(NS_XPCOM_STARTUP_CATEGORY,
+                                nullptr,
+                                NS_XPCOM_STARTUP_OBSERVER_ID);
 #ifdef XP_WIN
-    CreateAnonTempFileRemover();
+  CreateAnonTempFileRemover();
 #endif
 
-    // We only want the SystemMemoryReporter running in one process, because it
-    // profiles the entire system.  The main process is the obvious place for
-    // it.
-    if (XRE_GetProcessType() == GeckoProcessType_Default) {
-        mozilla::SystemMemoryReporter::Init();
-    }
+  // We only want the SystemMemoryReporter running in one process, because it
+  // profiles the entire system.  The main process is the obvious place for
+  // it.
+  if (XRE_GetProcessType() == GeckoProcessType_Default) {
+    mozilla::SystemMemoryReporter::Init();
+  }
 
-    // The memory reporter manager is up and running -- register our reporters.
-    RegisterStrongMemoryReporter(new ICUReporter());
-    RegisterStrongMemoryReporter(new OggReporter());
+  // The memory reporter manager is up and running -- register our reporters.
+  RegisterStrongMemoryReporter(new ICUReporter());
+  RegisterStrongMemoryReporter(new OggReporter());
 #ifdef MOZ_VPX
-    RegisterStrongMemoryReporter(new VPXReporter());
+  RegisterStrongMemoryReporter(new VPXReporter());
 #endif
 #ifdef MOZ_WEBM
-    RegisterStrongMemoryReporter(new NesteggReporter());
+  RegisterStrongMemoryReporter(new NesteggReporter());
 #endif
 
-    mozilla::Telemetry::Init();
+  mozilla::Telemetry::Init();
 
-    mozilla::HangMonitor::Startup();
-    mozilla::BackgroundHangMonitor::Startup();
+  mozilla::HangMonitor::Startup();
+  mozilla::BackgroundHangMonitor::Startup();
 
-    const MessageLoop* const loop = MessageLoop::current();
-    sMainHangMonitor = new mozilla::BackgroundHangMonitor(
-        loop->thread_name().c_str(),
-        loop->transient_hang_timeout(),
-        loop->permanent_hang_timeout());
+  const MessageLoop* const loop = MessageLoop::current();
+  sMainHangMonitor = new mozilla::BackgroundHangMonitor(
+    loop->thread_name().c_str(),
+    loop->transient_hang_timeout(),
+    loop->permanent_hang_timeout());
 
 #ifdef MOZ_VISUAL_EVENT_TRACER
-    mozilla::eventtracer::Init();
+  mozilla::eventtracer::Init();
 #endif
 
-    return NS_OK;
+  return NS_OK;
 }
 
 
 //
 // NS_ShutdownXPCOM()
 //
 // The shutdown sequence for xpcom would be
 //
@@ -744,268 +764,263 @@ NS_InitXPCOM2(nsIServiceManager* *result
 //   - Notify module loaders to shut down
 //   - Unload Libraries
 //   - Release Contractid Cache held by Component Manager
 //   - Release dll abstraction held by Component Manager
 //   - Release the Registry held by Component Manager
 //   - Finally, release the component manager itself
 //
 EXPORT_XPCOM_API(nsresult)
-NS_ShutdownXPCOM(nsIServiceManager* servMgr)
+NS_ShutdownXPCOM(nsIServiceManager* aServMgr)
 {
-    return mozilla::ShutdownXPCOM(servMgr);
+  return mozilla::ShutdownXPCOM(aServMgr);
 }
 
 namespace mozilla {
 
 void
 SetICUMemoryFunctions()
 {
-    static bool sICUReporterInitialized = false;
-    if (!sICUReporterInitialized) {
-        if (!JS_SetICUMemoryFunctions(ICUReporter::Alloc, ICUReporter::Realloc,
-                                      ICUReporter::Free)) {
-            NS_RUNTIMEABORT("JS_SetICUMemoryFunctions failed.");
-        }
-        sICUReporterInitialized = true;
+  static bool sICUReporterInitialized = false;
+  if (!sICUReporterInitialized) {
+    if (!JS_SetICUMemoryFunctions(ICUReporter::Alloc, ICUReporter::Realloc,
+                                  ICUReporter::Free)) {
+      NS_RUNTIMEABORT("JS_SetICUMemoryFunctions failed.");
     }
+    sICUReporterInitialized = true;
+  }
 }
 
 nsresult
-ShutdownXPCOM(nsIServiceManager* servMgr)
+ShutdownXPCOM(nsIServiceManager* aServMgr)
 {
-    // Make sure the hang monitor is enabled for shutdown.
-    HangMonitor::NotifyActivity();
+  // Make sure the hang monitor is enabled for shutdown.
+  HangMonitor::NotifyActivity();
+
+  if (!NS_IsMainThread()) {
+    NS_RUNTIMEABORT("Shutdown on wrong thread");
+  }
 
-    if (!NS_IsMainThread()) {
-        NS_RUNTIMEABORT("Shutdown on wrong thread");
+  nsresult rv;
+  nsCOMPtr<nsISimpleEnumerator> moduleLoaders;
+
+  // Notify observers of xpcom shutting down
+  {
+    // Block it so that the COMPtr will get deleted before we hit
+    // servicemanager shutdown
+
+    nsCOMPtr<nsIThread> thread = do_GetCurrentThread();
+    if (NS_WARN_IF(!thread)) {
+      return NS_ERROR_UNEXPECTED;
     }
 
-    nsresult rv;
-    nsCOMPtr<nsISimpleEnumerator> moduleLoaders;
-
-    // Notify observers of xpcom shutting down
-    {
-        // Block it so that the COMPtr will get deleted before we hit
-        // servicemanager shutdown
-
-        nsCOMPtr<nsIThread> thread = do_GetCurrentThread();
-        if (NS_WARN_IF(!thread))
-            return NS_ERROR_UNEXPECTED;
-
-        nsRefPtr<nsObserverService> observerService;
-        CallGetService("@mozilla.org/observer-service;1",
-                       (nsObserverService**) getter_AddRefs(observerService));
-
-        if (observerService)
-        {
-            (void) observerService->
-                NotifyObservers(nullptr, NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID,
-                                nullptr);
-
-            nsCOMPtr<nsIServiceManager> mgr;
-            rv = NS_GetServiceManager(getter_AddRefs(mgr));
-            if (NS_SUCCEEDED(rv))
-            {
-                (void) observerService->
-                    NotifyObservers(mgr, NS_XPCOM_SHUTDOWN_OBSERVER_ID,
-                                    nullptr);
-            }
-        }
-
-        // This must happen after the shutdown of media and widgets, which
-        // are triggered by the NS_XPCOM_SHUTDOWN_OBSERVER_ID notification.
-        NS_ProcessPendingEvents(thread);
-        gfxPlatform::ShutdownLayersIPC();
-
-        mozilla::scache::StartupCache::DeleteSingleton();
-        if (observerService)
-            (void) observerService->
-                NotifyObservers(nullptr, NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID,
-                                nullptr);
-
-        gXPCOMThreadsShutDown = true;
-        NS_ProcessPendingEvents(thread);
+    nsRefPtr<nsObserverService> observerService;
+    CallGetService("@mozilla.org/observer-service;1",
+                   (nsObserverService**) getter_AddRefs(observerService));
 
-        // Shutdown the timer thread and all timers that might still be alive before
-        // shutting down the component manager
-        nsTimerImpl::Shutdown();
-
-        NS_ProcessPendingEvents(thread);
-
-        // Shutdown all remaining threads.  This method does not return until
-        // all threads created using the thread manager (with the exception of
-        // the main thread) have exited.
-        nsThreadManager::get()->Shutdown();
-
-        NS_ProcessPendingEvents(thread);
-
-        HangMonitor::NotifyActivity();
-
-        // Late-write checks needs to find the profile directory, so it has to
-        // be initialized before mozilla::services::Shutdown or (because of
-        // xpcshell tests replacing the service) modules being unloaded.
-        mozilla::InitLateWriteChecks();
+    if (observerService) {
+      observerService->NotifyObservers(nullptr,
+                                       NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID,
+                                       nullptr);
 
-        // We save the "xpcom-shutdown-loaders" observers to notify after
-        // the observerservice is gone.
-        if (observerService) {
-            observerService->
-                EnumerateObservers(NS_XPCOM_SHUTDOWN_LOADERS_OBSERVER_ID,
-                                   getter_AddRefs(moduleLoaders));
-
-            observerService->Shutdown();
-        }
-    }
-
-    // Free ClearOnShutdown()'ed smart pointers.  This needs to happen *after*
-    // we've finished notifying observers of XPCOM shutdown, because shutdown
-    // observers themselves might call ClearOnShutdown().
-    mozilla::KillClearOnShutdown();
-
-    // XPCOM is officially in shutdown mode NOW
-    // Set this only after the observers have been notified as this
-    // will cause servicemanager to become inaccessible.
-    mozilla::services::Shutdown();
-
-#ifdef DEBUG_dougt
-    fprintf(stderr, "* * * * XPCOM shutdown. Access will be denied * * * * \n");
-#endif
-    // We may have AddRef'd for the caller of NS_InitXPCOM, so release it
-    // here again:
-    NS_IF_RELEASE(servMgr);
-
-    // Shutdown global servicemanager
-    if (nsComponentManagerImpl::gComponentManager) {
-        nsComponentManagerImpl::gComponentManager->FreeServices();
+      nsCOMPtr<nsIServiceManager> mgr;
+      rv = NS_GetServiceManager(getter_AddRefs(mgr));
+      if (NS_SUCCEEDED(rv)) {
+        observerService->NotifyObservers(mgr, NS_XPCOM_SHUTDOWN_OBSERVER_ID,
+                                         nullptr);
+      }
     }
 
-    // Release the directory service
-    NS_IF_RELEASE(nsDirectoryService::gService);
+    // This must happen after the shutdown of media and widgets, which
+    // are triggered by the NS_XPCOM_SHUTDOWN_OBSERVER_ID notification.
+    NS_ProcessPendingEvents(thread);
+    gfxPlatform::ShutdownLayersIPC();
 
-    NS_Free(gGREPath);
-    gGREPath = nullptr;
+    mozilla::scache::StartupCache::DeleteSingleton();
+    if (observerService)
+      observerService->NotifyObservers(nullptr,
+                                       NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID,
+                                       nullptr);
+
+    gXPCOMThreadsShutDown = true;
+    NS_ProcessPendingEvents(thread);
+
+    // Shutdown the timer thread and all timers that might still be alive before
+    // shutting down the component manager
+    nsTimerImpl::Shutdown();
+
+    NS_ProcessPendingEvents(thread);
 
-    if (moduleLoaders) {
-        bool more;
-        nsCOMPtr<nsISupports> el;
-        while (NS_SUCCEEDED(moduleLoaders->HasMoreElements(&more)) &&
-               more) {
-            moduleLoaders->GetNext(getter_AddRefs(el));
+    // Shutdown all remaining threads.  This method does not return until
+    // all threads created using the thread manager (with the exception of
+    // the main thread) have exited.
+    nsThreadManager::get()->Shutdown();
+
+    NS_ProcessPendingEvents(thread);
+
+    HangMonitor::NotifyActivity();
+
+    // Late-write checks needs to find the profile directory, so it has to
+    // be initialized before mozilla::services::Shutdown or (because of
+    // xpcshell tests replacing the service) modules being unloaded.
+    mozilla::InitLateWriteChecks();
+
+    // We save the "xpcom-shutdown-loaders" observers to notify after
+    // the observerservice is gone.
+    if (observerService) {
+      observerService->EnumerateObservers(NS_XPCOM_SHUTDOWN_LOADERS_OBSERVER_ID,
+                                          getter_AddRefs(moduleLoaders));
+
+      observerService->Shutdown();
+    }
+  }
 
-            // Don't worry about weak-reference observers here: there is
-            // no reason for weak-ref observers to register for
-            // xpcom-shutdown-loaders
+  // Free ClearOnShutdown()'ed smart pointers.  This needs to happen *after*
+  // we've finished notifying observers of XPCOM shutdown, because shutdown
+  // observers themselves might call ClearOnShutdown().
+  mozilla::KillClearOnShutdown();
+
+  // XPCOM is officially in shutdown mode NOW
+  // Set this only after the observers have been notified as this
+  // will cause servicemanager to become inaccessible.
+  mozilla::services::Shutdown();
+
+#ifdef DEBUG_dougt
+  fprintf(stderr, "* * * * XPCOM shutdown. Access will be denied * * * * \n");
+#endif
+  // We may have AddRef'd for the caller of NS_InitXPCOM, so release it
+  // here again:
+  NS_IF_RELEASE(aServMgr);
+
+  // Shutdown global servicemanager
+  if (nsComponentManagerImpl::gComponentManager) {
+    nsComponentManagerImpl::gComponentManager->FreeServices();
+  }
 
-            // FIXME: This can cause harmless writes from sqlite committing
-            // log files. We have to ignore them before we can move
-            // the mozilla::PoisonWrite call before this point. See bug
-            // 834945 for the details.
-            nsCOMPtr<nsIObserver> obs(do_QueryInterface(el));
-            if (obs)
-                (void) obs->Observe(nullptr,
-                                    NS_XPCOM_SHUTDOWN_LOADERS_OBSERVER_ID,
-                                    nullptr);
-        }
+  // Release the directory service
+  NS_IF_RELEASE(nsDirectoryService::gService);
+
+  NS_Free(gGREPath);
+  gGREPath = nullptr;
+
+  if (moduleLoaders) {
+    bool more;
+    nsCOMPtr<nsISupports> el;
+    while (NS_SUCCEEDED(moduleLoaders->HasMoreElements(&more)) && more) {
+      moduleLoaders->GetNext(getter_AddRefs(el));
 
-        moduleLoaders = nullptr;
+      // Don't worry about weak-reference observers here: there is
+      // no reason for weak-ref observers to register for
+      // xpcom-shutdown-loaders
+
+      // FIXME: This can cause harmless writes from sqlite committing
+      // log files. We have to ignore them before we can move
+      // the mozilla::PoisonWrite call before this point. See bug
+      // 834945 for the details.
+      nsCOMPtr<nsIObserver> obs(do_QueryInterface(el));
+      if (obs) {
+        obs->Observe(nullptr, NS_XPCOM_SHUTDOWN_LOADERS_OBSERVER_ID, nullptr);
+      }
     }
 
-    nsCycleCollector_shutdown();
+    moduleLoaders = nullptr;
+  }
 
-    layers::AsyncTransactionTrackersHolder::Finalize();
+  nsCycleCollector_shutdown();
 
-    PROFILER_MARKER("Shutdown xpcom");
-    // If we are doing any shutdown checks, poison writes.
-    if (gShutdownChecks != SCM_NOTHING) {
+  layers::AsyncTransactionTrackersHolder::Finalize();
+
+  PROFILER_MARKER("Shutdown xpcom");
+  // If we are doing any shutdown checks, poison writes.
+  if (gShutdownChecks != SCM_NOTHING) {
 #ifdef XP_MACOSX
-        mozilla::OnlyReportDirtyWrites();
+    mozilla::OnlyReportDirtyWrites();
 #endif /* XP_MACOSX */
-        mozilla::BeginLateWriteChecks();
-    }
+    mozilla::BeginLateWriteChecks();
+  }
 
-    // Shutdown nsLocalFile string conversion
-    NS_ShutdownLocalFile();
+  // Shutdown nsLocalFile string conversion
+  NS_ShutdownLocalFile();
 #ifdef XP_UNIX
-    NS_ShutdownNativeCharsetUtils();
+  NS_ShutdownNativeCharsetUtils();
 #endif
 
-    // Shutdown xpcom. This will release all loaders and cause others holding
-    // a refcount to the component manager to release it.
-    if (nsComponentManagerImpl::gComponentManager) {
-        rv = (nsComponentManagerImpl::gComponentManager)->Shutdown();
-        NS_ASSERTION(NS_SUCCEEDED(rv), "Component Manager shutdown failed.");
-    } else {
-        NS_WARNING("Component Manager was never created ...");
-    }
+  // Shutdown xpcom. This will release all loaders and cause others holding
+  // a refcount to the component manager to release it.
+  if (nsComponentManagerImpl::gComponentManager) {
+    rv = (nsComponentManagerImpl::gComponentManager)->Shutdown();
+    NS_ASSERTION(NS_SUCCEEDED(rv), "Component Manager shutdown failed.");
+  } else {
+    NS_WARNING("Component Manager was never created ...");
+  }
 
 #ifdef MOZ_ENABLE_PROFILER_SPS
-    // In optimized builds we don't do shutdown collections by default, so
-    // uncollected (garbage) objects may keep the nsXPConnect singleton alive,
-    // and its XPCJSRuntime along with it. However, we still destroy various
-    // bits of state in JS_ShutDown(), so we need to make sure the profiler
-    // can't access them when it shuts down. This call nulls out the
-    // JS pseudo-stack's internal reference to the main thread JSRuntime,
-    // duplicating the call in XPCJSRuntime::~XPCJSRuntime() in case that
-    // never fired.
-    if (PseudoStack *stack = mozilla_get_pseudo_stack()) {
-        stack->sampleRuntime(nullptr);
-    }
+  // In optimized builds we don't do shutdown collections by default, so
+  // uncollected (garbage) objects may keep the nsXPConnect singleton alive,
+  // and its XPCJSRuntime along with it. However, we still destroy various
+  // bits of state in JS_ShutDown(), so we need to make sure the profiler
+  // can't access them when it shuts down. This call nulls out the
+  // JS pseudo-stack's internal reference to the main thread JSRuntime,
+  // duplicating the call in XPCJSRuntime::~XPCJSRuntime() in case that
+  // never fired.
+  if (PseudoStack* stack = mozilla_get_pseudo_stack()) {
+    stack->sampleRuntime(nullptr);
+  }
 #endif
 
-    // Shut down the JS engine.
-    JS_ShutDown();
+  // Shut down the JS engine.
+  JS_ShutDown();
 
-    // Release our own singletons
-    // Do this _after_ shutting down the component manager, because the
-    // JS component loader will use XPConnect to call nsIModule::canUnload,
-    // and that will spin up the InterfaceInfoManager again -- bad mojo
-    XPTInterfaceInfoManager::FreeInterfaceInfoManager();
+  // Release our own singletons
+  // Do this _after_ shutting down the component manager, because the
+  // JS component loader will use XPConnect to call nsIModule::canUnload,
+  // and that will spin up the InterfaceInfoManager again -- bad mojo
+  XPTInterfaceInfoManager::FreeInterfaceInfoManager();
 
-    // Finally, release the component manager last because it unloads the
-    // libraries:
-    if (nsComponentManagerImpl::gComponentManager) {
-      nsrefcnt cnt;
-      NS_RELEASE2(nsComponentManagerImpl::gComponentManager, cnt);
-      NS_ASSERTION(cnt == 0, "Component Manager being held past XPCOM shutdown.");
-    }
-    nsComponentManagerImpl::gComponentManager = nullptr;
-    nsCategoryManager::Destroy();
+  // Finally, release the component manager last because it unloads the
+  // libraries:
+  if (nsComponentManagerImpl::gComponentManager) {
+    nsrefcnt cnt;
+    NS_RELEASE2(nsComponentManagerImpl::gComponentManager, cnt);
+    NS_ASSERTION(cnt == 0, "Component Manager being held past XPCOM shutdown.");
+  }
+  nsComponentManagerImpl::gComponentManager = nullptr;
+  nsCategoryManager::Destroy();
 
-    NS_PurgeAtomTable();
+  NS_PurgeAtomTable();
 
-    NS_IF_RELEASE(gDebug);
+  NS_IF_RELEASE(gDebug);
 
-    delete sIOThread;
-    sIOThread = nullptr;
+  delete sIOThread;
+  sIOThread = nullptr;
 
-    delete sMessageLoop;
-    sMessageLoop = nullptr;
+  delete sMessageLoop;
+  sMessageLoop = nullptr;
 
-    if (sCommandLineWasInitialized) {
-        CommandLine::Terminate();
-        sCommandLineWasInitialized = false;
-    }
+  if (sCommandLineWasInitialized) {
+    CommandLine::Terminate();
+    sCommandLineWasInitialized = false;
+  }
 
-    delete sExitManager;
-    sExitManager = nullptr;
+  delete sExitManager;
+  sExitManager = nullptr;
 
-    Omnijar::CleanUp();
+  Omnijar::CleanUp();
 
-    HangMonitor::Shutdown();
+  HangMonitor::Shutdown();
 
-    delete sMainHangMonitor;
-    sMainHangMonitor = nullptr;
+  delete sMainHangMonitor;
+  sMainHangMonitor = nullptr;
 
-    BackgroundHangMonitor::Shutdown();
+  BackgroundHangMonitor::Shutdown();
 
 #ifdef MOZ_VISUAL_EVENT_TRACER
-    eventtracer::Shutdown();
+  eventtracer::Shutdown();
 #endif
 
-    profiler_shutdown();
+  profiler_shutdown();
 
-    NS_LogTerm();
+  NS_LogTerm();
 
-    return NS_OK;
+  return NS_OK;
 }
 
 } // namespace mozilla
--- a/xpcom/build/nsXREAppData.h
+++ b/xpcom/build/nsXREAppData.h
@@ -32,98 +32,98 @@ struct nsXREAppData
    */
   nsIFile* directory;
 
   /**
    * The name of the application vendor. This must be ASCII, and is normally
    * mixed-case, e.g. "Mozilla". Optional (may be null), but highly
    * recommended. Must not be the empty string.
    */
-  const char *vendor;
+  const char* vendor;
 
   /**
    * The name of the application. This must be ASCII, and is normally
    * mixed-case, e.g. "Firefox". Required (must not be null or an empty
    * string).
    */
-  const char *name;
+  const char* name;
 
   /**
    * The major version, e.g. "0.8.0+". Optional (may be null), but
    * required for advanced application features such as the extension
    * manager and update service. Must not be the empty string.
    */
-  const char *version;
+  const char* version;
 
   /**
    * The application's build identifier, e.g. "2004051604"
    */
-  const char *buildID;
+  const char* buildID;
 
   /**
    * The application's UUID. Used by the extension manager to determine
    * compatible extensions. Optional, but required for advanced application
    * features such as the extension manager and update service.
    *
    * This has traditionally been in the form
    * "{AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE}" but for new applications
    * a more readable form is encouraged: "appname@vendor.tld". Only
    * the following characters are allowed: a-z A-Z 0-9 - . @ _ { } *
    */
-  const char *ID;
+  const char* ID;
 
   /**
    * The copyright information to print for the -h commandline flag,
    * e.g. "Copyright (c) 2003 mozilla.org".
    */
-  const char *copyright;
+  const char* copyright;
 
   /**
    * Combination of NS_XRE_ prefixed flags (defined below).
    */
   uint32_t flags;
 
   /**
    * The location of the XRE. XRE_main may not be able to figure this out
    * programatically.
    */
   nsIFile* xreDirectory;
 
   /**
    * The minimum/maximum compatible XRE version.
    */
-  const char *minVersion;
-  const char *maxVersion;
+  const char* minVersion;
+  const char* maxVersion;
 
   /**
    * The server URL to send crash reports to.
    */
-  const char *crashReporterURL;
+  const char* crashReporterURL;
 
   /**
    * The profile directory that will be used. Optional (may be null). Must not
    * be the empty string, must be ASCII. The path is split into components
    * along the path separator characters '/' and '\'.
    *
    * The application data directory ("UAppData", see below) is normally
    * composed as follows, where $HOME is platform-specific:
    *
    *   UAppData = $HOME[/$vendor]/$name
    *
    * If present, the 'profile' string will be used instead of the combination of
    * vendor and name as follows:
    *
    *   UAppData = $HOME/$profile
    */
-  const char *profile;
+  const char* profile;
 
   /**
    * The application name to use in the User Agent string.
    */
-  const char *UAName;
+  const char* UAName;
 };
 
 /**
  * Indicates whether or not the profile migrator service may be
  * invoked at startup when creating a profile.
  */
 #define NS_XRE_ENABLE_PROFILE_MIGRATOR (1 << 1)
 
--- a/xpcom/build/nsXULAppAPI.h
+++ b/xpcom/build/nsXULAppAPI.h
@@ -121,19 +121,19 @@
  * Windows: Documents and Settings\<User>\Local Settings\Application Data\
  *          <Vendor>\<Application>\<relative path to app dir from Program Files>
  * If appDir is not under the Program Files, directory service will fail.
  * Callers should fallback to appDir.
  */
 #define XRE_UPDATE_ROOT_DIR "UpdRootD"
 
 /**
- * A directory service key which provides an alternate location 
- * to UpdRootD to  to store large files. This key is currently 
- * only implemented in the Gonk directory service provider. 
+ * A directory service key which provides an alternate location
+ * to UpdRootD to  to store large files. This key is currently
+ * only implemented in the Gonk directory service provider.
  */
 
 #define XRE_UPDATE_ARCHIVE_DIR "UpdArchD"
 
 /**
  * A directory service key which provides the directory where an OS update is
 *  applied.
  * At present this is supported only in Gonk.
@@ -171,43 +171,43 @@ XRE_API(int,
 
 /**
  * Given a path relative to the current working directory (or an absolute
  * path), return an appropriate nsIFile object.
  *
  * @note Pass UTF8 strings on Windows... native charset on other platforms.
  */
 XRE_API(nsresult,
-        XRE_GetFileFromPath, (const char *aPath, nsIFile* *aResult))
+        XRE_GetFileFromPath, (const char* aPath, nsIFile** aResult))
 
 /**
  * Get the path of the running application binary and store it in aResult.
- * @param argv0   The value passed as argv[0] of main(). This value is only
+ * @param aArgv0  The value passed as argv[0] of main(). This value is only
  *                used on *nix, and only when other methods of determining
  *                the binary path have failed.
  */
 XRE_API(nsresult,
-        XRE_GetBinaryPath, (const char *argv0, nsIFile* *aResult))
+        XRE_GetBinaryPath, (const char* aArgv0, nsIFile** aResult))
 
 /**
  * Get the static module built in to libxul.
  */
 XRE_API(const mozilla::Module*,
         XRE_GetStaticModule, ())
 
 /**
  * Lock a profile directory using platform-specific semantics.
  *
  * @param aDirectory  The profile directory to lock.
  * @param aLockObject An opaque lock object. The directory will remain locked
  *                    as long as the XPCOM reference is held.
  */
 XRE_API(nsresult,
         XRE_LockProfileDirectory, (nsIFile* aDirectory,
-                                   nsISupports* *aLockObject))
+                                   nsISupports** aLockObject))
 
 /**
  * Initialize libXUL for embedding purposes.
  *
  * @param aLibXULDirectory   The directory in which the libXUL shared library
  *                           was found.
  * @param aAppDirectory      The directory in which the application components
  *                           and resources can be found. This will map to
@@ -220,19 +220,19 @@ XRE_API(nsresult,
  * @note This function must be called from the "main" thread.
  *
  * @note At the present time, this function may only be called once in
  * a given process. Use XRE_TermEmbedding to clean up and free
  * resources allocated by XRE_InitEmbedding.
  */
 
 XRE_API(nsresult,
-        XRE_InitEmbedding2, (nsIFile *aLibXULDirectory,
-                             nsIFile *aAppDirectory,
-                             nsIDirectoryServiceProvider *aAppDirProvider))
+        XRE_InitEmbedding2, (nsIFile* aLibXULDirectory,
+                             nsIFile* aAppDirectory,
+                             nsIDirectoryServiceProvider* aAppDirProvider))
 
 /**
  * Register static XPCOM component information.
  * This method may be called at any time before or after XRE_main or
  * XRE_InitEmbedding.
  */
 XRE_API(nsresult,
         XRE_AddStaticComponent, (const mozilla::Module* aComponent))
@@ -324,36 +324,37 @@ XRE_API(void,
  *
  * @param aINIFile The application.ini file to parse.
  * @param aAppData A newly-allocated nsXREAppData structure. The caller is
  *                 responsible for freeing this structure using
  *                 XRE_FreeAppData.
  */
 XRE_API(nsresult,
         XRE_CreateAppData, (nsIFile* aINIFile,
-                            nsXREAppData **aAppData))
+                            nsXREAppData** aAppData))
 
 /**
  * Parse an INI file (application.ini or override.ini) into an existing
  * nsXREAppData structure.
  *
  * @param aINIFile The INI file to parse
  * @param aAppData The nsXREAppData structure to fill.
  */
 XRE_API(nsresult,
         XRE_ParseAppData, (nsIFile* aINIFile,
-                           nsXREAppData *aAppData))
+                           nsXREAppData* aAppData))
 
 /**
  * Free a nsXREAppData structure that was allocated with XRE_CreateAppData.
  */
 XRE_API(void,
-        XRE_FreeAppData, (nsXREAppData *aAppData))
+        XRE_FreeAppData, (nsXREAppData* aAppData))
 
-enum GeckoProcessType {
+enum GeckoProcessType
+{
   GeckoProcessType_Default = 0,
 
   GeckoProcessType_Plugin,
   GeckoProcessType_Content,
 
   GeckoProcessType_IPDLUnitTest,
 
   GeckoProcessType_GMPlugin, // Gecko Media Plugin
@@ -439,41 +440,42 @@ XRE_API(void,
 
 XRE_API(void,
         XRE_TelemetryAccumulate, (int aID, uint32_t aSample))
 
 XRE_API(void,
         XRE_StartupTimelineRecord, (int aEvent, PRTime aWhen))
 
 XRE_API(void,
-        XRE_InitOmnijar, (nsIFile* greOmni,
-                          nsIFile* appOmni))
+        XRE_InitOmnijar, (nsIFile* aGreOmni,
+                          nsIFile* aAppOmni))
 XRE_API(void,
         XRE_StopLateWriteChecks, (void))
 
 #ifdef XP_WIN
 /**
  * Valid environment types for XRE_GetWindowsEnvironment.
  */
-enum WindowsEnvironmentType {
+enum WindowsEnvironmentType
+{
   WindowsEnvironmentType_Desktop = 0,
   WindowsEnvironmentType_Metro = 1
 };
 
 /**
  * Retrieve the Windows desktop environment libXUL is running
  * under. Valid after a call to XRE_main.
  */
 XRE_API(WindowsEnvironmentType,
         XRE_GetWindowsEnvironment, ())
 #endif // XP_WIN
 
 #ifdef MOZ_B2G_LOADER
 XRE_API(int,
-        XRE_ProcLoaderServiceRun, (pid_t, int, int argc, const char *argv[]));
+        XRE_ProcLoaderServiceRun, (pid_t, int, int argc, const char* argv[]));
 XRE_API(void,
         XRE_ProcLoaderClientInit, (pid_t, int));
 XRE_API(void,
         XRE_ProcLoaderPreload, (const char* aProgramDir,
                                 const nsXREAppData* aAppData));
 #endif // MOZ_B2G_LOADER
 
 XRE_API(int,
--- a/xpcom/build/perfprobe.cpp
+++ b/xpcom/build/perfprobe.cpp
@@ -12,105 +12,116 @@
 
 #include "perfprobe.h"
 #include "nsAutoPtr.h"
 
 namespace mozilla {
 namespace probes {
 
 #if defined(MOZ_LOGGING)
-static PRLogModuleInfo *
+static PRLogModuleInfo*
 GetProbeLog()
 {
-  static PRLogModuleInfo *sLog;
-  if (!sLog)
+  static PRLogModuleInfo* sLog;
+  if (!sLog) {
     sLog = PR_NewLogModule("SysProbe");
+  }
   return sLog;
 }
 #define LOG(x)  PR_LOG(GetProbeLog(), PR_LOG_DEBUG, x)
 #else
 #define LOG(x)
 #endif
 
-//Utility function
-GUID CID_to_GUID(const nsCID &aCID)
+// Utility function
+GUID
+CID_to_GUID(const nsCID& aCID)
 {
   GUID result;
   result.Data1 = aCID.m0;
   result.Data2 = aCID.m1;
   result.Data3 = aCID.m2;
-  for (int i = 0; i < 8; ++i)
+  for (int i = 0; i < 8; ++i) {
     result.Data4[i] = aCID.m3[i];
+  }
   return result;
 }
 
 
-
 // Implementation of Probe
 
-Probe::Probe(const nsCID &aGUID,
-             const nsACString &aName,
-             ProbeManager *aManager)
+Probe::Probe(const nsCID& aGUID,
+             const nsACString& aName,
+             ProbeManager* aManager)
   : mGUID(CID_to_GUID(aGUID))
   , mName(aName)
   , mManager(aManager)
 {
 }
 
-nsresult Probe::Trigger()
+nsresult
+Probe::Trigger()
 {
   if (!(mManager->mIsActive)) {
     //Do not trigger if there is no session
-    return NS_OK; 
+    return NS_OK;
   }
-  
+
   _EVENT_TRACE_HEADER event;
   ZeroMemory(&event, sizeof(event));
   event.Size = sizeof(event);
   event.Flags = WNODE_FLAG_TRACED_GUID ;
   event.Guid = (const GUID)mGUID;
   event.Class.Type    = 1;
   event.Class.Version = 0;
   event.Class.Level   = TRACE_LEVEL_INFORMATION;
-  
+
   ULONG result        = TraceEvent(mManager->mSessionHandle, &event);
-  
+
   LOG(("Probes: Triggered %s, %s, %ld",
        mName.Data(),
-       result==ERROR_SUCCESS ? "success":"failure",
+       result == ERROR_SUCCESS ? "success" : "failure",
        result));
-  
+
   nsresult rv;
-  switch(result)
-  {
-    case ERROR_SUCCESS:             rv = NS_OK; break;
+  switch (result) {
+    case ERROR_SUCCESS:
+      rv = NS_OK;
+      break;
     case ERROR_INVALID_FLAG_NUMBER:
     case ERROR_MORE_DATA:
-    case ERROR_INVALID_PARAMETER:   rv = NS_ERROR_INVALID_ARG; break;
-    case ERROR_INVALID_HANDLE:      rv = NS_ERROR_FAILURE;     break;
+    case ERROR_INVALID_PARAMETER:
+      rv = NS_ERROR_INVALID_ARG;
+      break;
+    case ERROR_INVALID_HANDLE:
+      rv = NS_ERROR_FAILURE;
+      break;
     case ERROR_NOT_ENOUGH_MEMORY:
-    case ERROR_OUTOFMEMORY:         rv = NS_ERROR_OUT_OF_MEMORY; break;
-    default:                        rv = NS_ERROR_UNEXPECTED;
+    case ERROR_OUTOFMEMORY:
+      rv = NS_ERROR_OUT_OF_MEMORY;
+      break;
+    default:
+      rv = NS_ERROR_UNEXPECTED;
   }
   return rv;
 }
 
 
 // Implementation of ProbeManager
 
 ProbeManager::~ProbeManager()
 {
   //If the manager goes out of scope, stop the session.
   if (mIsActive && mRegistrationHandle) {
     StopSession();
   }
 }
 
-ProbeManager::ProbeManager(const nsCID &aApplicationUID,
-                           const nsACString &aApplicationName)
+ProbeManager::ProbeManager(const nsCID& aApplicationUID,
+                           const nsACString& aApplicationName)
   : mApplicationUID(aApplicationUID)
   , mApplicationName(aApplicationName)
   , mSessionHandle(0)
   , mRegistrationHandle(0)
 {
 #if defined(MOZ_LOGGING)
   char cidStr[NSID_LENGTH];
   aApplicationUID.ToProvidedString(cidStr);
@@ -121,116 +132,116 @@ ProbeManager::ProbeManager(const nsCID &
 
 //Note: The Windows API is just a little bit scary there.
 //The only way to obtain the session handle is to
 //- ignore the session handle obtained from RegisterTraceGuids
 //- pass a callback
 //- in that callback, request the session handle through
 //      GetTraceLoggerHandle and some opaque value received by the callback
 
-ULONG WINAPI ControlCallback(
-                             WMIDPREQUESTCODE RequestCode,
-                             PVOID Context,
-                             ULONG *Reserved,
-                             PVOID Buffer
-                             )
+ULONG WINAPI
+ControlCallback(WMIDPREQUESTCODE aRequestCode,
+                PVOID aContext,
+                ULONG* aReserved,
+                PVOID aBuffer)
 {
-  ProbeManager* context = (ProbeManager*)Context;
-  switch(RequestCode)
-  {
-  case WMI_ENABLE_EVENTS: 
-    {
+  ProbeManager* context = (ProbeManager*)aContext;
+  switch (aRequestCode) {
+    case WMI_ENABLE_EVENTS: {
       context->mIsActive = true;
-      TRACEHANDLE sessionHandle = GetTraceLoggerHandle(Buffer);
+      TRACEHANDLE sessionHandle = GetTraceLoggerHandle(aBuffer);
       //Note: We only accept one handle
       if ((HANDLE)sessionHandle == INVALID_HANDLE_VALUE) {
         ULONG result = GetLastError();
         LOG(("Probes: ControlCallback failed, %ul", result));
         return result;
-      } else if (context->mIsActive && context->mSessionHandle
-                && context->mSessionHandle != sessionHandle) {
+      } else if (context->mIsActive && context->mSessionHandle &&
+                 context->mSessionHandle != sessionHandle) {
         LOG(("Probes: Can only handle one context at a time, "
              "ignoring activation"));
         return ERROR_SUCCESS;
       } else {
         context->mSessionHandle = sessionHandle;
         LOG(("Probes: ControlCallback activated"));
         return ERROR_SUCCESS;
       }
     }
 
-  case WMI_DISABLE_EVENTS:
-    context->mIsActive      = false;
-    context->mSessionHandle = 0;
-    LOG(("Probes: ControlCallback deactivated"));
-    return ERROR_SUCCESS;
+    case WMI_DISABLE_EVENTS:
+      context->mIsActive      = false;
+      context->mSessionHandle = 0;
+      LOG(("Probes: ControlCallback deactivated"));
+      return ERROR_SUCCESS;
 
-  default:
-    LOG(("Probes: ControlCallback does not know what to do with %d",
-         RequestCode));
-    return ERROR_INVALID_PARAMETER;
+    default:
+      LOG(("Probes: ControlCallback does not know what to do with %d",
+           aRequestCode));
+      return ERROR_INVALID_PARAMETER;
   }
 }
 
-already_AddRefed<Probe> ProbeManager::GetProbe(const nsCID &eventUID,
-                               const nsACString &eventName)
+already_AddRefed<Probe>
+ProbeManager::GetProbe(const nsCID& aEventUID, const nsACString& aEventName)
 {
-  nsRefPtr<Probe> result(new Probe(eventUID, eventName, this));
+  nsRefPtr<Probe> result(new Probe(aEventUID, aEventName, this));
   mAllProbes.AppendElement(result);
   return result.forget();
 }
 
-nsresult ProbeManager::StartSession()
+nsresult
+ProbeManager::StartSession()
 {
   return StartSession(mAllProbes);
 }
 
-nsresult ProbeManager::StartSession(nsTArray<nsRefPtr<Probe>> &aProbes)
+nsresult
+ProbeManager::StartSession(nsTArray<nsRefPtr<Probe>>& aProbes)
 {
   const size_t probesCount = aProbes.Length();
   _TRACE_GUID_REGISTRATION* probes = new _TRACE_GUID_REGISTRATION[probesCount];
   for (unsigned int i = 0; i < probesCount; ++i) {
-    const Probe *probe = aProbes[i];
-    const Probe *probeX = static_cast<const Probe*>(probe);
-    probes[i].Guid = (LPCGUID)&(probeX->mGUID);
+    const Probe* probe = aProbes[i];
+    const Probe* probeX = static_cast<const Probe*>(probe);
+    probes[i].Guid = (LPCGUID)&probeX->mGUID;
   }
   ULONG result =
     RegisterTraceGuids(&ControlCallback
-                     /*RequestAddress: Sets mSessions appropriately.*/,
-                     this
-                     /*RequestContext: Passed to ControlCallback*/,
-                     (LPGUID)&mApplicationUID
-                     /*ControlGuid:    Tracing GUID
-                      the cast comes from MSDN examples*/,
-                     probesCount
-                     /*GuidCount:      Number of probes*/,
-                     probes
-                     /*TraceGuidReg:   Probes registration*/,
-                     nullptr
-                     /*MofImagePath:   Must be nullptr, says MSDN*/,
-                     nullptr
-                     /*MofResourceName:Must be nullptr, says MSDN*/,
-                     &mRegistrationHandle
-                     /*RegistrationHandle: Handler.
-                      used only for unregistration*/
-                     );
+                       /*RequestAddress: Sets mSessions appropriately.*/,
+                       this
+                       /*RequestContext: Passed to ControlCallback*/,
+                       (LPGUID)&mApplicationUID
+                       /*ControlGuid:    Tracing GUID
+                        the cast comes from MSDN examples*/,
+                       probesCount
+                       /*GuidCount:      Number of probes*/,
+                       probes
+                       /*TraceGuidReg:   Probes registration*/,
+                       nullptr
+                       /*MofImagePath:   Must be nullptr, says MSDN*/,
+                       nullptr
+                       /*MofResourceName:Must be nullptr, says MSDN*/,
+                       &mRegistrationHandle
+                       /*RegistrationHandle: Handler.
+                        used only for unregistration*/
+                      );
   delete[] probes;
-  if (NS_WARN_IF(result != ERROR_SUCCESS))
+  if (NS_WARN_IF(result != ERROR_SUCCESS)) {
     return NS_ERROR_UNEXPECTED;
+  }
   return NS_OK;
 }
 
-nsresult ProbeManager::StopSession()
+nsresult
+ProbeManager::StopSession()
 {
   LOG(("Probes: Stopping measures"));
   if (mSessionHandle != 0) {
     ULONG result = UnregisterTraceGuids(mSessionHandle);
     mSessionHandle = 0;
     if (result != ERROR_SUCCESS) {
       return NS_ERROR_INVALID_ARG;
     }
   }
   return NS_OK;
 }
 
-
-}
-}
+}  // namespace probes
+}  // namespace mozilla
--- a/xpcom/build/perfprobe.h
+++ b/xpcom/build/perfprobe.h
@@ -45,19 +45,17 @@ public:
    *
    * Note: Can be called from any thread.
    */
   nsresult Trigger();
 
 protected:
   ~Probe() {};
 
-  Probe(const nsCID &aGUID,
-        const nsACString &aName,
-         ProbeManager *aManager);
+  Probe(const nsCID& aGUID, const nsACString& aName, ProbeManager* aManager);
   friend class ProbeManager;
 
 protected:
 
   /**
    * The system GUID associated to this probe. See the documentation
    * of |ProbeManager::Make| for more details.
    */
@@ -69,17 +67,17 @@ protected:
    */
   const nsCString mName;
 
   /**
    * The ProbeManager managing this probe.
    *
    * Note: This is a weak reference to avoid a useless cycle.
    */
-  class ProbeManager *mManager;
+  class ProbeManager* mManager;
 };
 
 
 /**
  * A manager for a group of probes.
  *
  * You can have several managers in one application, provided that they all
  * have distinct IDs and names. However, having more than 2 is considered a bad
@@ -90,48 +88,49 @@ class ProbeManager
 public:
   NS_INLINE_DECL_REFCOUNTING(ProbeManager)
 
   /**
    * Create a new probe manager.
    *
    * This constructor should be called from the main thread.
    *
-   * @param uid The unique ID of the probe. Under Windows, this unique
-   * ID must have been previously registered using an external tool.
+   * @param aApplicationUID The unique ID of the probe. Under Windows, this
+   * unique ID must have been previously registered using an external tool.
    * See MyCategory on http://msdn.microsoft.com/en-us/library/aa364100.aspx
-   * @param name A name for the probe. Currently used only for logging purposes.
-   * In the future, may be attached to the data sent to the operating system.
+   * @param aApplicationName A name for the probe. Currently used only for
+   * logging purposes. In the future, may be attached to the data sent to the
+   * operating system.
    *
    * Note: If two ProbeManagers are constructed with the same uid and/or name,
    * behavior is unspecified.
    */
-  ProbeManager(const nsCID &applicationUID,
-               const nsACString &applicationName);
+  ProbeManager(const nsCID& aApplicationUID,
+               const nsACString& aApplicationName);
 
   /**
    * Acquire a probe.
    *
    * Note: Only probes acquired before the call to SetReady are taken into
    * account
    * Note: Can be called only from the main thread.
    *
-   * @param eventUID The unique ID of the probe. Under Windows, this unique
+   * @param aEventUID The unique ID of the probe. Under Windows, this unique
    * ID must have been previously registered using an external tool.
    * See MyCategory on http://msdn.microsoft.com/en-us/library/aa364100.aspx
-   * @param eventMame A name for the probe. Currently used only for logging
+   * @param aEventName A name for the probe. Currently used only for logging
    * purposes. In the
    * future, may be attached to the data sent to the operating system.
    * @return Either |null| in case of error or a valid |Probe*|.
    *
    * Note: If this method is called twice with the same uid and/or name,
    * behavior is undefined.
    */
-  already_AddRefed<Probe> GetProbe(const nsCID &eventUID,
-                                   const nsACString &eventName);
+  already_AddRefed<Probe> GetProbe(const nsCID& aEventUID,
+                                   const nsACString& aEventName);
 
   /**
    * Start/stop the measuring session.
    *
    * This method should be called from the main thread.
    *
    * Note that starting an already started probe manager has no effect,
    * nor does stopping an already stopped probe manager.
@@ -144,18 +143,19 @@ public:
    * is useful. You do not have to check this before triggering a probe, unless
    * this can avoid complex computations.
    */
   bool IsActive();
 
 protected:
   ~ProbeManager();
 
-  nsresult StartSession(nsTArray<nsRefPtr<Probe> > &probes);
-  nsresult Init(const nsCID &applicationUID, const nsACString &applicationName);
+  nsresult StartSession(nsTArray<nsRefPtr<Probe>>& aProbes);
+  nsresult Init(const nsCID& aApplicationUID,
+                const nsACString& aApplicationName);
 
 protected:
   /**
    * `true` if a session is in activity, `false` otherwise.
    */
   bool mIsActive;
 
   /**
@@ -168,37 +168,36 @@ protected:
   /**
    * The name of the application.
    */
   nsCString mApplicationName;
 
   /**
    * All the probes that have been created for this manager.
    */
-  nsTArray<nsRefPtr<Probe> > mAllProbes;
+  nsTArray<nsRefPtr<Probe>> mAllProbes;
 
   /**
    * Handle used for triggering events
    */
   TRACEHANDLE mSessionHandle;
 
   /**
    * Handle used for registration/unregistration
    */
   TRACEHANDLE mRegistrationHandle;
 
   /**
    * `true` if initialization has been performed, `false` until then.
    */
   bool mInitialized;
 
-  friend class Probe;//Needs to access |mSessionHandle|
-  friend ULONG WINAPI ControlCallback(
-                                      WMIDPREQUESTCODE RequestCode,
-                                      PVOID Context,
-                                      ULONG *Reserved,
-                                      PVOID Buffer
-                                      );//Sets |mSessionHandle|
+  friend class Probe;  // Needs to access |mSessionHandle|
+  friend ULONG WINAPI ControlCallback(WMIDPREQUESTCODE aRequestCode,
+                                      PVOID aContext,
+                                      ULONG* aReserved,
+                                      PVOID aBuffer);  // Sets |mSessionHandle|
 };
-}
-}
+
+}  // namespace probes
+}  // namespace mozilla
 
 #endif //mozilla_perfprobe_h