Bug 1018486 - Part 9: Changes to account for modifications to clang plugin. r=ehsan, a=ritu
authorMichael Layzell <michael@thelayzells.com>
Wed, 21 Sep 2016 22:20:14 -0400
changeset 350356 7912cc5ad078d3fd1b7255b12f20e326d8e6623f
parent 350355 11548f0f2aba6321b7c0de6d7441214a94e0de64
child 350357 3ec85c5489927717bd2bcd9cd4d3881d9d44c4ef
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, ritu
bugs1018486
milestone50.0
Bug 1018486 - Part 9: Changes to account for modifications to clang plugin. r=ehsan, a=ritu MozReview-Commit-ID: EPQMbfHYxUK
dom/base/nsCopySupport.cpp
dom/base/nsDOMAttributeMap.cpp
dom/events/IMEStateManager.cpp
dom/html/nsHTMLDocument.cpp
dom/indexedDB/ActorsParent.cpp
dom/jsurl/nsJSProtocolHandler.cpp
dom/network/UDPSocketParent.cpp
js/xpconnect/src/nsXPConnect.cpp
media/mtransport/nr_timer.cpp
security/manager/pki/nsNSSDialogs.cpp
toolkit/components/downloads/ApplicationReputation.cpp
toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
toolkit/xre/nsAppRunner.cpp
--- a/dom/base/nsCopySupport.cpp
+++ b/dom/base/nsCopySupport.cpp
@@ -506,17 +506,18 @@ static nsresult AppendDOMNode(nsITransfe
   NS_ENSURE_SUCCESS(rv, rv);
 
   // get document for the encoder
   nsCOMPtr<nsIDocument> document = aDOMNode->OwnerDoc();
 
   // Note that XHTML is not counted as HTML here, because we can't copy it
   // properly (all the copy code for non-plaintext assumes using HTML
   // serializers and parsers is OK, and those mess up XHTML).
-  nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(document, &rv);
+  DebugOnly<nsCOMPtr<nsIHTMLDocument>> htmlDoc =
+    nsCOMPtr<nsIHTMLDocument>(do_QueryInterface(document, &rv));
   NS_ENSURE_SUCCESS(rv, NS_OK);
 
   NS_ENSURE_TRUE(document->IsHTMLDocument(), NS_OK);
 
   // init encoder with document and node
   rv = docEncoder->NativeInit(document, NS_LITERAL_STRING(kHTMLMime),
                               nsIDocumentEncoder::OutputAbsoluteLinks |
                               nsIDocumentEncoder::OutputEncodeW3CEntities);
--- a/dom/base/nsDOMAttributeMap.cpp
+++ b/dom/base/nsDOMAttributeMap.cpp
@@ -255,17 +255,17 @@ nsDOMAttributeMap::SetNamedItemNS(Attr& 
     // setting a preexisting attribute is a no-op, just return the same
     // node.
     RefPtr<Attr> attribute = &aAttr;
     return attribute.forget();
   }
 
   nsresult rv;
   if (mContent->OwnerDoc() != aAttr.OwnerDoc()) {
-    nsCOMPtr<nsINode> adoptedNode =
+    DebugOnly<void*> adoptedNode =
       mContent->OwnerDoc()->AdoptNode(aAttr, aError);
     if (aError.Failed()) {
       return nullptr;
     }
 
     NS_ASSERTION(adoptedNode == &aAttr, "Uh, adopt node changed nodes?");
   }
 
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -318,17 +318,17 @@ IMEStateManager::OnRemoveContent(nsPresC
       MOZ_LOG(sISMLog, LogLevel::Debug,
         ("  OnRemoveContent(), "
          "composition is in the content"));
 
       // Try resetting the native IME state.  Be aware, typically, this method
       // is called during the content being removed.  Then, the native
       // composition events which are caused by following APIs are ignored due
       // to unsafe to run script (in PresShell::HandleEvent()).
-      nsCOMPtr<nsIWidget> widget = aPresContext->GetRootWidget();
+      DebugOnly<void*> widget = aPresContext->GetRootWidget();
       MOZ_ASSERT(widget, "Why is there no widget?");
       nsresult rv =
         compositionInContent->NotifyIME(REQUEST_TO_CANCEL_COMPOSITION);
       if (NS_FAILED(rv)) {
         compositionInContent->NotifyIME(REQUEST_TO_COMMIT_COMPOSITION);
       }
     }
   }
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -2665,18 +2665,20 @@ nsHTMLDocument::EditingStateChanged()
   nsresult rv = docshell->GetEditingSession(getter_AddRefs(editSession));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIEditor> existingEditor;
   editSession->GetEditorForWindow(window, getter_AddRefs(existingEditor));
   if (existingEditor) {
     // We might already have an editor if it was set up for mail, let's see
     // if this is actually the case.
+#ifdef DEBUG
     nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(existingEditor);
     MOZ_ASSERT(htmlEditor, "If we have an editor, it must be an HTML editor");
+#endif
     uint32_t flags = 0;
     existingEditor->GetFlags(&flags);
     if (flags & nsIPlaintextEditor::eEditorMailMask) {
       // We already have a mail editor, then we should not attempt to create
       // another one.
       return NS_OK;
     }
   }
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -23883,18 +23883,17 @@ nsresult
 CreateIndexOp::InsertDataFromObjectStoreInternal(
                                                 DatabaseConnection* aConnection)
 {
   MOZ_ASSERT(aConnection);
   aConnection->AssertIsOnConnectionThread();
   MOZ_ASSERT(!IndexedDatabaseManager::InLowDiskSpaceMode());
   MOZ_ASSERT(mMaybeUniqueIndexTable);
 
-  nsCOMPtr<mozIStorageConnection> storageConnection =
-    aConnection->GetStorageConnection();
+  DebugOnly<void*> storageConnection = aConnection->GetStorageConnection();
   MOZ_ASSERT(storageConnection);
 
   DatabaseConnection::CachedStatement stmt;
   nsresult rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
     "UPDATE object_data "
       "SET index_data_values = update_index_data_values "
         "(key, index_data_values, file_ids, data) "
       "WHERE object_store_id = :object_store_id;"),
