Bug 1018486 - Part 8: Various other changes, r=smaug
authorMichael Layzell <michael@thelayzells.com>
Mon, 18 Jul 2016 12:44:45 -0400
changeset 313047 9f60d4e661e40a33d866ad5006e8a2f5f9007a89
parent 313046 f5ff51f80c2de3d1d8539e9d6041bf0e052c34a4
child 313048 59495d40a3c1270d59fafa99127be3c6e23a3300
push id30669
push userkwierso@gmail.com
push dateThu, 08 Sep 2016 00:56:12 +0000
treeherdermozilla-central@77940cbf0c2a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1018486
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1018486 - Part 8: Various other changes, r=smaug MozReview-Commit-ID: B0dsomkWgEk
accessible/xul/XULTreeAccessible.cpp
caps/DomainPolicy.cpp
chrome/nsChromeRegistryContent.cpp
embedding/browser/nsWebBrowser.cpp
embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
extensions/spellcheck/src/mozInlineSpellChecker.cpp
gfx/tests/gtest/TestTreeTraversal.cpp
image/SVGDocumentWrapper.cpp
image/imgRequestProxy.cpp
js/xpconnect/src/XPCComponents.cpp
mfbt/tests/TestNotNull.cpp
modules/libjar/nsJAR.cpp
modules/libjar/nsJARChannel.cpp
netwerk/cache2/CacheEntry.cpp
netwerk/ipc/ChannelEventQueue.cpp
netwerk/protocol/http/InterceptedChannel.cpp
netwerk/sctp/datachannel/DataChannel.cpp
rdf/base/nsRDFXMLDataSource.cpp
security/manager/pki/nsASN1Tree.cpp
security/manager/ssl/nsNSSComponent.cpp
storage/mozStorageAsyncStatementExecution.cpp
toolkit/components/satchel/nsFormFillController.cpp
toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
xpcom/components/nsComponentManager.cpp
xpcom/tests/TestCOMPtr.cpp
xpcom/tests/TestNsRefPtr.cpp
--- a/accessible/xul/XULTreeAccessible.cpp
+++ b/accessible/xul/XULTreeAccessible.cpp
@@ -119,17 +119,16 @@ XULTreeAccessible::Value(nsString& aValu
 
   // Return the value is the first selected child.
   nsCOMPtr<nsITreeSelection> selection;
   mTreeView->GetSelection(getter_AddRefs(selection));
   if (!selection)
     return;
 
   int32_t currentIndex;
-  nsCOMPtr<nsIDOMElement> selectItem;
   selection->GetCurrentIndex(&currentIndex);
   if (currentIndex >= 0) {
     nsCOMPtr<nsITreeColumn> keyCol;
 
     nsCOMPtr<nsITreeColumns> cols;
     mTree->GetColumns(getter_AddRefs(cols));
     if (cols)
       cols->GetKeyColumn(getter_AddRefs(keyCol));
--- a/caps/DomainPolicy.cpp
+++ b/caps/DomainPolicy.cpp
@@ -136,18 +136,16 @@ CopyURIs(const InfallibleTArray<URIParam
         nsCOMPtr<nsIURI> uri = DeserializeURI(aDomains[i]);
         aSet->Add(uri);
     }
 }
 
 void
 DomainPolicy::ApplyClone(DomainPolicyClone* aClone)
 {
-    nsCOMPtr<nsIDomainSet> list;
-
     CopyURIs(aClone->blacklist(), mBlacklist);
     CopyURIs(aClone->whitelist(), mWhitelist);
     CopyURIs(aClone->superBlacklist(), mSuperBlacklist);
     CopyURIs(aClone->superWhitelist(), mSuperWhitelist);
 }
 
 static already_AddRefed<nsIURI>
 GetCanonicalClone(nsIURI* aURI)
--- a/chrome/nsChromeRegistryContent.cpp
+++ b/chrome/nsChromeRegistryContent.cpp
@@ -70,17 +70,16 @@ nsChromeRegistryContent::RegisterPackage
     nsresult rv = NS_NewURI(getter_AddRefs(locale),
                             aPackage.localeBaseURI.spec,
                             aPackage.localeBaseURI.charset.get(),
                             nullptr, io);
     if (NS_FAILED(rv))
       return;
   }
   if (aPackage.skinBaseURI.spec.Length()) {
-    nsCOMPtr<nsIURI> skinBaseURI;
     nsresult rv = NS_NewURI(getter_AddRefs(skin),
                             aPackage.skinBaseURI.spec,
                             aPackage.skinBaseURI.charset.get(),
                             nullptr, io);
     if (NS_FAILED(rv))
       return;
   }
 
