Bug 1130096 - Convert embedding/browser/ to Gecko style. r=mccr8
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Mon, 11 May 2015 12:35:13 -0700
changeset 262928 4ff686c997507c045be0a5b058ec22bac9897fcd
parent 262927 107ff1a3cebd31da16c14b6bb69d3751bea2f4a4
child 262929 0f6c617635886a1644bf5bf9cf59797a3df09f0a
push id8157
push userjlund@mozilla.com
push dateMon, 29 Jun 2015 20:36:23 +0000
treeherdermozilla-aurora@d480e05bd276 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1130096
milestone40.0a1
Bug 1130096 - Convert embedding/browser/ to Gecko style. r=mccr8
embedding/browser/build/nsWebBrowserModule.cpp
embedding/browser/nsCTooltipTextProvider.h
embedding/browser/nsCommandHandler.cpp
embedding/browser/nsCommandHandler.h
embedding/browser/nsContextMenuInfo.cpp
embedding/browser/nsContextMenuInfo.h
embedding/browser/nsDocShellTreeOwner.cpp
embedding/browser/nsDocShellTreeOwner.h
embedding/browser/nsEmbedStream.cpp
embedding/browser/nsEmbedStream.h
embedding/browser/nsWebBrowser.cpp
embedding/browser/nsWebBrowser.h
embedding/browser/nsWebBrowserContentPolicy.cpp
embedding/browser/nsWebBrowserContentPolicy.h
--- a/embedding/browser/build/nsWebBrowserModule.cpp
+++ b/embedding/browser/build/nsWebBrowserModule.cpp
@@ -20,37 +20,34 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebBrow
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebBrowserContentPolicy)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsCommandHandler)
 
 NS_DEFINE_NAMED_CID(NS_WEBBROWSER_CID);
 NS_DEFINE_NAMED_CID(NS_COMMANDHANDLER_CID);
 NS_DEFINE_NAMED_CID(NS_WEBBROWSERCONTENTPOLICY_CID);
 
 static const mozilla::Module::CIDEntry kWebBrowserCIDs[] = {
-    { &kNS_WEBBROWSER_CID, false, nullptr, nsWebBrowserConstructor },
-    { &kNS_COMMANDHANDLER_CID, false, nullptr, nsCommandHandlerConstructor },
-    { &kNS_WEBBROWSERCONTENTPOLICY_CID, false, nullptr, nsWebBrowserContentPolicyConstructor },
-    { nullptr }
+  { &kNS_WEBBROWSER_CID, false, nullptr, nsWebBrowserConstructor },
+  { &kNS_COMMANDHANDLER_CID, false, nullptr, nsCommandHandlerConstructor },
+  { &kNS_WEBBROWSERCONTENTPOLICY_CID, false, nullptr, nsWebBrowserContentPolicyConstructor },
+  { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kWebBrowserContracts[] = {
-    { NS_WEBBROWSER_CONTRACTID, &kNS_WEBBROWSER_CID },
-    { NS_COMMANDHANDLER_CONTRACTID, &kNS_COMMANDHANDLER_CID },
-    { NS_WEBBROWSERCONTENTPOLICY_CONTRACTID, &kNS_WEBBROWSERCONTENTPOLICY_CID },
-    { nullptr }
+  { NS_WEBBROWSER_CONTRACTID, &kNS_WEBBROWSER_CID },
+  { NS_COMMANDHANDLER_CONTRACTID, &kNS_COMMANDHANDLER_CID },
+  { NS_WEBBROWSERCONTENTPOLICY_CONTRACTID, &kNS_WEBBROWSERCONTENTPOLICY_CID },
+  { nullptr }
 };
 
 static const mozilla::Module::CategoryEntry kWebBrowserCategories[] = {
-    { "content-policy", NS_WEBBROWSERCONTENTPOLICY_CONTRACTID, NS_WEBBROWSERCONTENTPOLICY_CONTRACTID },
-    { nullptr }
+  { "content-policy", NS_WEBBROWSERCONTENTPOLICY_CONTRACTID, NS_WEBBROWSERCONTENTPOLICY_CONTRACTID },
+  { nullptr }
 };
 
 static const mozilla::Module kWebBrowserModule = {
-    mozilla::Module::kVersion,
-    kWebBrowserCIDs,
-    kWebBrowserContracts,
-    kWebBrowserCategories
+  mozilla::Module::kVersion,
+  kWebBrowserCIDs,
+  kWebBrowserContracts,
+  kWebBrowserCategories
 };
 
 NSMODULE_DEFN(Browser_Embedding_Module) = &kWebBrowserModule;
-
-
-
--- a/embedding/browser/nsCTooltipTextProvider.h
+++ b/embedding/browser/nsCTooltipTextProvider.h
@@ -1,14 +1,14 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
 #ifndef NSCTOOLTIPTEXTPROVIDER_H
 #define NSCTOOLTIPTEXTPROVIDER_H
 
 #include "nsITooltipTextProvider.h"
 
 #define NS_TOOLTIPTEXTPROVIDER_CONTRACTID \
-	"@mozilla.org/embedcomp/tooltiptextprovider;1"
+  "@mozilla.org/embedcomp/tooltiptextprovider;1"
 
 #endif
--- a/embedding/browser/nsCommandHandler.cpp
+++ b/embedding/browser/nsCommandHandler.cpp
@@ -6,142 +6,139 @@
 
 #include "nsCommandHandler.h"
 #include "nsWebBrowser.h"
 #include "nsDocShellTreeOwner.h"
 
 #include "nsMemory.h"
 #include "nsPIDOMWindow.h"
 
-nsCommandHandler::nsCommandHandler() :
-    mWindow(nullptr)
+nsCommandHandler::nsCommandHandler()
+  : mWindow(nullptr)
 {
 }
 
 nsCommandHandler::~nsCommandHandler()
 {
 }
 
-nsresult nsCommandHandler::GetCommandHandler(nsICommandHandler **aCommandHandler)
+nsresult
+nsCommandHandler::GetCommandHandler(nsICommandHandler** aCommandHandler)
 {
-    NS_ENSURE_ARG_POINTER(aCommandHandler);
+  NS_ENSURE_ARG_POINTER(aCommandHandler);
+
+  *aCommandHandler = nullptr;
+  if (!mWindow) {
+    return NS_ERROR_FAILURE;
+  }
+
+  nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(mWindow));
+  if (!window) {
+    return NS_ERROR_FAILURE;
+  }
+
+  // Get the document tree owner
 
-    *aCommandHandler = nullptr;
-    if (mWindow == nullptr)
-    {
-        return NS_ERROR_FAILURE;
-    }
+  nsCOMPtr<nsIDocShellTreeItem> docShellAsTreeItem =
+    do_QueryInterface(window->GetDocShell());
+  nsIDocShellTreeOwner* treeOwner = nullptr;
+  docShellAsTreeItem->GetTreeOwner(&treeOwner);
+
+  // Make sure the tree owner is an an nsDocShellTreeOwner object
+  // by QI'ing for a hidden interface. If it doesn't have the interface
+  // then it's not safe to do the casting.
 
-    nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(mWindow));
-    if (!window)
-    {
-        return NS_ERROR_FAILURE;
+  nsCOMPtr<nsICDocShellTreeOwner> realTreeOwner(do_QueryInterface(treeOwner));
+  if (realTreeOwner) {
+    nsDocShellTreeOwner* tree = static_cast<nsDocShellTreeOwner*>(treeOwner);
+    if (tree->mTreeOwner) {
+      nsresult rv;
+      rv = tree->mTreeOwner->QueryInterface(NS_GET_IID(nsICommandHandler),
+                                            (void**)aCommandHandler);
+      NS_RELEASE(treeOwner);
+      return rv;
     }
 
-    // Get the document tree owner
-
-    nsCOMPtr<nsIDocShellTreeItem> docShellAsTreeItem =
-      do_QueryInterface(window->GetDocShell());
-    nsIDocShellTreeOwner *treeOwner = nullptr;
-    docShellAsTreeItem->GetTreeOwner(&treeOwner);
-
-    // Make sure the tree owner is an an nsDocShellTreeOwner object
-    // by QI'ing for a hidden interface. If it doesn't have the interface
-    // then it's not safe to do the casting.
+    NS_RELEASE(treeOwner);
+  }
 
-    nsCOMPtr<nsICDocShellTreeOwner> realTreeOwner(do_QueryInterface(treeOwner));
-    if (realTreeOwner)
-    {
-        nsDocShellTreeOwner *tree = static_cast<nsDocShellTreeOwner *>(treeOwner);
-        if (tree->mTreeOwner)
-        {
-            nsresult rv;
-            rv = tree->mTreeOwner->QueryInterface(NS_GET_IID(nsICommandHandler), (void **)aCommandHandler);
-            NS_RELEASE(treeOwner);
-            return rv;
-        }
-     
-        NS_RELEASE(treeOwner);
-     }
+  *aCommandHandler = nullptr;
 
-    *aCommandHandler = nullptr;
-
-    return NS_OK;
+  return NS_OK;
 }
 
-
 NS_IMPL_ADDREF(nsCommandHandler)
 NS_IMPL_RELEASE(nsCommandHandler)
 
 NS_INTERFACE_MAP_BEGIN(nsCommandHandler)
-    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsICommandHandler)
-    NS_INTERFACE_MAP_ENTRY(nsICommandHandlerInit)
-    NS_INTERFACE_MAP_ENTRY(nsICommandHandler)
+  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsICommandHandler)
+  NS_INTERFACE_MAP_ENTRY(nsICommandHandlerInit)
+  NS_INTERFACE_MAP_ENTRY(nsICommandHandler)
 NS_INTERFACE_MAP_END
 
 ///////////////////////////////////////////////////////////////////////////////
 // nsICommandHandlerInit implementation
 
-/* attribute nsIDocShell docShell; */
-NS_IMETHODIMP nsCommandHandler::GetWindow(nsIDOMWindow * *aWindow)
+NS_IMETHODIMP
+nsCommandHandler::GetWindow(nsIDOMWindow** aWindow)
 {
-    *aWindow = nullptr;
-    return NS_OK;
+  *aWindow = nullptr;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsCommandHandler::SetWindow(nsIDOMWindow * aWindow)
+NS_IMETHODIMP
+nsCommandHandler::SetWindow(nsIDOMWindow* aWindow)
 {
-    if (aWindow == nullptr)
-    {
-       return NS_ERROR_FAILURE;
-    }
-    mWindow = aWindow;
-    return NS_OK;
+  if (!aWindow) {
+    return NS_ERROR_FAILURE;
+  }
+  mWindow = aWindow;
+  return NS_OK;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 // nsICommandHandler implementation
 
-/* string exec (in string aCommand, in string aStatus); */
-NS_IMETHODIMP nsCommandHandler::Exec(const char *aCommand, const char *aStatus, char **aResult)
+NS_IMETHODIMP
+nsCommandHandler::Exec(const char* aCommand, const char* aStatus,
+                       char** aResult)
 {
-    NS_ENSURE_ARG_POINTER(aCommand);
-    NS_ENSURE_ARG_POINTER(aResult);
+  NS_ENSURE_ARG_POINTER(aCommand);
+  NS_ENSURE_ARG_POINTER(aResult);
 
-    nsCOMPtr<nsICommandHandler> commandHandler;
-    GetCommandHandler(getter_AddRefs(commandHandler));
+  nsCOMPtr<nsICommandHandler> commandHandler;
+  GetCommandHandler(getter_AddRefs(commandHandler));
 
-    // Call the client's command handler to deal with this command
-    if (commandHandler)
-    {
-        *aResult = nullptr;
-        return commandHandler->Exec(aCommand, aStatus, aResult);
-    }
+  // Call the client's command handler to deal with this command
+  if (commandHandler) {
+    *aResult = nullptr;
+    return commandHandler->Exec(aCommand, aStatus, aResult);
+  }
 
-    // Return an empty string
-    const char szEmpty[] = "";
-    *aResult = (char *) nsMemory::Clone(szEmpty, sizeof(szEmpty));
+  // Return an empty string
+  const char szEmpty[] = "";
+  *aResult = (char*)nsMemory::Clone(szEmpty, sizeof(szEmpty));
 
-    return NS_OK;
+  return NS_OK;
 }
 
-/* string query (in string aCommand, in string aStatus); */
-NS_IMETHODIMP nsCommandHandler::Query(const char *aCommand, const char *aStatus, char **aResult)
+NS_IMETHODIMP
+nsCommandHandler::Query(const char* aCommand, const char* aStatus,
+                        char** aResult)
 {
-    NS_ENSURE_ARG_POINTER(aCommand);
-    NS_ENSURE_ARG_POINTER(aResult);
+  NS_ENSURE_ARG_POINTER(aCommand);
+  NS_ENSURE_ARG_POINTER(aResult);
 
-    nsCOMPtr<nsICommandHandler> commandHandler;
-    GetCommandHandler(getter_AddRefs(commandHandler));
+  nsCOMPtr<nsICommandHandler> commandHandler;
+  GetCommandHandler(getter_AddRefs(commandHandler));
 
-    // Call the client's command handler to deal with this command
-    if (commandHandler)
-    {
-        *aResult = nullptr;
-        return commandHandler->Query(aCommand, aStatus, aResult);
-    }
+  // Call the client's command handler to deal with this command
+  if (commandHandler) {
+    *aResult = nullptr;
+    return commandHandler->Query(aCommand, aStatus, aResult);
+  }
 
-    // Return an empty string
-    const char szEmpty[] = "";
-    *aResult = (char *) nsMemory::Clone(szEmpty, sizeof(szEmpty));
+  // Return an empty string
+  const char szEmpty[] = "";
+  *aResult = (char*)nsMemory::Clone(szEmpty, sizeof(szEmpty));
 
-    return NS_OK;
+  return NS_OK;
 }
--- a/embedding/browser/nsCommandHandler.h
+++ b/embedding/browser/nsCommandHandler.h
@@ -6,29 +6,29 @@
 
 #ifndef NSCOMMANDHANDLER_H
 #define NSCOMMANDHANDLER_H
 
 #include "nsISupports.h"
 #include "nsICommandHandler.h"
 #include "nsIDOMWindow.h"
 
-class nsCommandHandler :
-    public nsICommandHandlerInit,
-    public nsICommandHandler
+class nsCommandHandler
+  : public nsICommandHandlerInit
+  , public nsICommandHandler
 {
-    nsIDOMWindow *mWindow;
+public:
+  nsCommandHandler();
 
-    nsresult GetCommandHandler(nsICommandHandler **aCommandHandler);
-
-public:
-    nsCommandHandler();
-
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSICOMMANDHANDLERINIT
-    NS_DECL_NSICOMMANDHANDLER
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSICOMMANDHANDLERINIT
+  NS_DECL_NSICOMMANDHANDLER
 
 protected:
-    virtual ~nsCommandHandler();
+  virtual ~nsCommandHandler();
+
+private:
+  nsresult GetCommandHandler(nsICommandHandler** aCommandHandler);
+
+  nsIDOMWindow* mWindow;
 };
 
 #endif
-
--- a/embedding/browser/nsContextMenuInfo.cpp
+++ b/embedding/browser/nsContextMenuInfo.cpp
@@ -23,220 +23,214 @@
 #include "nsUnicharUtils.h"
 #include "nsIDocument.h"
 #include "nsIPrincipal.h"
 #include "nsIContentSecurityPolicy.h"
 #include "nsIContentPolicy.h"
 #include "nsAutoPtr.h"
 #include "imgRequestProxy.h"
 
-
-//*****************************************************************************
-// class nsContextMenuInfo
-//*****************************************************************************
-
 NS_IMPL_ISUPPORTS(nsContextMenuInfo, nsIContextMenuInfo)
 
 nsContextMenuInfo::nsContextMenuInfo()
 {
 }
 
 nsContextMenuInfo::~nsContextMenuInfo()
 {
 }
 
-/* readonly attribute nsIDOMEvent mouseEvent; */
 NS_IMETHODIMP
-nsContextMenuInfo::GetMouseEvent(nsIDOMEvent **aEvent)
+nsContextMenuInfo::GetMouseEvent(nsIDOMEvent** aEvent)
 {
   NS_ENSURE_ARG_POINTER(aEvent);
   NS_IF_ADDREF(*aEvent = mMouseEvent);
   return NS_OK;
 }
 
-/* readonly attribute nsIDOMNode targetNode; */
 NS_IMETHODIMP
-nsContextMenuInfo::GetTargetNode(nsIDOMNode **aNode)
+nsContextMenuInfo::GetTargetNode(nsIDOMNode** aNode)
 {
   NS_ENSURE_ARG_POINTER(aNode);
   NS_IF_ADDREF(*aNode = mDOMNode);
   return NS_OK;
 }
 
-/* readonly attribute AString associatedLink; */
 NS_IMETHODIMP
 nsContextMenuInfo::GetAssociatedLink(nsAString& aHRef)
 {
   NS_ENSURE_STATE(mAssociatedLink);
   aHRef.Truncate(0);
-    
+
   nsCOMPtr<nsIDOMElement> content(do_QueryInterface(mAssociatedLink));
   nsAutoString localName;
-  if (content)
+  if (content) {
     content->GetLocalName(localName);
+  }
 
   nsCOMPtr<nsIDOMElement> linkContent;
   ToLowerCase(localName);
   if (localName.EqualsLiteral("a") ||
       localName.EqualsLiteral("area") ||
       localName.EqualsLiteral("link")) {
     bool hasAttr;
     content->HasAttribute(NS_LITERAL_STRING("href"), &hasAttr);
     if (hasAttr) {
       linkContent = content;
       nsCOMPtr<nsIDOMHTMLAnchorElement> anchor(do_QueryInterface(linkContent));
-      if (anchor)
+      if (anchor) {
         anchor->GetHref(aHRef);
-      else {
+      } else {
         nsCOMPtr<nsIDOMHTMLAreaElement> area(do_QueryInterface(linkContent));
-        if (area)
+        if (area) {
           area->GetHref(aHRef);
-        else {
+        } else {
           nsCOMPtr<nsIDOMHTMLLinkElement> link(do_QueryInterface(linkContent));
-          if (link)
+          if (link) {
             link->GetHref(aHRef);
+          }
         }
       }
     }
-  }
-  else {
+  } else {
     nsCOMPtr<nsIDOMNode> curr;
     mAssociatedLink->GetParentNode(getter_AddRefs(curr));
     while (curr) {
       content = do_QueryInterface(curr);
-      if (!content)
+      if (!content) {
         break;
+      }
       content->GetLocalName(localName);
       ToLowerCase(localName);
       if (localName.EqualsLiteral("a")) {
         bool hasAttr;
         content->HasAttribute(NS_LITERAL_STRING("href"), &hasAttr);
         if (hasAttr) {
           linkContent = content;
-          nsCOMPtr<nsIDOMHTMLAnchorElement> anchor(do_QueryInterface(linkContent));
-          if (anchor)
+          nsCOMPtr<nsIDOMHTMLAnchorElement> anchor(
+            do_QueryInterface(linkContent));
+          if (anchor) {
             anchor->GetHref(aHRef);
+          }
+        } else {
+          linkContent = nullptr; // Links can't be nested.
         }
-        else
-          linkContent = nullptr; // Links can't be nested.
         break;
       }
 
       nsCOMPtr<nsIDOMNode> temp = curr;
       temp->GetParentNode(getter_AddRefs(curr));
     }
   }
 
   return NS_OK;
 }
 
-/* readonly attribute imgIContainer imageContainer; */
 NS_IMETHODIMP
-nsContextMenuInfo::GetImageContainer(imgIContainer **aImageContainer)
+nsContextMenuInfo::GetImageContainer(imgIContainer** aImageContainer)
 {
   NS_ENSURE_ARG_POINTER(aImageContainer);
   NS_ENSURE_STATE(mDOMNode);
-  
+
   nsCOMPtr<imgIRequest> request;
   GetImageRequest(mDOMNode, getter_AddRefs(request));
-  if (request)
+  if (request) {
     return request->GetImage(aImageContainer);
+  }
 
   return NS_ERROR_FAILURE;
 }
 
-/* readonly attribute nsIURI imageSrc; */
 NS_IMETHODIMP
-nsContextMenuInfo::GetImageSrc(nsIURI **aURI)
+nsContextMenuInfo::GetImageSrc(nsIURI** aURI)
 {
   NS_ENSURE_ARG_POINTER(aURI);
   NS_ENSURE_STATE(mDOMNode);
-  
+
   nsCOMPtr<nsIImageLoadingContent> content(do_QueryInterface(mDOMNode));
   NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
   return content->GetCurrentURI(aURI);
 }
 
-/* readonly attribute imgIContainer backgroundImageContainer; */
 NS_IMETHODIMP
-nsContextMenuInfo::GetBackgroundImageContainer(imgIContainer **aImageContainer)
+nsContextMenuInfo::GetBackgroundImageContainer(imgIContainer** aImageContainer)
 {
   NS_ENSURE_ARG_POINTER(aImageContainer);
   NS_ENSURE_STATE(mDOMNode);
-  
+
   nsRefPtr<imgRequestProxy> request;
   GetBackgroundImageRequest(mDOMNode, getter_AddRefs(request));
-  if (request)
+  if (request) {
     return request->GetImage(aImageContainer);
+  }
 
   return NS_ERROR_FAILURE;
 }
 
-/* readonly attribute nsIURI backgroundImageSrc; */
 NS_IMETHODIMP
-nsContextMenuInfo::GetBackgroundImageSrc(nsIURI **aURI)
+nsContextMenuInfo::GetBackgroundImageSrc(nsIURI** aURI)
 {
   NS_ENSURE_ARG_POINTER(aURI);
   NS_ENSURE_STATE(mDOMNode);
-  
+
   nsRefPtr<imgRequestProxy> request;
   GetBackgroundImageRequest(mDOMNode, getter_AddRefs(request));
-  if (request)
+  if (request) {
     return request->GetURI(aURI);
+  }
 
   return NS_ERROR_FAILURE;
 }
 
-//*****************************************************************************
-
 nsresult
-nsContextMenuInfo::GetImageRequest(nsIDOMNode *aDOMNode, imgIRequest **aRequest)
+nsContextMenuInfo::GetImageRequest(nsIDOMNode* aDOMNode, imgIRequest** aRequest)
 {
   NS_ENSURE_ARG(aDOMNode);
   NS_ENSURE_ARG_POINTER(aRequest);
 
   // Get content
   nsCOMPtr<nsIImageLoadingContent> content(do_QueryInterface(aDOMNode));
   NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
 
-  return content->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,
-                             aRequest);
+  return content->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST, aRequest);
 }
 
 bool
-nsContextMenuInfo::HasBackgroundImage(nsIDOMNode * aDOMNode)
+nsContextMenuInfo::HasBackgroundImage(nsIDOMNode* aDOMNode)
 {
   NS_ENSURE_TRUE(aDOMNode, false);
 
   nsRefPtr<imgRequestProxy> request;
   GetBackgroundImageRequest(aDOMNode, getter_AddRefs(request));
-  
+
   return (request != nullptr);
 }
 
 nsresult
-nsContextMenuInfo::GetBackgroundImageRequest(nsIDOMNode *aDOMNode, imgRequestProxy **aRequest)
+nsContextMenuInfo::GetBackgroundImageRequest(nsIDOMNode* aDOMNode,
+                                             imgRequestProxy** aRequest)
 {
 
   NS_ENSURE_ARG(aDOMNode);
   NS_ENSURE_ARG_POINTER(aRequest);
 
   nsCOMPtr<nsIDOMNode> domNode = aDOMNode;
 
   // special case for the <html> element: if it has no background-image
   // we'll defer to <body>
   nsCOMPtr<nsIDOMHTMLHtmlElement> htmlElement = do_QueryInterface(domNode);
   if (htmlElement) {
     nsCOMPtr<nsIDOMHTMLElement> element = do_QueryInterface(domNode);
     nsAutoString nameSpace;
     element->GetNamespaceURI(nameSpace);
     if (nameSpace.IsEmpty()) {
       nsresult rv = GetBackgroundImageRequestInternal(domNode, aRequest);
-      if (NS_SUCCEEDED(rv) && *aRequest)
+      if (NS_SUCCEEDED(rv) && *aRequest) {
         return NS_OK;
+      }
 
       // no background-image found
       nsCOMPtr<nsIDOMDocument> document;
       domNode->GetOwnerDocument(getter_AddRefs(document));
       nsCOMPtr<nsIDOMHTMLDocument> htmlDocument(do_QueryInterface(document));
       NS_ENSURE_TRUE(htmlDocument, NS_ERROR_FAILURE);
 
       nsCOMPtr<nsIDOMHTMLElement> body;
@@ -244,17 +238,18 @@ nsContextMenuInfo::GetBackgroundImageReq
       domNode = do_QueryInterface(body);
       NS_ENSURE_TRUE(domNode, NS_ERROR_FAILURE);
     }
   }
   return GetBackgroundImageRequestInternal(domNode, aRequest);
 }
 
 nsresult
-nsContextMenuInfo::GetBackgroundImageRequestInternal(nsIDOMNode *aDOMNode, imgRequestProxy **aRequest)
+nsContextMenuInfo::GetBackgroundImageRequestInternal(nsIDOMNode* aDOMNode,
+                                                     imgRequestProxy** aRequest)
 {
   NS_ENSURE_ARG_POINTER(aDOMNode);
 
   nsCOMPtr<nsIDOMNode> domNode = aDOMNode;
   nsCOMPtr<nsIDOMNode> parentNode;
 
   nsCOMPtr<nsIDOMDocument> document;
   domNode->GetOwnerDocument(getter_AddRefs(document));
@@ -268,18 +263,19 @@ nsContextMenuInfo::GetBackgroundImageReq
   nsAutoString bgStringValue;
 
   nsCOMPtr<nsIDocument> doc(do_QueryInterface(document));
   nsCOMPtr<nsIPrincipal> principal = doc ? doc->NodePrincipal() : nullptr;
 
   while (true) {
     nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(domNode));
     // bail for the parent node of the root element or null argument
-    if (!domElement)
+    if (!domElement) {
       break;
+    }
 
     nsCOMPtr<nsIDOMCSSStyleDeclaration> computedStyle;
     window->GetComputedStyle(domElement, EmptyString(),
                              getter_AddRefs(computedStyle));
     if (computedStyle) {
       nsCOMPtr<nsIDOMCSSValue> cssValue;
       computedStyle->GetPropertyCSSValue(NS_LITERAL_STRING("background-image"),
                                          getter_AddRefs(cssValue));
@@ -303,18 +299,19 @@ nsContextMenuInfo::GetBackgroundImageReq
       }
 
       // bail if we encounter non-transparent background-color
       computedStyle->GetPropertyCSSValue(NS_LITERAL_STRING("background-color"),
                                          getter_AddRefs(cssValue));
       primitiveValue = do_QueryInterface(cssValue);
       if (primitiveValue) {
         primitiveValue->GetStringValue(bgStringValue);
-        if (!bgStringValue.EqualsLiteral("transparent"))
+        if (!bgStringValue.EqualsLiteral("transparent")) {
           return NS_ERROR_FAILURE;
+        }
       }
     }
 
     domNode->GetParentNode(getter_AddRefs(parentNode));
     domNode = parentNode;
   }
 
   return NS_ERROR_FAILURE;
--- a/embedding/browser/nsContextMenuInfo.h
+++ b/embedding/browser/nsContextMenuInfo.h
@@ -12,56 +12,43 @@
 #include "nsIDOMNode.h"
 #include "nsIDOMEvent.h"
 #include "imgIContainer.h"
 #include "imgIRequest.h"
 
 class ChromeContextMenuListener;
 class imgRequestProxy;
 
-//*****************************************************************************
-// class nsContextMenuInfo
-//
 // Helper class for implementors of nsIContextMenuListener2
-//*****************************************************************************
- 
 class nsContextMenuInfo : public nsIContextMenuInfo
 {
   friend class ChromeContextMenuListener;
-  
-public:    
-                    nsContextMenuInfo();
+
+public:
+  nsContextMenuInfo();
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSICONTEXTMENUINFO
-  
+
 private:
-  virtual           ~nsContextMenuInfo();
-
-  void              SetMouseEvent(nsIDOMEvent *aEvent)
-                    { mMouseEvent = aEvent; }
+  virtual ~nsContextMenuInfo();
 
-  void              SetDOMNode(nsIDOMNode *aNode)
-                    { mDOMNode = aNode; }
-                    
-  void              SetAssociatedLink(nsIDOMNode *aLink)
-                    { mAssociatedLink = aLink; }
+  void SetMouseEvent(nsIDOMEvent* aEvent) { mMouseEvent = aEvent; }
+  void SetDOMNode(nsIDOMNode* aNode) { mDOMNode = aNode; }
+  void SetAssociatedLink(nsIDOMNode* aLink) { mAssociatedLink = aLink; }
 
-  nsresult          GetImageRequest(nsIDOMNode *aDOMNode,
-                                    imgIRequest **aRequest);
+  nsresult GetImageRequest(nsIDOMNode* aDOMNode, imgIRequest** aRequest);
+
+  bool HasBackgroundImage(nsIDOMNode* aDOMNode);
 
-  bool              HasBackgroundImage(nsIDOMNode *aDOMNode);
+  nsresult GetBackgroundImageRequest(nsIDOMNode* aDOMNode,
+                                     imgRequestProxy** aRequest);
 
-  nsresult          GetBackgroundImageRequest(nsIDOMNode *aDOMNode,
-                                              imgRequestProxy **aRequest);
+  nsresult GetBackgroundImageRequestInternal(nsIDOMNode* aDOMNode,
+                                             imgRequestProxy** aRequest);
 
-  nsresult          GetBackgroundImageRequestInternal(nsIDOMNode *aDOMNode,
-                                                      imgRequestProxy **aRequest);
-  
 private:
-  nsCOMPtr<nsIDOMEvent>   mMouseEvent;
-  nsCOMPtr<nsIDOMNode>    mDOMNode;  
-  nsCOMPtr<nsIDOMNode>    mAssociatedLink;
-
-}; // class nsContextMenuInfo
-
+  nsCOMPtr<nsIDOMEvent> mMouseEvent;
+  nsCOMPtr<nsIDOMNode> mDOMNode;
+  nsCOMPtr<nsIDOMNode> mAssociatedLink;
+};
 
 #endif // nsContextMenuInfo_h__