--- a/dom/jsurl/nsJSProtocolHandler.cpp
+++ b/dom/jsurl/nsJSProtocolHandler.cpp
@@ -211,17 +211,17 @@ nsresult nsJSThunk::EvaluateScript(nsICh
     nsPIDOMWindowInner *innerWin = win->GetCurrentInnerWindow();
 
     if (innerWin != aOriginalInnerWindow) {
         return NS_ERROR_UNEXPECTED;
     }
 
     nsCOMPtr<nsIScriptGlobalObject> innerGlobal = do_QueryInterface(innerWin);
 
-    nsCOMPtr<nsIDOMWindow> domWindow(do_QueryInterface(global, &rv));
+    mozilla::DebugOnly<nsCOMPtr<nsIDOMWindow>> domWindow(do_QueryInterface(global, &rv));
     if (NS_FAILED(rv)) {
         return NS_ERROR_FAILURE;
     }
 
     // So far so good: get the script context from its owner.
     nsCOMPtr<nsIScriptContext> scriptContext = global->GetContext();
     if (!scriptContext)
         return NS_ERROR_FAILURE;
--- a/dom/network/UDPSocketParent.cpp
+++ b/dom/network/UDPSocketParent.cpp
@@ -279,19 +279,19 @@ static nsCOMPtr<nsIEventTarget> GetSTSTh
   sts_thread = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv);
   MOZ_ASSERT(NS_SUCCEEDED(rv));
 
   return sts_thread;
 }
 
 static void CheckSTSThread()
 {
-  nsCOMPtr<nsIEventTarget> sts_thread = GetSTSThread();
+  DebugOnly<nsCOMPtr<nsIEventTarget>> sts_thread = GetSTSThread();
 
-  ASSERT_ON_THREAD(sts_thread);
+  ASSERT_ON_THREAD(sts_thread.value);
 }
 
 
 // Proxy the Connect() request to the STS thread, since it may block and
 // should be done there.
 bool
 UDPSocketParent::RecvConnect(const UDPAddressInfo& aAddressInfo)
 {
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -338,20 +338,22 @@ xpc_MarkInCCGeneration(nsISupports* aVar
           weak->RemovePurple();
         }
     }
 }
 
 void
 xpc_TryUnmarkWrappedGrayObject(nsISupports* aWrappedJS)
 {
+#ifdef DEBUG
     nsCOMPtr<nsIXPConnectWrappedJSUnmarkGray> wjsug =
       do_QueryInterface(aWrappedJS);
     MOZ_ASSERT(!wjsug, "One should never be able to QI to "
                        "nsIXPConnectWrappedJSUnmarkGray successfully!");
+#endif
 }
 
 /***************************************************************************/
 /***************************************************************************/
 // nsIXPConnect interface methods...
 
 template<typename T>
 static inline T UnexpectedFailure(T rv)
--- a/media/mtransport/nr_timer.cpp
+++ b/media/mtransport/nr_timer.cpp
@@ -53,16 +53,17 @@
 
 #include "nsCOMPtr.h"
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIEventTarget.h"
 #include "nsITimer.h"
 #include "nsNetCID.h"
 #include "runnable_utils.h"