--- a/embedding/browser/nsWebBrowser.cpp
+++ b/embedding/browser/nsWebBrowser.cpp
@@ -1656,17 +1656,21 @@ nsWebBrowser::ScrollByPages(int32_t aNum
 
 //*****************************************************************************
 // nsWebBrowser: Listener Helpers
 //*****************************************************************************
 
 NS_IMETHODIMP
 nsWebBrowser::SetDocShell(nsIDocShell* aDocShell)
 {
+  // We need to keep the docshell alive while we perform the changes, but we
+  // don't need to call any methods on it.
   nsCOMPtr<nsIDocShell> kungFuDeathGrip(mDocShell);
+  mozilla::Unused << kungFuDeathGrip;
+
   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));
     nsCOMPtr<nsIScrollable> scrollable(do_QueryInterface(aDocShell));
     nsCOMPtr<nsITextScroll> textScroll(do_QueryInterface(aDocShell));
--- a/embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
+++ b/embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
@@ -1524,17 +1524,16 @@ nsWebBrowserPersist::GetExtensionForCont
 
     nsresult rv;
     if (!mMIMEService)
     {
         mMIMEService = do_GetService(NS_MIMESERVICE_CONTRACTID, &rv);
         NS_ENSURE_TRUE(mMIMEService, NS_ERROR_FAILURE);
     }
 