--- a/embedding/browser/nsDocShellTreeOwner.cpp
+++ b/embedding/browser/nsDocShellTreeOwner.cpp
@@ -65,96 +65,84 @@
 #include "nsIConstraintValidation.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
-//
-// GetEventReceiver
-//
 // A helper routine that navigates the tricky path from a |nsWebBrowser| to
 // a |EventTarget| via the window root and chrome event handler.
-//
 static nsresult
-GetDOMEventTarget(nsWebBrowser* inBrowser, EventTarget** aTarget)
+GetDOMEventTarget(nsWebBrowser* aInBrowser, EventTarget** aTarget)
 {
-  NS_ENSURE_ARG_POINTER(inBrowser);
+  NS_ENSURE_ARG_POINTER(aInBrowser);
 
   nsCOMPtr<nsIDOMWindow> domWindow;
-  inBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
+  aInBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
   NS_ENSURE_TRUE(domWindow, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsPIDOMWindow> domWindowPrivate = do_QueryInterface(domWindow);
   NS_ENSURE_TRUE(domWindowPrivate, NS_ERROR_FAILURE);
-  nsPIDOMWindow *rootWindow = domWindowPrivate->GetPrivateRoot();
+  nsPIDOMWindow* rootWindow = domWindowPrivate->GetPrivateRoot();
   NS_ENSURE_TRUE(rootWindow, NS_ERROR_FAILURE);
-  nsCOMPtr<EventTarget> target =
-    rootWindow->GetChromeEventHandler();
+  nsCOMPtr<EventTarget> target = rootWindow->GetChromeEventHandler();
   NS_ENSURE_TRUE(target, NS_ERROR_FAILURE);
   target.forget(aTarget);
 
   return NS_OK;
 }
 
-
-//*****************************************************************************
-//***    nsDocShellTreeOwner: Object Management
-//*****************************************************************************
-
-nsDocShellTreeOwner::nsDocShellTreeOwner() :
-   mWebBrowser(nullptr),
-   mTreeOwner(nullptr),
-   mPrimaryContentShell(nullptr),
-   mWebBrowserChrome(nullptr),
-   mOwnerWin(nullptr),
-   mOwnerRequestor(nullptr)
+nsDocShellTreeOwner::nsDocShellTreeOwner()
+  : mWebBrowser(nullptr)
+  , mTreeOwner(nullptr)
+  , mPrimaryContentShell(nullptr)
+  , mWebBrowserChrome(nullptr)
+  , mOwnerWin(nullptr)
+  , mOwnerRequestor(nullptr)
 {
 }
 
 nsDocShellTreeOwner::~nsDocShellTreeOwner()
 {
   RemoveChromeListeners();
 }
 
-//*****************************************************************************
-// nsDocShellTreeOwner::nsISupports
-//*****************************************************************************
-
 NS_IMPL_ADDREF(nsDocShellTreeOwner)
 NS_IMPL_RELEASE(nsDocShellTreeOwner)
 
 NS_INTERFACE_MAP_BEGIN(nsDocShellTreeOwner)
-    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDocShellTreeOwner)
-    NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeOwner)
-    NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
-    NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
-    NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
-    NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
-    NS_INTERFACE_MAP_ENTRY(nsICDocShellTreeOwner)
-    NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
+  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDocShellTreeOwner)
+  NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeOwner)
+  NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
+  NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
+  NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
+  NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
+  NS_INTERFACE_MAP_ENTRY(nsICDocShellTreeOwner)
+  NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
 NS_INTERFACE_MAP_END
 
 //*****************************************************************************
 // nsDocShellTreeOwner::nsIInterfaceRequestor
 //*****************************************************************************
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::GetInterface(const nsIID& aIID, void** aSink)
 {
   NS_ENSURE_ARG_POINTER(aSink);
 
-  if (NS_SUCCEEDED(QueryInterface(aIID, aSink)))
+  if (NS_SUCCEEDED(QueryInterface(aIID, aSink))) {
     return NS_OK;
+  }
 
   if (aIID.Equals(NS_GET_IID(nsIWebBrowserChromeFocus))) {
-    if (mWebBrowserChromeWeak != nullptr)
+    if (mWebBrowserChromeWeak != nullptr) {
       return mWebBrowserChromeWeak->QueryReferent(aIID, aSink);
+    }
     return mOwnerWin->QueryInterface(aIID, aSink);
   }
 
   if (aIID.Equals(NS_GET_IID(nsIPrompt))) {
     nsCOMPtr<nsIPrompt> prompt;
     EnsurePrompter();
     prompt = mPrompter;
     if (prompt) {
@@ -171,47 +159,53 @@ nsDocShellTreeOwner::GetInterface(const 
     if (prompt) {
       prompt.forget(aSink);
       return NS_OK;
     }
     return NS_NOINTERFACE;
   }
 
   nsCOMPtr<nsIInterfaceRequestor> req = GetOwnerRequestor();
-  if (req)
+  if (req) {
     return req->GetInterface(aIID, aSink);
+  }
 
   return NS_NOINTERFACE;
 }
 
 //*****************************************************************************
 // nsDocShellTreeOwner::nsIDocShellTreeOwner
 //*****************************************************************************
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::FindItemWithName(const char16_t* aName,
                                       nsIDocShellTreeItem* aRequestor,
                                       nsIDocShellTreeItem* aOriginalRequestor,
                                       nsIDocShellTreeItem** aFoundItem)
 {
   NS_ENSURE_ARG(aName);
   NS_ENSURE_ARG_POINTER(aFoundItem);
-  *aFoundItem = nullptr; // if we don't find one, we return NS_OK and a null result
+
+  // if we don't find one, we return NS_OK and a null result
+  *aFoundItem = nullptr;
   nsresult rv;
 
   nsAutoString name(aName);
 
-  if (!mWebBrowser)
+  if (!mWebBrowser) {
     return NS_OK; // stymied
+  }
 
   /* special cases */
-  if (name.IsEmpty())
+  if (name.IsEmpty()) {
     return NS_OK;
-  if (name.LowerCaseEqualsLiteral("_blank"))
+  }
+  if (name.LowerCaseEqualsLiteral("_blank")) {
     return NS_OK;
+  }
   // _main is an IE target which should be case-insensitive but isn't
   // see bug 217886 for details
   // XXXbz what if our browser isn't targetable?  We need to handle that somehow.
   if (name.LowerCaseEqualsLiteral("_content") || name.EqualsLiteral("_main")) {
     nsCOMPtr<nsIDocShell> foundItem = mWebBrowser->mDocShell;
     foundItem.forget(aFoundItem);
     return NS_OK;
   }
@@ -236,181 +230,197 @@ nsDocShellTreeOwner::FindItemWithName(co
   }
 
   // finally, failing everything else, search all windows
   return FindItemWithNameAcrossWindows(aName, aRequestor, aOriginalRequestor,
                                        aFoundItem);
 }
 
 nsresult
-nsDocShellTreeOwner::FindItemWithNameAcrossWindows(const char16_t* aName,
-                                                   nsIDocShellTreeItem* aRequestor,
-                                                   nsIDocShellTreeItem* aOriginalRequestor,
-                                                   nsIDocShellTreeItem** aFoundItem)
+nsDocShellTreeOwner::FindItemWithNameAcrossWindows(
+    const char16_t* aName,
+    nsIDocShellTreeItem* aRequestor,
+    nsIDocShellTreeItem* aOriginalRequestor,
+    nsIDocShellTreeItem** aFoundItem)
 {
   // search for the item across the list of top-level windows
   nsCOMPtr<nsPIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
-  if (!wwatch)
+  if (!wwatch) {
     return NS_OK;
+  }
 
   return wwatch->FindItemWithName(aName, aRequestor, aOriginalRequestor,
                                   aFoundItem);
 }
 
 void
 nsDocShellTreeOwner::EnsurePrompter()
 {
-  if (mPrompter)
+  if (mPrompter) {
     return;
+  }
 
   nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
   if (wwatch && mWebBrowser) {
     nsCOMPtr<nsIDOMWindow> domWindow;
     mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
-    if (domWindow)
+    if (domWindow) {
       wwatch->GetNewPrompter(domWindow, getter_AddRefs(mPrompter));
+    }
   }
 }
 
 void
 nsDocShellTreeOwner::EnsureAuthPrompter()
 {
-  if (mAuthPrompter)
+  if (mAuthPrompter) {
     return;
+  }
 
   nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
   if (wwatch && mWebBrowser) {
     nsCOMPtr<nsIDOMWindow> domWindow;
     mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
-    if (domWindow)
+    if (domWindow) {
       wwatch->GetNewAuthPrompter(domWindow, getter_AddRefs(mAuthPrompter));
+    }
   }
 }
 
 void
 nsDocShellTreeOwner::AddToWatcher()
 {
   if (mWebBrowser) {
     nsCOMPtr<nsIDOMWindow> domWindow;
     mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
     if (domWindow) {
-      nsCOMPtr<nsPIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
+      nsCOMPtr<nsPIWindowWatcher> wwatch(
+        do_GetService(NS_WINDOWWATCHER_CONTRACTID));
       if (wwatch) {
         nsCOMPtr<nsIWebBrowserChrome> webBrowserChrome = GetWebBrowserChrome();
-        if (webBrowserChrome)
+        if (webBrowserChrome) {
           wwatch->AddWindow(domWindow, webBrowserChrome);
+        }
       }
     }
   }
 }
 
 void
 nsDocShellTreeOwner::RemoveFromWatcher()
 {
   if (mWebBrowser) {
     nsCOMPtr<nsIDOMWindow> domWindow;
     mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
     if (domWindow) {
-      nsCOMPtr<nsPIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
-      if (wwatch)
+      nsCOMPtr<nsPIWindowWatcher> wwatch(
+        do_GetService(NS_WINDOWWATCHER_CONTRACTID));
+      if (wwatch) {
         wwatch->RemoveWindow(domWindow);
+      }
     }
   }
 }
 
-
 NS_IMETHODIMP
 nsDocShellTreeOwner::ContentShellAdded(nsIDocShellTreeItem* aContentShell,
                                        bool aPrimary, bool aTargetable,
                                        const nsAString& aID)
 {
-   if (mTreeOwner)
-      return mTreeOwner->ContentShellAdded(aContentShell, aPrimary,
-                                           aTargetable, aID);
+  if (mTreeOwner)
+    return mTreeOwner->ContentShellAdded(aContentShell, aPrimary, aTargetable,
+                                         aID);
 
-   if (aPrimary)
-      mPrimaryContentShell = aContentShell;
-   return NS_OK;
+  if (aPrimary) {
+    mPrimaryContentShell = aContentShell;
+  }
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::ContentShellRemoved(nsIDocShellTreeItem* aContentShell)
 {
-  if (mTreeOwner)
+  if (mTreeOwner) {
     return mTreeOwner->ContentShellRemoved(aContentShell);
+  }
 
-  if (mPrimaryContentShell == aContentShell)
+  if (mPrimaryContentShell == aContentShell) {
     mPrimaryContentShell = nullptr;
+  }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::GetPrimaryContentShell(nsIDocShellTreeItem** aShell)
 {
-   NS_ENSURE_ARG_POINTER(aShell);
+  NS_ENSURE_ARG_POINTER(aShell);
 
-   if (mTreeOwner)
-       return mTreeOwner->GetPrimaryContentShell(aShell);
+  if (mTreeOwner) {
+    return mTreeOwner->GetPrimaryContentShell(aShell);
+  }
 
-   nsCOMPtr<nsIDocShellTreeItem> shell;
-   shell = (mPrimaryContentShell ? mPrimaryContentShell : mWebBrowser->mDocShell);
-   shell.forget(aShell);
+  nsCOMPtr<nsIDocShellTreeItem> shell;
+  shell = mPrimaryContentShell ? mPrimaryContentShell : mWebBrowser->mDocShell;
+  shell.forget(aShell);
 
-   return NS_OK;
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem,
                                  int32_t aCX, int32_t aCY)
 {
-   nsCOMPtr<nsIWebBrowserChrome> webBrowserChrome = GetWebBrowserChrome();
+  nsCOMPtr<nsIWebBrowserChrome> webBrowserChrome = GetWebBrowserChrome();
 
-   NS_ENSURE_STATE(mTreeOwner || webBrowserChrome);
+  NS_ENSURE_STATE(mTreeOwner || webBrowserChrome);
 
-   if (mTreeOwner)
-      return mTreeOwner->SizeShellTo(aShellItem, aCX, aCY);
-
-   if (aShellItem == mWebBrowser->mDocShell)
-      return webBrowserChrome->SizeBrowserTo(aCX, aCY);
+  if (mTreeOwner) {
+    return mTreeOwner->SizeShellTo(aShellItem, aCX, aCY);
+  }
 
-   nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(aShellItem));
-   NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
+  if (aShellItem == mWebBrowser->mDocShell) {
+    return webBrowserChrome->SizeBrowserTo(aCX, aCY);
+  }
+
+  nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(aShellItem));
+  NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
 
-   nsCOMPtr<nsIDOMDocument> domDocument;
-   webNav->GetDocument(getter_AddRefs(domDocument));
-   NS_ENSURE_TRUE(domDocument, NS_ERROR_FAILURE);
+  nsCOMPtr<nsIDOMDocument> domDocument;
+  webNav->GetDocument(getter_AddRefs(domDocument));
+  NS_ENSURE_TRUE(domDocument, NS_ERROR_FAILURE);
 
-   nsCOMPtr<nsIDOMElement> domElement;
-   domDocument->GetDocumentElement(getter_AddRefs(domElement));
-   NS_ENSURE_TRUE(domElement, NS_ERROR_FAILURE);
+  nsCOMPtr<nsIDOMElement> domElement;
+  domDocument->GetDocumentElement(getter_AddRefs(domElement));
+  NS_ENSURE_TRUE(domElement, NS_ERROR_FAILURE);
 
-   // Set the preferred Size
-   //XXX
-   NS_ERROR("Implement this");
-   /*
-   Set the preferred size on the aShellItem.
-   */
+  // Set the preferred Size
+  //XXX
+  NS_ERROR("Implement this");
+  /*
+  Set the preferred size on the aShellItem.
+  */
 
-   nsRefPtr<nsPresContext> presContext;
-   mWebBrowser->mDocShell->GetPresContext(getter_AddRefs(presContext));
-   NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
+  nsRefPtr<nsPresContext> presContext;
+  mWebBrowser->mDocShell->GetPresContext(getter_AddRefs(presContext));
+  NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
 
-   nsIPresShell *presShell = presContext->GetPresShell();
-   NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
+  nsIPresShell* presShell = presContext->GetPresShell();
+  NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
 
-   NS_ENSURE_SUCCESS(presShell->ResizeReflow(NS_UNCONSTRAINEDSIZE,
-      NS_UNCONSTRAINEDSIZE), NS_ERROR_FAILURE);
+  NS_ENSURE_SUCCESS(
+    presShell->ResizeReflow(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE),
+    NS_ERROR_FAILURE);
 
-   nsRect shellArea = presContext->GetVisibleArea();
+  nsRect shellArea = presContext->GetVisibleArea();
 
-   int32_t browserCX = presContext->AppUnitsToDevPixels(shellArea.width);
-   int32_t browserCY = presContext->AppUnitsToDevPixels(shellArea.height);
+  int32_t browserCX = presContext->AppUnitsToDevPixels(shellArea.width);
+  int32_t browserCY = presContext->AppUnitsToDevPixels(shellArea.height);
 
-   return webBrowserChrome->SizeBrowserTo(browserCX, browserCY);
+  return webBrowserChrome->SizeBrowserTo(browserCX, browserCY);
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::SetPersistence(bool aPersistPosition,
                                     bool aPersistSize,
                                     bool aPersistSizeMode)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
@@ -435,17 +445,16 @@ nsDocShellTreeOwner::GetTargetableShellC
 
   return NS_OK;
 }
 
 //*****************************************************************************
 // nsDocShellTreeOwner::nsIBaseWindow
 //*****************************************************************************
 
-
 NS_IMETHODIMP
 nsDocShellTreeOwner::InitWindow(nativeWindow aParentNativeWindow,
                                 nsIWidget* aParentWidget, int32_t aX,
                                 int32_t aY, int32_t aCX, int32_t aCY)
 {
   return NS_ERROR_NULL_POINTER;
 }
 
@@ -454,107 +463,102 @@ nsDocShellTreeOwner::Create()
 {
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::Destroy()
 {
   nsCOMPtr<nsIWebBrowserChrome> webBrowserChrome = GetWebBrowserChrome();
-  if (webBrowserChrome)
-  {
+  if (webBrowserChrome) {
     return webBrowserChrome->DestroyBrowserWindow();
   }
 
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
-nsDocShellTreeOwner::GetUnscaledDevicePixelsPerCSSPixel(double *aScale)
+nsDocShellTreeOwner::GetUnscaledDevicePixelsPerCSSPixel(double* aScale)
 {
   if (mWebBrowser) {
     return mWebBrowser->GetUnscaledDevicePixelsPerCSSPixel(aScale);
   }
 
   *aScale = 1.0;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::SetPosition(int32_t aX, int32_t aY)
 {
   nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin = GetOwnerWin();
-  if (ownerWin)
-  {
+  if (ownerWin) {
     return ownerWin->SetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION,
                                    aX, aY, 0, 0);
   }
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::GetPosition(int32_t* aX, int32_t* aY)
 {
   nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin = GetOwnerWin();
-  if (ownerWin)
-  {
+  if (ownerWin) {
     return ownerWin->GetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION,
                                    aX, aY, nullptr, nullptr);
   }
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::SetSize(int32_t aCX, int32_t aCY, bool aRepaint)
 {
   nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin = GetOwnerWin();
-  if (ownerWin)
-  {
+  if (ownerWin) {
     return ownerWin->SetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER,
                                    0, 0, aCX, aCY);
   }
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::GetSize(int32_t* aCX, int32_t* aCY)
 {
   nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin = GetOwnerWin();
-  if (ownerWin)
-  {
+  if (ownerWin) {
     return ownerWin->GetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER,
                                    nullptr, nullptr, aCX, aCY);
   }
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::SetPositionAndSize(int32_t aX, int32_t aY, int32_t aCX,
                                         int32_t aCY, bool aRepaint)
 {
   nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin = GetOwnerWin();
-  if (ownerWin)
-  {
-    return ownerWin->SetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER |
-                                   nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION,
-                                   aX, aY, aCX, aCY);
+  if (ownerWin) {
+    return ownerWin->SetDimensions(
+      nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER |
+        nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION,
+      aX, aY, aCX, aCY);
   }
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::GetPositionAndSize(int32_t* aX, int32_t* aY, int32_t* aCX,
                                         int32_t* aCY)
 {
   nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin = GetOwnerWin();
-  if (ownerWin)
-  {
-    return ownerWin->GetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER |
-                                   nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION,
-                                   aX, aY, aCX, aCY);
+  if (ownerWin) {
+    return ownerWin->GetDimensions(
+      nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER |
+        nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION,
+      aX, aY, aCX, aCY);
   }
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::Repaint(bool aForce)
 {
   return NS_ERROR_NULL_POINTER;
@@ -571,18 +575,17 @@ nsDocShellTreeOwner::SetParentWidget(nsI
 {
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::GetParentNativeWindow(nativeWindow* aParentNativeWindow)
 {
   nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin = GetOwnerWin();
-  if (ownerWin)
-  {
+  if (ownerWin) {
     return ownerWin->GetSiteWindow(aParentNativeWindow);
   }
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::SetParentNativeWindow(nativeWindow aParentNativeWindow)
 {
@@ -595,250 +598,239 @@ nsDocShellTreeOwner::GetNativeHandle(nsA
   // the nativeHandle should be accessed from nsIXULWindow
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::GetVisibility(bool* aVisibility)
 {
   nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin = GetOwnerWin();
-  if (ownerWin)
-  {
+  if (ownerWin) {
     return ownerWin->GetVisibility(aVisibility);
   }
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::SetVisibility(bool aVisibility)
 {
   nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin = GetOwnerWin();
-  if (ownerWin)
-  {
+  if (ownerWin) {
     return ownerWin->SetVisibility(aVisibility);
   }
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
-nsDocShellTreeOwner::GetEnabled(bool *aEnabled)
+nsDocShellTreeOwner::GetEnabled(bool* aEnabled)
 {
   NS_ENSURE_ARG_POINTER(aEnabled);
   *aEnabled = true;
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::SetEnabled(bool aEnabled)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::GetMainWidget(nsIWidget** aMainWidget)
 {
-    return NS_ERROR_NULL_POINTER;
+  return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::SetFocus()
 {
   nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin = GetOwnerWin();
-  if (ownerWin)
-  {
+  if (ownerWin) {
     return ownerWin->SetFocus();
   }
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::GetTitle(char16_t** aTitle)
 {
   nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin = GetOwnerWin();
-  if (ownerWin)
-  {
+  if (ownerWin) {
     return ownerWin->GetTitle(aTitle);
   }
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::SetTitle(const char16_t* aTitle)
 {
   nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin = GetOwnerWin();
-  if (ownerWin)
-  {
+  if (ownerWin) {
     return ownerWin->SetTitle(aTitle);
   }
   return NS_ERROR_NULL_POINTER;
 }
 
-
 //*****************************************************************************
 // nsDocShellTreeOwner::nsIWebProgressListener
 //*****************************************************************************
 
-
 NS_IMETHODIMP
 nsDocShellTreeOwner::OnProgressChange(nsIWebProgress* aProgress,
                                       nsIRequest* aRequest,
                                       int32_t aCurSelfProgress,
                                       int32_t aMaxSelfProgress,
                                       int32_t aCurTotalProgress,
                                       int32_t aMaxTotalProgress)
 {
-    // In the absence of DOM document creation event, this method is the
-    // most convenient place to install the mouse listener on the
-    // DOM document.
-    return AddChromeListeners();
+  // In the absence of DOM document creation event, this method is the
+  // most convenient place to install the mouse listener on the
+  // DOM document.
+  return AddChromeListeners();
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::OnStateChange(nsIWebProgress* aProgress,
                                    nsIRequest* aRequest,
                                    uint32_t aProgressStateFlags,
                                    nsresult aStatus)
 {
-    return NS_OK;
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::OnLocationChange(nsIWebProgress* aWebProgress,
                                       nsIRequest* aRequest,
                                       nsIURI* aURI,
                                       uint32_t aFlags)
 {
-    return NS_OK;
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::OnStatusChange(nsIWebProgress* aWebProgress,
                                     nsIRequest* aRequest,
                                     nsresult aStatus,
                                     const char16_t* aMessage)
 {
-    return NS_OK;
+  return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocShellTreeOwner::OnSecurityChange(nsIWebProgress *aWebProgress,
-                                      nsIRequest *aRequest,
-                                      uint32_t state)
+nsDocShellTreeOwner::OnSecurityChange(nsIWebProgress* aWebProgress,
+                                      nsIRequest* aRequest,
+                                      uint32_t aState)
 {
-    return NS_OK;
+  return NS_OK;
 }
 
-
-//*****************************************************************************
-// nsDocShellTreeOwner: Helpers
-//*****************************************************************************
-
 //*****************************************************************************
 // nsDocShellTreeOwner: Accessors
 //*****************************************************************************
 
 void
 nsDocShellTreeOwner::WebBrowser(nsWebBrowser* aWebBrowser)
 {
-  if (!aWebBrowser)
+  if (!aWebBrowser) {
     RemoveChromeListeners();
+  }
   if (aWebBrowser != mWebBrowser) {
     mPrompter = nullptr;
     mAuthPrompter = nullptr;
   }
 
   mWebBrowser = aWebBrowser;
 }
 
-nsWebBrowser *
+nsWebBrowser*
 nsDocShellTreeOwner::WebBrowser()
 {
-   return mWebBrowser;
+  return mWebBrowser;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::SetTreeOwner(nsIDocShellTreeOwner* aTreeOwner)
 {
   if (aTreeOwner) {
     nsCOMPtr<nsIWebBrowserChrome> webBrowserChrome(do_GetInterface(aTreeOwner));
     NS_ENSURE_TRUE(webBrowserChrome, NS_ERROR_INVALID_ARG);
-    NS_ENSURE_SUCCESS(SetWebBrowserChrome(webBrowserChrome), NS_ERROR_INVALID_ARG);
+    NS_ENSURE_SUCCESS(SetWebBrowserChrome(webBrowserChrome),
+                      NS_ERROR_INVALID_ARG);
     mTreeOwner = aTreeOwner;
   } else {
     mTreeOwner = nullptr;
     nsCOMPtr<nsIWebBrowserChrome> webBrowserChrome = GetWebBrowserChrome();
-    if (!webBrowserChrome)
+    if (!webBrowserChrome) {
       NS_ENSURE_SUCCESS(SetWebBrowserChrome(nullptr), NS_ERROR_FAILURE);
+    }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::SetWebBrowserChrome(nsIWebBrowserChrome* aWebBrowserChrome)
 {
   if (!aWebBrowserChrome) {
     mWebBrowserChrome = nullptr;
     mOwnerWin = nullptr;
     mOwnerRequestor = nullptr;
     mWebBrowserChromeWeak = nullptr;
   } else {
     nsCOMPtr<nsISupportsWeakReference> supportsweak =
-                                           do_QueryInterface(aWebBrowserChrome);
+      do_QueryInterface(aWebBrowserChrome);
     if (supportsweak) {
       supportsweak->GetWeakReference(getter_AddRefs(mWebBrowserChromeWeak));
     } else {
-      nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin(do_QueryInterface(aWebBrowserChrome));
-      nsCOMPtr<nsIInterfaceRequestor> requestor(do_QueryInterface(aWebBrowserChrome));
+      nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin(
+        do_QueryInterface(aWebBrowserChrome));
+      nsCOMPtr<nsIInterfaceRequestor> requestor(
+        do_QueryInterface(aWebBrowserChrome));
 
       // it's ok for ownerWin or requestor to be null.
       mWebBrowserChrome = aWebBrowserChrome;
       mOwnerWin = ownerWin;
       mOwnerRequestor = requestor;
     }
   }
   return NS_OK;
 }
 
-
-//
-// AddChromeListeners
-//
 // Hook up things to the chrome like context menus and tooltips, if the chrome
 // has implemented the right interfaces.
-//
 NS_IMETHODIMP
 nsDocShellTreeOwner::AddChromeListeners()
 {
   nsresult rv = NS_OK;
 
   nsCOMPtr<nsIWebBrowserChrome> webBrowserChrome = GetWebBrowserChrome();
-  if (!webBrowserChrome)
+  if (!webBrowserChrome) {
     return NS_ERROR_FAILURE;
+  }
 
   // install tooltips
   if (!mChromeTooltipListener) {
-    nsCOMPtr<nsITooltipListener>
-                           tooltipListener(do_QueryInterface(webBrowserChrome));
+    nsCOMPtr<nsITooltipListener> tooltipListener(
+      do_QueryInterface(webBrowserChrome));
     if (tooltipListener) {
       mChromeTooltipListener = new ChromeTooltipListener(mWebBrowser,
                                                          webBrowserChrome);
       rv = mChromeTooltipListener->AddChromeListeners();
     }
   }
 
   // install context menus
   if (!mChromeContextMenuListener) {
-    nsCOMPtr<nsIContextMenuListener2>
-                          contextListener2(do_QueryInterface(webBrowserChrome));
-    nsCOMPtr<nsIContextMenuListener>
-                           contextListener(do_QueryInterface(webBrowserChrome));
+    nsCOMPtr<nsIContextMenuListener2> contextListener2(
+      do_QueryInterface(webBrowserChrome));
+    nsCOMPtr<nsIContextMenuListener> contextListener(
+      do_QueryInterface(webBrowserChrome));
     if (contextListener2 || contextListener) {
       mChromeContextMenuListener =
-                   new ChromeContextMenuListener(mWebBrowser, webBrowserChrome);
+        new ChromeContextMenuListener(mWebBrowser, webBrowserChrome);
       rv = mChromeContextMenuListener->AddChromeListeners();
     }
   }
 
   // register dragover and drop event listeners with the listener manager
   nsCOMPtr<EventTarget> target;
   GetDOMEventTarget(mWebBrowser, getter_AddRefs(target));
 
@@ -846,40 +838,38 @@ nsDocShellTreeOwner::AddChromeListeners(
   if (elmP) {
     elmP->AddEventListenerByType(this, NS_LITERAL_STRING("dragover"),
                                  TrustedEventsAtSystemGroupBubble());
     elmP->AddEventListenerByType(this, NS_LITERAL_STRING("drop"),
                                  TrustedEventsAtSystemGroupBubble());
   }
 
   return rv;
-
-} // AddChromeListeners
-
+}
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::RemoveChromeListeners()
 {
   if (mChromeTooltipListener) {
     mChromeTooltipListener->RemoveChromeListeners();
     mChromeTooltipListener = nullptr;
   }
   if (mChromeContextMenuListener) {
     mChromeContextMenuListener->RemoveChromeListeners();
     mChromeContextMenuListener = nullptr;
   }
 
   nsCOMPtr<EventTarget> piTarget;
   GetDOMEventTarget(mWebBrowser, getter_AddRefs(piTarget));
-  if (!piTarget)
+  if (!piTarget) {
     return NS_OK;
+  }
 
   EventListenerManager* elmP = piTarget->GetOrCreateListenerManager();
-  if (elmP)
-  {
+  if (elmP) {
     elmP->RemoveEventListenerByType(this, NS_LITERAL_STRING("dragover"),
                                     TrustedEventsAtSystemGroupBubble());
     elmP->RemoveEventListenerByType(this, NS_LITERAL_STRING("drop"),
                                     TrustedEventsAtSystemGroupBubble());
   }
 
   return NS_OK;
 }
@@ -891,31 +881,33 @@ nsDocShellTreeOwner::HandleEvent(nsIDOME
   NS_ENSURE_TRUE(dragEvent, NS_ERROR_INVALID_ARG);
 
   bool defaultPrevented;
   aEvent->GetDefaultPrevented(&defaultPrevented);
   if (defaultPrevented) {
     return NS_OK;
   }
 
-  nsCOMPtr<nsIDroppedLinkHandler> handler = do_GetService("@mozilla.org/content/dropped-link-handler;1");
+  nsCOMPtr<nsIDroppedLinkHandler> handler =
+    do_GetService("@mozilla.org/content/dropped-link-handler;1");
   if (handler) {
     nsAutoString eventType;
     aEvent->GetType(eventType);
     if (eventType.EqualsLiteral("dragover")) {
       bool canDropLink;
       handler->CanDropLink(dragEvent, false, &canDropLink);
-      if (canDropLink)
+      if (canDropLink) {
         aEvent->PreventDefault();
-    }
-    else if (eventType.EqualsLiteral("drop")) {
-      nsIWebNavigation* webnav = static_cast<nsIWebNavigation *>(mWebBrowser);
+      }
+    } else if (eventType.EqualsLiteral("drop")) {
+      nsIWebNavigation* webnav = static_cast<nsIWebNavigation*>(mWebBrowser);
 
       nsAutoString link, name;
-      if (webnav && NS_SUCCEEDED(handler->DropLink(dragEvent, name, true, link))) {
+      if (webnav &&
+          NS_SUCCEEDED(handler->DropLink(dragEvent, name, true, link))) {
         if (!link.IsEmpty()) {
           webnav->LoadURI(link.get(), 0, nullptr, nullptr, nullptr);
         }
       } else {
         aEvent->StopPropagation();
         aEvent->PreventDefault();
       }
     }
@@ -955,68 +947,60 @@ nsDocShellTreeOwner::GetOwnerRequestor()
   if (mWebBrowserChromeWeak) {
     req = do_QueryReferent(mWebBrowserChromeWeak);
   } else if (mOwnerRequestor) {
     req = mOwnerRequestor;
   }
   return req.forget();
 }
 
-
-///////////////////////////////////////////////////////////////////////////////
-// DefaultTooltipTextProvider
-
 class DefaultTooltipTextProvider final : public nsITooltipTextProvider
 {
 public:
-    DefaultTooltipTextProvider();
+  DefaultTooltipTextProvider();
 
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSITOOLTIPTEXTPROVIDER
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSITOOLTIPTEXTPROVIDER
 
 protected:
-    ~DefaultTooltipTextProvider() {}
+  ~DefaultTooltipTextProvider() {}
 
-    nsCOMPtr<nsIAtom>   mTag_dialog;
-    nsCOMPtr<nsIAtom>   mTag_dialogheader;
-    nsCOMPtr<nsIAtom>   mTag_window;
+  nsCOMPtr<nsIAtom> mTag_dialog;
+  nsCOMPtr<nsIAtom> mTag_dialogheader;
+  nsCOMPtr<nsIAtom> mTag_window;
 };
 
 NS_IMPL_ISUPPORTS(DefaultTooltipTextProvider, nsITooltipTextProvider)
 
 DefaultTooltipTextProvider::DefaultTooltipTextProvider()
 {
-    // There are certain element types which we don't want to use
-    // as tool tip text.
-    mTag_dialog       = do_GetAtom("dialog");
-    mTag_dialogheader = do_GetAtom("dialogheader");
-    mTag_window       = do_GetAtom("window");
+  // There are certain element types which we don't want to use
+  // as tool tip text.
+  mTag_dialog = do_GetAtom("dialog");
+  mTag_dialogheader = do_GetAtom("dialogheader");
+  mTag_window = do_GetAtom("window");
 }
 
-//
-// UseSVGTitle
-//
-// A helper routine that determines whether we're still interested
-// in SVG titles. We need to stop at the SVG root element that
-// has a document node parent
-//
+// A helper routine that determines whether we're still interested in SVG
+// titles. We need to stop at the SVG root element that has a document node
+// parent.
 static bool
-UseSVGTitle(nsIDOMElement *currElement)
+UseSVGTitle(nsIDOMElement* aCurrElement)
 {
-  nsCOMPtr<dom::Element> element(do_QueryInterface(currElement));
-  if (!element || !element->IsSVGElement() || !element->GetParentNode())
+  nsCOMPtr<dom::Element> element(do_QueryInterface(aCurrElement));
+  if (!element || !element->IsSVGElement() || !element->GetParentNode()) {
     return false;
+  }
 
   return element->GetParentNode()->NodeType() != nsIDOMNode::DOCUMENT_NODE;
 }
 
-/* void getNodeText(in nsIDOMNode aNode, out wstring aText); */
 NS_IMETHODIMP
-DefaultTooltipTextProvider::GetNodeText(nsIDOMNode *aNode, char16_t **aText,
-                                        bool *_retval)
+DefaultTooltipTextProvider::GetNodeText(nsIDOMNode* aNode, char16_t** aText,
+                                        bool* aResult)
 {
   NS_ENSURE_ARG_POINTER(aNode);
   NS_ENSURE_ARG_POINTER(aText);
 
   nsString outText;
 
   nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
 
@@ -1034,18 +1018,17 @@ DefaultTooltipTextProvider::GetNodeText(
     nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(content);
     bool formHasNoValidate = false;
     mozilla::dom::Element* form = formControl->GetFormElement();
     if (form) {
       nsCOMPtr<nsIAtom> noValidateAtom = do_GetAtom("novalidate");
       formHasNoValidate = form->HasAttr(kNameSpaceID_None, noValidateAtom);
     }
 
-    if (!content->HasAttr(kNameSpaceID_None, titleAtom) &&
-        !formHasNoValidate) {
+    if (!content->HasAttr(kNameSpaceID_None, titleAtom) && !formHasNoValidate) {
       cvElement->GetValidationMessage(outText);
       found = !outText.IsEmpty();
     }
   }
 
   while (!found && current) {
     nsCOMPtr<nsIDOMElement> currElement(do_QueryInterface(current));
     if (currElement) {
@@ -1056,189 +1039,169 @@ DefaultTooltipTextProvider::GetNodeText(
                                          mTag_window)) {
           // first try the normal title attribute...
           currElement->GetAttribute(NS_LITERAL_STRING("title"), outText);
           if (outText.Length()) {
             found = true;
           } else {
             // ...ok, that didn't work, try it in the XLink namespace
             NS_NAMED_LITERAL_STRING(xlinkNS, "http://www.w3.org/1999/xlink");
-            nsCOMPtr<mozilla::dom::Link> linkContent(do_QueryInterface(currElement));
+            nsCOMPtr<mozilla::dom::Link> linkContent(
+              do_QueryInterface(currElement));
             if (linkContent) {
               nsCOMPtr<nsIURI> uri(linkContent->GetURIExternal());
               if (uri) {
-                currElement->GetAttributeNS(NS_LITERAL_STRING("http://www.w3.org/1999/xlink"), NS_LITERAL_STRING("title"), outText);
-                if (outText.Length())
+                currElement->GetAttributeNS(
+                  NS_LITERAL_STRING("http://www.w3.org/1999/xlink"),
+                  NS_LITERAL_STRING("title"), outText);
+                if (outText.Length()) {
                   found = true;
+                }
               }
             } else {
               if (lookingForSVGTitle) {
                 lookingForSVGTitle = UseSVGTitle(currElement);
               }
               if (lookingForSVGTitle) {
                 nsINodeList* childNodes = node->ChildNodes();
                 uint32_t childNodeCount = childNodes->Length();
                 for (uint32_t i = 0; i < childNodeCount; i++) {
                   nsIContent* child = childNodes->Item(i);
                   if (child->IsSVGElement(nsGkAtoms::title)) {
                     static_cast<dom::SVGTitleElement*>(child)->GetTextContent(outText);
-                    if (outText.Length())
+                    if (outText.Length()) {
                       found = true;
+                    }
                     break;
                   }
                 }
               }
             }
           }
         }
       }
     }
 
     // not found here, walk up to the parent and keep trying
     if (!found) {
       nsCOMPtr<nsIDOMNode> temp(current);
       temp->GetParentNode(getter_AddRefs(current));
     }
-  } // while not found
+  }
 
-  *_retval = found;
+  *aResult = found;
   *aText = (found) ? ToNewUnicode(outText) : nullptr;
 
   return NS_OK;
 }
 
-///////////////////////////////////////////////////////////////////////////////
-
 NS_IMPL_ISUPPORTS(ChromeTooltipListener, nsIDOMEventListener)
 
-//
-// ChromeTooltipListener ctor
-//
-
-ChromeTooltipListener::ChromeTooltipListener(nsWebBrowser* inBrowser,
-                                             nsIWebBrowserChrome* inChrome)
-  : mWebBrowser(inBrowser), mWebBrowserChrome(inChrome),
-     mTooltipListenerInstalled(false),
-     mMouseClientX(0), mMouseClientY(0),
-     mShowingTooltip(false), mTooltipShownOnce(false)
+ChromeTooltipListener::ChromeTooltipListener(nsWebBrowser* aInBrowser,
+                                             nsIWebBrowserChrome* aInChrome)
+  : mWebBrowser(aInBrowser)
+  , mWebBrowserChrome(aInChrome)
+  , mTooltipListenerInstalled(false)
+  , mMouseClientX(0)
+  , mMouseClientY(0)
+  , mShowingTooltip(false)
+  , mTooltipShownOnce(false)
 {
   mTooltipTextProvider = do_GetService(NS_TOOLTIPTEXTPROVIDER_CONTRACTID);
   if (!mTooltipTextProvider) {
     mTooltipTextProvider = new DefaultTooltipTextProvider();
   }
-} // ctor
-
+}
 
-//
-// ChromeTooltipListener dtor
-//
 ChromeTooltipListener::~ChromeTooltipListener()
 {
-
-} // dtor
-
+}
 
-//
-// AddChromeListeners
-//
 // Hook up things to the chrome like context menus and tooltips, if the chrome
 // has implemented the right interfaces.
-//
 NS_IMETHODIMP
 ChromeTooltipListener::AddChromeListeners()
 {
-  if (!mEventTarget)
+  if (!mEventTarget) {
     GetDOMEventTarget(mWebBrowser, getter_AddRefs(mEventTarget));
+  }
 
   // Register the appropriate events for tooltips, but only if
   // the embedding chrome cares.
   nsresult rv = NS_OK;
-  nsCOMPtr<nsITooltipListener> tooltipListener(do_QueryInterface(mWebBrowserChrome));
+  nsCOMPtr<nsITooltipListener> tooltipListener(
+    do_QueryInterface(mWebBrowserChrome));
   if (tooltipListener && !mTooltipListenerInstalled) {
     rv = AddTooltipListener();
-    if (NS_FAILED(rv))
+    if (NS_FAILED(rv)) {
       return rv;
+    }
   }
 
   return rv;
-
-} // AddChromeListeners
-
+}
 
-//
-// AddTooltipListener
-//
-// Subscribe to the events that will allow us to track tooltips. We need "mouse" for mouseExit,
-// "mouse motion" for mouseMove, and "key" for keyDown. As we add the listeners, keep track
-// of how many succeed so we can clean up correctly in Release().
-//
+// Subscribe to the events that will allow us to track tooltips. We need "mouse"
+// for mouseExit, "mouse motion" for mouseMove, and "key" for keyDown. As we
+// add the listeners, keep track of how many succeed so we can clean up
+// correctly in Release().
 NS_IMETHODIMP
 ChromeTooltipListener::AddTooltipListener()
 {
   if (mEventTarget) {
-    nsresult rv = mEventTarget->AddSystemEventListener(NS_LITERAL_STRING("keydown"),
-                                                       this, false, false);
-    NS_ENSURE_SUCCESS(rv, rv);
-    rv = mEventTarget->AddSystemEventListener(NS_LITERAL_STRING("mousedown"), this,
-                                              false, false);
+    nsresult rv = NS_OK;
+    rv = mEventTarget->AddSystemEventListener(NS_LITERAL_STRING("keydown"),
+                                              this, false, false);
     NS_ENSURE_SUCCESS(rv, rv);
-    rv = mEventTarget->AddSystemEventListener(NS_LITERAL_STRING("mouseout"), this,
-                                              false, false);
+    rv = mEventTarget->AddSystemEventListener(NS_LITERAL_STRING("mousedown"),
+                                              this, false, false);
     NS_ENSURE_SUCCESS(rv, rv);
-    rv = mEventTarget->AddSystemEventListener(NS_LITERAL_STRING("mousemove"), this,
-                                              false, false);
+    rv = mEventTarget->AddSystemEventListener(NS_LITERAL_STRING("mouseout"),
+                                              this, false, false);
+    NS_ENSURE_SUCCESS(rv, rv);
+    rv = mEventTarget->AddSystemEventListener(NS_LITERAL_STRING("mousemove"),
+                                              this, false, false);
     NS_ENSURE_SUCCESS(rv, rv);
 
     mTooltipListenerInstalled = true;
   }
 
   return NS_OK;
 }
 
-
-//
-// RemoveChromeListeners
-//
 // Unsubscribe from the various things we've hooked up to the window root.
-//
 NS_IMETHODIMP
 ChromeTooltipListener::RemoveChromeListeners()
 {
   HideTooltip();
 
-  if (mTooltipListenerInstalled)
+  if (mTooltipListenerInstalled) {
     RemoveTooltipListener();
+  }
 
   mEventTarget = nullptr;
 
   // it really doesn't matter if these fail...
   return NS_OK;
-
-} // RemoveChromeTooltipListeners
-
-
+}
 
-//
-// RemoveTooltipListener
-//
-// Unsubscribe from all the various tooltip events that we were listening to
-//
+// Unsubscribe from all the various tooltip events that we were listening to.
 NS_IMETHODIMP
 ChromeTooltipListener::RemoveTooltipListener()
 {
   if (mEventTarget) {
-    nsresult rv =
-      mEventTarget->RemoveSystemEventListener(NS_LITERAL_STRING("keydown"), this,
-                                              false);
+    nsresult rv = NS_OK;
+    rv = mEventTarget->RemoveSystemEventListener(NS_LITERAL_STRING("keydown"),
+                                                 this, false);
     NS_ENSURE_SUCCESS(rv, rv);
     rv = mEventTarget->RemoveSystemEventListener(NS_LITERAL_STRING("mousedown"),
                                                  this, false);
     NS_ENSURE_SUCCESS(rv, rv);
-    rv = mEventTarget->RemoveSystemEventListener(NS_LITERAL_STRING("mouseout"), this,
-                                           false);
+    rv = mEventTarget->RemoveSystemEventListener(NS_LITERAL_STRING("mouseout"),
+                                                 this, false);
     NS_ENSURE_SUCCESS(rv, rv);
     rv = mEventTarget->RemoveSystemEventListener(NS_LITERAL_STRING("mousemove"),
                                                  this, false);
     NS_ENSURE_SUCCESS(rv, rv);
 
     mTooltipListenerInstalled = false;
   }
 
@@ -1261,157 +1224,146 @@ ChromeTooltipListener::HandleEvent(nsIDO
   } else if (eventType.EqualsLiteral("mousemove")) {
     return MouseMove(aEvent);
   }
 
   NS_ERROR("Unexpected event type");
   return NS_OK;
 }
 
-//
-// MouseMove
-//
-// If we're a tooltip, fire off a timer to see if a tooltip should be shown. If the
-// timer fires, we cache the node in |mPossibleTooltipNode|.
-//
+// If we're a tooltip, fire off a timer to see if a tooltip should be shown. If
+// the timer fires, we cache the node in |mPossibleTooltipNode|.
 nsresult
 ChromeTooltipListener::MouseMove(nsIDOMEvent* aMouseEvent)
 {
   nsCOMPtr<nsIDOMMouseEvent> mouseEvent(do_QueryInterface(aMouseEvent));
-  if (!mouseEvent)
+  if (!mouseEvent) {
     return NS_OK;
+  }
 
-  // stash the coordinates of the event so that we can still get back to it from within the
-  // timer callback. On win32, we'll get a MouseMove event even when a popup goes away --
-  // even when the mouse doesn't change position! To get around this, we make sure the
-  // mouse has really moved before proceeding.
+  // stash the coordinates of the event so that we can still get back to it from
+  // within the timer callback. On win32, we'll get a MouseMove event even when
+  // a popup goes away -- even when the mouse doesn't change position! To get
+  // around this, we make sure the mouse has really moved before proceeding.
   int32_t newMouseX, newMouseY;
   mouseEvent->GetClientX(&newMouseX);
   mouseEvent->GetClientY(&newMouseY);
-  if (mMouseClientX == newMouseX && mMouseClientY == newMouseY)
+  if (mMouseClientX == newMouseX && mMouseClientY == newMouseY) {
     return NS_OK;
+  }
 
   // Filter out minor mouse movements.
   if (mShowingTooltip &&
       (abs(mMouseClientX - newMouseX) <= kTooltipMouseMoveTolerance) &&
-      (abs(mMouseClientY - newMouseY) <= kTooltipMouseMoveTolerance))
+      (abs(mMouseClientY - newMouseY) <= kTooltipMouseMoveTolerance)) {
     return NS_OK;
+  }
 
-  mMouseClientX = newMouseX; mMouseClientY = newMouseY;
+  mMouseClientX = newMouseX;
+  mMouseClientY = newMouseY;
   mouseEvent->GetScreenX(&mMouseScreenX);
   mouseEvent->GetScreenY(&mMouseScreenY);
 
   if (mTooltipTimer) {
     mTooltipTimer->Cancel();
   }
 
   if (!mShowingTooltip && !mTooltipShownOnce) {
     mTooltipTimer = do_CreateInstance("@mozilla.org/timer;1");
     if (mTooltipTimer) {
-      nsCOMPtr<EventTarget> eventTarget = aMouseEvent->InternalDOMEvent()->GetTarget();
-      if (eventTarget)
+      nsCOMPtr<EventTarget> eventTarget =
+        aMouseEvent->InternalDOMEvent()->GetTarget();
+      if (eventTarget) {
         mPossibleTooltipNode = do_QueryInterface(eventTarget);
+      }
       if (mPossibleTooltipNode) {
-        nsresult rv =
-          mTooltipTimer->InitWithFuncCallback(sTooltipCallback, this,
-            LookAndFeel::GetInt(LookAndFeel::eIntID_TooltipDelay, 500),
-            nsITimer::TYPE_ONE_SHOT);
-        if (NS_FAILED(rv))
+        nsresult rv = mTooltipTimer->InitWithFuncCallback(
+          sTooltipCallback, this,
+          LookAndFeel::GetInt(LookAndFeel::eIntID_TooltipDelay, 500),
+          nsITimer::TYPE_ONE_SHOT);
+        if (NS_FAILED(rv)) {
           mPossibleTooltipNode = nullptr;
+        }
       }
-    }
-    else {
+    } else {
       NS_WARNING("Could not create a timer for tooltip tracking");
     }
   } else {
     mTooltipShownOnce = true;
     return HideTooltip();
   }
 
   return NS_OK;
-
-} // MouseMove
-
+}
 
-//
-// ShowTooltip
-//
-// Tell the registered chrome that they should show the tooltip
-//
+// Tell the registered chrome that they should show the tooltip.
 NS_IMETHODIMP
-ChromeTooltipListener::ShowTooltip(int32_t inXCoords, int32_t inYCoords,
-                                   const nsAString & inTipText)
+ChromeTooltipListener::ShowTooltip(int32_t aInXCoords, int32_t aInYCoords,
+                                   const nsAString& aInTipText)
 {
   nsresult rv = NS_OK;
 
   // do the work to call the client
-  nsCOMPtr<nsITooltipListener> tooltipListener(do_QueryInterface(mWebBrowserChrome));
+  nsCOMPtr<nsITooltipListener> tooltipListener(
+    do_QueryInterface(mWebBrowserChrome));
   if (tooltipListener) {
-    rv = tooltipListener->OnShowTooltip(inXCoords, inYCoords, PromiseFlatString(inTipText).get());
-    if (NS_SUCCEEDED(rv))
+    rv = tooltipListener->OnShowTooltip(aInXCoords, aInYCoords,
+                                        PromiseFlatString(aInTipText).get());
+    if (NS_SUCCEEDED(rv)) {
       mShowingTooltip = true;
+    }
   }
 
   return rv;
-
-} // ShowTooltip
-
+}
 
-//
-// HideTooltip
-//
 // Tell the registered chrome that they should rollup the tooltip
 // NOTE: This routine is safe to call even if the popup is already closed.
-//
 NS_IMETHODIMP
 ChromeTooltipListener::HideTooltip()
 {
   nsresult rv = NS_OK;
 
   // shut down the relevant timers
   if (mTooltipTimer) {
     mTooltipTimer->Cancel();
     mTooltipTimer = nullptr;
     // release tooltip target
     mPossibleTooltipNode = nullptr;
   }
 
   // if we're showing the tip, tell the chrome to hide it
   if (mShowingTooltip) {
-    nsCOMPtr<nsITooltipListener> tooltipListener(do_QueryInterface(mWebBrowserChrome));
+    nsCOMPtr<nsITooltipListener> tooltipListener(
+      do_QueryInterface(mWebBrowserChrome));
     if (tooltipListener) {
       rv = tooltipListener->OnHideTooltip();
-      if (NS_SUCCEEDED(rv))
+      if (NS_SUCCEEDED(rv)) {
         mShowingTooltip = false;
+      }
     }
   }
 
   return rv;
-
-} // HideTooltip
+}
 
-
-//
-// sTooltipCallback
+// A timer callback, fired when the mouse has hovered inside of a frame for the
+// appropriate amount of time. Getting to this point means that we should show
+// the tooltip, but only after we determine there is an appropriate TITLE
+// element.
 //
-// A timer callback, fired when the mouse has hovered inside of a frame for the
-// appropriate amount of time. Getting to this point means that we should show the
-// tooltip, but only after we determine there is an appropriate TITLE element.
-//
-// This relies on certain things being cached into the |aChromeTooltipListener| object passed to
-// us by the timer:
+// This relies on certain things being cached into the |aChromeTooltipListener|
+// object passed to us by the timer:
 //   -- the x/y coordinates of the mouse      (mMouseClientY, mMouseClientX)
 //   -- the dom node the user hovered over    (mPossibleTooltipNode)
-//
 void
-ChromeTooltipListener::sTooltipCallback(nsITimer *aTimer,
-                                        void *aChromeTooltipListener)
+ChromeTooltipListener::sTooltipCallback(nsITimer* aTimer,
+                                        void* aChromeTooltipListener)
 {
-  ChromeTooltipListener* self = static_cast<ChromeTooltipListener*>
-                                           (aChromeTooltipListener);
+  auto self = static_cast<ChromeTooltipListener*>(aChromeTooltipListener);
   if (self && self->mPossibleTooltipNode) {
     // The actual coordinates we want to put the tooltip at are relative to the
     // toplevel docshell of our mWebBrowser.  We know what the screen
     // coordinates of the mouse event were, which means we just need the screen
     // coordinates of the docshell.  Unfortunately, there is no good way to
     // find those short of groveling for the presentation in that docshell and
     // finding the screen coords of its toplevel widget...
     nsCOMPtr<nsIDocShell> docShell =
@@ -1442,185 +1394,157 @@ ChromeTooltipListener::sTooltipCallback(
     // if there is text associated with the node, show the tip and fire
     // off a timer to auto-hide it.
 
     nsXPIDLString tooltipText;
     if (self->mTooltipTextProvider) {
       bool textFound = false;
 
       self->mTooltipTextProvider->GetNodeText(
-          self->mPossibleTooltipNode, getter_Copies(tooltipText), &textFound);
+        self->mPossibleTooltipNode, getter_Copies(tooltipText), &textFound);
 
       if (textFound) {
         nsString tipText(tooltipText);
         LayoutDeviceIntPoint screenDot = widget->WidgetToScreenOffset();
         double scaleFactor = 1.0;
         if (shell->GetPresContext()) {
-          scaleFactor = double(nsPresContext::AppUnitsPerCSSPixel())/
-          shell->GetPresContext()->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom();
+          nsDeviceContext* dc = shell->GetPresContext()->DeviceContext();
+          scaleFactor = double(nsPresContext::AppUnitsPerCSSPixel()) /
+                        dc->AppUnitsPerDevPixelAtUnitFullZoom();
         }
         // ShowTooltip expects widget-relative position.
         self->ShowTooltip(self->mMouseScreenX - screenDot.x / scaleFactor,
-          self->mMouseScreenY - screenDot.y / scaleFactor,
-          tipText);
+                          self->mMouseScreenY - screenDot.y / scaleFactor,
+                          tipText);
       }
     }
 
     // release tooltip target if there is one, NO MATTER WHAT
     self->mPossibleTooltipNode = nullptr;
-  } // if "self" data valid
-
-} // sTooltipCallback
-
+  }
+}
 
 NS_IMPL_ISUPPORTS(ChromeContextMenuListener, nsIDOMEventListener)
 
+ChromeContextMenuListener::ChromeContextMenuListener(
+      nsWebBrowser* aInBrowser,
+      nsIWebBrowserChrome* aInChrome)
+  : mContextMenuListenerInstalled(false)
+  , mWebBrowser(aInBrowser)
+  , mWebBrowserChrome(aInChrome)
+{
+}
 
-//
-// ChromeTooltipListener ctor
-//
-ChromeContextMenuListener::ChromeContextMenuListener(nsWebBrowser* inBrowser, nsIWebBrowserChrome* inChrome)
-  : mContextMenuListenerInstalled(false),
-    mWebBrowser(inBrowser),
-    mWebBrowserChrome(inChrome)
-{
-} // ctor
-
-
-//
-// ChromeTooltipListener dtor
-//
 ChromeContextMenuListener::~ChromeContextMenuListener()
 {
-} // dtor
-
+}
 
-//
-// AddContextMenuListener
-//
-// Subscribe to the events that will allow us to track context menus. Bascially, this
-// is just the context-menu DOM event.
-//
+// Subscribe to the events that will allow us to track context menus. Bascially,
+// this is just the context-menu DOM event.
 NS_IMETHODIMP
 ChromeContextMenuListener::AddContextMenuListener()
 {
   if (mEventTarget) {
-    nsresult rv =
-      mEventTarget->AddEventListener(NS_LITERAL_STRING("contextmenu"), this,
-                                     false, false);
+    nsresult rv = mEventTarget->AddEventListener(
+      NS_LITERAL_STRING("contextmenu"), this, false, false);
     NS_ENSURE_SUCCESS(rv, rv);
 
     mContextMenuListenerInstalled = true;
   }
 
   return NS_OK;
 }
 
-
-//
-// RemoveContextMenuListener
-//
-// Unsubscribe from all the various context menu events that we were listening to.
-//
+// Unsubscribe from all the various context menu events that we were listening
+// to.
 NS_IMETHODIMP
 ChromeContextMenuListener::RemoveContextMenuListener()
 {
   if (mEventTarget) {
-    nsresult rv =
-      mEventTarget->RemoveEventListener(NS_LITERAL_STRING("contextmenu"), this,
-                                        false);
+    nsresult rv = mEventTarget->RemoveEventListener(
+      NS_LITERAL_STRING("contextmenu"), this, false);
     NS_ENSURE_SUCCESS(rv, rv);
 
     mContextMenuListenerInstalled = false;
   }
 
   return NS_OK;
 }
 
-
-//
-// AddChromeListeners
-//
 // Hook up things to the chrome like context menus and tooltips, if the chrome
 // has implemented the right interfaces.
-//
 NS_IMETHODIMP
 ChromeContextMenuListener::AddChromeListeners()
 {
-  if (!mEventTarget)
+  if (!mEventTarget) {
     GetDOMEventTarget(mWebBrowser, getter_AddRefs(mEventTarget));
+  }
 
   // Register the appropriate events for context menus, but only if
   // the embedding chrome cares.
   nsresult rv = NS_OK;
 
-  nsCOMPtr<nsIContextMenuListener2> contextListener2(do_QueryInterface(mWebBrowserChrome));
-  nsCOMPtr<nsIContextMenuListener> contextListener(do_QueryInterface(mWebBrowserChrome));
-  if ((contextListener || contextListener2) && !mContextMenuListenerInstalled)
+  nsCOMPtr<nsIContextMenuListener2> contextListener2(
+    do_QueryInterface(mWebBrowserChrome));
+  nsCOMPtr<nsIContextMenuListener> contextListener(
+    do_QueryInterface(mWebBrowserChrome));
+  if ((contextListener || contextListener2) && !mContextMenuListenerInstalled) {
     rv = AddContextMenuListener();
+  }
 
   return rv;
-
-} // AddChromeListeners
-
+}
 
-//
-// RemoveChromeListeners
-//
 // Unsubscribe from the various things we've hooked up to the window root.
-//
 NS_IMETHODIMP
 ChromeContextMenuListener::RemoveChromeListeners()
 {
-  if (mContextMenuListenerInstalled)
+  if (mContextMenuListenerInstalled) {
     RemoveContextMenuListener();
+  }
 
   mEventTarget = nullptr;
 
   // it really doesn't matter if these fail...
   return NS_OK;
-
-} // RemoveChromeTooltipListeners
-
-
+}
 
-//
-// ContextMenu
-//
-// We're on call to show the context menu. Dig around in the DOM to
-// find the type of object we're dealing with and notify the front
-// end chrome.
-//
+// We're on call to show the context menu. Dig around in the DOM to find the
+// type of object we're dealing with and notify the front end chrome.
 NS_IMETHODIMP
 ChromeContextMenuListener::HandleEvent(nsIDOMEvent* aMouseEvent)
 {
   nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aMouseEvent);
   NS_ENSURE_TRUE(mouseEvent, NS_ERROR_UNEXPECTED);
 
   bool isDefaultPrevented = false;
   aMouseEvent->GetDefaultPrevented(&isDefaultPrevented);
   if (isDefaultPrevented) {
     return NS_OK;
   }
 
-  nsCOMPtr<EventTarget> targetNode = aMouseEvent->InternalDOMEvent()->GetTarget();
-  if (!targetNode)
+  nsCOMPtr<EventTarget> targetNode =
+    aMouseEvent->InternalDOMEvent()->GetTarget();
+  if (!targetNode) {
     return NS_ERROR_NULL_POINTER;
+  }
 
   nsCOMPtr<nsIDOMNode> targetDOMnode;
   nsCOMPtr<nsIDOMNode> node = do_QueryInterface(targetNode);
-  if (!node)
+  if (!node) {
     return NS_OK;
+  }
 
   // Stop the context menu event going to other windows (bug 78396)
   aMouseEvent->PreventDefault();
 
   // If the listener is a nsIContextMenuListener2, create the info object
-  nsCOMPtr<nsIContextMenuListener2> menuListener2(do_QueryInterface(mWebBrowserChrome));
-  nsContextMenuInfo *menuInfoImpl = nullptr;
+  nsCOMPtr<nsIContextMenuListener2> menuListener2(
+    do_QueryInterface(mWebBrowserChrome));
+  nsContextMenuInfo* menuInfoImpl = nullptr;
   nsCOMPtr<nsIContextMenuInfo> menuInfo;
   if (menuListener2) {
     menuInfoImpl = new nsContextMenuInfo;
     menuInfo = menuInfoImpl;
   }
 
   uint32_t flags = nsIContextMenuListener::CONTEXT_NONE;
   uint32_t flags2 = nsIContextMenuListener2::CONTEXT_NONE;
@@ -1646,17 +1570,18 @@ ChromeContextMenuListener::HandleEvent(n
 
     nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(node));
     if (formControl) {
       if (formControl->GetType() == NS_FORM_TEXTAREA) {
         flags |= nsIContextMenuListener::CONTEXT_TEXT;
         flags2 |= nsIContextMenuListener2::CONTEXT_TEXT;
         targetDOMnode = node;
       } else {
-        nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(formControl));
+        nsCOMPtr<nsIDOMHTMLInputElement> inputElement(
+          do_QueryInterface(formControl));
         if (inputElement) {
           flags |= nsIContextMenuListener::CONTEXT_INPUT;
           flags2 |= nsIContextMenuListener2::CONTEXT_INPUT;
 
           if (menuListener2) {
             if (formControl->IsSingleLineTextControl(false)) {
               flags2 |= nsIContextMenuListener2::CONTEXT_TEXT;
             }
@@ -1666,47 +1591,50 @@ ChromeContextMenuListener::HandleEvent(n
         }
       }
     }
 
     // always consume events for plugins and Java who may throw their
     // own context menus but not for image objects.  Document objects
     // will never be targets or ancestors of targets, so that's OK.
     nsCOMPtr<nsIDOMHTMLObjectElement> objectElement;
-    if (!(flags & nsIContextMenuListener::CONTEXT_IMAGE))
+    if (!(flags & nsIContextMenuListener::CONTEXT_IMAGE)) {
       objectElement = do_QueryInterface(node);
+    }
     nsCOMPtr<nsIDOMHTMLEmbedElement> embedElement(do_QueryInterface(node));
     nsCOMPtr<nsIDOMHTMLAppletElement> appletElement(do_QueryInterface(node));
 
-    if (objectElement || embedElement || appletElement)
+    if (objectElement || embedElement || appletElement) {
       return NS_OK;
+    }
   }
 
   // Bubble out, looking for items of interest
   do {
     uint16_t nodeType;
     res = node->GetNodeType(&nodeType);
     NS_ENSURE_SUCCESS(res, res);
 
     if (nodeType == nsIDOMNode::ELEMENT_NODE) {
 
       // Test if the element has an associated link
       nsCOMPtr<nsIDOMElement> element(do_QueryInterface(node));
 
       bool hasAttr = false;
       res = element->HasAttribute(NS_LITERAL_STRING("href"), &hasAttr);
 
-      if (NS_SUCCEEDED(res) && hasAttr)
-      {
+      if (NS_SUCCEEDED(res) && hasAttr) {
         flags |= nsIContextMenuListener::CONTEXT_LINK;
         flags2 |= nsIContextMenuListener2::CONTEXT_LINK;
-        if (!targetDOMnode)
+        if (!targetDOMnode) {
           targetDOMnode = node;
-        if (menuInfoImpl)
+        }
+        if (menuInfoImpl) {
           menuInfoImpl->SetAssociatedLink(node);
+        }
         break; // exit do-while
       }
     }
 
     // walk-up-the-tree
     nsCOMPtr<nsIDOMNode> parentNode;
     node->GetParentNode(getter_AddRefs(parentNode));
     node = parentNode;
@@ -1719,18 +1647,19 @@ ChromeContextMenuListener::HandleEvent(n
     node = do_QueryInterface(targetNode);
     node->GetOwnerDocument(getter_AddRefs(document));
     nsCOMPtr<nsIDOMHTMLDocument> htmlDocument(do_QueryInterface(document));
     if (htmlDocument) {
       flags |= nsIContextMenuListener::CONTEXT_DOCUMENT;
       flags2 |= nsIContextMenuListener2::CONTEXT_DOCUMENT;
       targetDOMnode = node;
       if (!(flags & nsIContextMenuListener::CONTEXT_IMAGE)) {
-        // check if this is a background image that the user was trying to click on
-        // and if the listener is ready for that (only nsIContextMenuListener2 and up)
+        // check if this is a background image that the user was trying to click
+        // on and if the listener is ready for that (only
+        // nsIContextMenuListener2 and up)
         if (menuInfoImpl && menuInfoImpl->HasBackgroundImage(targetDOMnode)) {
           flags2 |= nsIContextMenuListener2::CONTEXT_BACKGROUND_IMAGE;
           // For the embedder to get the correct background image
           // targetDOMnode must point to the original node.
           targetDOMnode = do_QueryInterface(targetNode);
         }
       }
     }
@@ -1755,16 +1684,17 @@ ChromeContextMenuListener::HandleEvent(n
   }
 
   // Tell the listener all about the event
   if (menuListener2) {
     menuInfoImpl->SetMouseEvent(aMouseEvent);
     menuInfoImpl->SetDOMNode(targetDOMnode);
     menuListener2->OnShowContextMenu(flags2, menuInfo);
   } else {
-    nsCOMPtr<nsIContextMenuListener> menuListener(do_QueryInterface(mWebBrowserChrome));
-    if (menuListener)
+    nsCOMPtr<nsIContextMenuListener> menuListener(
+      do_QueryInterface(mWebBrowserChrome));
+    if (menuListener) {
       menuListener->OnShowContextMenu(flags, aMouseEvent, targetDOMnode);
+    }
   }
 
   return NS_OK;
-
-} // MouseDown
+}
--- a/embedding/browser/nsDocShellTreeOwner.h
+++ b/embedding/browser/nsDocShellTreeOwner.h
@@ -38,215 +38,204 @@ class EventTarget;
 }
 
 class nsWebBrowser;
 class ChromeTooltipListener;
 class ChromeContextMenuListener;
 
 // {6D10C180-6888-11d4-952B-0020183BF181}
 #define NS_ICDOCSHELLTREEOWNER_IID \
-{ 0x6d10c180, 0x6888, 0x11d4, { 0x95, 0x2b, 0x0, 0x20, 0x18, 0x3b, 0xf1, 0x81 } }
+  { 0x6d10c180, 0x6888, 0x11d4, { 0x95, 0x2b, 0x0, 0x20, 0x18, 0x3b, 0xf1, 0x81 } }
 
-/*
- * This is a fake 'hidden' interface that nsDocShellTreeOwner implements.
- * Classes such as nsCommandHandler can QI for this interface to be
- * sure that they're dealing with a valid nsDocShellTreeOwner and not some
- * other object that implements nsIDocShellTreeOwner.
- */
+// This is a fake 'hidden' interface that nsDocShellTreeOwner implements.
+// Classes such as nsCommandHandler can QI for this interface to be sure that
+// they're dealing with a valid nsDocShellTreeOwner and not some other object
+// that implements nsIDocShellTreeOwner.
 class nsICDocShellTreeOwner : public nsISupports
 {
 public:
-    NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICDOCSHELLTREEOWNER_IID)
+  NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICDOCSHELLTREEOWNER_IID)
 };
 
-NS_DEFINE_STATIC_IID_ACCESSOR(nsICDocShellTreeOwner,
-                              NS_ICDOCSHELLTREEOWNER_IID)
+NS_DEFINE_STATIC_IID_ACCESSOR(nsICDocShellTreeOwner, NS_ICDOCSHELLTREEOWNER_IID)
 
 class nsDocShellTreeOwner final : public nsIDocShellTreeOwner,
                                   public nsIBaseWindow,
                                   public nsIInterfaceRequestor,
                                   public nsIWebProgressListener,
                                   public nsIDOMEventListener,
                                   public nsICDocShellTreeOwner,
                                   public nsSupportsWeakReference
 {
-friend class nsWebBrowser;
-friend class nsCommandHandler;
+  friend class nsWebBrowser;
+  friend class nsCommandHandler;
 
 public:
-    NS_DECL_ISUPPORTS
+  NS_DECL_ISUPPORTS
 
-    NS_DECL_NSIBASEWINDOW
-    NS_DECL_NSIDOCSHELLTREEOWNER
-    NS_DECL_NSIDOMEVENTLISTENER
-    NS_DECL_NSIINTERFACEREQUESTOR
-    NS_DECL_NSIWEBPROGRESSLISTENER
+  NS_DECL_NSIBASEWINDOW
+  NS_DECL_NSIDOCSHELLTREEOWNER
+  NS_DECL_NSIDOMEVENTLISTENER
+  NS_DECL_NSIINTERFACEREQUESTOR
+  NS_DECL_NSIWEBPROGRESSLISTENER
 
 protected:
-    nsDocShellTreeOwner();
-    virtual ~nsDocShellTreeOwner();
+  nsDocShellTreeOwner();
+  virtual ~nsDocShellTreeOwner();
 
-    void WebBrowser(nsWebBrowser* aWebBrowser);
+  void WebBrowser(nsWebBrowser* aWebBrowser);
 
-    nsWebBrowser* WebBrowser();
-    NS_IMETHOD SetTreeOwner(nsIDocShellTreeOwner* aTreeOwner);
-    NS_IMETHOD SetWebBrowserChrome(nsIWebBrowserChrome* aWebBrowserChrome);
+  nsWebBrowser* WebBrowser();
+  NS_IMETHOD SetTreeOwner(nsIDocShellTreeOwner* aTreeOwner);
+  NS_IMETHOD SetWebBrowserChrome(nsIWebBrowserChrome* aWebBrowserChrome);
 
-    NS_IMETHOD AddChromeListeners();
-    NS_IMETHOD RemoveChromeListeners();
+  NS_IMETHOD AddChromeListeners();
+  NS_IMETHOD RemoveChromeListeners();
 
-    nsresult   FindItemWithNameAcrossWindows(const char16_t* aName,
-                 nsIDocShellTreeItem* aRequestor,
-                 nsIDocShellTreeItem* aOriginalRequestor,
-                 nsIDocShellTreeItem **aFoundItem);
+  nsresult FindItemWithNameAcrossWindows(
+    const char16_t* aName,
+    nsIDocShellTreeItem* aRequestor, nsIDocShellTreeItem* aOriginalRequestor,
+    nsIDocShellTreeItem** aFoundItem);
 
-    void       EnsurePrompter();
-    void       EnsureAuthPrompter();
+  void EnsurePrompter();
+  void EnsureAuthPrompter();
 
-    void AddToWatcher();
-    void RemoveFromWatcher();
+  void AddToWatcher();
+  void RemoveFromWatcher();
 
-    // These helper functions return the correct instances of the requested
-    // interfaces.  If the object passed to SetWebBrowserChrome() implements
-    // nsISupportsWeakReference, then these functions call QueryReferent on
-    // that object.  Otherwise, they return an addrefed pointer.  If the
-    // WebBrowserChrome object doesn't exist, they return nullptr.
-    already_AddRefed<nsIWebBrowserChrome>     GetWebBrowserChrome();
-    already_AddRefed<nsIEmbeddingSiteWindow>  GetOwnerWin();
-    already_AddRefed<nsIInterfaceRequestor>   GetOwnerRequestor();
+  // These helper functions return the correct instances of the requested
+  // interfaces.  If the object passed to SetWebBrowserChrome() implements
+  // nsISupportsWeakReference, then these functions call QueryReferent on
+  // that object.  Otherwise, they return an addrefed pointer.  If the
+  // WebBrowserChrome object doesn't exist, they return nullptr.
+  already_AddRefed<nsIWebBrowserChrome> GetWebBrowserChrome();
+  already_AddRefed<nsIEmbeddingSiteWindow> GetOwnerWin();
+  already_AddRefed<nsIInterfaceRequestor> GetOwnerRequestor();
 
 protected:
+  // Weak References
+  nsWebBrowser* mWebBrowser;
+  nsIDocShellTreeOwner* mTreeOwner;
+  nsIDocShellTreeItem* mPrimaryContentShell;
 
-   // Weak References
-   nsWebBrowser*           mWebBrowser;
-   nsIDocShellTreeOwner*   mTreeOwner;
-   nsIDocShellTreeItem*    mPrimaryContentShell;
-
-   nsIWebBrowserChrome*    mWebBrowserChrome;
-   nsIEmbeddingSiteWindow* mOwnerWin;
-   nsIInterfaceRequestor*  mOwnerRequestor;
+  nsIWebBrowserChrome* mWebBrowserChrome;
+  nsIEmbeddingSiteWindow* mOwnerWin;
+  nsIInterfaceRequestor* mOwnerRequestor;
 
-   nsWeakPtr               mWebBrowserChromeWeak;   // nsIWebBrowserChrome
+  nsWeakPtr mWebBrowserChromeWeak; // nsIWebBrowserChrome
 
-    // the objects that listen for chrome events like context menus and tooltips.
-    // They are separate objects to avoid circular references between |this|
-    // and the DOM.
-   nsRefPtr<ChromeTooltipListener>     mChromeTooltipListener;
-   nsRefPtr<ChromeContextMenuListener> mChromeContextMenuListener;
+  // the objects that listen for chrome events like context menus and tooltips.
+  // They are separate objects to avoid circular references between |this|
+  // and the DOM.
+  nsRefPtr<ChromeTooltipListener> mChromeTooltipListener;
+  nsRefPtr<ChromeContextMenuListener> mChromeContextMenuListener;
 
-   nsCOMPtr<nsIPrompt>     mPrompter;
-   nsCOMPtr<nsIAuthPrompt> mAuthPrompter;
+  nsCOMPtr<nsIPrompt> mPrompter;
+  nsCOMPtr<nsIAuthPrompt> mAuthPrompter;
 };
 
 
-//
-// class ChromeTooltipListener
-//
-// The class that listens to the chrome events and tells the embedding
-// chrome to show tooltips, as appropriate. Handles registering itself
-// with the DOM with AddChromeListeners() and removing itself with
-// RemoveChromeListeners().
-//
+// The class that listens to the chrome events and tells the embedding chrome to
+// show tooltips, as appropriate. Handles registering itself with the DOM with
+// AddChromeListeners() and removing itself with RemoveChromeListeners().
 class ChromeTooltipListener final : public nsIDOMEventListener
 {
 protected:
   virtual ~ChromeTooltipListener();
 
 public:
   NS_DECL_ISUPPORTS
 
-  ChromeTooltipListener(nsWebBrowser* inBrowser, nsIWebBrowserChrome* inChrome);
+  ChromeTooltipListener(nsWebBrowser* aInBrowser, nsIWebBrowserChrome* aInChrome);
 
   NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) override;
   NS_IMETHOD MouseMove(nsIDOMEvent* aMouseEvent);
 
-    // Add/remove the relevant listeners, based on what interfaces
-    // the embedding chrome implements.
+  // Add/remove the relevant listeners, based on what interfaces the embedding
+  // chrome implements.
   NS_IMETHOD AddChromeListeners();
   NS_IMETHOD RemoveChromeListeners();
 
 private:
-
-    // various delays for tooltips
-  enum {
-    kTooltipAutoHideTime = 5000,       // 5000ms = 5 seconds
-    kTooltipMouseMoveTolerance = 7     // 7 pixel tolerance for mousemove event
+  // various delays for tooltips
+  enum
+  {
+    kTooltipAutoHideTime = 5000,    // ms
+    kTooltipMouseMoveTolerance = 7  // pixel tolerance for mousemove event
   };
 
   NS_IMETHOD AddTooltipListener();
   NS_IMETHOD RemoveTooltipListener();
 
-  NS_IMETHOD ShowTooltip(int32_t inXCoords, int32_t inYCoords, const nsAString & inTipText);
+  NS_IMETHOD ShowTooltip(int32_t aInXCoords, int32_t aInYCoords,
+                         const nsAString& aInTipText);
   NS_IMETHOD HideTooltip();
 
   nsWebBrowser* mWebBrowser;
   nsCOMPtr<mozilla::dom::EventTarget> mEventTarget;
   nsCOMPtr<nsITooltipTextProvider> mTooltipTextProvider;
 
-    // This must be a strong ref in order to make sure we can hide the tooltip
-    // if the window goes away while we're displaying one. If we don't hold
-    // a strong ref, the chrome might have been disposed of before we get a chance
-    // to tell it, and no one would ever tell us of that fact.
+  // This must be a strong ref in order to make sure we can hide the tooltip if
+  // the window goes away while we're displaying one. If we don't hold a strong
+  // ref, the chrome might have been disposed of before we get a chance to tell
+  // it, and no one would ever tell us of that fact.
   nsCOMPtr<nsIWebBrowserChrome> mWebBrowserChrome;
 
   bool mTooltipListenerInstalled;
 
   nsCOMPtr<nsITimer> mTooltipTimer;
   static void sTooltipCallback(nsITimer* aTimer, void* aListener);
-  int32_t mMouseClientX, mMouseClientY;       // mouse coordinates for last mousemove event we saw
-  int32_t mMouseScreenX, mMouseScreenY;       // mouse coordinates for tooltip event
+
+  // Mouse coordinates for last mousemove event we saw
+  int32_t mMouseClientX;
+  int32_t mMouseClientY;
+
+  // Mouse coordinates for tooltip event
+  int32_t mMouseScreenX;
+  int32_t mMouseScreenY;
+
   bool mShowingTooltip;
   bool mTooltipShownOnce;
 
-    // The node hovered over that fired the timer. This may turn into the node that
-    // triggered the tooltip, but only if the timer ever gets around to firing.
-    // This is a strong reference, because the tooltip content can be destroyed while we're
-    // waiting for the tooltip to pup up, and we need to detect that.
-    // It's set only when the tooltip timer is created and launched. The timer must
-    // either fire or be cancelled (or possibly released?), and we release this
-    // reference in each of those cases. So we don't leak.
+  // The node hovered over that fired the timer. This may turn into the node
+  // that triggered the tooltip, but only if the timer ever gets around to
+  // firing. This is a strong reference, because the tooltip content can be
+  // destroyed while we're waiting for the tooltip to pup up, and we need to
+  // detect that. It's set only when the tooltip timer is created and launched.
+  // The timer must either fire or be cancelled (or possibly released?), and we
+  // release this reference in each of those cases. So we don't leak.
   nsCOMPtr<nsIDOMNode> mPossibleTooltipNode;
+};
 
-}; // ChromeTooltipListener
-
-
-//
-// class ChromeContextMenuListener
-//
-// The class that listens to the chrome events and tells the embedding
-// chrome to show context menus, as appropriate. Handles registering itself
-// with the DOM with AddChromeListeners() and removing itself with
-// RemoveChromeListeners().
-//
+// The class that listens to the chrome events and tells the embedding chrome to
+// show context menus, as appropriate. Handles registering itself with the DOM
+// with AddChromeListeners() and removing itself with RemoveChromeListeners().
 class ChromeContextMenuListener : public nsIDOMEventListener
 {
 protected:
   virtual ~ChromeContextMenuListener();
 
 public:
   NS_DECL_ISUPPORTS
 
-  ChromeContextMenuListener(nsWebBrowser* inBrowser, nsIWebBrowserChrome* inChrome);
+  ChromeContextMenuListener(nsWebBrowser* aInBrowser,
+                            nsIWebBrowserChrome* aInChrome);
 
   // nsIDOMContextMenuListener
   NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) override;
 
   // Add/remove the relevant listeners, based on what interfaces
   // the embedding chrome implements.
   NS_IMETHOD AddChromeListeners();
   NS_IMETHOD RemoveChromeListeners();
 
 private:
-
   NS_IMETHOD AddContextMenuListener();
   NS_IMETHOD RemoveContextMenuListener();
 
   bool mContextMenuListenerInstalled;
 
   nsWebBrowser* mWebBrowser;
   nsCOMPtr<mozilla::dom::EventTarget> mEventTarget;
   nsCOMPtr<nsIWebBrowserChrome> mWebBrowserChrome;
-
-}; // class ChromeContextMenuListener
-
-
+};
 
 #endif /* nsDocShellTreeOwner_h__ */
--- a/embedding/browser/nsEmbedStream.cpp
+++ b/embedding/browser/nsEmbedStream.cpp
@@ -20,67 +20,70 @@ nsEmbedStream::nsEmbedStream()
   mOwner = nullptr;
 }
 
 nsEmbedStream::~nsEmbedStream()
 {
 }
 
 void
-nsEmbedStream::InitOwner(nsIWebBrowser *aOwner)
+nsEmbedStream::InitOwner(nsIWebBrowser* aOwner)
 {
   mOwner = aOwner;
 }
 
 NS_METHOD
 nsEmbedStream::Init(void)
 {
   return NS_OK;
 }
 
 NS_METHOD
-nsEmbedStream::OpenStream(nsIURI *aBaseURI, const nsACString& aContentType)
+nsEmbedStream::OpenStream(nsIURI* aBaseURI, const nsACString& aContentType)
 {
   nsresult rv;
   NS_ENSURE_ARG_POINTER(aBaseURI);
   NS_ENSURE_TRUE(IsASCII(aContentType), NS_ERROR_INVALID_ARG);
 
   // if we're already doing a stream, return an error
-  if (mOutputStream)
+  if (mOutputStream) {
     return NS_ERROR_IN_PROGRESS;
+  }
 
   nsCOMPtr<nsIAsyncInputStream> inputStream;
   nsCOMPtr<nsIAsyncOutputStream> outputStream;
-  rv = NS_NewPipe2(getter_AddRefs(inputStream),
-                   getter_AddRefs(outputStream),
+  rv = NS_NewPipe2(getter_AddRefs(inputStream), getter_AddRefs(outputStream),
                    true, false, 0, UINT32_MAX);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   nsCOMPtr<nsIDocShell> docShell = do_GetInterface(mOwner);
   rv = docShell->LoadStream(inputStream, aBaseURI, aContentType,
                             EmptyCString(), nullptr);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   mOutputStream = outputStream;
   return rv;
 }
 
 NS_METHOD
-nsEmbedStream::AppendToStream(const uint8_t *aData, uint32_t aLen)
+nsEmbedStream::AppendToStream(const uint8_t* aData, uint32_t aLen)
 {
   nsresult rv;
   NS_ENSURE_STATE(mOutputStream);
 
   uint32_t bytesWritten = 0;
   rv = mOutputStream->Write(reinterpret_cast<const char*>(aData),
                             aLen, &bytesWritten);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   NS_ASSERTION(bytesWritten == aLen,
                "underlying buffer couldn't handle the write");
   return rv;
 }
 
 NS_METHOD
 nsEmbedStream::CloseStream(void)
--- a/embedding/browser/nsEmbedStream.h
+++ b/embedding/browser/nsEmbedStream.h
@@ -8,30 +8,29 @@
 
 #include "nsCOMPtr.h"
 #include "nsIOutputStream.h"
 #include "nsIURI.h"
 #include "nsIWebBrowser.h"
 
 class nsEmbedStream : public nsISupports
 {
- public:
-
+public:
   nsEmbedStream();
 
-  void      InitOwner      (nsIWebBrowser *aOwner);
-  NS_METHOD Init           (void);
+  void InitOwner(nsIWebBrowser* aOwner);
+  NS_METHOD Init(void);
 
-  NS_METHOD OpenStream     (nsIURI *aBaseURI, const nsACString& aContentType);
-  NS_METHOD AppendToStream (const uint8_t *aData, uint32_t aLen);
-  NS_METHOD CloseStream    (void);
+  NS_METHOD OpenStream(nsIURI* aBaseURI, const nsACString& aContentType);
+  NS_METHOD AppendToStream(const uint8_t* aData, uint32_t aLen);
+  NS_METHOD CloseStream(void);
 
   NS_DECL_ISUPPORTS
 
- protected:
+protected:
   virtual ~nsEmbedStream();
 
- private:
-  nsIWebBrowser            *mOwner;
+private:
+  nsIWebBrowser* mOwner;
   nsCOMPtr<nsIOutputStream> mOutputStream;
 };
 
 #endif // nsEmbedStream_h__
--- a/embedding/browser/nsWebBrowser.cpp
+++ b/embedding/browser/nsWebBrowser.cpp
@@ -9,17 +9,17 @@
 
 // Helper Classes
 #include "nsGfxCIID.h"
 #include "nsWidgetsCID.h"
 
 #include "gfxUtils.h"
 #include "mozilla/gfx/2D.h"
 
-//Interfaces Needed
+// Interfaces Needed
 #include "nsReadableUtils.h"
 #include "nsIComponentManager.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMWindow.h"
 #include "nsIDOMElement.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIWebBrowserChrome.h"
@@ -55,45 +55,41 @@
 #include "nsXULAppAPI.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 using namespace mozilla::layers;
 
 static NS_DEFINE_CID(kChildCID, NS_CHILD_CID);
 
-
-//*****************************************************************************
-//***    nsWebBrowser: Object Management
-//*****************************************************************************
-
-nsWebBrowser::nsWebBrowser() :
-  mInitInfo(new nsWebBrowserInitInfo()),
-  mContentType(typeContentWrapper),
-  mActivating(false),
-  mShouldEnableHistory(true),
-  mIsActive(true),
-  mParentNativeWindow(nullptr),
-  mProgressListener(nullptr),
-  mBackgroundColor(0),
-  mPersistCurrentState(nsIWebBrowserPersist::PERSIST_STATE_READY),
-  mPersistResult(NS_OK),
-  mPersistFlags(nsIWebBrowserPersist::PERSIST_FLAGS_NONE),
-  mParentWidget(nullptr)
+nsWebBrowser::nsWebBrowser()
+  : mInitInfo(new nsWebBrowserInitInfo())
+  , mContentType(typeContentWrapper)
+  , mActivating(false)
+  , mShouldEnableHistory(true)
+  , mIsActive(true)
+  , mParentNativeWindow(nullptr)
+  , mProgressListener(nullptr)
+  , mBackgroundColor(0)
+  , mPersistCurrentState(nsIWebBrowserPersist::PERSIST_STATE_READY)
+  , mPersistResult(NS_OK)
+  , mPersistFlags(nsIWebBrowserPersist::PERSIST_FLAGS_NONE)
+  , mParentWidget(nullptr)
 {
   mWWatch = do_GetService(NS_WINDOWWATCHER_CONTRACTID);
   NS_ASSERTION(mWWatch, "failed to get WindowWatcher");
 }
 
 nsWebBrowser::~nsWebBrowser()
 {
   InternalDestroy();
 }
 
-NS_IMETHODIMP nsWebBrowser::InternalDestroy()
+NS_IMETHODIMP
+nsWebBrowser::InternalDestroy()
 {
   if (mInternalWidget) {
     mInternalWidget->SetWidgetListener(nullptr);
     mInternalWidget->Destroy();
     mInternalWidget = nullptr; // Force release here.
   }
 
   SetDocShell(nullptr);
@@ -105,21 +101,16 @@ NS_IMETHODIMP nsWebBrowser::InternalDest
 
   mInitInfo = nullptr;
 
   mListenerArray = nullptr;
 
   return NS_OK;
 }
 
-
-//*****************************************************************************
-// nsWebBrowser::nsISupports
-//*****************************************************************************
-
 NS_IMPL_ADDREF(nsWebBrowser)
 NS_IMPL_RELEASE(nsWebBrowser)
 
 NS_INTERFACE_MAP_BEGIN(nsWebBrowser)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowser)
   NS_INTERFACE_MAP_ENTRY(nsIWebBrowser)
   NS_INTERFACE_MAP_ENTRY(nsIWebNavigation)
   NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
@@ -135,17 +126,18 @@ NS_INTERFACE_MAP_BEGIN(nsWebBrowser)
   NS_INTERFACE_MAP_ENTRY(nsIWebBrowserStream)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
 NS_INTERFACE_MAP_END
 
 ///*****************************************************************************
 // nsWebBrowser::nsIInterfaceRequestor
 //*****************************************************************************
 
-NS_IMETHODIMP nsWebBrowser::GetInterface(const nsIID& aIID, void** aSink)
+NS_IMETHODIMP
+nsWebBrowser::GetInterface(const nsIID& aIID, void** aSink)
 {
   NS_ENSURE_ARG_POINTER(aSink);
 
   if (NS_SUCCEEDED(QueryInterface(aIID, aSink))) {
     return NS_OK;
   }
 
   if (mDocShell) {
@@ -172,70 +164,88 @@ NS_IMETHODIMP nsWebBrowser::GetInterface
 }
 
 //*****************************************************************************
 // nsWebBrowser::nsIWebBrowser
 //*****************************************************************************
 
 // listeners that currently support registration through AddWebBrowserListener:
 //  - nsIWebProgressListener
-NS_IMETHODIMP nsWebBrowser::AddWebBrowserListener(nsIWeakReference *aListener, const nsIID& aIID)
+NS_IMETHODIMP
+nsWebBrowser::AddWebBrowserListener(nsIWeakReference* aListener,
+                                    const nsIID& aIID)
 {
   NS_ENSURE_ARG_POINTER(aListener);
 
   nsresult rv = NS_OK;
   if (!mWebProgress) {
     // The window hasn't been created yet, so queue up the listener. They'll be
     // registered when the window gets created.
     if (!mListenerArray) {
       mListenerArray = new nsTArray<nsWebBrowserListenerState>();
     }
 
     nsWebBrowserListenerState* state = mListenerArray->AppendElement();
     state->mWeakPtr = aListener;
     state->mID = aIID;
   } else {
     nsCOMPtr<nsISupports> supports(do_QueryReferent(aListener));
-    if (!supports) return NS_ERROR_INVALID_ARG;
+    if (!supports) {
+      return NS_ERROR_INVALID_ARG;
+    }
     rv = BindListener(supports, aIID);
   }
 
   return rv;
 }
 
-NS_IMETHODIMP nsWebBrowser::BindListener(nsISupports *aListener, const nsIID& aIID) {
+NS_IMETHODIMP
+nsWebBrowser::BindListener(nsISupports* aListener, const nsIID& aIID)
+{
   NS_ENSURE_ARG_POINTER(aListener);
-  NS_ASSERTION(mWebProgress, "this should only be called after we've retrieved a progress iface");
+  NS_ASSERTION(mWebProgress,
+               "this should only be called after we've retrieved a progress iface");
   nsresult rv = NS_OK;
 
   // register this listener for the specified interface id
   if (aIID.Equals(NS_GET_IID(nsIWebProgressListener))) {
     nsCOMPtr<nsIWebProgressListener> listener = do_QueryInterface(aListener, &rv);
-    if (NS_FAILED(rv)) return rv;
+    if (NS_FAILED(rv)) {
+      return rv;
+    }
     NS_ENSURE_STATE(mWebProgress);
     rv = mWebProgress->AddProgressListener(listener, nsIWebProgress::NOTIFY_ALL);
   } else if (aIID.Equals(NS_GET_IID(nsISHistoryListener))) {
     nsCOMPtr<nsISHistory> shistory(do_GetInterface(mDocShell, &rv));
-    if (NS_FAILED(rv)) return rv;
+    if (NS_FAILED(rv)) {
+      return rv;
+    }
     nsCOMPtr<nsISHistoryListener> listener(do_QueryInterface(aListener, &rv));
-    if (NS_FAILED(rv)) return rv;
+    if (NS_FAILED(rv)) {
+      return rv;
+    }
     rv = shistory->AddSHistoryListener(listener);
   }
   return rv;
 }
 
-NS_IMETHODIMP nsWebBrowser::RemoveWebBrowserListener(nsIWeakReference *aListener, const nsIID& aIID)
+NS_IMETHODIMP
+nsWebBrowser::RemoveWebBrowserListener(nsIWeakReference* aListener,
+                                       const nsIID& aIID)
 {
   NS_ENSURE_ARG_POINTER(aListener);
 
   nsresult rv = NS_OK;
   if (!mWebProgress) {
-    // if there's no-one to register the listener w/, and we don't have a queue going,
-    // the the called is calling Remove before an Add which doesn't make sense.
-    if (!mListenerArray) return NS_ERROR_FAILURE;
+    // if there's no-one to register the listener w/, and we don't have a queue
+    // going, the the called is calling Remove before an Add which doesn't make
+    // sense.
+    if (!mListenerArray) {
+      return NS_ERROR_FAILURE;
+    }
 
     // iterate the array and remove the queued listener
     int32_t count = mListenerArray->Length();
     while (count > 0) {
       if (mListenerArray->ElementAt(count).Equals(aListener, aIID)) {
         mListenerArray->RemoveElementAt(count);
         break;
       }
@@ -244,706 +254,752 @@ NS_IMETHODIMP nsWebBrowser::RemoveWebBro
 
     // if we've emptied the array, get rid of it.
     if (0 >= mListenerArray->Length()) {
       mListenerArray = nullptr;
     }
 
   } else {
     nsCOMPtr<nsISupports> supports(do_QueryReferent(aListener));
-    if (!supports) return NS_ERROR_INVALID_ARG;
+    if (!supports) {
+      return NS_ERROR_INVALID_ARG;
+    }
     rv = UnBindListener(supports, aIID);
   }
 
   return rv;
 }
 
-NS_IMETHODIMP nsWebBrowser::UnBindListener(nsISupports *aListener, const nsIID& aIID) {
+NS_IMETHODIMP
+nsWebBrowser::UnBindListener(nsISupports* aListener, const nsIID& aIID)
+{
   NS_ENSURE_ARG_POINTER(aListener);
-  NS_ASSERTION(mWebProgress, "this should only be called after we've retrieved a progress iface");
+  NS_ASSERTION(mWebProgress,
+               "this should only be called after we've retrieved a progress iface");
   nsresult rv = NS_OK;
 
   // remove the listener for the specified interface id
   if (aIID.Equals(NS_GET_IID(nsIWebProgressListener))) {
     nsCOMPtr<nsIWebProgressListener> listener = do_QueryInterface(aListener, &rv);
-    if (NS_FAILED(rv)) return rv;
+    if (NS_FAILED(rv)) {
+      return rv;
+    }
     NS_ENSURE_STATE(mWebProgress);
     rv = mWebProgress->RemoveProgressListener(listener);
   } else if (aIID.Equals(NS_GET_IID(nsISHistoryListener))) {
     nsCOMPtr<nsISHistory> shistory(do_GetInterface(mDocShell, &rv));
-    if (NS_FAILED(rv)) return rv;
+    if (NS_FAILED(rv)) {
+      return rv;
+    }
     nsCOMPtr<nsISHistoryListener> listener(do_QueryInterface(aListener, &rv));
-    if (NS_FAILED(rv)) return rv;
+    if (NS_FAILED(rv)) {
+      return rv;
+    }
     rv = shistory->RemoveSHistoryListener(listener);
   }
   return rv;
 }
 
-NS_IMETHODIMP nsWebBrowser::EnableGlobalHistory(bool aEnable)
+NS_IMETHODIMP
+nsWebBrowser::EnableGlobalHistory(bool aEnable)
 {
   NS_ENSURE_STATE(mDocShell);
 
   return mDocShell->SetUseGlobalHistory(aEnable);
 }
 
-NS_IMETHODIMP nsWebBrowser::GetContainerWindow(nsIWebBrowserChrome** aTopWindow)
+NS_IMETHODIMP
+nsWebBrowser::GetContainerWindow(nsIWebBrowserChrome** aTopWindow)
 {
   NS_ENSURE_ARG_POINTER(aTopWindow);
 
   nsCOMPtr<nsIWebBrowserChrome> top;
   if (mDocShellTreeOwner) {
     top = mDocShellTreeOwner->GetWebBrowserChrome();
   }
 
   top.forget(aTopWindow);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::SetContainerWindow(nsIWebBrowserChrome* aTopWindow)
+NS_IMETHODIMP
+nsWebBrowser::SetContainerWindow(nsIWebBrowserChrome* aTopWindow)
 {
   NS_ENSURE_SUCCESS(EnsureDocShellTreeOwner(), NS_ERROR_FAILURE);
   return mDocShellTreeOwner->SetWebBrowserChrome(aTopWindow);
 }
 
-NS_IMETHODIMP nsWebBrowser::GetParentURIContentListener(nsIURIContentListener** aParentContentListener)
+NS_IMETHODIMP
+nsWebBrowser::GetParentURIContentListener(
+    nsIURIContentListener** aParentContentListener)
 {
   NS_ENSURE_ARG_POINTER(aParentContentListener);
   *aParentContentListener = nullptr;
 
   // get the interface from the docshell
   nsCOMPtr<nsIURIContentListener> listener(do_GetInterface(mDocShell));
 
-  if (listener)
+  if (listener) {
     return listener->GetParentContentListener(aParentContentListener);
+  }
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::SetParentURIContentListener(nsIURIContentListener* aParentContentListener)
+NS_IMETHODIMP
+nsWebBrowser::SetParentURIContentListener(
+    nsIURIContentListener* aParentContentListener)
 {
   // get the interface from the docshell
   nsCOMPtr<nsIURIContentListener> listener(do_GetInterface(mDocShell));
 
-  if (listener)
+  if (listener) {
     return listener->SetParentContentListener(aParentContentListener);
+  }
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetContentDOMWindow(nsIDOMWindow **_retval)
+NS_IMETHODIMP
+nsWebBrowser::GetContentDOMWindow(nsIDOMWindow** aResult)
 {
   NS_ENSURE_STATE(mDocShell);
   nsCOMPtr<nsIDOMWindow> retval = mDocShell->GetWindow();
-  retval.forget(_retval);
-  return *_retval ? NS_OK : NS_ERROR_FAILURE;
+  retval.forget(aResult);
+  return *aResult ? NS_OK : NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetIsActive(bool *rv)
+NS_IMETHODIMP
+nsWebBrowser::GetIsActive(bool* aResult)
 {
-  *rv = mIsActive;
+  *aResult = mIsActive;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::SetIsActive(bool aIsActive)
+NS_IMETHODIMP
+nsWebBrowser::SetIsActive(bool aIsActive)
 {
   // Set our copy of the value
   mIsActive = aIsActive;
 
   // If we have a docshell, pass on the request
-  if (mDocShell)
+  if (mDocShell) {
     return mDocShell->SetIsActive(aIsActive);
+  }
   return NS_OK;
 }
 
 //*****************************************************************************
 // nsWebBrowser::nsIDocShellTreeItem
 //*****************************************************************************
 
-NS_IMETHODIMP nsWebBrowser::GetName(nsAString& aName)
+NS_IMETHODIMP
+nsWebBrowser::GetName(nsAString& aName)
 {
-  if (mDocShell)
+  if (mDocShell) {
     mDocShell->GetName(aName);
-  else
+  } else {
     aName = mInitInfo->name;
+  }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::SetName(const nsAString& aName)
+NS_IMETHODIMP
+nsWebBrowser::SetName(const nsAString& aName)
 {
   if (mDocShell) {
     return mDocShell->SetName(aName);
   } else {
     mInitInfo->name = aName;
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::NameEquals(const char16_t *aName, bool *_retval)
+NS_IMETHODIMP
+nsWebBrowser::NameEquals(const char16_t* aName, bool* aResult)
 {
   NS_ENSURE_ARG_POINTER(aName);
-  NS_ENSURE_ARG_POINTER(_retval);
+  NS_ENSURE_ARG_POINTER(aResult);
   if (mDocShell) {
-    return mDocShell->NameEquals(aName, _retval);
+    return mDocShell->NameEquals(aName, aResult);
   } else {
-    *_retval = mInitInfo->name.Equals(aName);
+    *aResult = mInitInfo->name.Equals(aName);
   }
 
   return NS_OK;
 }
 
 /* virtual */ int32_t
 nsWebBrowser::ItemType()
 {
   return mContentType;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetItemType(int32_t* aItemType)
+NS_IMETHODIMP
+nsWebBrowser::GetItemType(int32_t* aItemType)
 {
   NS_ENSURE_ARG_POINTER(aItemType);
 
   *aItemType = ItemType();
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::SetItemType(int32_t aItemType)
+NS_IMETHODIMP
+nsWebBrowser::SetItemType(int32_t aItemType)
 {
-  NS_ENSURE_TRUE((aItemType == typeContentWrapper || aItemType == typeChromeWrapper), NS_ERROR_FAILURE);
+  NS_ENSURE_TRUE(
+    aItemType == typeContentWrapper || aItemType == typeChromeWrapper,
+    NS_ERROR_FAILURE);
   mContentType = aItemType;
   if (mDocShell) {
-    mDocShell->SetItemType(mContentType == typeChromeWrapper
-                           ? static_cast<int32_t>(typeChrome)
-                           : static_cast<int32_t>(typeContent));
+    mDocShell->SetItemType(mContentType == typeChromeWrapper ?
+                             static_cast<int32_t>(typeChrome) :
+                             static_cast<int32_t>(typeContent));
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetParent(nsIDocShellTreeItem** aParent)
+NS_IMETHODIMP
+nsWebBrowser::GetParent(nsIDocShellTreeItem** aParent)
 {
   *aParent = nullptr;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetSameTypeParent(nsIDocShellTreeItem** aParent)
+NS_IMETHODIMP
+nsWebBrowser::GetSameTypeParent(nsIDocShellTreeItem** aParent)
 {
   *aParent = nullptr;
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetRootTreeItem(nsIDocShellTreeItem** aRootTreeItem)
+NS_IMETHODIMP
+nsWebBrowser::GetRootTreeItem(nsIDocShellTreeItem** aRootTreeItem)
 {
   NS_ENSURE_ARG_POINTER(aRootTreeItem);
   *aRootTreeItem = static_cast<nsIDocShellTreeItem*>(this);
 
   nsCOMPtr<nsIDocShellTreeItem> parent;
   NS_ENSURE_SUCCESS(GetParent(getter_AddRefs(parent)), NS_ERROR_FAILURE);
-  while(parent) {
+  while (parent) {
     *aRootTreeItem = parent;
-    NS_ENSURE_SUCCESS((*aRootTreeItem)->GetParent(getter_AddRefs(parent)), NS_ERROR_FAILURE);
+    NS_ENSURE_SUCCESS((*aRootTreeItem)->GetParent(getter_AddRefs(parent)),
+                      NS_ERROR_FAILURE);
   }
   NS_ADDREF(*aRootTreeItem);
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetSameTypeRootTreeItem(nsIDocShellTreeItem** aRootTreeItem)
+NS_IMETHODIMP
+nsWebBrowser::GetSameTypeRootTreeItem(nsIDocShellTreeItem** aRootTreeItem)
 {
   NS_ENSURE_ARG_POINTER(aRootTreeItem);
   *aRootTreeItem = static_cast<nsIDocShellTreeItem*>(this);
 
   nsCOMPtr<nsIDocShellTreeItem> parent;
-  NS_ENSURE_SUCCESS(GetSameTypeParent(getter_AddRefs(parent)), NS_ERROR_FAILURE);
-  while(parent) {
+  NS_ENSURE_SUCCESS(GetSameTypeParent(getter_AddRefs(parent)),
+                    NS_ERROR_FAILURE);
+  while (parent) {
     *aRootTreeItem = parent;
     NS_ENSURE_SUCCESS((*aRootTreeItem)->GetSameTypeParent(getter_AddRefs(parent)),
                       NS_ERROR_FAILURE);
   }
   NS_ADDREF(*aRootTreeItem);
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::FindItemWithName(const char16_t *aName,
-                                             nsISupports* aRequestor,
-                                             nsIDocShellTreeItem* aOriginalRequestor,
-                                             nsIDocShellTreeItem **_retval)
+NS_IMETHODIMP
+nsWebBrowser::FindItemWithName(const char16_t* aName,
+                               nsISupports* aRequestor,
+                               nsIDocShellTreeItem* aOriginalRequestor,
+                               nsIDocShellTreeItem** aResult)
 {
   NS_ENSURE_STATE(mDocShell);
-  NS_ASSERTION(mDocShellTreeOwner, "This should always be set when in this situation");
+  NS_ASSERTION(mDocShellTreeOwner,
+               "This should always be set when in this situation");
 
-  return mDocShell->FindItemWithName(aName,
-                                     static_cast<nsIDocShellTreeOwner*>(mDocShellTreeOwner),
-                                     aOriginalRequestor, _retval);
+  return mDocShell->FindItemWithName(
+    aName, static_cast<nsIDocShellTreeOwner*>(mDocShellTreeOwner),
+    aOriginalRequestor, aResult);
 }
 
 nsIDocument*
 nsWebBrowser::GetDocument()
 {
   return mDocShell ? mDocShell->GetDocument() : nullptr;
 }
 
 nsPIDOMWindow*
 nsWebBrowser::GetWindow()
 {
   return mDocShell ? mDocShell->GetWindow() : nullptr;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetTreeOwner(nsIDocShellTreeOwner** aTreeOwner)
+NS_IMETHODIMP
+nsWebBrowser::GetTreeOwner(nsIDocShellTreeOwner** aTreeOwner)
 {
   NS_ENSURE_ARG_POINTER(aTreeOwner);
   *aTreeOwner = nullptr;
   if (mDocShellTreeOwner) {
     if (mDocShellTreeOwner->mTreeOwner) {
       *aTreeOwner = mDocShellTreeOwner->mTreeOwner;
     } else {
       *aTreeOwner = mDocShellTreeOwner;
     }
   }
   NS_IF_ADDREF(*aTreeOwner);
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::SetTreeOwner(nsIDocShellTreeOwner* aTreeOwner)
+NS_IMETHODIMP
+nsWebBrowser::SetTreeOwner(nsIDocShellTreeOwner* aTreeOwner)
 {
   NS_ENSURE_SUCCESS(EnsureDocShellTreeOwner(), NS_ERROR_FAILURE);
   return mDocShellTreeOwner->SetTreeOwner(aTreeOwner);
 }
 
 //*****************************************************************************
 // nsWebBrowser::nsIDocShellTreeItem
 //*****************************************************************************
 
-NS_IMETHODIMP nsWebBrowser::GetChildCount(int32_t * aChildCount)
+NS_IMETHODIMP
+nsWebBrowser::GetChildCount(int32_t* aChildCount)
 {
   NS_ENSURE_ARG_POINTER(aChildCount);
   *aChildCount = 0;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::AddChild(nsIDocShellTreeItem * aChild)
+NS_IMETHODIMP
+nsWebBrowser::AddChild(nsIDocShellTreeItem* aChild)
 {
   return NS_ERROR_UNEXPECTED;
 }
 
-NS_IMETHODIMP nsWebBrowser::RemoveChild(nsIDocShellTreeItem * aChild)
+NS_IMETHODIMP
+nsWebBrowser::RemoveChild(nsIDocShellTreeItem* aChild)
 {
   return NS_ERROR_UNEXPECTED;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetChildAt(int32_t aIndex,
-                                       nsIDocShellTreeItem ** aChild)
+NS_IMETHODIMP
+nsWebBrowser::GetChildAt(int32_t aIndex, nsIDocShellTreeItem** aChild)
 {
   return NS_ERROR_UNEXPECTED;
 }
 
-NS_IMETHODIMP nsWebBrowser::FindChildWithName(const char16_t * aName,
-                                              bool aRecurse, bool aSameType,
-                                              nsIDocShellTreeItem * aRequestor,
-                                              nsIDocShellTreeItem * aOriginalRequestor,
-                                              nsIDocShellTreeItem ** _retval)
+NS_IMETHODIMP
+nsWebBrowser::FindChildWithName(const char16_t* aName,
+                                bool aRecurse,
+                                bool aSameType,
+                                nsIDocShellTreeItem* aRequestor,
+                                nsIDocShellTreeItem* aOriginalRequestor,
+                                nsIDocShellTreeItem** aResult)
 {
-  NS_ENSURE_ARG_POINTER(_retval);
+  NS_ENSURE_ARG_POINTER(aResult);
 
-  *_retval = nullptr;
+  *aResult = nullptr;
   return NS_OK;
 }
 
 //*****************************************************************************
 // nsWebBrowser::nsIWebNavigation
 //*****************************************************************************
 
-NS_IMETHODIMP nsWebBrowser::GetCanGoBack(bool* aCanGoBack)
+NS_IMETHODIMP
+nsWebBrowser::GetCanGoBack(bool* aCanGoBack)
 {
   NS_ENSURE_STATE(mDocShell);
 
   return mDocShellAsNav->GetCanGoBack(aCanGoBack);
 }
 
-NS_IMETHODIMP nsWebBrowser::GetCanGoForward(bool* aCanGoForward)
+NS_IMETHODIMP
+nsWebBrowser::GetCanGoForward(bool* aCanGoForward)
 {
   NS_ENSURE_STATE(mDocShell);
 
   return mDocShellAsNav->GetCanGoForward(aCanGoForward);
 }
 
-NS_IMETHODIMP nsWebBrowser::GoBack()
+NS_IMETHODIMP
+nsWebBrowser::GoBack()
 {
   NS_ENSURE_STATE(mDocShell);
 
   return mDocShellAsNav->GoBack();
 }
 
-NS_IMETHODIMP nsWebBrowser::GoForward()
+NS_IMETHODIMP
+nsWebBrowser::GoForward()
 {
   NS_ENSURE_STATE(mDocShell);
 
   return mDocShellAsNav->GoForward();
 }
 
-NS_IMETHODIMP nsWebBrowser::LoadURIWithOptions(const char16_t* aURI,
-                                               uint32_t aLoadFlags,
-                                               nsIURI* aReferringURI,
-                                               uint32_t aReferrerPolicy,
-                                               nsIInputStream* aPostDataStream,
-                                               nsIInputStream* aExtraHeaderStream,
-                                               nsIURI* aBaseURI)
+NS_IMETHODIMP
+nsWebBrowser::LoadURIWithOptions(const char16_t* aURI, uint32_t aLoadFlags,
+                                 nsIURI* aReferringURI,
+                                 uint32_t aReferrerPolicy,
+                                 nsIInputStream* aPostDataStream,
+                                 nsIInputStream* aExtraHeaderStream,
+                                 nsIURI* aBaseURI)
 {
   NS_ENSURE_STATE(mDocShell);
 
-  return mDocShellAsNav->LoadURIWithOptions(aURI,
-                                            aLoadFlags,
-                                            aReferringURI,
-                                            aReferrerPolicy,
-                                            aPostDataStream,
-                                            aExtraHeaderStream,
-                                            aBaseURI);
+  return mDocShellAsNav->LoadURIWithOptions(
+    aURI, aLoadFlags, aReferringURI, aReferrerPolicy, aPostDataStream,
+    aExtraHeaderStream, aBaseURI);
 }
 
-NS_IMETHODIMP nsWebBrowser::LoadURI(const char16_t* aURI,
-                                    uint32_t aLoadFlags,
-                                    nsIURI* aReferringURI,
-                                    nsIInputStream* aPostDataStream,
-                                    nsIInputStream* aExtraHeaderStream)
+NS_IMETHODIMP
+nsWebBrowser::LoadURI(const char16_t* aURI, uint32_t aLoadFlags,
+                      nsIURI* aReferringURI,
+                      nsIInputStream* aPostDataStream,
+                      nsIInputStream* aExtraHeaderStream)
 {
   NS_ENSURE_STATE(mDocShell);
 
-  return mDocShellAsNav->LoadURI(aURI,
-                                 aLoadFlags,
-                                 aReferringURI,
-                                 aPostDataStream,
-                                 aExtraHeaderStream);
+  return mDocShellAsNav->LoadURI(
+    aURI, aLoadFlags, aReferringURI, aPostDataStream, aExtraHeaderStream);
 }
 
-NS_IMETHODIMP nsWebBrowser::Reload(uint32_t aReloadFlags)
+NS_IMETHODIMP
+nsWebBrowser::Reload(uint32_t aReloadFlags)
 {
   NS_ENSURE_STATE(mDocShell);
 
   return mDocShellAsNav->Reload(aReloadFlags);
 }
 
-NS_IMETHODIMP nsWebBrowser::GotoIndex(int32_t aIndex)
+NS_IMETHODIMP
+nsWebBrowser::GotoIndex(int32_t aIndex)
 {
   NS_ENSURE_STATE(mDocShell);
 
   return mDocShellAsNav->GotoIndex(aIndex);
 }
 
-NS_IMETHODIMP nsWebBrowser::Stop(uint32_t aStopFlags)
+NS_IMETHODIMP
+nsWebBrowser::Stop(uint32_t aStopFlags)
 {
   NS_ENSURE_STATE(mDocShell);
 
   return mDocShellAsNav->Stop(aStopFlags);
 }
 
-NS_IMETHODIMP nsWebBrowser::GetCurrentURI(nsIURI** aURI)
+NS_IMETHODIMP
+nsWebBrowser::GetCurrentURI(nsIURI** aURI)
 {
   NS_ENSURE_STATE(mDocShell);
 
   return mDocShellAsNav->GetCurrentURI(aURI);
 }
 
-NS_IMETHODIMP nsWebBrowser::GetReferringURI(nsIURI** aURI)
+NS_IMETHODIMP
+nsWebBrowser::GetReferringURI(nsIURI** aURI)
 {
   NS_ENSURE_STATE(mDocShell);
 
   return mDocShellAsNav->GetReferringURI(aURI);
 }
 
-NS_IMETHODIMP nsWebBrowser::SetSessionHistory(nsISHistory* aSessionHistory)
+NS_IMETHODIMP
+nsWebBrowser::SetSessionHistory(nsISHistory* aSessionHistory)
 {
-  if (mDocShell)
+  if (mDocShell) {
     return mDocShellAsNav->SetSessionHistory(aSessionHistory);
-  else
+  } else {
     mInitInfo->sessionHistory = aSessionHistory;
+  }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetSessionHistory(nsISHistory** aSessionHistory)
+NS_IMETHODIMP
+nsWebBrowser::GetSessionHistory(nsISHistory** aSessionHistory)
 {
   NS_ENSURE_ARG_POINTER(aSessionHistory);
-  if (mDocShell)
+  if (mDocShell) {
     return mDocShellAsNav->GetSessionHistory(aSessionHistory);
-  else
+  } else {
     *aSessionHistory = mInitInfo->sessionHistory;
+  }
 
   NS_IF_ADDREF(*aSessionHistory);
 
   return NS_OK;
 }
 
-
-NS_IMETHODIMP nsWebBrowser::GetDocument(nsIDOMDocument** aDocument)
+NS_IMETHODIMP
+nsWebBrowser::GetDocument(nsIDOMDocument** aDocument)
 {
   NS_ENSURE_STATE(mDocShell);
 
   return mDocShellAsNav->GetDocument(aDocument);
 }
 
-
 //*****************************************************************************
 // nsWebBrowser::nsIWebBrowserSetup
 //*****************************************************************************
 
-/* void setProperty (in unsigned long aId, in unsigned long aValue); */
-NS_IMETHODIMP nsWebBrowser::SetProperty(uint32_t aId, uint32_t aValue)
+NS_IMETHODIMP
+nsWebBrowser::SetProperty(uint32_t aId, uint32_t aValue)
 {
   nsresult rv = NS_OK;
 
   switch (aId) {
-  case nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS:
-    {
+    case nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS: {
       NS_ENSURE_STATE(mDocShell);
       NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
                       aValue == static_cast<uint32_t>(false)),
                      NS_ERROR_INVALID_ARG);
       mDocShell->SetAllowPlugins(!!aValue);
       break;
     }
-  case nsIWebBrowserSetup::SETUP_ALLOW_JAVASCRIPT:
-    {
+    case nsIWebBrowserSetup::SETUP_ALLOW_JAVASCRIPT: {
       NS_ENSURE_STATE(mDocShell);
       NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
                       aValue == static_cast<uint32_t>(false)),
                      NS_ERROR_INVALID_ARG);
       mDocShell->SetAllowJavascript(!!aValue);
       break;
     }
-  case nsIWebBrowserSetup::SETUP_ALLOW_META_REDIRECTS:
-    {
+    case nsIWebBrowserSetup::SETUP_ALLOW_META_REDIRECTS: {
       NS_ENSURE_STATE(mDocShell);
       NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
                       aValue == static_cast<uint32_t>(false)),
                      NS_ERROR_INVALID_ARG);
       mDocShell->SetAllowMetaRedirects(!!aValue);
       break;
     }
-    case nsIWebBrowserSetup::SETUP_ALLOW_SUBFRAMES:
-      {
-        NS_ENSURE_STATE(mDocShell);
-        NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
-                        aValue == static_cast<uint32_t>(false)),
-                       NS_ERROR_INVALID_ARG);
-        mDocShell->SetAllowSubframes(!!aValue);
-        break;
-      }
-    case nsIWebBrowserSetup::SETUP_ALLOW_IMAGES:
-      {
-        NS_ENSURE_STATE(mDocShell);
-        NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
-                        aValue == static_cast<uint32_t>(false)),
-                       NS_ERROR_INVALID_ARG);
-        mDocShell->SetAllowImages(!!aValue);
-        break;
-      }
-    case nsIWebBrowserSetup::SETUP_ALLOW_DNS_PREFETCH:
-      {
-        NS_ENSURE_STATE(mDocShell);
-        NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
-                        aValue == static_cast<uint32_t>(false)),
-                       NS_ERROR_INVALID_ARG);
-        mDocShell->SetAllowDNSPrefetch(!!aValue);
-        break;
-      }
-    case nsIWebBrowserSetup::SETUP_USE_GLOBAL_HISTORY:
-      {
-        NS_ENSURE_STATE(mDocShell);
-        NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
-                        aValue == static_cast<uint32_t>(false)),
-                       NS_ERROR_INVALID_ARG);
-        rv = EnableGlobalHistory(!!aValue);
-        mShouldEnableHistory = aValue;
-        break;
-      }
-    case nsIWebBrowserSetup::SETUP_FOCUS_DOC_BEFORE_CONTENT:
-      {
-        // obsolete
-        break;
-      }
-    case nsIWebBrowserSetup::SETUP_IS_CHROME_WRAPPER:
-      {
-        NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
-                        aValue == static_cast<uint32_t>(false)),
-                       NS_ERROR_INVALID_ARG);
-        SetItemType(aValue ? static_cast<int32_t>(typeChromeWrapper)
-                    : static_cast<int32_t>(typeContentWrapper));
-        break;
-      }
-  default:
-    rv = NS_ERROR_INVALID_ARG;
-
+    case nsIWebBrowserSetup::SETUP_ALLOW_SUBFRAMES: {
+      NS_ENSURE_STATE(mDocShell);
+      NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
+                      aValue == static_cast<uint32_t>(false)),
+                     NS_ERROR_INVALID_ARG);
+      mDocShell->SetAllowSubframes(!!aValue);
+      break;
+    }
+    case nsIWebBrowserSetup::SETUP_ALLOW_IMAGES: {
+      NS_ENSURE_STATE(mDocShell);
+      NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
+                      aValue == static_cast<uint32_t>(false)),
+                     NS_ERROR_INVALID_ARG);
+      mDocShell->SetAllowImages(!!aValue);
+      break;
+    }
+    case nsIWebBrowserSetup::SETUP_ALLOW_DNS_PREFETCH: {
+      NS_ENSURE_STATE(mDocShell);
+      NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
+                      aValue == static_cast<uint32_t>(false)),
+                     NS_ERROR_INVALID_ARG);
+      mDocShell->SetAllowDNSPrefetch(!!aValue);
+      break;
+    }
+    case nsIWebBrowserSetup::SETUP_USE_GLOBAL_HISTORY: {
+      NS_ENSURE_STATE(mDocShell);
+      NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
+                      aValue == static_cast<uint32_t>(false)),
+                     NS_ERROR_INVALID_ARG);
+      rv = EnableGlobalHistory(!!aValue);
+      mShouldEnableHistory = aValue;
+      break;
+    }
+    case nsIWebBrowserSetup::SETUP_FOCUS_DOC_BEFORE_CONTENT: {
+      // obsolete
+      break;
+    }
+    case nsIWebBrowserSetup::SETUP_IS_CHROME_WRAPPER: {
+      NS_ENSURE_TRUE((aValue == static_cast<uint32_t>(true) ||
+                      aValue == static_cast<uint32_t>(false)),
+                     NS_ERROR_INVALID_ARG);
+      SetItemType(aValue ? static_cast<int32_t>(typeChromeWrapper) :
+                           static_cast<int32_t>(typeContentWrapper));
+      break;
+    }
+    default:
+      rv = NS_ERROR_INVALID_ARG;
   }
   return rv;
 }
 
-
 //*****************************************************************************
 // nsWebBrowser::nsIWebProgressListener
 //*****************************************************************************
 
-/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */
-NS_IMETHODIMP nsWebBrowser::OnStateChange(nsIWebProgress *aWebProgress,
-                                          nsIRequest *aRequest,
-                                          uint32_t aStateFlags,
-                                          nsresult aStatus)
+NS_IMETHODIMP
+nsWebBrowser::OnStateChange(nsIWebProgress* aWebProgress,
+                            nsIRequest* aRequest,
+                            uint32_t aStateFlags,
+                            nsresult aStatus)
 {
   if (mPersist) {
     mPersist->GetCurrentState(&mPersistCurrentState);
   }
   if (aStateFlags & STATE_IS_NETWORK && aStateFlags & STATE_STOP) {
     mPersist = nullptr;
   }
   if (mProgressListener) {
-    return mProgressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
+    return mProgressListener->OnStateChange(aWebProgress, aRequest, aStateFlags,
+                                            aStatus);
   }
   return NS_OK;
 }
 
-/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */
-NS_IMETHODIMP nsWebBrowser::OnProgressChange(nsIWebProgress *aWebProgress,
-                                             nsIRequest *aRequest,
-                                             int32_t aCurSelfProgress,
-                                             int32_t aMaxSelfProgress,
-                                             int32_t aCurTotalProgress,
-                                             int32_t aMaxTotalProgress)
+NS_IMETHODIMP
+nsWebBrowser::OnProgressChange(nsIWebProgress* aWebProgress,
+                               nsIRequest* aRequest,
+                               int32_t aCurSelfProgress,
+                               int32_t aMaxSelfProgress,
+                               int32_t aCurTotalProgress,
+                               int32_t aMaxTotalProgress)
 {
   if (mPersist) {
     mPersist->GetCurrentState(&mPersistCurrentState);
   }
   if (mProgressListener) {
-    return mProgressListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
+    return mProgressListener->OnProgressChange(
+      aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress,
+      aCurTotalProgress, aMaxTotalProgress);
   }
   return NS_OK;
 }
 
-/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location, in unsigned long aFlags); */
-NS_IMETHODIMP nsWebBrowser::OnLocationChange(nsIWebProgress *aWebProgress,
-                                             nsIRequest *aRequest,
-                                             nsIURI *location,
-                                             uint32_t aFlags)
+NS_IMETHODIMP
+nsWebBrowser::OnLocationChange(nsIWebProgress* aWebProgress,
+                               nsIRequest* aRequest,
+                               nsIURI* aLocation,
+                               uint32_t aFlags)
 {
   if (mProgressListener) {
-    return mProgressListener->OnLocationChange(aWebProgress, aRequest, location, aFlags);
+    return mProgressListener->OnLocationChange(aWebProgress, aRequest, aLocation,
+                                               aFlags);
   }
   return NS_OK;
 }
 
-/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */
-NS_IMETHODIMP nsWebBrowser::OnStatusChange(nsIWebProgress *aWebProgress,
-                                           nsIRequest *aRequest,
-                                           nsresult aStatus,
-                                           const char16_t *aMessage)
+NS_IMETHODIMP
+nsWebBrowser::OnStatusChange(nsIWebProgress* aWebProgress,
+                             nsIRequest* aRequest,
+                             nsresult aStatus,
+                             const char16_t* aMessage)
 {
   if (mProgressListener) {
-    return mProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage);
+    return mProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus,
+                                             aMessage);
   }
   return NS_OK;
 }
 
-/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */
-NS_IMETHODIMP nsWebBrowser::OnSecurityChange(nsIWebProgress *aWebProgress,
-                                             nsIRequest *aRequest,
-                                             uint32_t state)
+NS_IMETHODIMP
+nsWebBrowser::OnSecurityChange(nsIWebProgress* aWebProgress,
+                               nsIRequest* aRequest,
+                               uint32_t aState)
 {
   if (mProgressListener) {
-    return mProgressListener->OnSecurityChange(aWebProgress, aRequest, state);
+    return mProgressListener->OnSecurityChange(aWebProgress, aRequest, aState);
   }
   return NS_OK;
 }
 
 //*****************************************************************************
 // nsWebBrowser::nsIWebBrowserPersist
 //*****************************************************************************
 
-/* attribute unsigned long persistFlags; */
-NS_IMETHODIMP nsWebBrowser::GetPersistFlags(uint32_t *aPersistFlags)
+NS_IMETHODIMP
+nsWebBrowser::GetPersistFlags(uint32_t* aPersistFlags)
 {
   NS_ENSURE_ARG_POINTER(aPersistFlags);
   nsresult rv = NS_OK;
   if (mPersist) {
     rv = mPersist->GetPersistFlags(&mPersistFlags);
   }
   *aPersistFlags = mPersistFlags;
   return rv;
 }
 
-NS_IMETHODIMP nsWebBrowser::SetPersistFlags(uint32_t aPersistFlags)
+NS_IMETHODIMP
+nsWebBrowser::SetPersistFlags(uint32_t aPersistFlags)
 {
   nsresult rv = NS_OK;
   mPersistFlags = aPersistFlags;
   if (mPersist) {
     rv = mPersist->SetPersistFlags(mPersistFlags);
     mPersist->GetPersistFlags(&mPersistFlags);
   }
   return rv;
 }
 
-
-/* readonly attribute unsigned long currentState; */
-NS_IMETHODIMP nsWebBrowser::GetCurrentState(uint32_t *aCurrentState)
+NS_IMETHODIMP
+nsWebBrowser::GetCurrentState(uint32_t* aCurrentState)
 {
   NS_ENSURE_ARG_POINTER(aCurrentState);
   if (mPersist) {
     mPersist->GetCurrentState(&mPersistCurrentState);
   }
   *aCurrentState = mPersistCurrentState;
   return NS_OK;
 }
 
-/* readonly attribute nsresult result; */
-NS_IMETHODIMP nsWebBrowser::GetResult(nsresult *aResult)
+NS_IMETHODIMP
+nsWebBrowser::GetResult(nsresult* aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
   if (mPersist) {
     mPersist->GetResult(&mPersistResult);
   }
   *aResult = mPersistResult;
   return NS_OK;
 }
 
-/* attribute nsIWebBrowserPersistProgress progressListener; */
-NS_IMETHODIMP nsWebBrowser::GetProgressListener(nsIWebProgressListener * *aProgressListener)
+NS_IMETHODIMP
+nsWebBrowser::GetProgressListener(nsIWebProgressListener** aProgressListener)
 {
   NS_ENSURE_ARG_POINTER(aProgressListener);
   *aProgressListener = mProgressListener;
   NS_IF_ADDREF(*aProgressListener);
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::SetProgressListener(nsIWebProgressListener * aProgressListener)
+NS_IMETHODIMP
+nsWebBrowser::SetProgressListener(nsIWebProgressListener* aProgressListener)
 {
   mProgressListener = aProgressListener;
   return NS_OK;
 }
 
-/* void saveURI (in nsIURI aURI, in nsIURI aReferrer, in unsigned long aReferrerPolicy
-   in nsISupports aCacheKey, in nsIInputStream aPostData, in wstring aExtraHeaders,
-   in nsISupports aFile, in nsILoadContext aPrivacyContext); */
-NS_IMETHODIMP nsWebBrowser::SaveURI(nsIURI *aURI,
-                                    nsISupports *aCacheKey,
-                                    nsIURI *aReferrer,
-                                    uint32_t aReferrerPolicy,
-                                    nsIInputStream *aPostData,
-                                    const char *aExtraHeaders,
-                                    nsISupports *aFile,
-                                    nsILoadContext* aPrivacyContext)
+NS_IMETHODIMP
+nsWebBrowser::SaveURI(nsIURI* aURI,
+                      nsISupports* aCacheKey,
+                      nsIURI* aReferrer,
+                      uint32_t aReferrerPolicy,
+                      nsIInputStream* aPostData,
+                      const char* aExtraHeaders,
+                      nsISupports* aFile,
+                      nsILoadContext* aPrivacyContext)
 {
-  return SavePrivacyAwareURI(aURI, aCacheKey, aReferrer, aReferrerPolicy,
-                             aPostData, aExtraHeaders,
-                             aFile, aPrivacyContext && aPrivacyContext->UsePrivateBrowsing());
+  return SavePrivacyAwareURI(
+    aURI, aCacheKey, aReferrer, aReferrerPolicy, aPostData, aExtraHeaders,
+    aFile, aPrivacyContext && aPrivacyContext->UsePrivateBrowsing());
 }
 
-NS_IMETHODIMP nsWebBrowser::SavePrivacyAwareURI(nsIURI *aURI,
-                                                nsISupports *aCacheKey,
-                                                nsIURI *aReferrer,
-                                                uint32_t aReferrerPolicy,
-                                                nsIInputStream *aPostData,
-                                                const char *aExtraHeaders,
-                                                nsISupports *aFile,
-                                                bool aIsPrivate)
+NS_IMETHODIMP
+nsWebBrowser::SavePrivacyAwareURI(nsIURI* aURI,
+                                  nsISupports* aCacheKey,
+                                  nsIURI* aReferrer,
+                                  uint32_t aReferrerPolicy,
+                                  nsIInputStream* aPostData,
+                                  const char* aExtraHeaders,
+                                  nsISupports* aFile,
+                                  bool aIsPrivate)
 {
   if (mPersist) {
     uint32_t currentState;
     mPersist->GetCurrentState(&currentState);
     if (currentState == PERSIST_STATE_FINISHED) {
       mPersist = nullptr;
     } else {
       // You can't save again until the last save has completed
@@ -972,18 +1028,18 @@ NS_IMETHODIMP nsWebBrowser::SavePrivacyA
   rv = mPersist->SavePrivacyAwareURI(uri, aCacheKey, aReferrer, aReferrerPolicy,
                                      aPostData, aExtraHeaders, aFile, aIsPrivate);
   if (NS_FAILED(rv)) {
     mPersist = nullptr;
   }
   return rv;
 }
 
-/* void saveChannel (in nsIChannel aChannel, in nsISupports aFile); */
-NS_IMETHODIMP nsWebBrowser::SaveChannel(nsIChannel* aChannel, nsISupports *aFile)
+NS_IMETHODIMP
+nsWebBrowser::SaveChannel(nsIChannel* aChannel, nsISupports* aFile)
 {
   if (mPersist) {
     uint32_t currentState;
     mPersist->GetCurrentState(&currentState);
     if (currentState == PERSIST_STATE_FINISHED) {
       mPersist = nullptr;
     } else {
       // You can't save again until the last save has completed
@@ -1000,23 +1056,23 @@ NS_IMETHODIMP nsWebBrowser::SaveChannel(
   mPersist->GetCurrentState(&mPersistCurrentState);
   rv = mPersist->SaveChannel(aChannel, aFile);
   if (NS_FAILED(rv)) {
     mPersist = nullptr;
   }
   return rv;
 }
 
-/* void saveDocument (in nsIDOMDocument document, in nsISupports aFile, in nsISupports aDataPath); */
-NS_IMETHODIMP nsWebBrowser::SaveDocument(nsIDOMDocument *aDocument,
-                                         nsISupports *aFile,
-                                         nsISupports *aDataPath,
-                                         const char *aOutputContentType,
-                                         uint32_t aEncodingFlags,
-                                         uint32_t aWrapColumn)
+NS_IMETHODIMP
+nsWebBrowser::SaveDocument(nsIDOMDocument* aDocument,
+                           nsISupports* aFile,
+                           nsISupports* aDataPath,
+                           const char* aOutputContentType,
+                           uint32_t aEncodingFlags,
+                           uint32_t aWrapColumn)
 {
   if (mPersist) {
     uint32_t currentState;
     mPersist->GetCurrentState(&currentState);
     if (currentState == PERSIST_STATE_FINISHED) {
       mPersist = nullptr;
     } else {
       // You can't save again until the last save has completed
@@ -1039,90 +1095,95 @@ NS_IMETHODIMP nsWebBrowser::SaveDocument
 
   // Create a throwaway persistence object to do the work
   nsresult rv;
   mPersist = do_CreateInstance(NS_WEBBROWSERPERSIST_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
   mPersist->SetProgressListener(this);
   mPersist->SetPersistFlags(mPersistFlags);
   mPersist->GetCurrentState(&mPersistCurrentState);
-  rv = mPersist->SaveDocument(doc, aFile, aDataPath, aOutputContentType, aEncodingFlags, aWrapColumn);
+  rv = mPersist->SaveDocument(doc, aFile, aDataPath, aOutputContentType,
+                              aEncodingFlags, aWrapColumn);
   if (NS_FAILED(rv)) {
     mPersist = nullptr;
   }
   return rv;
 }
 
-/* void cancelSave(); */
-NS_IMETHODIMP nsWebBrowser::CancelSave()
+NS_IMETHODIMP
+nsWebBrowser::CancelSave()
 {
   if (mPersist) {
     return mPersist->CancelSave();
   }
-    return NS_OK;
+  return NS_OK;
 }
 
-/* void cancel(nsresult aReason); */
-NS_IMETHODIMP nsWebBrowser::Cancel(nsresult aReason)
+NS_IMETHODIMP
+nsWebBrowser::Cancel(nsresult aReason)
 {
   if (mPersist) {
     return mPersist->Cancel(aReason);
   }
   return NS_OK;
 }
 
-
 //*****************************************************************************
 // nsWebBrowser::nsIBaseWindow
 //*****************************************************************************
 
-NS_IMETHODIMP nsWebBrowser::InitWindow(nativeWindow aParentNativeWindow,
-   nsIWidget* aParentWidget, int32_t aX, int32_t aY, int32_t aCX, int32_t aCY)
+NS_IMETHODIMP
+nsWebBrowser::InitWindow(nativeWindow aParentNativeWindow,
+                         nsIWidget* aParentWidget,
+                         int32_t aX, int32_t aY,
+                         int32_t aCX, int32_t aCY)
 {
   NS_ENSURE_ARG(aParentNativeWindow || aParentWidget);
   NS_ENSURE_STATE(!mDocShell || mInitInfo);
 
-  if (aParentWidget)
+  if (aParentWidget) {
     NS_ENSURE_SUCCESS(SetParentWidget(aParentWidget), NS_ERROR_FAILURE);
-  else
+  } else
     NS_ENSURE_SUCCESS(SetParentNativeWindow(aParentNativeWindow),
                       NS_ERROR_FAILURE);
 
   NS_ENSURE_SUCCESS(SetPositionAndSize(aX, aY, aCX, aCY, false),
                     NS_ERROR_FAILURE);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::Create()
+NS_IMETHODIMP
+nsWebBrowser::Create()
 {
   NS_ENSURE_STATE(!mDocShell && (mParentNativeWindow || mParentWidget));
 
   nsresult rv = EnsureDocShellTreeOwner();
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIWidget> docShellParentWidget(mParentWidget);
   if (!mParentWidget) {
     // Create the widget
     mInternalWidget = do_CreateInstance(kChildCID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     docShellParentWidget = mInternalWidget;
-    nsWidgetInitData  widgetInit;
+    nsWidgetInitData widgetInit;
 
     widgetInit.clipChildren = true;
 
     widgetInit.mWindowType = eWindowType_child;
     nsIntRect bounds(mInitInfo->x, mInitInfo->y, mInitInfo->cx, mInitInfo->cy);
 
     mInternalWidget->SetWidgetListener(this);
     mInternalWidget->Create(nullptr, mParentNativeWindow, bounds, &widgetInit);
   }
 
-  nsCOMPtr<nsIDocShell> docShell(do_CreateInstance("@mozilla.org/docshell;1", &rv));
+  nsCOMPtr<nsIDocShell> docShell(
+    do_CreateInstance("@mozilla.org/docshell;1", &rv));
   NS_ENSURE_SUCCESS(rv, rv);
   rv = SetDocShell(docShell);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // get the system default window background colour
   LookAndFeel::GetColor(LookAndFeel::eColorID_WindowBackground,
                         &mBackgroundColor);
 
@@ -1143,35 +1204,38 @@ NS_IMETHODIMP nsWebBrowser::Create()
   }
 
   // HACK ALERT - this registration registers the nsDocShellTreeOwner as a
   // nsIWebBrowserListener so it can setup its MouseListener in one of the
   // progress callbacks. If we can register the MouseListener another way, this
   // registration can go away, and nsDocShellTreeOwner can stop implementing
   // nsIWebProgressListener.
   nsCOMPtr<nsISupports> supports = nullptr;
-  (void)mDocShellTreeOwner->QueryInterface(NS_GET_IID(nsIWebProgressListener),
-                                           static_cast<void**>(getter_AddRefs(supports)));
+  (void)mDocShellTreeOwner->QueryInterface(
+    NS_GET_IID(nsIWebProgressListener),
+    static_cast<void**>(getter_AddRefs(supports)));
   (void)BindListener(supports, NS_GET_IID(nsIWebProgressListener));
 
-  NS_ENSURE_SUCCESS(mDocShellAsWin->InitWindow(nullptr,
-                                               docShellParentWidget, mInitInfo->x, mInitInfo->y, mInitInfo->cx,
-                                               mInitInfo->cy), NS_ERROR_FAILURE);
+  NS_ENSURE_SUCCESS(mDocShellAsWin->InitWindow(nullptr, docShellParentWidget,
+                                               mInitInfo->x, mInitInfo->y,
+                                               mInitInfo->cx, mInitInfo->cy),
+                    NS_ERROR_FAILURE);
 
   mDocShell->SetName(mInitInfo->name);
   if (mContentType == typeChromeWrapper) {
     mDocShell->SetItemType(nsIDocShellTreeItem::typeChrome);
   } else {
     mDocShell->SetItemType(nsIDocShellTreeItem::typeContent);
   }
   mDocShell->SetTreeOwner(mDocShellTreeOwner);
 
   // If the webbrowser is a content docshell item then we won't hear any
-  // events from subframes. To solve that we install our own chrome event handler
-  // that always gets called (even for subframes) for any bubbling event.
+  // events from subframes. To solve that we install our own chrome event
+  // handler that always gets called (even for subframes) for any bubbling
+  // event.
 
   if (!mInitInfo->sessionHistory) {
     mInitInfo->sessionHistory = do_CreateInstance(NS_SHISTORY_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
   }
   mDocShellAsNav->SetSessionHistory(mInitInfo->sessionHistory);
 
   if (XRE_GetProcessType() == GeckoProcessType_Default) {
@@ -1187,78 +1251,85 @@ NS_IMETHODIMP nsWebBrowser::Create()
   nsCOMPtr<nsIDOMWindow> domWindow;
   rv = GetContentDOMWindow(getter_AddRefs(domWindow));
   if (NS_SUCCEEDED(rv)) {
     // this works because the implementation of nsISecureBrowserUI
     // (nsSecureBrowserUIImpl) gets a docShell from the domWindow,
     // and calls docShell->SetSecurityUI(this);
     nsCOMPtr<nsISecureBrowserUI> securityUI =
       do_CreateInstance(NS_SECURE_BROWSER_UI_CONTRACTID, &rv);
-    if (NS_SUCCEEDED(rv))
+    if (NS_SUCCEEDED(rv)) {
       securityUI->Init(domWindow);
+    }
   }
 
   mDocShellTreeOwner->AddToWatcher(); // evil twin of Remove in SetDocShell(0)
   mDocShellTreeOwner->AddChromeListeners();
 
   mInitInfo = nullptr;
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::Destroy()
+NS_IMETHODIMP
+nsWebBrowser::Destroy()
 {
   InternalDestroy();
 
   if (!mInitInfo) {
     mInitInfo = new nsWebBrowserInitInfo();
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetUnscaledDevicePixelsPerCSSPixel(double *aScale)
+NS_IMETHODIMP
+nsWebBrowser::GetUnscaledDevicePixelsPerCSSPixel(double* aScale)
 {
   *aScale = mParentWidget ? mParentWidget->GetDefaultScale().scale : 1.0;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::SetPosition(int32_t aX, int32_t aY)
+NS_IMETHODIMP
+nsWebBrowser::SetPosition(int32_t aX, int32_t aY)
 {
   int32_t cx = 0;
   int32_t cy = 0;
 
   GetSize(&cx, &cy);
 
   return SetPositionAndSize(aX, aY, cx, cy, false);
 }
 
-NS_IMETHODIMP nsWebBrowser::GetPosition(int32_t* aX, int32_t* aY)
+NS_IMETHODIMP
+nsWebBrowser::GetPosition(int32_t* aX, int32_t* aY)
 {
   return GetPositionAndSize(aX, aY, nullptr, nullptr);
 }
 
-NS_IMETHODIMP nsWebBrowser::SetSize(int32_t aCX, int32_t aCY, bool aRepaint)
+NS_IMETHODIMP
+nsWebBrowser::SetSize(int32_t aCX, int32_t aCY, bool aRepaint)
 {
   int32_t x = 0;
   int32_t y = 0;
 
   GetPosition(&x, &y);
 
   return SetPositionAndSize(x, y, aCX, aCY, aRepaint);
 }
 
-NS_IMETHODIMP nsWebBrowser::GetSize(int32_t* aCX, int32_t* aCY)
+NS_IMETHODIMP
+nsWebBrowser::GetSize(int32_t* aCX, int32_t* aCY)
 {
   return GetPositionAndSize(nullptr, nullptr, aCX, aCY);
 }
 
-NS_IMETHODIMP nsWebBrowser::SetPositionAndSize(int32_t aX, int32_t aY,
-                                               int32_t aCX, int32_t aCY,
-                                               bool aRepaint)
+NS_IMETHODIMP
+nsWebBrowser::SetPositionAndSize(int32_t aX, int32_t aY,
+                                 int32_t aCX, int32_t aCY, bool aRepaint)
 {
   if (!mDocShell) {
     mInitInfo->x = aX;
     mInitInfo->y = aY;
     mInitInfo->cx = aCX;
     mInitInfo->cy = aCY;
   } else {
     int32_t doc_x = aX;
@@ -1268,25 +1339,27 @@ NS_IMETHODIMP nsWebBrowser::SetPositionA
     // relative to the internal widget rather than the calling app's parent.
     // We also need to resize our widget then.
     if (mInternalWidget) {
       doc_x = doc_y = 0;
       NS_ENSURE_SUCCESS(mInternalWidget->Resize(aX, aY, aCX, aCY, aRepaint),
                         NS_ERROR_FAILURE);
     }
     // Now reposition/ resize the doc
-    NS_ENSURE_SUCCESS(mDocShellAsWin->SetPositionAndSize(doc_x, doc_y, aCX, aCY,
-                                                         aRepaint), NS_ERROR_FAILURE);
+    NS_ENSURE_SUCCESS(
+      mDocShellAsWin->SetPositionAndSize(doc_x, doc_y, aCX, aCY, aRepaint),
+      NS_ERROR_FAILURE);
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetPositionAndSize(int32_t* aX, int32_t* aY,
-                                               int32_t* aCX, int32_t* aCY)
+NS_IMETHODIMP
+nsWebBrowser::GetPositionAndSize(int32_t* aX, int32_t* aY,
+                                 int32_t* aCX, int32_t* aCY)
 {
   if (!mDocShell) {
     if (aX) {
       *aX = mInitInfo->x;
     }
     if (aY) {
       *aY = mInitInfo->y;
     }
@@ -1316,212 +1389,237 @@ NS_IMETHODIMP nsWebBrowser::GetPositionA
   } else {
     // Can directly return this as it is the
     // same interface, thus same returns.
     return mDocShellAsWin->GetPositionAndSize(aX, aY, aCX, aCY);
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::Repaint(bool aForce)
+NS_IMETHODIMP
+nsWebBrowser::Repaint(bool aForce)
 {
   NS_ENSURE_STATE(mDocShell);
   // Can directly return this as it is the
   // same interface, thus same returns.
   return mDocShellAsWin->Repaint(aForce);
 }
 
-NS_IMETHODIMP nsWebBrowser::GetParentWidget(nsIWidget** aParentWidget)
+NS_IMETHODIMP
+nsWebBrowser::GetParentWidget(nsIWidget** aParentWidget)
 {
   NS_ENSURE_ARG_POINTER(aParentWidget);
 
   *aParentWidget = mParentWidget;
 
   NS_IF_ADDREF(*aParentWidget);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::SetParentWidget(nsIWidget* aParentWidget)
+NS_IMETHODIMP
+nsWebBrowser::SetParentWidget(nsIWidget* aParentWidget)
 {
   NS_ENSURE_STATE(!mDocShell);
 
   mParentWidget = aParentWidget;
-  if (mParentWidget)
+  if (mParentWidget) {
     mParentNativeWindow = mParentWidget->GetNativeData(NS_NATIVE_WIDGET);
-  else
+  } else {
     mParentNativeWindow = nullptr;
+  }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetParentNativeWindow(nativeWindow* aParentNativeWindow)
+NS_IMETHODIMP
+nsWebBrowser::GetParentNativeWindow(nativeWindow* aParentNativeWindow)
 {
   NS_ENSURE_ARG_POINTER(aParentNativeWindow);
 
   *aParentNativeWindow = mParentNativeWindow;
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::SetParentNativeWindow(nativeWindow aParentNativeWindow)
+NS_IMETHODIMP
+nsWebBrowser::SetParentNativeWindow(nativeWindow aParentNativeWindow)
 {
   NS_ENSURE_STATE(!mDocShell);
 
   mParentNativeWindow = aParentNativeWindow;
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetNativeHandle(nsAString& aNativeHandle)
+NS_IMETHODIMP
+nsWebBrowser::GetNativeHandle(nsAString& aNativeHandle)
 {
   // the nativeHandle should be accessed from nsIXULWindow
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetVisibility(bool* visibility)
+NS_IMETHODIMP
+nsWebBrowser::GetVisibility(bool* aVisibility)
 {
-  NS_ENSURE_ARG_POINTER(visibility);
+  NS_ENSURE_ARG_POINTER(aVisibility);
 
-  if (!mDocShell)
-    *visibility = mInitInfo->visible;
-  else
-    NS_ENSURE_SUCCESS(mDocShellAsWin->GetVisibility(visibility), NS_ERROR_FAILURE);
+  if (!mDocShell) {
+    *aVisibility = mInitInfo->visible;
+  } else {
+    NS_ENSURE_SUCCESS(mDocShellAsWin->GetVisibility(aVisibility),
+                      NS_ERROR_FAILURE);
+  }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::SetVisibility(bool aVisibility)
+NS_IMETHODIMP
+nsWebBrowser::SetVisibility(bool aVisibility)
 {
   if (!mDocShell) {
     mInitInfo->visible = aVisibility;
   } else {
-    NS_ENSURE_SUCCESS(mDocShellAsWin->SetVisibility(aVisibility), NS_ERROR_FAILURE);
+    NS_ENSURE_SUCCESS(mDocShellAsWin->SetVisibility(aVisibility),
+                      NS_ERROR_FAILURE);
     if (mInternalWidget) {
       mInternalWidget->Show(aVisibility);
     }
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetEnabled(bool* aEnabled)
+NS_IMETHODIMP
+nsWebBrowser::GetEnabled(bool* aEnabled)
 {
   if (mInternalWidget) {
     *aEnabled = mInternalWidget->IsEnabled();
     return NS_OK;
   }
 
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP nsWebBrowser::SetEnabled(bool aEnabled)
+NS_IMETHODIMP
+nsWebBrowser::SetEnabled(bool aEnabled)
 {
-  if (mInternalWidget)
+  if (mInternalWidget) {
     return mInternalWidget->Enable(aEnabled);
+  }
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetMainWidget(nsIWidget** mainWidget)
+NS_IMETHODIMP
+nsWebBrowser::GetMainWidget(nsIWidget** aMainWidget)
 {
-  NS_ENSURE_ARG_POINTER(mainWidget);
+  NS_ENSURE_ARG_POINTER(aMainWidget);
 
-  if (mInternalWidget)
-    *mainWidget = mInternalWidget;
-  else
-    *mainWidget = mParentWidget;
+  if (mInternalWidget) {
+    *aMainWidget = mInternalWidget;
+  } else {
+    *aMainWidget = mParentWidget;
+  }
 
-  NS_IF_ADDREF(*mainWidget);
+  NS_IF_ADDREF(*aMainWidget);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::SetFocus()
+NS_IMETHODIMP
+nsWebBrowser::SetFocus()
 {
   nsCOMPtr<nsIDOMWindow> window = GetWindow();
   NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
   return fm ? fm->SetFocusedWindow(window) : NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetTitle(char16_t** aTitle)
+NS_IMETHODIMP
+nsWebBrowser::GetTitle(char16_t** aTitle)
 {
   NS_ENSURE_ARG_POINTER(aTitle);
   NS_ENSURE_STATE(mDocShell);
 
   NS_ENSURE_SUCCESS(mDocShellAsWin->GetTitle(aTitle), NS_ERROR_FAILURE);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::SetTitle(const char16_t* aTitle)
+NS_IMETHODIMP
+nsWebBrowser::SetTitle(const char16_t* aTitle)
 {
   NS_ENSURE_STATE(mDocShell);
 
   NS_ENSURE_SUCCESS(mDocShellAsWin->SetTitle(aTitle), NS_ERROR_FAILURE);
 
   return NS_OK;
 }
 
 //*****************************************************************************
 // nsWebBrowser::nsIScrollable
 //*****************************************************************************
 
-NS_IMETHODIMP nsWebBrowser::GetDefaultScrollbarPreferences(int32_t aScrollOrientation,
-                                                           int32_t* aScrollbarPref)
+NS_IMETHODIMP
+nsWebBrowser::GetDefaultScrollbarPreferences(int32_t aScrollOrientation,
+                                             int32_t* aScrollbarPref)
 {
   NS_ENSURE_STATE(mDocShell);
 
-  return mDocShellAsScrollable->GetDefaultScrollbarPreferences(aScrollOrientation,
-                                                               aScrollbarPref);
+  return mDocShellAsScrollable->GetDefaultScrollbarPreferences(
+    aScrollOrientation, aScrollbarPref);
 }
 
-NS_IMETHODIMP nsWebBrowser::SetDefaultScrollbarPreferences(int32_t aScrollOrientation,
-                                                           int32_t aScrollbarPref)
+NS_IMETHODIMP
+nsWebBrowser::SetDefaultScrollbarPreferences(int32_t aScrollOrientation,
+                                             int32_t aScrollbarPref)
 {
   NS_ENSURE_STATE(mDocShell);
 
-  return mDocShellAsScrollable->SetDefaultScrollbarPreferences(aScrollOrientation,
-                                                               aScrollbarPref);
+  return mDocShellAsScrollable->SetDefaultScrollbarPreferences(
+    aScrollOrientation, aScrollbarPref);
 }
 
-NS_IMETHODIMP nsWebBrowser::GetScrollbarVisibility(bool* aVerticalVisible,
-                                                   bool* aHorizontalVisible)
+NS_IMETHODIMP
+nsWebBrowser::GetScrollbarVisibility(bool* aVerticalVisible,
+                                     bool* aHorizontalVisible)
 {
   NS_ENSURE_STATE(mDocShell);
 
   return mDocShellAsScrollable->GetScrollbarVisibility(aVerticalVisible,
                                                        aHorizontalVisible);
 }
 
 //*****************************************************************************
 // nsWebBrowser::nsITextScroll
 //*****************************************************************************
 
-NS_IMETHODIMP nsWebBrowser::ScrollByLines(int32_t aNumLines)
+NS_IMETHODIMP
+nsWebBrowser::ScrollByLines(int32_t aNumLines)
 {
   NS_ENSURE_STATE(mDocShell);
 
   return mDocShellAsTextScroll->ScrollByLines(aNumLines);
 }
 
-NS_IMETHODIMP nsWebBrowser::ScrollByPages(int32_t aNumPages)
+NS_IMETHODIMP
+nsWebBrowser::ScrollByPages(int32_t aNumPages)
 {
   NS_ENSURE_STATE(mDocShell);
 
   return mDocShellAsTextScroll->ScrollByPages(aNumPages);
 }
 
-
 //*****************************************************************************
 // nsWebBrowser: Listener Helpers
 //*****************************************************************************
 
-NS_IMETHODIMP nsWebBrowser::SetDocShell(nsIDocShell* aDocShell)
+NS_IMETHODIMP
+nsWebBrowser::SetDocShell(nsIDocShell* aDocShell)
 {
   nsCOMPtr<nsIDocShell> kungFuDeathGrip(mDocShell);
   if (aDocShell) {
     NS_ENSURE_TRUE(!mDocShell, NS_ERROR_FAILURE);
 
     nsCOMPtr<nsIInterfaceRequestor> req(do_QueryInterface(aDocShell));
     nsCOMPtr<nsIBaseWindow> baseWin(do_QueryInterface(aDocShell));
     nsCOMPtr<nsIWebNavigation> nav(do_QueryInterface(aDocShell));
@@ -1544,102 +1642,110 @@ NS_IMETHODIMP nsWebBrowser::SetDocShell(
     mDocShell->SetAllowDNSPrefetch(false);
 
     // It's possible to call setIsActive() on us before we have a docshell.
     // If we're getting a docshell now, pass along our desired value. The
     // default here (true) matches the default of the docshell, so this is
     // a no-op unless setIsActive(false) has been called on us.
     mDocShell->SetIsActive(mIsActive);
   } else {
-    if (mDocShellTreeOwner)
+    if (mDocShellTreeOwner) {
       mDocShellTreeOwner->RemoveFromWatcher(); // evil twin of Add in Create()
-    if (mDocShellAsWin)
+    }
+    if (mDocShellAsWin) {
       mDocShellAsWin->Destroy();
+    }
 
     mDocShell = nullptr;
     mDocShellAsReq = nullptr;
     mDocShellAsWin = nullptr;
     mDocShellAsNav = nullptr;
     mDocShellAsScrollable = nullptr;
     mDocShellAsTextScroll = nullptr;
     mWebProgress = nullptr;
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::EnsureDocShellTreeOwner()
+NS_IMETHODIMP
+nsWebBrowser::EnsureDocShellTreeOwner()
 {
-  if (mDocShellTreeOwner)
+  if (mDocShellTreeOwner) {
     return NS_OK;
+  }
 
   mDocShellTreeOwner = new nsDocShellTreeOwner();
   mDocShellTreeOwner->WebBrowser(this);
 
   return NS_OK;
 }
 
-static void DrawPaintedLayer(PaintedLayer* aLayer,
-                             gfxContext* aContext,
-                             const nsIntRegion& aRegionToDraw,
-                             DrawRegionClip aClip,
-                             const nsIntRegion& aRegionToInvalidate,
-                             void* aCallbackData)
+static void
+DrawPaintedLayer(PaintedLayer* aLayer,
+                 gfxContext* aContext,
+                 const nsIntRegion& aRegionToDraw,
+                 DrawRegionClip aClip,
+                 const nsIntRegion& aRegionToInvalidate,
+                 void* aCallbackData)
 {
   DrawTarget& aDrawTarget = *aContext->GetDrawTarget();
 
   ColorPattern color(ToDeviceColor(*static_cast<nscolor*>(aCallbackData)));
   nsIntRect dirtyRect = aRegionToDraw.GetBounds();
-  aDrawTarget.FillRect(Rect(dirtyRect.x, dirtyRect.y,
-                            dirtyRect.width, dirtyRect.height),
-                       color);
+  aDrawTarget.FillRect(
+    Rect(dirtyRect.x, dirtyRect.y, dirtyRect.width, dirtyRect.height), color);
 }
 
-void nsWebBrowser::WindowRaised(nsIWidget* aWidget)
+void
+nsWebBrowser::WindowRaised(nsIWidget* aWidget)
 {
 #if defined(DEBUG_smaug)
   nsCOMPtr<nsIDocument> document = mDocShell->GetDocument();
   nsAutoString documentURI;
   document->GetDocumentURI(documentURI);
   printf("nsWebBrowser::NS_ACTIVATE %p %s\n", (void*)this,
          NS_ConvertUTF16toUTF8(documentURI).get());
 #endif
   Activate();
 }
 
-void nsWebBrowser::WindowLowered(nsIWidget* aWidget)
+void
+nsWebBrowser::WindowLowered(nsIWidget* aWidget)
 {
 #if defined(DEBUG_smaug)
   nsCOMPtr<nsIDocument> document = mDocShell->GetDocument();
   nsAutoString documentURI;
   document->GetDocumentURI(documentURI);
   printf("nsWebBrowser::NS_DEACTIVATE %p %s\n", (void*)this,
          NS_ConvertUTF16toUTF8(documentURI).get());
 #endif
   Deactivate();
 }
 
-bool nsWebBrowser::PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion)
+bool
+nsWebBrowser::PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion)
 {
   LayerManager* layerManager = aWidget->GetLayerManager();
   NS_ASSERTION(layerManager, "Must be in paint event");
 
   layerManager->BeginTransaction();
   nsRefPtr<PaintedLayer> root = layerManager->CreatePaintedLayer();
   if (root) {
     nsIntRect dirtyRect = aRegion.GetBounds();
     root->SetVisibleRegion(dirtyRect);
     layerManager->SetRoot(root);
   }
 
   layerManager->EndTransaction(DrawPaintedLayer, &mBackgroundColor);
   return true;
 }
 
-NS_IMETHODIMP nsWebBrowser::GetPrimaryContentWindow(nsIDOMWindow** aDOMWindow)
+NS_IMETHODIMP
+nsWebBrowser::GetPrimaryContentWindow(nsIDOMWindow** aDOMWindow)
 {
   *aDOMWindow = nullptr;
 
   nsCOMPtr<nsIDocShellTreeItem> item;
   NS_ENSURE_TRUE(mDocShellTreeOwner, NS_ERROR_FAILURE);
   mDocShellTreeOwner->GetPrimaryContentShell(getter_AddRefs(item));
   NS_ENSURE_TRUE(item, NS_ERROR_FAILURE);
 
@@ -1654,125 +1760,135 @@ NS_IMETHODIMP nsWebBrowser::GetPrimaryCo
   NS_ADDREF(*aDOMWindow);
   return NS_OK;
 }
 
 //*****************************************************************************
 // nsWebBrowser::nsIWebBrowserFocus
 //*****************************************************************************
 
-/* void activate (); */
-NS_IMETHODIMP nsWebBrowser::Activate(void)
+NS_IMETHODIMP
+nsWebBrowser::Activate(void)
 {
   nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
   nsCOMPtr<nsIDOMWindow> window = GetWindow();
-  if (fm && window)
+  if (fm && window) {
     return fm->WindowRaised(window);
+  }
   return NS_OK;
 }
 
-/* void deactivate (); */
-NS_IMETHODIMP nsWebBrowser::Deactivate(void)
+NS_IMETHODIMP
+nsWebBrowser::Deactivate(void)
 {
   nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
   nsCOMPtr<nsIDOMWindow> window = GetWindow();
-  if (fm && window)
+  if (fm && window) {
     return fm->WindowLowered(window);
+  }
   return NS_OK;
 }
 
-/* void setFocusAtFirstElement (); */
-NS_IMETHODIMP nsWebBrowser::SetFocusAtFirstElement(void)
+NS_IMETHODIMP
+nsWebBrowser::SetFocusAtFirstElement(void)
 {
   return NS_OK;
 }
 
-/* void setFocusAtLastElement (); */
-NS_IMETHODIMP nsWebBrowser::SetFocusAtLastElement(void)
+NS_IMETHODIMP
+nsWebBrowser::SetFocusAtLastElement(void)
 {
   return NS_OK;
 }
 
-/* attribute nsIDOMWindow focusedWindow; */
-NS_IMETHODIMP nsWebBrowser::GetFocusedWindow(nsIDOMWindow * *aFocusedWindow)
+NS_IMETHODIMP
+nsWebBrowser::GetFocusedWindow(nsIDOMWindow** aFocusedWindow)
 {
   NS_ENSURE_ARG_POINTER(aFocusedWindow);
   *aFocusedWindow = nullptr;
 
   NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsIDOMWindow> window = mDocShell->GetWindow();
   NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsIDOMElement> focusedElement;
   nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
   return fm ? fm->GetFocusedElementForWindow(window, true, aFocusedWindow,
-                                             getter_AddRefs(focusedElement)) : NS_OK;
+                                             getter_AddRefs(focusedElement)) :
+              NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::SetFocusedWindow(nsIDOMWindow * aFocusedWindow)
+NS_IMETHODIMP
+nsWebBrowser::SetFocusedWindow(nsIDOMWindow* aFocusedWindow)
 {
   nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
   return fm ? fm->SetFocusedWindow(aFocusedWindow) : NS_OK;
 }
 
-/* attribute nsIDOMElement focusedElement; */
-NS_IMETHODIMP nsWebBrowser::GetFocusedElement(nsIDOMElement * *aFocusedElement)
+NS_IMETHODIMP
+nsWebBrowser::GetFocusedElement(nsIDOMElement** aFocusedElement)
 {
   NS_ENSURE_ARG_POINTER(aFocusedElement);
   NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsIDOMWindow> window = mDocShell->GetWindow();
   NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
-  return fm ? fm->GetFocusedElementForWindow(window, true, nullptr, aFocusedElement) : NS_OK;
+  return
+    fm ? fm->GetFocusedElementForWindow(window, true, nullptr, aFocusedElement) :
+         NS_OK;
 }
 
-NS_IMETHODIMP nsWebBrowser::SetFocusedElement(nsIDOMElement * aFocusedElement)
+NS_IMETHODIMP
+nsWebBrowser::SetFocusedElement(nsIDOMElement* aFocusedElement)
 {
   nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
   return fm ? fm->SetFocus(aFocusedElement, 0) : NS_OK;
 }
 
 //*****************************************************************************
 // nsWebBrowser::nsIWebBrowserStream
 //*****************************************************************************
 
-/* void openStream(in nsIURI aBaseURI, in ACString aContentType); */
-NS_IMETHODIMP nsWebBrowser::OpenStream(nsIURI *aBaseURI, const nsACString& aContentType)
+NS_IMETHODIMP
+nsWebBrowser::OpenStream(nsIURI* aBaseURI, const nsACString& aContentType)
 {
   nsresult rv;
 
   if (!mStream) {
     mStream = new nsEmbedStream();
     mStream->InitOwner(this);
     rv = mStream->Init();
-    if (NS_FAILED(rv))
+    if (NS_FAILED(rv)) {
       return rv;
+    }
   }
 
   return mStream->OpenStream(aBaseURI, aContentType);
 }
 
-/* void appendToStream([const, array, size_is(aLen)] in octet aData,
- * in unsigned long aLen); */
-NS_IMETHODIMP nsWebBrowser::AppendToStream(const uint8_t *aData, uint32_t aLen)
+
+NS_IMETHODIMP
+nsWebBrowser::AppendToStream(const uint8_t* aData, uint32_t aLen)
 {
-  if (!mStream)
+  if (!mStream) {
     return NS_ERROR_FAILURE;
+  }
 
   return mStream->AppendToStream(aData, aLen);
 }
 
-/* void closeStream (); */
-NS_IMETHODIMP nsWebBrowser::CloseStream()
+NS_IMETHODIMP
+nsWebBrowser::CloseStream()
 {
   nsresult rv;
 
-  if (!mStream)
+  if (!mStream) {
     return NS_ERROR_FAILURE;
+  }
   rv = mStream->CloseStream();
 
   mStream = nullptr;
 
   return rv;
 }
--- a/embedding/browser/nsWebBrowser.h
+++ b/embedding/browser/nsWebBrowser.h
@@ -39,40 +39,41 @@
 #include "nsIWidgetListener.h"
 
 #include "nsTArray.h"
 #include "nsWeakPtr.h"
 
 class nsWebBrowserInitInfo
 {
 public:
-  //nsIBaseWindow Stuff
-  int32_t                 x;
-  int32_t                 y;
-  int32_t                 cx;
-  int32_t                 cy;
-  bool                    visible;
-  nsCOMPtr<nsISHistory>   sessionHistory;
-  nsString                name;
+  // nsIBaseWindow Stuff
+  int32_t x;
+  int32_t y;
+  int32_t cx;
+  int32_t cy;
+  bool visible;
+  nsCOMPtr<nsISHistory> sessionHistory;
+  nsString name;
 };
 
 class nsWebBrowserListenerState
 {
 public:
-  bool Equals(nsIWeakReference *aListener, const nsIID& aID) {
+  bool Equals(nsIWeakReference* aListener, const nsIID& aID)
+  {
     return mWeakPtr.get() == aListener && mID.Equals(aID);
   }
 
   nsWeakPtr mWeakPtr;
   nsIID mID;
 };
 
 //  {cda5863a-aa9c-411e-be49-ea0d525ab4b5} -
 #define NS_WEBBROWSER_CID \
-{0xcda5863a, 0xaa9c, 0x411e, { 0xbe, 0x49, 0xea, 0x0d, 0x52, 0x5a, 0xb4, 0xb5 }}
+  { 0xcda5863a, 0xaa9c, 0x411e, { 0xbe, 0x49, 0xea, 0x0d, 0x52, 0x5a, 0xb4, 0xb5 } }
 
 
 class nsWebBrowser final : public nsIWebBrowser,
                            public nsIWebNavigation,
                            public nsIWebBrowserSetup,
                            public nsIDocShellTreeItem,
                            public nsIBaseWindow,
                            public nsIScrollable,
@@ -81,16 +82,17 @@ class nsWebBrowser final : public nsIWeb
                            public nsIWebBrowserPersist,
                            public nsIWebBrowserFocus,
                            public nsIWebProgressListener,
                            public nsIWebBrowserStream,
                            public nsIWidgetListener,
                            public nsSupportsWeakReference
 {
   friend class nsDocShellTreeOwner;
+
 public:
   nsWebBrowser();
 
   NS_DECL_ISUPPORTS
 
   NS_DECL_NSIBASEWINDOW
   NS_DECL_NSIDOCSHELLTREEITEM
   NS_DECL_NSIINTERFACEREQUESTOR
@@ -107,57 +109,58 @@ public:
 
 protected:
   virtual ~nsWebBrowser();
   NS_IMETHOD InternalDestroy();
 
   // XXXbz why are these NS_IMETHOD?  They're not interface methods!
   NS_IMETHOD SetDocShell(nsIDocShell* aDocShell);
   NS_IMETHOD EnsureDocShellTreeOwner();
-  NS_IMETHOD GetPrimaryContentWindow(nsIDOMWindow **aDomWindow);
-  NS_IMETHOD BindListener(nsISupports *aListener, const nsIID& aIID);
-  NS_IMETHOD UnBindListener(nsISupports *aListener, const nsIID& aIID);
+  NS_IMETHOD GetPrimaryContentWindow(nsIDOMWindow** aDomWindow);
+  NS_IMETHOD BindListener(nsISupports* aListener, const nsIID& aIID);
+  NS_IMETHOD UnBindListener(nsISupports* aListener, const nsIID& aIID);
   NS_IMETHOD EnableGlobalHistory(bool aEnable);
 
   // nsIWidgetListener
   virtual void WindowRaised(nsIWidget* aWidget);
   virtual void WindowLowered(nsIWidget* aWidget);
   virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion) override;
 
 protected:
   nsRefPtr<nsDocShellTreeOwner> mDocShellTreeOwner;
-  nsCOMPtr<nsIDocShell>      mDocShell;
+  nsCOMPtr<nsIDocShell> mDocShell;
   nsCOMPtr<nsIInterfaceRequestor> mDocShellAsReq;
-  nsCOMPtr<nsIBaseWindow>    mDocShellAsWin;
+  nsCOMPtr<nsIBaseWindow> mDocShellAsWin;
   nsCOMPtr<nsIWebNavigation> mDocShellAsNav;
-  nsCOMPtr<nsIScrollable>    mDocShellAsScrollable;
-  nsCOMPtr<nsITextScroll>    mDocShellAsTextScroll;
-  nsCOMPtr<nsIWidget>        mInternalWidget;
+  nsCOMPtr<nsIScrollable> mDocShellAsScrollable;
+  nsCOMPtr<nsITextScroll> mDocShellAsTextScroll;
+
+  nsCOMPtr<nsIWidget> mInternalWidget;
   nsCOMPtr<nsIWindowWatcher> mWWatch;
   nsAutoPtr<nsWebBrowserInitInfo> mInitInfo;
-  uint32_t                   mContentType;
-  bool                       mActivating;
-  bool                       mShouldEnableHistory;
-  bool                       mIsActive;
-  nativeWindow               mParentNativeWindow;
-  nsIWebProgressListener    *mProgressListener;
-  nsCOMPtr<nsIWebProgress>      mWebProgress;
+  uint32_t mContentType;
+  bool mActivating;
+  bool mShouldEnableHistory;
+  bool mIsActive;
+  nativeWindow mParentNativeWindow;
+  nsIWebProgressListener* mProgressListener;
+  nsCOMPtr<nsIWebProgress> mWebProgress;
 
   nsCOMPtr<nsIPrintSettings> mPrintSettings;
 
   // cached background color
-  nscolor                       mBackgroundColor;
+  nscolor mBackgroundColor;
 
   // persistence object
   nsCOMPtr<nsIWebBrowserPersist> mPersist;
-  uint32_t                       mPersistCurrentState;
-  nsresult                       mPersistResult;
-  uint32_t                       mPersistFlags;
+  uint32_t mPersistCurrentState;
+  nsresult mPersistResult;
+  uint32_t mPersistFlags;
 
   // stream
-  nsRefPtr<nsEmbedStream>        mStream;
+  nsRefPtr<nsEmbedStream> mStream;
 
-  //Weak Reference interfaces...
-  nsIWidget*                            mParentWidget;
-  nsAutoPtr<nsTArray<nsWebBrowserListenerState>> mListenerArray;
+  // Weak Reference interfaces...
+  nsIWidget* mParentWidget;
+  nsAutoPtr<nsTArray<nsWebBrowserListenerState> > mListenerArray;
 };
 
 #endif /* nsWebBrowser_h__ */
--- a/embedding/browser/nsWebBrowserContentPolicy.cpp
+++ b/embedding/browser/nsWebBrowserContentPolicy.cpp
@@ -8,96 +8,96 @@
 #include "nsWebBrowserContentPolicy.h"
 #include "nsIDocShell.h"
 #include "nsCOMPtr.h"
 #include "nsContentPolicyUtils.h"
 #include "nsIContentViewer.h"
 
 nsWebBrowserContentPolicy::nsWebBrowserContentPolicy()
 {
-    MOZ_COUNT_CTOR(nsWebBrowserContentPolicy);
+  MOZ_COUNT_CTOR(nsWebBrowserContentPolicy);
 }
 
 nsWebBrowserContentPolicy::~nsWebBrowserContentPolicy()
 {
-    MOZ_COUNT_DTOR(nsWebBrowserContentPolicy);
+  MOZ_COUNT_DTOR(nsWebBrowserContentPolicy);
 }
 
 NS_IMPL_ISUPPORTS(nsWebBrowserContentPolicy, nsIContentPolicy)
 
 NS_IMETHODIMP
-nsWebBrowserContentPolicy::ShouldLoad(uint32_t          contentType,
-                                      nsIURI           *contentLocation,
-                                      nsIURI           *requestingLocation,
-                                      nsISupports      *requestingContext,
-                                      const nsACString &mimeGuess,
-                                      nsISupports      *extra,
-                                      nsIPrincipal     *requestPrincipal,
-                                      int16_t          *shouldLoad)
+nsWebBrowserContentPolicy::ShouldLoad(uint32_t aContentType,
+                                      nsIURI* aContentLocation,
+                                      nsIURI* aRequestingLocation,
+                                      nsISupports* aRequestingContext,
+                                      const nsACString& aMimeGuess,
+                                      nsISupports* aExtra,
+                                      nsIPrincipal* aRequestPrincipal,
+                                      int16_t* aShouldLoad)
 {
-    NS_PRECONDITION(shouldLoad, "Null out param");
+  NS_PRECONDITION(aShouldLoad, "Null out param");
 
-    *shouldLoad = nsIContentPolicy::ACCEPT;
+  *aShouldLoad = nsIContentPolicy::ACCEPT;
 
-    nsIDocShell *shell = NS_CP_GetDocShellFromContext(requestingContext);
-    /* We're going to dereference shell, so make sure it isn't null */
-    if (!shell) {
-        return NS_OK;
-    }
+  nsIDocShell* shell = NS_CP_GetDocShellFromContext(aRequestingContext);
+  /* We're going to dereference shell, so make sure it isn't null */
+  if (!shell) {
+    return NS_OK;
+  }
 
-    nsresult rv;
-    bool allowed = true;
+  nsresult rv;
+  bool allowed = true;
 
-    switch (contentType) {
-      case nsIContentPolicy::TYPE_SCRIPT:
-        rv = shell->GetAllowJavascript(&allowed);
-        break;
-      case nsIContentPolicy::TYPE_SUBDOCUMENT:
-        rv = shell->GetAllowSubframes(&allowed);
-        break;
+  switch (aContentType) {
+    case nsIContentPolicy::TYPE_SCRIPT:
+      rv = shell->GetAllowJavascript(&allowed);
+      break;
+    case nsIContentPolicy::TYPE_SUBDOCUMENT:
+      rv = shell->GetAllowSubframes(&allowed);
+      break;
 #if 0
-      /* XXXtw: commented out in old code; add during conpol phase 2 */
-      case nsIContentPolicy::TYPE_REFRESH:
-        rv = shell->GetAllowMetaRedirects(&allowed); /* meta _refresh_ */
-        break;
+    /* XXXtw: commented out in old code; add during conpol phase 2 */
+    case nsIContentPolicy::TYPE_REFRESH:
+      rv = shell->GetAllowMetaRedirects(&allowed); /* meta _refresh_ */
+      break;
 #endif
-      case nsIContentPolicy::TYPE_IMAGE:
-      case nsIContentPolicy::TYPE_IMAGESET:
-        rv = shell->GetAllowImages(&allowed);
-        break;
-      default:
-        return NS_OK;
-    }
+    case nsIContentPolicy::TYPE_IMAGE:
+    case nsIContentPolicy::TYPE_IMAGESET:
+      rv = shell->GetAllowImages(&allowed);
+      break;
+    default:
+      return NS_OK;
+  }
 
-    if (NS_SUCCEEDED(rv) && !allowed) {
-        *shouldLoad = nsIContentPolicy::REJECT_TYPE;
-    }
-    return rv;
+  if (NS_SUCCEEDED(rv) && !allowed) {
+    *aShouldLoad = nsIContentPolicy::REJECT_TYPE;
+  }
+  return rv;
 }
 
 NS_IMETHODIMP
-nsWebBrowserContentPolicy::ShouldProcess(uint32_t          contentType,
-                                         nsIURI           *contentLocation,
-                                         nsIURI           *requestingLocation,
-                                         nsISupports      *requestingContext,
-                                         const nsACString &mimeGuess,
-                                         nsISupports      *extra,
-                                         nsIPrincipal     *requestPrincipal,
-                                         int16_t          *shouldProcess)
+nsWebBrowserContentPolicy::ShouldProcess(uint32_t aContentType,
+                                         nsIURI* aContentLocation,
+                                         nsIURI* aRequestingLocation,
+                                         nsISupports* aRequestingContext,
+                                         const nsACString& aMimeGuess,
+                                         nsISupports* aExtra,
+                                         nsIPrincipal* aRequestPrincipal,
+                                         int16_t* aShouldProcess)
 {
-    NS_PRECONDITION(shouldProcess, "Null out param");
+  NS_PRECONDITION(aShouldProcess, "Null out param");
 
-    *shouldProcess = nsIContentPolicy::ACCEPT;
+  *aShouldProcess = nsIContentPolicy::ACCEPT;
 
-    // Object tags will always open channels with TYPE_OBJECT, but may end up
-    // loading with TYPE_IMAGE or TYPE_DOCUMENT as their final type, so we block
-    // actual-plugins at the process stage
-    if (contentType != nsIContentPolicy::TYPE_OBJECT) {
-        return NS_OK;
-    }
+  // Object tags will always open channels with TYPE_OBJECT, but may end up
+  // loading with TYPE_IMAGE or TYPE_DOCUMENT as their final type, so we block
+  // actual-plugins at the process stage
+  if (aContentType != nsIContentPolicy::TYPE_OBJECT) {
+    return NS_OK;
+  }
 
-    nsIDocShell *shell = NS_CP_GetDocShellFromContext(requestingContext);
-    if (shell && (!shell->PluginsAllowedInCurrentDoc())) {
-        *shouldProcess = nsIContentPolicy::REJECT_TYPE;
-    }
+  nsIDocShell* shell = NS_CP_GetDocShellFromContext(aRequestingContext);
+  if (shell && (!shell->PluginsAllowedInCurrentDoc())) {
+    *aShouldProcess = nsIContentPolicy::REJECT_TYPE;
+  }
 
-    return NS_OK;
+  return NS_OK;
 }
--- a/embedding/browser/nsWebBrowserContentPolicy.h
+++ b/embedding/browser/nsWebBrowserContentPolicy.h
@@ -3,24 +3,24 @@
  * 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 "nsIContentPolicy.h"
 
 /* f66bc334-1dd1-11b2-bab2-90e04fe15c19 */
 #define NS_WEBBROWSERCONTENTPOLICY_CID \
-{ 0xf66bc334, 0x1dd1, 0x11b2, { 0xba, 0xb2, 0x90, 0xe0, 0x4f, 0xe1, 0x5c, 0x19 } }
+  { 0xf66bc334, 0x1dd1, 0x11b2, { 0xba, 0xb2, 0x90, 0xe0, 0x4f, 0xe1, 0x5c, 0x19 } }
 
-#define NS_WEBBROWSERCONTENTPOLICY_CONTRACTID "@mozilla.org/embedding/browser/content-policy;1"
+#define NS_WEBBROWSERCONTENTPOLICY_CONTRACTID                                  \
+  "@mozilla.org/embedding/browser/content-policy;1"
 
 class nsWebBrowserContentPolicy : public nsIContentPolicy
 {
 protected:
-    virtual ~nsWebBrowserContentPolicy();
+  virtual ~nsWebBrowserContentPolicy();
 
 public:
-    nsWebBrowserContentPolicy();
+  nsWebBrowserContentPolicy();
 
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSICONTENTPOLICY
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSICONTENTPOLICY
 };
-