+#include "mozilla/DebugOnly.h"
 
 extern "C" {
 #include "nr_api.h"
 #include "async_timer.h"
 }
 
 
 namespace mozilla {
@@ -161,19 +162,19 @@ static nsCOMPtr<nsIEventTarget> GetSTSTh
   MOZ_ASSERT(NS_SUCCEEDED(rv));
 
   return sts_thread;
 }
 
 // These timers must only be used from the STS thread.
 // This function is a helper that enforces that.
 static void CheckSTSThread() {
-  nsCOMPtr<nsIEventTarget> sts_thread = GetSTSThread();
+  DebugOnly<nsCOMPtr<nsIEventTarget>> sts_thread = GetSTSThread();
 
-  ASSERT_ON_THREAD(sts_thread);
+  ASSERT_ON_THREAD(sts_thread.value);
 }
 
 static int nr_async_timer_set_zero(NR_async_cb cb, void *arg,
                                    char *func, int l,
                                    nrappkitCallback **handle) {
   nrappkitScheduledCallback* callback(new nrappkitScheduledCallback(
       cb, arg, func, l));
 
--- a/security/manager/pki/nsNSSDialogs.cpp
+++ b/security/manager/pki/nsNSSDialogs.cpp
@@ -265,19 +265,16 @@ nsNSSDialogs::PickCertificate(nsIInterfa
                               int32_t *selectedIndex, 
                               bool *canceled) 
 {
   nsresult rv;
   uint32_t i;
 
   *canceled = false;
 
-  // Get the parent window for the dialog
-  nsCOMPtr<nsIDOMWindow> parent = do_GetInterface(ctx);
-
   nsCOMPtr<nsIDialogParamBlock> block =
            do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID);
   if (!block) return NS_ERROR_FAILURE;
 
   block->SetNumberStrings(1+count*2);
 
   for (i = 0; i < count; i++) {
     rv = block->SetString(i, certNickList[i]);
@@ -430,19 +427,16 @@ nsNSSDialogs::DisplayGeneratingKeypairIn
 
 NS_IMETHODIMP
 nsNSSDialogs::ChooseToken(nsIInterfaceRequestor *aCtx, const char16_t **aTokenList, uint32_t aCount, char16_t **aTokenChosen, bool *aCanceled) {
   nsresult rv;
   uint32_t i;
 
   *aCanceled = false;
 
-  // Get the parent window for the dialog
-  nsCOMPtr<nsIDOMWindow> parent = do_GetInterface(aCtx);
-
   nsCOMPtr<nsIDialogParamBlock> block =
            do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID);
   if (!block) return NS_ERROR_FAILURE;
 
   block->SetNumberStrings(aCount);
 
   for (i = 0; i < aCount; i++) {
     rv = block->SetString(i, aTokenList[i]);
--- a/toolkit/components/downloads/ApplicationReputation.cpp
+++ b/toolkit/components/downloads/ApplicationReputation.cpp
@@ -1265,16 +1265,17 @@ PendingLookup::SendRemoteQueryInternal()
   nsCOMPtr<nsILoadInfo> loadInfo = mChannel->GetLoadInfo();
   if (loadInfo) {
     loadInfo->SetOriginAttributes(
       mozilla::NeckoOriginAttributes(NECKO_SAFEBROWSING_APP_ID, false));
   }
 
   nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(mChannel, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
+  mozilla::Unused << httpChannel;
 
   // Upload the protobuf to the application reputation service.
   nsCOMPtr<nsIUploadChannel2> uploadChannel = do_QueryInterface(mChannel, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = uploadChannel->ExplicitSetUploadStream(sstream,
     NS_LITERAL_CSTRING("application/octet-stream"), serialized.size(),
     NS_LITERAL_CSTRING("POST"), false);
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
@@ -1609,16 +1609,18 @@ nsUrlClassifierDBService::GetCompleter(c
 NS_IMETHODIMP
 nsUrlClassifierDBService::Observe(nsISupports *aSubject, const char *aTopic,
                                   const char16_t *aData)
 {
   if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
     nsresult rv;
     nsCOMPtr<nsIPrefBranch> prefs(do_QueryInterface(aSubject, &rv));
     NS_ENSURE_SUCCESS(rv, rv);
+    Unused << prefs;
+
     if (NS_LITERAL_STRING(CHECK_MALWARE_PREF).Equals(aData)) {
       mCheckMalware = Preferences::GetBool(CHECK_MALWARE_PREF,
         CHECK_MALWARE_DEFAULT);
     } else if (NS_LITERAL_STRING(CHECK_PHISHING_PREF).Equals(aData)) {
       mCheckPhishing = Preferences::GetBool(CHECK_PHISHING_PREF,
         CHECK_PHISHING_DEFAULT);
     } else if (NS_LITERAL_STRING(CHECK_TRACKING_PREF).Equals(aData) ||
                NS_LITERAL_STRING(CHECK_TRACKING_PB_PREF).Equals(aData)) {
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -1399,19 +1399,21 @@ ScopedXPCOMStartup::Initialize()
 
   rv = NS_InitXPCOM2(&mServiceManager, gDirServiceProvider->GetAppDir(),
                      gDirServiceProvider);
   if (NS_FAILED(rv)) {
     NS_ERROR("Couldn't start xpcom!");
     mServiceManager = nullptr;
   }
   else {
+#ifdef DEBUG
     nsCOMPtr<nsIComponentRegistrar> reg =
       do_QueryInterface(mServiceManager);
     NS_ASSERTION(reg, "Service Manager doesn't QI to Registrar.");
+#endif
   }
 
   return rv;
 }
 
 /**
  * This is a little factory class that serves as a singleton-service-factory
  * for the nativeappsupport object.