-    nsCOMPtr<nsIMIMEInfo> mimeInfo;
     nsAutoCString contentType;
     contentType.AssignWithConversion(aContentType);
     nsAutoCString ext;
     rv = mMIMEService->GetPrimaryExtension(contentType, EmptyCString(), ext);
     if (NS_SUCCEEDED(rv))
     {
         *aExt = UTF8ToNewUnicode(ext);
         NS_ENSURE_TRUE(*aExt, NS_ERROR_OUT_OF_MEMORY);
--- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp
@@ -1800,17 +1800,16 @@ nsresult mozInlineSpellChecker::GetSpell
 { 
   nsCOMPtr<nsIEditor> editor (do_QueryReferent(mEditor));
   NS_ENSURE_TRUE(editor, NS_ERROR_NULL_POINTER);
 
   nsCOMPtr<nsISelectionController> selcon;
   nsresult rv = editor->GetSelectionController(getter_AddRefs(selcon));
   NS_ENSURE_SUCCESS(rv, rv); 
 
-  nsCOMPtr<nsISelection> spellCheckSelection;
   return selcon->GetSelection(nsISelectionController::SELECTION_SPELLCHECK, aSpellCheckSelection);
 }
 
 nsresult mozInlineSpellChecker::SaveCurrentSelectionPosition()
 {
   nsCOMPtr<nsIEditor> editor (do_QueryReferent(mEditor));
   NS_ENSURE_TRUE(editor, NS_OK);
 
--- a/gfx/tests/gtest/TestTreeTraversal.cpp
+++ b/gfx/tests/gtest/TestTreeTraversal.cpp
@@ -1496,17 +1496,16 @@ static void TreeTraversal_ForwardDepthFi
   ASSERT_EQ(root, foundNode);
 }
 
 MOZ_GTEST_BENCH(TreeTraversal, TreeTraversal_ForwardDepthFirstSearchPostOrderPerformance, &TreeTraversal_ForwardDepthFirstSearchPostOrderPerformance);
 
 template <typename Node>
 static RefPtr<Node> BreadthFirstSearchForwardQueue(RefPtr<Node> aNode)
 {
-  RefPtr<Node> returnNode = nullptr;
   queue<RefPtr<Node>> nodes;
   nodes.push(aNode);
   while(!nodes.empty()) {
     RefPtr<Node> node = nodes.front();
     nodes.pop();
     if (node->GetType() == SearchNodeType::Needle) {
       return node;
     }
@@ -1946,17 +1945,16 @@ static void TreeTraversal_ReverseDepthFi
   ASSERT_EQ(root, foundNode);
 }
 
 MOZ_GTEST_BENCH(TreeTraversal, TreeTraversal_ReverseDepthFirstSearchPostOrderPerformance, &TreeTraversal_ReverseDepthFirstSearchPostOrderPerformance);
 
 template <typename Node>
 static RefPtr<Node> BreadthFirstSearchReverseQueue(RefPtr<Node> aNode)
 {
-  RefPtr<Node> returnNode = nullptr;
   queue<RefPtr<Node>> nodes;
   nodes.push(aNode);
   while(!nodes.empty()) {
     RefPtr<Node> node = nodes.front();
     nodes.pop();
     if (node->GetType() == SearchNodeType::Needle) {
       return node;
     }
--- a/image/SVGDocumentWrapper.cpp
+++ b/image/SVGDocumentWrapper.cpp
@@ -363,18 +363,17 @@ SVGDocumentWrapper::SetupViewer(nsIReque
   RefPtr<nsDOMNavigationTiming> timing = new nsDOMNavigationTiming();
   timing->NotifyNavigationStart();
   viewer->SetNavigationTiming(timing);
 
   nsCOMPtr<nsIParser> parser = do_QueryInterface(listener);
   NS_ENSURE_TRUE(parser, NS_ERROR_UNEXPECTED);
 
   // XML-only, because this is for SVG content
-  nsIContentSink* sink = parser->GetContentSink();
-  nsCOMPtr<nsIXMLContentSink> xmlSink = do_QueryInterface(sink);
+  nsCOMPtr<nsIContentSink> sink = parser->GetContentSink();
   NS_ENSURE_TRUE(sink, NS_ERROR_UNEXPECTED);
 
   listener.swap(mListener);
   viewer.forget(aViewer);
   newLoadGroup.forget(aLoadGroup);
 
   RegisterForXPCOMShutdown();
   return NS_OK;
--- a/image/imgRequestProxy.cpp
+++ b/image/imgRequestProxy.cpp
@@ -782,17 +782,17 @@ imgRequestProxy::Notify(int32_t aType, c
 
   if (!mListener || mCanceled) {
     return;
   }
 
   // Make sure the listener stays alive while we notify.
   nsCOMPtr<imgINotificationObserver> listener(mListener);
 
-  mListener->Notify(this, aType, aRect);
+  listener->Notify(this, aType, aRect);
 }
 
 void
 imgRequestProxy::OnLoadComplete(bool aLastPart)
 {
   if (MOZ_LOG_TEST(gImgLog, LogLevel::Debug)) {
     nsAutoCString name;
     GetName(name);
@@ -802,18 +802,18 @@ imgRequestProxy::OnLoadComplete(bool aLa
 
   // There's all sorts of stuff here that could kill us (the OnStopRequest call
   // on the listener, the removal from the loadgroup, the release of the
   // listener, etc).  Don't let them do it.
   nsCOMPtr<imgIRequest> kungFuDeathGrip(this);
 
   if (mListener && !mCanceled) {
     // Hold a ref to the listener while we call it, just in case.
-    nsCOMPtr<imgINotificationObserver> kungFuDeathGrip(mListener);
-    mListener->Notify(this, imgINotificationObserver::LOAD_COMPLETE, nullptr);
+    nsCOMPtr<imgINotificationObserver> listener(mListener);
+    listener->Notify(this, imgINotificationObserver::LOAD_COMPLETE, nullptr);
   }
 
   // If we're expecting more data from a multipart channel, re-add ourself
   // to the loadgroup so that the document doesn't lose track of the load.
   // If the request is already a background request and there's more data
   // coming, we can just leave the request in the loadgroup as-is.
   if (aLastPart || (mLoadFlags & nsIRequest::LOAD_BACKGROUND) == 0) {
     RemoveFromLoadGroup(aLastPart);
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -54,17 +54,16 @@ xpc::ThrowAndFail(nsresult errNum, JSCon
     return NS_OK;
 }
 
 static bool
 JSValIsInterfaceOfType(JSContext* cx, HandleValue v, REFNSIID iid)
 {
 
     nsCOMPtr<nsIXPConnectWrappedNative> wn;
-    nsCOMPtr<nsISupports> sup;
     nsCOMPtr<nsISupports> iface;
 
     if (v.isPrimitive())
         return false;
 
     nsXPConnect* xpc = nsXPConnect::XPConnect();
     RootedObject obj(cx, &v.toObject());
     return NS_SUCCEEDED(xpc->GetWrappedNativeOfJSObject(cx, obj, getter_AddRefs(wn))) && wn &&
--- a/mfbt/tests/TestNotNull.cpp
+++ b/mfbt/tests/TestNotNull.cpp
@@ -2,16 +2,17 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "mozilla/NotNull.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/UniquePtr.h"
+#include "mozilla/Unused.h"
 
 using mozilla::WrapNotNull;
 using mozilla::MakeUnique;
 using mozilla::NotNull;
 using mozilla::UniquePtr;
 
 #define CHECK MOZ_RELEASE_ASSERT
 
@@ -278,20 +279,22 @@ TestNotNullWithRefPtr()
   // At this point the refcount is 2.
 
   NotNull<MyRefType*> r3 = r2;
   (void)r3;
 
   // At this point the refcount is still 2.
 
   RefPtr<MyRefType> r4 = r2;
+  mozilla::Unused << r4;
 
   // At this point the refcount is 3.
 
   RefPtr<MyRefType> r5 = r3.get();
+  mozilla::Unused << r5;
 
   // At this point the refcount is 4.
 
   // No change to the refcount occurs because of the argument passing. Within
   // f_ref() the refcount temporarily hits 5, due to the local RefPtr.
   f_ref(r2);
 
   // At this point the refcount is 4.
--- a/modules/libjar/nsJAR.cpp
+++ b/modules/libjar/nsJAR.cpp
@@ -1107,17 +1107,16 @@ nsZipReaderCache::~nsZipReaderCache()
 #endif
 }
 
 NS_IMETHODIMP
 nsZipReaderCache::IsCached(nsIFile* zipFile, bool* aResult)
 {
   NS_ENSURE_ARG_POINTER(zipFile);
   nsresult rv;
-  nsCOMPtr<nsIZipReader> antiLockZipGrip;
   MutexAutoLock lock(mLock);
 
   nsAutoCString uri;
   rv = zipFile->GetNativePath(uri);
   if (NS_FAILED(rv))
     return rv;
 
   uri.Insert(NS_LITERAL_CSTRING("file:"), 0);
@@ -1126,17 +1125,16 @@ nsZipReaderCache::IsCached(nsIFile* zipF
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsZipReaderCache::GetZip(nsIFile* zipFile, nsIZipReader* *result)
 {
   NS_ENSURE_ARG_POINTER(zipFile);
   nsresult rv;
-  nsCOMPtr<nsIZipReader> antiLockZipGrip;
   MutexAutoLock lock(mLock);
 
 #ifdef ZIP_CACHE_HIT_RATE
   mZipCacheLookups++;
 #endif
 
   nsAutoCString uri;
   rv = zipFile->GetNativePath(uri);
--- a/modules/libjar/nsJARChannel.cpp
+++ b/modules/libjar/nsJARChannel.cpp
@@ -330,17 +330,16 @@ nsresult
 nsJARChannel::LookupFile(bool aAllowAsync)
 {
     LOG(("nsJARChannel::LookupFile [this=%x %s]\n", this, mSpec.get()));
 
     if (mJarFile)
         return NS_OK;
 
     nsresult rv;
-    nsCOMPtr<nsIURI> uri;
 
     rv = mJarURI->GetJARFile(getter_AddRefs(mJarBaseURI));
     if (NS_FAILED(rv))
         return rv;
 
     rv = mJarURI->GetJAREntry(mJarEntry);
     if (NS_FAILED(rv))
         return rv;
--- a/netwerk/cache2/CacheEntry.cpp
+++ b/netwerk/cache2/CacheEntry.cpp
@@ -1818,17 +1818,16 @@ NS_IMETHODIMP CacheOutputCloseListener::
   return NS_OK;
 }
 
 // Memory reporting
 
 size_t CacheEntry::SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const
 {
   size_t n = 0;
-  nsCOMPtr<nsISizeOf> sizeOf;
 
   n += mCallbacks.ShallowSizeOfExcludingThis(mallocSizeOf);
   if (mFile) {
     n += mFile->SizeOfIncludingThis(mallocSizeOf);
   }
 
   n += mURI.SizeOfExcludingThisIfUnshared(mallocSizeOf);
   n += mEnhanceID.SizeOfExcludingThisIfUnshared(mallocSizeOf);
--- a/netwerk/ipc/ChannelEventQueue.cpp
+++ b/netwerk/ipc/ChannelEventQueue.cpp
@@ -4,16 +4,17 @@
 /* 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 "nsISupports.h"
 #include "mozilla/net/ChannelEventQueue.h"
 #include "mozilla/Unused.h"
 #include "nsThreadUtils.h"
+#include "mozilla/Unused.h"
 
 namespace mozilla {
 namespace net {
 
 ChannelEvent*
 ChannelEventQueue::TakeEvent()
 {
   MutexAutoLock lock(mMutex);
@@ -31,16 +32,17 @@ ChannelEventQueue::TakeEvent()
 
 void
 ChannelEventQueue::FlushQueue()
 {
   // Events flushed could include destruction of channel (and our own
   // destructor) unless we make sure its refcount doesn't drop to 0 while this
   // method is running.
   nsCOMPtr<nsISupports> kungFuDeathGrip(mOwner);
+  mozilla::Unused << kungFuDeathGrip; // Not used in this function
 
   // Prevent flushed events from flushing the queue recursively
   {
     MutexAutoLock lock(mMutex);
     mFlushing = true;
   }
 
   while (true) {
--- a/netwerk/protocol/http/InterceptedChannel.cpp
+++ b/netwerk/protocol/http/InterceptedChannel.cpp
@@ -157,18 +157,16 @@ InterceptedChannelChrome::InterceptedCha
   if (NS_WARN_IF(NS_FAILED(rv))) {
     mOldApplyConversion = false;
   }
 }
 
 void
 InterceptedChannelChrome::NotifyController()
 {
-  nsCOMPtr<nsIOutputStream> out;
-
   // Intercepted responses should already be decoded.
   mChannel->SetApplyConversion(false);
 
   nsresult rv = mSynthesizedCacheEntry->OpenOutputStream(0, getter_AddRefs(mResponseBody));
   NS_ENSURE_SUCCESS_VOID(rv);
 
   DoNotifyController();
 }
--- a/netwerk/sctp/datachannel/DataChannel.cpp
+++ b/netwerk/sctp/datachannel/DataChannel.cpp
@@ -2541,17 +2541,17 @@ DataChannel::~DataChannel()
   NS_ASSERTION(mState == CLOSED || mState == CLOSING, "unexpected state in ~DataChannel");
 }
 
 void
 DataChannel::Close()
 {
   ENSURE_DATACONNECTION;
   RefPtr<DataChannelConnection> connection(mConnection);
-  mConnection->Close(this);
+  connection->Close(this);
 }
 
 // Used when disconnecting from the DataChannelConnection
 void
 DataChannel::DestroyLocked()
 {
   mConnection->mLock.AssertCurrentThreadOwns();
   ENSURE_DATACONNECTION;
--- a/rdf/base/nsRDFXMLDataSource.cpp
+++ b/rdf/base/nsRDFXMLDataSource.cpp
@@ -470,17 +470,16 @@ RDFXMLDataSourceImpl::BlockingParse(nsIU
 {
     nsresult rv;
 
     // XXX I really hate the way that we're spoon-feeding this stuff
     // to the parser: it seems like this is something that netlib
     // should be able to do by itself.
     
     nsCOMPtr<nsIChannel> channel;
-    nsCOMPtr<nsIRequest> request;
 
     // Null LoadGroup ?
     rv = NS_NewChannel(getter_AddRefs(channel),
                        aURL,
                        nsContentUtils::GetSystemPrincipal(),
                        nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
                        nsIContentPolicy::TYPE_OTHER);
 
--- a/security/manager/pki/nsASN1Tree.cpp
+++ b/security/manager/pki/nsASN1Tree.cpp
@@ -82,17 +82,16 @@ nsNSSASN1Tree::InitChildsRecursively(myN
   asn1Objects->GetLength(&numObjects);
   if (!numObjects) {
     n->seq = nullptr;
     return;
   }
 
   myNode *walk = nullptr;
   myNode *prev = nullptr;
-  nsCOMPtr<nsISupports> isupports;
   for (uint32_t i = 0; i < numObjects; i++) {
     if (0 == i) {
       n->child = walk = new myNode;
     }
     else {
       walk = new myNode;
     }
 
--- a/security/manager/ssl/nsNSSComponent.cpp
+++ b/security/manager/ssl/nsNSSComponent.cpp
@@ -2189,17 +2189,16 @@ nsNSSComponent::GetDefaultCertVerifier()
 namespace mozilla { namespace psm {
 
 already_AddRefed<SharedCertVerifier>
 GetDefaultCertVerifier()
 {
   static NS_DEFINE_CID(kNSSComponentCID, NS_NSSCOMPONENT_CID);
 
   nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(kNSSComponentCID));
-  RefPtr<SharedCertVerifier> certVerifier;
   if (nssComponent) {
     return nssComponent->GetDefaultCertVerifier();
   }
 
   return nullptr;
 }
 
 } } // namespace mozilla::psm
--- a/storage/mozStorageAsyncStatementExecution.cpp
+++ b/storage/mozStorageAsyncStatementExecution.cpp
@@ -65,20 +65,19 @@ public:
   NS_IMETHOD Run() override
   {
     NS_ASSERTION(mCallback, "Trying to notify about results without a callback!");
 
     if (mEventStatus->shouldNotify()) {
       // Hold a strong reference to the callback while notifying it, so that if
       // it spins the event loop, the callback won't be released and freed out
       // from under us.
-      nsCOMPtr<mozIStorageStatementCallback> callback =
-        do_QueryInterface(mCallback);
+      nsCOMPtr<mozIStorageStatementCallback> callback = mCallback;
 
-      (void)mCallback->HandleResult(mResults);
+      (void)callback->HandleResult(mResults);
     }
 
     return NS_OK;
   }
 
 private:
   mozIStorageStatementCallback *mCallback;
   nsCOMPtr<mozIStorageResultSet> mResults;
@@ -101,20 +100,19 @@ public:
   }
 
   NS_IMETHOD Run() override
   {
     if (mEventStatus->shouldNotify() && mCallback) {
       // Hold a strong reference to the callback while notifying it, so that if
       // it spins the event loop, the callback won't be released and freed out
       // from under us.
-      nsCOMPtr<mozIStorageStatementCallback> callback =
-        do_QueryInterface(mCallback);
+      nsCOMPtr<mozIStorageStatementCallback> callback = mCallback;
 
-      (void)mCallback->HandleError(mErrorObj);
+      (void)callback->HandleError(mErrorObj);
     }
 
     return NS_OK;
   }
 
 private:
   mozIStorageStatementCallback *mCallback;
   nsCOMPtr<mozIStorageError> mErrorObj;
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -608,17 +608,16 @@ nsFormFillController::GetInPrivateContex
     *aInPrivateContext = false;
     return NS_OK;
   }
 
   nsCOMPtr<nsIDOMDocument> inputDoc;
   nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mFocusedInput);
   element->GetOwnerDocument(getter_AddRefs(inputDoc));
   nsCOMPtr<nsIDocument> doc = do_QueryInterface(inputDoc);
-  nsCOMPtr<nsIDocShell> docShell = doc->GetDocShell();
   nsCOMPtr<nsILoadContext> loadContext = doc->GetLoadContext();
   *aInPrivateContext = loadContext && loadContext->UsePrivateBrowsing();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsFormFillController::GetNoRollupOnCaretMove(bool *aNoRollupOnCaretMove)
 {
--- a/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
+++ b/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
@@ -389,17 +389,16 @@ nsTypeAheadFind::FindItNow(nsIPresShell 
     docShellEnumerator->GetNext(getter_AddRefs(currentContainer));
     currentDocShell = do_QueryInterface(currentContainer);
     if (!currentDocShell || currentDocShell == startingDocShell || aIsFirstVisiblePreferred)
       break;    
   }
 
   // ------------ Get ranges ready ----------------
   nsCOMPtr<nsIDOMRange> returnRange;
-  nsCOMPtr<nsIPresShell> focusedPS;
   if (NS_FAILED(GetSearchContainers(currentContainer,
                                     (!aIsFirstVisiblePreferred ||
                                      mStartFindRange) ?
                                     selectionController.get() : nullptr,
                                     aIsFirstVisiblePreferred,  aFindPrev,
                                     getter_AddRefs(presShell),
                                     getter_AddRefs(presContext)))) {
     return NS_ERROR_FAILURE;
@@ -892,17 +891,17 @@ nsTypeAheadFind::RangeStartsInsideLink(n
     }
   }
 
   // ------- Check to see if inside link ---------
 
   // We now have the correct start node for the range
   // Search for links, starting with startNode, and going up parent chain
 
-  nsCOMPtr<nsIAtom> tag, hrefAtom(NS_Atomize("href"));
+  nsCOMPtr<nsIAtom> hrefAtom(NS_Atomize("href"));
   nsCOMPtr<nsIAtom> typeAtom(NS_Atomize("type"));
 
   while (true) {
     // Keep testing while startContent is equal to something,
     // eventually we'll run out of ancestors
 
     if (startContent->IsHTMLElement()) {
       nsCOMPtr<mozilla::dom::Link> link(do_QueryInterface(startContent));
--- a/xpcom/components/nsComponentManager.cpp
+++ b/xpcom/components/nsComponentManager.cpp
@@ -1982,17 +1982,16 @@ nsComponentManagerImpl::AddBootstrappedM
 NS_IMETHODIMP
 nsComponentManagerImpl::RemoveBootstrappedManifestLocation(nsIFile* aLocation)
 {
   nsCOMPtr<nsIChromeRegistry> cr = mozilla::services::GetChromeRegistryService();
   if (!cr) {
     return NS_ERROR_FAILURE;
   }
 
-  nsCOMPtr<nsIFile> manifest;
   nsString path;
   nsresult rv = aLocation->GetPath(path);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   nsComponentManagerImpl::ComponentLocation elem;
   elem.type = NS_BOOTSTRAPPED_LOCATION;
--- a/xpcom/tests/TestCOMPtr.cpp
+++ b/xpcom/tests/TestCOMPtr.cpp
@@ -2,16 +2,17 @@
 /* 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 <assert.h>
 #include <stdio.h>
 #include "nsCOMPtr.h"
 #include "nsISupports.h"
+#include "mozilla/Unused.h"
 
 #define NS_IFOO_IID \
 { 0x6f7652e0,  0xee43, 0x11d1, \
  { 0x9c, 0xc3, 0x00, 0x60, 0x08, 0x8c, 0xa6, 0xb3 } }
 
 class IFoo : public nsISupports
   {
 		public:
@@ -355,16 +356,17 @@ main()
       static_cast<IFoo*>(foop)->Release();
 
       printf("\n### Test  5: will a |nsCOMPtr| |Release| when it goes out of scope?\n");
     }
 
     {
       printf("\n### Test  6: will a |nsCOMPtr| call the correct destructor?\n");
       nsCOMPtr<IFoo> foop( do_QueryInterface(new IBar) );
+      mozilla::Unused << foop;
     }
 
     {
       printf("\n### Test  7: can you compare one |nsCOMPtr| with another [!=]?\n");
 
       nsCOMPtr<IFoo> foo1p( do_QueryInterface(new IFoo) );
 
         // [Shouldn't compile] Is it a compile time error to omit |getter_[doesnt_]AddRef[s]|?
--- a/xpcom/tests/TestNsRefPtr.cpp
+++ b/xpcom/tests/TestNsRefPtr.cpp
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <assert.h>
 #include <stdio.h>
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "nsISupports.h"
 #include "nsQueryObject.h"
+#include "mozilla/Unused.h"
 
 #define NS_FOO_IID \
 { 0x6f7652e0,  0xee43, 0x11d1, \
  { 0x9c, 0xc3, 0x00, 0x60, 0x08, 0x8c, 0xa6, 0xb3 } }
 
 class Foo : public nsISupports
   {
 		public:
@@ -426,16 +427,17 @@ main()
       static_cast<Foo*>(foop)->Release();
 
       printf("\n### Test  5: will a |nsCOMPtr| |Release| when it goes out of scope?\n");
     }
 
     {
       printf("\n### Test  6: will a |nsCOMPtr| call the correct destructor?\n");
       RefPtr<Foo> foop( do_QueryObject(new Bar) );
+      mozilla::Unused << foop;
     }
 
     {
       printf("\n### Test  7: can you compare one |nsCOMPtr| with another [!=]?\n");
 
       RefPtr<Foo> foo1p( do_QueryObject(new Foo) );
 
         // [Shouldn't compile] Is it a compile time error to omit |getter_[doesnt_]AddRef[s]|?