Bug 1503207 - Remove nsWeakPtr.h and cleanup all files including weak reference-related headers r=froydnj
authorGabriele Svelto <gsvelto@mozilla.com>
Wed, 31 Oct 2018 20:39:03 +0000
changeset 443821 c4633ad9220fa16e7ab25ba30e82cd792ca1eb5e
parent 443820 dc7924e3ea6b0d953be2b0f953e7281044b52ab7
child 443822 82c181279b31782ba5cc9ed419e2d8fa2817697a
push id34972
push userebalazs@mozilla.com
push dateThu, 01 Nov 2018 09:11:48 +0000
treeherdermozilla-central@cfb6077ee31b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1503207
milestone65.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 1503207 - Remove nsWeakPtr.h and cleanup all files including weak reference-related headers r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D10251
docshell/shistory/nsSHEntryShared.h
dom/audiochannel/AudioChannelAgent.h
dom/base/EventSource.h
dom/base/Navigator.h
dom/base/WindowDestroyedEvent.h
dom/base/nsContentPermissionHelper.cpp
dom/base/nsDocument.h
dom/base/nsFrameMessageManager.h
dom/base/nsHistory.h
dom/base/nsIDocument.h
dom/base/nsPIWindowRoot.h
dom/commandhandler/nsBaseCommandController.cpp
dom/events/DOMEventTargetHelper.h
dom/events/IMEContentObserver.cpp
dom/geolocation/nsGeolocation.h
dom/html/AutoplayPermissionManager.h
dom/html/nsHTMLContentSink.cpp
dom/indexedDB/FileSnapshot.h
dom/indexedDB/IDBDatabase.cpp
dom/ipc/ContentChild.h
dom/ipc/TabChild.cpp
dom/media/doctor/DecoderDoctorDiagnostics.cpp
dom/media/gmp/GMPService.h
dom/media/webspeech/synth/test/nsFakeSynthServices.cpp
dom/midi/MIDIAccessManager.h
dom/plugins/base/nsPluginHost.h
dom/presentation/PresentationConnection.h
dom/presentation/provider/MulticastDNSDeviceProvider.h
dom/script/nsIScriptElement.h
dom/security/nsCSPContext.h
dom/storage/Storage.h
dom/xbl/nsXBLPrototypeBinding.h
dom/xbl/nsXBLPrototypeHandler.cpp
dom/xbl/nsXBLService.cpp
dom/xbl/nsXBLWindowKeyHandler.h
dom/xslt/xpath/XPathResult.h
dom/xslt/xslt/txMozillaTextOutput.h
dom/xul/nsXULContentSink.h
dom/xul/nsXULControllers.h
editor/composer/ComposerCommandsUpdater.h
editor/composer/nsEditingSession.h
editor/libeditor/PlaceholderTransaction.h
gfx/layers/ipc/CompositorBridgeChild.h
js/xpconnect/src/XPCJSWeakReference.h
layout/base/ZoomConstraintsClient.h
layout/base/nsIPresShell.h
layout/xul/nsXULTooltipListener.h
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
netwerk/base/nsDNSPrefetch.h
netwerk/base/nsIOService.h
netwerk/base/nsLoadGroup.h
netwerk/cache/nsDiskCacheDeviceSQL.cpp
netwerk/cache/nsDiskCacheDeviceSQL.h
netwerk/cache2/CacheIndex.h
netwerk/cache2/CacheStorageService.cpp
startupcache/StartupCache.cpp
toolkit/components/browser/nsWebBrowser.h
toolkit/components/extensions/webrequest/ChannelWrapper.h
toolkit/components/find/nsWebBrowserFind.h
toolkit/components/places/nsMaybeWeakPtr.h
toolkit/components/remote/nsDBusRemoteService.cpp
toolkit/components/remote/nsGTKRemoteService.cpp
toolkit/components/remote/nsGTKRemoteService.h
toolkit/components/remote/nsRemoteService.cpp
toolkit/components/remote/nsXRemoteService.cpp
uriloader/base/nsDocLoader.cpp
uriloader/base/nsURILoader.cpp
uriloader/prefetch/OfflineCacheUpdateChild.cpp
uriloader/prefetch/OfflineCacheUpdateChild.h
uriloader/prefetch/nsOfflineCacheUpdate.cpp
uriloader/prefetch/nsOfflineCacheUpdateService.cpp
uriloader/prefetch/nsPrefetchService.cpp
uriloader/prefetch/nsPrefetchService.h
widget/cocoa/nsChildView.h
widget/nsPrintSettingsImpl.h
widget/nsTransferable.cpp
widget/windows/TaskbarPreview.h
widget/windows/TaskbarPreviewButton.h
widget/windows/TaskbarWindowPreview.h
xpcom/base/moz.build
xpcom/base/nsIWeakReference.idl
xpcom/base/nsWeakPtr.h
xpcom/build/XPCOM.h
xpcom/ds/nsObserverList.cpp
xpfe/appshell/nsXULWindow.h
--- a/docshell/shistory/nsSHEntryShared.h
+++ b/docshell/shistory/nsSHEntryShared.h
@@ -7,20 +7,20 @@
 #ifndef nsSHEntryShared_h__
 #define nsSHEntryShared_h__
 
 #include "nsAutoPtr.h"
 #include "nsCOMArray.h"
 #include "nsCOMPtr.h"
 #include "nsExpirationTracker.h"
 #include "nsIBFCacheEntry.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsRect.h"
 #include "nsString.h"
 #include "nsStubMutationObserver.h"
-#include "nsWeakPtr.h"
 
 #include "mozilla/Attributes.h"
 
 class nsSHEntry;
 class nsISHEntry;
 class nsIDocument;
 class nsIContentViewer;
 class nsIDocShellTreeItem;
--- a/dom/audiochannel/AudioChannelAgent.h
+++ b/dom/audiochannel/AudioChannelAgent.h
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_audio_channel_agent_h__
 #define mozilla_dom_audio_channel_agent_h__
 
 #include "nsIAudioChannelAgent.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsCOMPtr.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 
 class nsPIDOMWindowInner;
 class nsPIDOMWindowOuter;
 
 namespace mozilla {
 namespace dom {
 
 class AudioPlaybackConfig;
--- a/dom/base/EventSource.h
+++ b/dom/base/EventSource.h
@@ -17,17 +17,16 @@
 #include "mozilla/Attributes.h"
 #include "mozilla/DOMEventTargetHelper.h"
 #include "nsIObserver.h"
 #include "nsIStreamListener.h"
 #include "nsIChannelEventSink.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsITimer.h"
 #include "nsIHttpChannel.h"
-#include "nsWeakReference.h"
 #include "nsDeque.h"
 
 class nsPIDOMWindowInner;
 
 namespace mozilla {
 
 class ErrorResult;
 
--- a/dom/base/Navigator.h
+++ b/dom/base/Navigator.h
@@ -12,17 +12,16 @@
 #include "mozilla/dom/Fetch.h"
 #include "mozilla/dom/Nullable.h"
 #include "mozilla/ErrorResult.h"
 #include "nsWrapperCache.h"
 #include "nsHashKeys.h"
 #include "nsInterfaceHashtable.h"
 #include "nsString.h"
 #include "nsTArray.h"
-#include "nsWeakPtr.h"
 #include "mozilla/dom/MediaKeySystemAccessManager.h"
 
 class nsPluginArray;
 class nsMimeTypeArray;
 class nsPIDOMWindowInner;
 class nsIDOMNavigatorSystemMessages;
 class nsINetworkProperties;
 class nsIPrincipal;
--- a/dom/base/WindowDestroyedEvent.h
+++ b/dom/base/WindowDestroyedEvent.h
@@ -3,19 +3,19 @@
 /* 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 WindowDestroyedEvent_h
 #define WindowDestroyedEvent_h
 
 #include "nsGlobalWindow.h"
+#include "nsIWeakReferenceUtils.h"
+#include "nsString.h"
 #include "nsThreadUtils.h"
-#include "nsWeakPtr.h"
-#include "nsString.h"
 
 namespace mozilla {
 
 class WindowDestroyedEvent final : public Runnable
 {
 public:
   WindowDestroyedEvent(nsGlobalWindowInner* aWindow,
                        uint64_t aID, const char* aTopic);
--- a/dom/base/nsContentPermissionHelper.cpp
+++ b/dom/base/nsContentPermissionHelper.cpp
@@ -22,17 +22,17 @@
 #include "nsComponentManagerUtils.h"
 #include "nsArrayUtils.h"
 #include "nsIMutableArray.h"
 #include "nsContentPermissionHelper.h"
 #include "nsJSUtils.h"
 #include "nsISupportsPrimitives.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIDocument.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 
 using mozilla::Unused;          // <snicker>
 using namespace mozilla::dom;
 using namespace mozilla;
 
 #define kVisibilityChange "visibilitychange"
 
 class VisibilityChangeListener final : public nsIDOMEventListener
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -12,18 +12,17 @@
 #define nsDocument_h___
 
 #include "nsIDocument.h"
 
 #include "jsfriendapi.h"
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "nsCRT.h"
-#include "nsWeakReference.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsTArray.h"
 #include "nsIdentifierMapEntry.h"
 #include "nsStubDocumentObserver.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIContent.h"
 #include "nsIPrincipal.h"
 #include "nsIParser.h"
 #include "nsBindingManager.h"
--- a/dom/base/nsFrameMessageManager.h
+++ b/dom/base/nsFrameMessageManager.h
@@ -19,17 +19,17 @@
 #include "nsIPrincipal.h"
 #include "nsIXPConnect.h"
 #include "nsDataHashtable.h"
 #include "nsClassHashtable.h"
 #include "mozilla/Services.h"
 #include "mozilla/StaticPtr.h"
 #include "nsIObserverService.h"
 #include "nsThreadUtils.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 #include "mozilla/Attributes.h"
 #include "js/RootingAPI.h"
 #include "nsTObserverArray.h"
 #include "mozilla/TypedEnumBits.h"
 #include "mozilla/dom/CallbackObject.h"
 #include "mozilla/dom/SameProcessMessageQueue.h"
 #include "mozilla/dom/ipc/StructuredCloneData.h"
 #include "mozilla/jsipc/CpowHolder.h"
--- a/dom/base/nsHistory.h
+++ b/dom/base/nsHistory.h
@@ -57,12 +57,12 @@ protected:
   nsIDocShell* GetDocShell() const;
 
   void PushOrReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData,
                           const nsAString& aTitle, const nsAString& aUrl,
                           mozilla::ErrorResult& aRv, bool aReplace);
 
   already_AddRefed<mozilla::dom::ChildSHistory> GetSessionHistory() const;
 
-  nsCOMPtr<nsIWeakReference> mInnerWindow;
+  nsWeakPtr mInnerWindow;
 };
 
 #endif /* nsHistory_h___ */
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -26,23 +26,23 @@
 #include "nsIChannelEventSink.h"
 #include "nsIProgressEventSink.h"
 #include "nsISecurityEventSink.h"
 #include "nsIScriptGlobalObject.h"       // for member (in nsCOMPtr)
 #include "nsIServiceManager.h"
 #include "nsIURI.h"                      // for use in inline functions
 #include "nsIUUIDGenerator.h"
 #include "nsIWebProgressListener.h"      // for nsIWebProgressListener
+#include "nsIWeakReferenceUtils.h"       // for nsWeakPtr
 #include "nsPIDOMWindow.h"               // for use in inline functions
 #include "nsPropertyTable.h"             // for member
 #include "nsStringFwd.h"
 #include "nsTHashtable.h"                // for member
 #include "nsURIHashKey.h"
 #include "mozilla/net/ReferrerPolicy.h"  // for member
-#include "nsWeakReference.h"
 #include "mozilla/UseCounter.h"
 #include "mozilla/WeakPtr.h"
 #include "Units.h"
 #include "nsContentListDeclarations.h"
 #include "nsExpirationTracker.h"
 #include "nsClassHashtable.h"
 #include "mozilla/CORSMode.h"
 #include "mozilla/dom/ContentBlockingLog.h"
--- a/dom/base/nsPIWindowRoot.h
+++ b/dom/base/nsPIWindowRoot.h
@@ -4,17 +4,16 @@
  * 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 nsPIWindowRoot_h__
 #define nsPIWindowRoot_h__
 
 #include "nsISupports.h"
 #include "mozilla/dom/EventTarget.h"
-#include "nsWeakReference.h"
 
 class nsPIDOMWindowOuter;
 class nsIControllers;
 class nsIController;
 class nsINode;
 
 namespace mozilla {
 namespace dom {
--- a/dom/commandhandler/nsBaseCommandController.cpp
+++ b/dom/commandhandler/nsBaseCommandController.cpp
@@ -1,22 +1,20 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "nsString.h"
 #include "nsIComponentManager.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsBaseCommandController.h"
 #include "nsControllerCommandTable.h"
 
-#include "nsString.h"
-#include "nsWeakPtr.h"
-
 NS_IMPL_ADDREF(nsBaseCommandController)
 NS_IMPL_RELEASE(nsBaseCommandController)
 
 NS_INTERFACE_MAP_BEGIN(nsBaseCommandController)
   NS_INTERFACE_MAP_ENTRY(nsIController)
   NS_INTERFACE_MAP_ENTRY(nsICommandController)
   NS_INTERFACE_MAP_ENTRY(nsIControllerContext)
   NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
--- a/dom/events/DOMEventTargetHelper.h
+++ b/dom/events/DOMEventTargetHelper.h
@@ -8,17 +8,16 @@
 #define mozilla_DOMEventTargetHelper_h_
 
 #include "nsCOMPtr.h"
 #include "nsGkAtoms.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsPIDOMWindow.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIScriptContext.h"
-#include "nsIWeakReferenceUtils.h"
 #include "MainThreadUtils.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/LinkedList.h"
 #include "mozilla/dom/EventTarget.h"
 
 class nsIDocument;
 
--- a/dom/events/IMEContentObserver.cpp
+++ b/dom/events/IMEContentObserver.cpp
@@ -22,21 +22,21 @@
 #include "nsAtom.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsIFrame.h"
 #include "nsINode.h"
 #include "nsIPresShell.h"
 #include "nsISelectionController.h"
 #include "nsISupports.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsIWidget.h"
 #include "nsPresContext.h"
 #include "nsRange.h"
 #include "nsRefreshDriver.h"
-#include "nsWeakReference.h"
 #include "WritingModes.h"
 
 namespace mozilla {
 
 typedef ContentEventHandler::NodePosition NodePosition;
 typedef ContentEventHandler::NodePositionBefore NodePositionBefore;
 
 using namespace widget;
--- a/dom/geolocation/nsGeolocation.h
+++ b/dom/geolocation/nsGeolocation.h
@@ -10,19 +10,19 @@
 // Microsoft's API Name hackery sucks
 #undef CreateEvent
 
 #include "mozilla/StaticPtr.h"
 #include "nsCOMPtr.h"
 #include "nsTArray.h"
 #include "nsITimer.h"
 #include "nsIObserver.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsWrapperCache.h"
 
-#include "nsWeakPtr.h"
 #include "nsCycleCollectionParticipant.h"
 
 #include "nsGeoPosition.h"
 #include "nsIDOMGeoPosition.h"
 #include "nsIDOMGeoPositionCallback.h"
 #include "nsIDOMGeoPositionErrorCallback.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "mozilla/dom/GeolocationBinding.h"
--- a/dom/html/AutoplayPermissionManager.h
+++ b/dom/html/AutoplayPermissionManager.h
@@ -7,17 +7,16 @@
 #ifndef __AutoplayPermissionRequestManager_h__
 #define __AutoplayPermissionRequestManager_h__
 
 #include "mozilla/MozPromise.h"
 #include "mozilla/WeakPtr.h"
 #include "nsIContentPermissionPrompt.h"
 #include "nsISupports.h"
 #include "nsIWeakReferenceUtils.h"
-#include "nsWeakReference.h"
 
 class nsGlobalWindowInner;
 class nsIEventTarget;
 
 namespace mozilla {
 
 // Encapsulates requesting permission from the user to autoplay with a
 // doorhanger. The AutoplayPermissionManager is stored on the top level window,
--- a/dom/html/nsHTMLContentSink.cpp
+++ b/dom/html/nsHTMLContentSink.cpp
@@ -59,17 +59,16 @@
 
 #include "nsIStyleSheetLinkingElement.h"
 #include "nsITimer.h"
 #include "nsError.h"
 #include "nsContentPolicyUtils.h"
 #include "nsIScriptContext.h"
 #include "nsStyleLinkElement.h"
 
-#include "nsWeakReference.h" // nsHTMLElementFactory supports weak references
 #include "nsIPrompt.h"
 #include "nsLayoutCID.h"
 #include "nsIDocShellTreeItem.h"
 
 #include "nsEscape.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 #include "mozAutoDocUpdate.h"
--- a/dom/indexedDB/FileSnapshot.h
+++ b/dom/indexedDB/FileSnapshot.h
@@ -5,17 +5,17 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_indexeddb_filesnapshot_h__
 #define mozilla_dom_indexeddb_filesnapshot_h__
 
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/File.h"
 #include "nsISupports.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 
 #define FILEIMPLSNAPSHOT_IID \
   {0x0dfc11b1, 0x75d3, 0x473b, {0x8c, 0x67, 0xb7, 0x23, 0xf4, 0x67, 0xd6, 0x73}}
 
 class PIBlobImplSnapshot : public nsISupports
 {
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(FILEIMPLSNAPSHOT_IID)
--- a/dom/indexedDB/IDBDatabase.cpp
+++ b/dom/indexedDB/IDBDatabase.cpp
@@ -40,16 +40,17 @@
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsIDocument.h"
 #include "nsIObserver.h"
 #include "nsIObserverService.h"
 #include "nsIScriptError.h"
 #include "nsISupportsPrimitives.h"
 #include "nsThreadUtils.h"
+#include "nsIWeakReferenceUtils.h"
 #include "ProfilerHelpers.h"
 #include "ReportInternalError.h"
 #include "ScriptErrorHelper.h"
 #include "nsQueryObject.h"
 
 // Include this last to avoid path problems on Windows.
 #include "ActorsChild.h"
 
@@ -913,17 +914,17 @@ IDBDatabase::GetOrCreateFileActorForBlob
   AssertIsOnOwningThread();
   MOZ_ASSERT(aBlob);
   MOZ_ASSERT(mBackgroundActor);
 
   // We use the File's nsIWeakReference as the key to the table because
   // a) it is unique per blob, b) it is reference-counted so that we can
   // guarantee that it stays alive, and c) it doesn't hold the actual File
   // alive.
-  nsCOMPtr<nsIWeakReference> weakRef = do_GetWeakReference(aBlob);
+  nsWeakPtr weakRef = do_GetWeakReference(aBlob);
   MOZ_ASSERT(weakRef);
 
   PBackgroundIDBDatabaseFileChild* actor = nullptr;
 
   if (!mFileActors.Get(weakRef, &actor)) {
     BlobImpl* blobImpl = aBlob->Impl();
     MOZ_ASSERT(blobImpl);
 
@@ -1069,17 +1070,17 @@ IDBDatabase::ExpireFileActors(bool aExpi
     for (auto iter = mFileActors.Iter(); !iter.Done(); iter.Next()) {
       nsISupports* key = iter.Key();
       PBackgroundIDBDatabaseFileChild* actor = iter.Data();
       MOZ_ASSERT(key);
       MOZ_ASSERT(actor);
 
       bool shouldExpire = aExpireAll;
       if (!shouldExpire) {
-        nsCOMPtr<nsIWeakReference> weakRef = do_QueryInterface(key);
+        nsWeakPtr weakRef = do_QueryInterface(key);
         MOZ_ASSERT(weakRef);
 
         nsCOMPtr<nsISupports> referent = do_QueryReferent(weakRef);
         shouldExpire = !referent;
       }
 
       if (shouldExpire) {
         PBackgroundIDBDatabaseFileChild::Send__delete__(actor);
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -15,17 +15,16 @@
 #include "mozilla/dom/PContentChild.h"
 #include "mozilla/StaticPtr.h"
 #include "nsAutoPtr.h"
 #include "nsHashKeys.h"
 #include "nsIObserver.h"
 #include "nsTHashtable.h"
 #include "nsRefPtrHashtable.h"
 
-#include "nsWeakPtr.h"
 #include "nsIWindowProvider.h"
 
 #if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
 #include "nsIFile.h"
 #endif
 
 struct ChromePackage;
 class nsIObserver;
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -88,17 +88,17 @@
 #include "nsPIWindowRoot.h"
 #include "nsPointerHashKeys.h"
 #include "nsLayoutUtils.h"
 #include "nsPrintfCString.h"
 #include "nsTHashtable.h"
 #include "nsThreadManager.h"
 #include "nsThreadUtils.h"
 #include "nsViewManager.h"
-#include "nsWeakReference.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsWindowWatcher.h"
 #include "PermissionMessageUtils.h"
 #include "PuppetWidget.h"
 #include "StructuredCloneData.h"
 #include "nsViewportInfo.h"
 #include "nsILoadContext.h"
 #include "ipc/nsGUIEventIPC.h"
 #include "mozilla/gfx/Matrix.h"
--- a/dom/media/doctor/DecoderDoctorDiagnostics.cpp
+++ b/dom/media/doctor/DecoderDoctorDiagnostics.cpp
@@ -10,17 +10,16 @@
 #include "mozilla/Logging.h"
 #include "mozilla/Preferences.h"
 #include "nsContentUtils.h"
 #include "nsGkAtoms.h"
 #include "nsIDocument.h"
 #include "nsIObserverService.h"
 #include "nsIScriptError.h"
 #include "nsITimer.h"
-#include "nsIWeakReference.h"
 #include "nsPluginHost.h"
 #include "nsPrintfCString.h"
 #include "VideoUtils.h"
 
 #if defined(MOZ_FFMPEG)
 #include "FFmpegRuntimeLinker.h"
 #endif
 
--- a/dom/media/gmp/GMPService.h
+++ b/dom/media/gmp/GMPService.h
@@ -13,17 +13,16 @@
 #include "mozilla/Atomics.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/Monitor.h"
 #include "nsString.h"
 #include "nsCOMPtr.h"
 #include "nsIThread.h"
 #include "nsThreadUtils.h"
 #include "nsIDocument.h"
-#include "nsIWeakReference.h"
 #include "mozilla/AbstractThread.h"
 #include "nsClassHashtable.h"
 #include "nsISupportsImpl.h"
 #include "mozilla/MozPromise.h"
 #include "GMPContentParent.h"
 #include "GMPCrashHelper.h"
 #include "ChromiumCDMParent.h"
 #include "MediaResult.h"
--- a/dom/media/webspeech/synth/test/nsFakeSynthServices.cpp
+++ b/dom/media/webspeech/synth/test/nsFakeSynthServices.cpp
@@ -2,17 +2,16 @@
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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 "nsFakeSynthServices.h"
 #include "nsPrintfCString.h"
-#include "nsIWeakReferenceUtils.h"
 #include "SharedBuffer.h"
 #include "nsISimpleEnumerator.h"
 
 #include "mozilla/dom/nsSynthVoiceRegistry.h"
 #include "mozilla/dom/nsSpeechTask.h"
 
 #include "nsThreadUtils.h"
 #include "prenv.h"
--- a/dom/midi/MIDIAccessManager.h
+++ b/dom/midi/MIDIAccessManager.h
@@ -6,17 +6,16 @@
 
 #ifndef mozilla_dom_MIDIAccessManager_h
 #define mozilla_dom_MIDIAccessManager_h
 
 #include "nsPIDOMWindow.h"
 #include "nsIObserver.h"
 #include "mozilla/dom/MIDITypes.h"
 #include "mozilla/Observer.h"
-#include "nsWeakPtr.h"
 
 namespace mozilla {
 namespace dom {
 
 class MIDIAccess;
 class MIDIManagerChild;
 struct MIDIOptions;
 class MIDIPortChangeEvent;
--- a/dom/plugins/base/nsPluginHost.h
+++ b/dom/plugins/base/nsPluginHost.h
@@ -11,19 +11,18 @@
 
 #include "nsIPluginHost.h"
 #include "nsIObserver.h"
 #include "nsCOMPtr.h"
 #include "prlink.h"
 #include "nsIPluginTag.h"
 #include "nsPluginsDir.h"
 #include "nsPluginDirServiceProvider.h"
-#include "nsWeakPtr.h"
+#include "nsWeakReference.h"
 #include "nsIPrompt.h"
-#include "nsWeakReference.h"
 #include "MainThreadUtils.h"
 #include "nsTArray.h"
 #include "nsINamed.h"
 #include "nsTObserverArray.h"
 #include "nsITimer.h"
 #include "nsPluginTags.h"
 #include "nsIEffectiveTLDService.h"
 #include "nsIIDNService.h"
--- a/dom/presentation/PresentationConnection.h
+++ b/dom/presentation/PresentationConnection.h
@@ -9,17 +9,17 @@
 
 #include "mozilla/DOMEventTargetHelper.h"
 #include "mozilla/dom/TypedArray.h"
 #include "mozilla/WeakPtr.h"
 #include "mozilla/dom/PresentationConnectionBinding.h"
 #include "mozilla/dom/PresentationConnectionCloseEventBinding.h"
 #include "nsIPresentationListener.h"
 #include "nsIRequest.h"
-#include "nsWeakReference.h"
+#include "nsIWeakReferenceUtils.h"
 
 namespace mozilla {
 namespace dom {
 
 class Blob;
 class PresentationConnectionList;
 
 class PresentationConnection final : public DOMEventTargetHelper
--- a/dom/presentation/provider/MulticastDNSDeviceProvider.h
+++ b/dom/presentation/provider/MulticastDNSDeviceProvider.h
@@ -11,19 +11,19 @@
 #include "nsCOMPtr.h"
 #include "nsICancelable.h"
 #include "nsIDNSServiceDiscovery.h"
 #include "nsIObserver.h"
 #include "nsIPresentationDevice.h"
 #include "nsIPresentationDeviceProvider.h"
 #include "nsIPresentationControlService.h"
 #include "nsITimer.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsString.h"
 #include "nsTArray.h"
-#include "nsWeakPtr.h"
 
 class nsITCPDeviceInfo;
 
 namespace mozilla {
 namespace dom {
 namespace presentation {
 
 class DNSServiceWrappedListener;
--- a/dom/script/nsIScriptElement.h
+++ b/dom/script/nsIScriptElement.h
@@ -6,17 +6,17 @@
 
 #ifndef nsIScriptElement_h___
 #define nsIScriptElement_h___
 
 #include "nsISupports.h"
 #include "nsIURI.h"
 #include "nsCOMPtr.h"
 #include "nsIScriptLoaderObserver.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsIParser.h"
 #include "nsIContent.h"
 #include "nsContentCreatorFunctions.h"
 #include "mozilla/CORSMode.h"
 
 // Must be kept in sync with xpcom/rust/xpcom/src/interfaces/nonidl.rs
 #define NS_ISCRIPTELEMENT_IID \
 { 0xe60fca9b, 0x1b96, 0x4e4e, \
--- a/dom/security/nsCSPContext.h
+++ b/dom/security/nsCSPContext.h
@@ -12,17 +12,17 @@
 #include "mozilla/StaticPrefs.h"
 #include "nsIChannel.h"
 #include "nsIChannelEventSink.h"
 #include "nsIClassInfo.h"
 #include "nsIContentSecurityPolicy.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsISerializable.h"
 #include "nsIStreamListener.h"
-#include "nsWeakReference.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsXPCOM.h"
 
 #define NS_CSPCONTEXT_CONTRACTID "@mozilla.org/cspcontext;1"
  // 09d9ed1a-e5d4-4004-bfe0-27ceb923d9ac
 #define NS_CSPCONTEXT_CID \
 { 0x09d9ed1a, 0xe5d4, 0x4004, \
   { 0xbf, 0xe0, 0x27, 0xce, 0xb9, 0x23, 0xd9, 0xac } }
 
--- a/dom/storage/Storage.h
+++ b/dom/storage/Storage.h
@@ -6,17 +6,17 @@
 
 #ifndef mozilla_dom_Storage_h
 #define mozilla_dom_Storage_h
 
 #include "mozilla/Attributes.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/Maybe.h"
 #include "nsCycleCollectionParticipant.h"
-#include "nsWeakReference.h"
+#include "nsCOMPtr.h"
 #include "nsWrapperCache.h"
 #include "nsISupports.h"
 
 class nsIPrincipal;
 class nsPIDOMWindowInner;
 
 namespace mozilla {
 namespace dom {
--- a/dom/xbl/nsXBLPrototypeBinding.h
+++ b/dom/xbl/nsXBLPrototypeBinding.h
@@ -8,17 +8,16 @@
 #define nsXBLPrototypeBinding_h__
 
 #include "nsAutoPtr.h"
 #include "nsClassHashtable.h"
 #include "nsCOMArray.h"
 #include "nsCOMPtr.h"
 #include "nsICSSLoaderObserver.h"
 #include "nsInterfaceHashtable.h"
-#include "nsWeakReference.h"
 #include "nsXBLDocumentInfo.h"
 #include "nsXBLProtoImpl.h"
 #include "nsXBLProtoImplMethod.h"
 #include "nsXBLPrototypeHandler.h"
 #include "nsXBLPrototypeResources.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/WeakPtr.h"
 #include "mozilla/StyleSheet.h"
--- a/dom/xbl/nsXBLPrototypeHandler.cpp
+++ b/dom/xbl/nsXBLPrototypeHandler.cpp
@@ -24,16 +24,17 @@
 #include "nsFocusManager.h"
 #include "nsIFormControl.h"
 #include "nsIDOMEventListener.h"
 #include "nsPIDOMWindow.h"
 #include "nsPIWindowRoot.h"
 #include "nsIDOMWindow.h"
 #include "nsIServiceManager.h"
 #include "nsIScriptError.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsGkAtoms.h"
 #include "nsIXPConnect.h"
 #include "nsDOMCID.h"
 #include "nsUnicharUtils.h"
 #include "nsCRT.h"
 #include "nsXBLEventHandler.h"
@@ -869,17 +870,17 @@ nsXBLPrototypeHandler::ConstructPrototyp
                                           const char16_t* aPreventDefault,
                                           const char16_t* aAllowUntrusted)
 {
   mType = 0;
 
   if (aKeyElement) {
     mType |= NS_HANDLER_TYPE_XUL;
     MOZ_ASSERT(!mPrototypeBinding);
-    nsCOMPtr<nsIWeakReference> weak = do_GetWeakReference(aKeyElement);
+    nsWeakPtr weak = do_GetWeakReference(aKeyElement);
     if (!weak) {
       return;
     }
     weak.swap(mHandlerElement);
   }
   else {
     mType |= aCommand ? NS_HANDLER_TYPE_XBL_COMMAND : NS_HANDLER_TYPE_XBL_JS;
     mHandlerText = nullptr;
--- a/dom/xbl/nsXBLService.cpp
+++ b/dom/xbl/nsXBLService.cpp
@@ -157,17 +157,17 @@ public:
   bool HasRequest(nsIURI* aURI, nsIContent* aBoundElement);
 
 private:
   ~nsXBLStreamListener();
 
   nsCOMPtr<nsIStreamListener> mInner;
   AutoTArray<nsXBLBindingRequest*, 8> mBindingRequests;
 
-  nsCOMPtr<nsIWeakReference> mBoundDocument;
+  nsWeakPtr mBoundDocument;
   nsCOMPtr<nsIXMLContentSink> mSink; // Only set until OnStartRequest
   nsCOMPtr<nsIDocument> mBindingDocument; // Only set until OnStartRequest
 };
 
 /* Implementation file */
 NS_IMPL_ISUPPORTS(nsXBLStreamListener,
                   nsIStreamListener,
                   nsIRequestObserver,
--- a/dom/xbl/nsXBLWindowKeyHandler.h
+++ b/dom/xbl/nsXBLWindowKeyHandler.h
@@ -4,18 +4,18 @@
  * 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 nsXBLWindowKeyHandler_h__
 #define nsXBLWindowKeyHandler_h__
 
 #include "mozilla/EventForwards.h"
 #include "mozilla/layers/KeyboardMap.h"
-#include "nsWeakPtr.h"
 #include "nsIDOMEventListener.h"
+#include "nsIWeakReferenceUtils.h"
 
 class nsAtom;
 class nsXBLPrototypeHandler;
 
 namespace mozilla {
 class EventListenerManager;
 class WidgetKeyboardEvent;
 struct IgnoreModifierState;
--- a/dom/xslt/xpath/XPathResult.h
+++ b/dom/xslt/xpath/XPathResult.h
@@ -5,17 +5,17 @@
 
 #ifndef mozilla_dom_XPathResult_h
 #define mozilla_dom_XPathResult_h
 
 #include "nsStubMutationObserver.h"
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsCycleCollectionParticipant.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/ErrorResult.h"
 #include "nsString.h"
 #include "nsWrapperCache.h"
 #include "nsINode.h"
 
 class nsIDocument;
--- a/dom/xslt/xslt/txMozillaTextOutput.h
+++ b/dom/xslt/xslt/txMozillaTextOutput.h
@@ -3,17 +3,17 @@
  * 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 TRANSFRMX_MOZILLA_TEXT_OUTPUT_H
 #define TRANSFRMX_MOZILLA_TEXT_OUTPUT_H
 
 #include "txXMLEventHandler.h"
 #include "nsCOMPtr.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 #include "txOutputFormat.h"
 
 class nsITransformObserver;
 class nsIDocument;
 class nsIContent;
 
 namespace mozilla {
 namespace dom {
--- a/dom/xul/nsXULContentSink.h
+++ b/dom/xul/nsXULContentSink.h
@@ -3,19 +3,19 @@
  * 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 nsXULContentSink_h__
 #define nsXULContentSink_h__
 
 #include "mozilla/Attributes.h"
 #include "nsIExpatSink.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsIXMLContentSink.h"
 #include "nsNodeInfoManager.h"
-#include "nsWeakPtr.h"
 #include "nsXULElement.h"
 #include "nsIDTD.h"
 
 class nsIDocument;
 class nsIScriptSecurityManager;
 class nsAttrName;
 class nsXULPrototypeDocument;
 class nsXULPrototypeElement;
--- a/dom/xul/nsXULControllers.h
+++ b/dom/xul/nsXULControllers.h
@@ -9,17 +9,16 @@
 
 */
 
 #ifndef nsXULControllers_h__
 #define nsXULControllers_h__
 
 #include "nsCOMPtr.h"
 #include "nsTArray.h"
-#include "nsWeakPtr.h"
 #include "nsIControllers.h"
 #include "nsCycleCollectionParticipant.h"
 
 /* non-XPCOM class for holding controllers and their IDs */
 class nsXULControllerData final
 {
 public:
                             nsXULControllerData(uint32_t inControllerID, nsIController* inController)
--- a/editor/composer/ComposerCommandsUpdater.h
+++ b/editor/composer/ComposerCommandsUpdater.h
@@ -9,17 +9,16 @@
 
 #include "nsCOMPtr.h"                   // for already_AddRefed, nsCOMPtr
 #include "nsCycleCollectionParticipant.h"
 #include "nsIDocumentStateListener.h"
 #include "nsINamed.h"
 #include "nsISupportsImpl.h"            // for NS_DECL_ISUPPORTS
 #include "nsITimer.h"                   // for NS_DECL_NSITIMERCALLBACK, etc
 #include "nsITransactionListener.h"     // for nsITransactionListener
-#include "nsIWeakReferenceUtils.h"      // for nsWeakPtr
 #include "nscore.h"                     // for NS_IMETHOD, nsresult, etc
 
 class nsIDocShell;
 class nsITransaction;
 class nsITransactionManager;
 class nsPIDOMWindowOuter;
 class nsPICommandUpdater;
 
--- a/editor/composer/nsEditingSession.h
+++ b/editor/composer/nsEditingSession.h
@@ -1,21 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; 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 nsEditingSession_h__
 #define nsEditingSession_h__
 
-
-#ifndef nsWeakReference_h__
-#include "nsWeakReference.h"            // for nsSupportsWeakReference, etc
-#endif
-
 #include "nsCOMPtr.h"                   // for nsCOMPtr
 #include "nsISupportsImpl.h"            // for NS_DECL_ISUPPORTS
 #include "nsIWeakReferenceUtils.h"      // for nsWeakPtr
 #include "nsWeakReference.h"            // for nsSupportsWeakReference, etc
 #include "nscore.h"                     // for nsresult
 
 #ifndef __gen_nsIWebProgressListener_h__
 #include "nsIWebProgressListener.h"
--- a/editor/libeditor/PlaceholderTransaction.h
+++ b/editor/libeditor/PlaceholderTransaction.h
@@ -4,18 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef PlaceholderTransaction_h
 #define PlaceholderTransaction_h
 
 #include "EditAggregateTransaction.h"
 #include "mozilla/Maybe.h"
 #include "nsIAbsorbingTransaction.h"
-#include "nsCOMPtr.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 
 namespace mozilla {
 
 class CompositionTransaction;
 
 /**
  * An aggregate transaction that knows how to absorb all subsequent
  * transactions with the same name.  This transaction does not "Do" anything.
--- a/gfx/layers/ipc/CompositorBridgeChild.h
+++ b/gfx/layers/ipc/CompositorBridgeChild.h
@@ -15,18 +15,18 @@
 #include "mozilla/layers/PCompositorBridgeChild.h"
 #include "mozilla/layers/TextureForwarder.h" // for TextureForwarder
 #include "mozilla/layers/PaintThread.h" // for PaintThread
 #include "mozilla/webrender/WebRenderTypes.h"
 #include "nsClassHashtable.h"           // for nsClassHashtable
 #include "nsCOMPtr.h"                   // for nsCOMPtr
 #include "nsHashKeys.h"                 // for nsUint64HashKey
 #include "nsISupportsImpl.h"            // for NS_INLINE_DECL_REFCOUNTING
+#include "nsIWeakReferenceUtils.h"
 #include "ThreadSafeRefcountingWithMainThreadDestruction.h"
-#include "nsWeakReference.h"
 
 #include <unordered_map>
 
 namespace mozilla {
 
 namespace dom {
 class TabChild;
 } // namespace dom
--- a/js/xpconnect/src/XPCJSWeakReference.h
+++ b/js/xpconnect/src/XPCJSWeakReference.h
@@ -3,27 +3,27 @@
 /* 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 xpcjsweakreference_h___
 #define xpcjsweakreference_h___
 
 #include "xpcIJSWeakReference.h"
-#include "nsIWeakReference.h"
+#include "nsIWeakReferenceUtils.h"
 #include "mozilla/Attributes.h"
 
 class xpcJSWeakReference final : public xpcIJSWeakReference
 {
     ~xpcJSWeakReference() {}
 
 public:
     xpcJSWeakReference();
     nsresult Init(JSContext* cx, const JS::Value& object);
 
     NS_DECL_ISUPPORTS
     NS_DECL_XPCIJSWEAKREFERENCE
 
 private:
-    nsCOMPtr<nsIWeakReference> mReferent;
+    nsWeakPtr mReferent;
 };
 
 #endif // xpcjsweakreference_h___
--- a/layout/base/ZoomConstraintsClient.h
+++ b/layout/base/ZoomConstraintsClient.h
@@ -6,17 +6,16 @@
 
 #ifndef ZoomConstraintsClient_h_
 #define ZoomConstraintsClient_h_
 
 #include "FrameMetrics.h"
 #include "mozilla/Maybe.h"
 #include "nsIDOMEventListener.h"
 #include "nsIObserver.h"
-#include "nsWeakPtr.h"
 
 class nsIDocument;
 class nsIPresShell;
 
 namespace mozilla {
 namespace dom {
 class EventTarget;
 } // namespace dom
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -27,17 +27,16 @@
 #include "nsISelectionController.h"
 #include "nsQueryFrame.h"
 #include "nsStringFwd.h"
 #include "nsCoord.h"
 #include "nsColor.h"
 #include "nsFrameManager.h"
 #include "nsRect.h"
 #include "nsRegionFwd.h"
-#include "nsWeakReference.h"
 #include <stdio.h> // for FILE definition
 #include "nsChangeHint.h"
 #include "nsRefPtrHashtable.h"
 #include "nsClassHashtable.h"
 #include "nsPresArena.h"
 #include "nsIImageLoadingContent.h"
 #include "nsMargin.h"
 #include "nsFrameState.h"
--- a/layout/xul/nsXULTooltipListener.h
+++ b/layout/xul/nsXULTooltipListener.h
@@ -9,17 +9,17 @@
 
 #include "nsIDOMEventListener.h"
 #include "nsITimer.h"
 #include "nsCOMPtr.h"
 #include "nsString.h"
 #ifdef MOZ_XUL
 #include "nsITreeBoxObject.h"
 #endif
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 #include "mozilla/Attributes.h"
 
 class nsIContent;
 class nsTreeColumn;
 
 namespace mozilla {
 namespace dom {
 class Event;
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
@@ -8,17 +8,16 @@
 #include <deque>
 #include <string>
 #include <vector>
 #include <map>
 #include <cmath>
 
 #include "prlock.h"
 #include "mozilla/RefPtr.h"
-#include "nsWeakPtr.h"
 #include "nsAutoPtr.h"
 #include "nsIWeakReferenceUtils.h" // for the definition of nsWeakPtr
 #include "IPeerConnection.h"
 #include "sigslot.h"
 #include "nsComponentManagerUtils.h"
 #include "nsPIDOMWindow.h"
 #include "nsIUUIDGenerator.h"
 #include "nsIThread.h"
--- a/netwerk/base/nsDNSPrefetch.h
+++ b/netwerk/base/nsDNSPrefetch.h
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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 nsDNSPrefetch_h___
 #define nsDNSPrefetch_h___
 
-#include "nsWeakReference.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsString.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/BasePrincipal.h"
 
 #include "nsIDNSListener.h"
 
 class nsIURI;
--- a/netwerk/base/nsIOService.h
+++ b/netwerk/base/nsIOService.h
@@ -5,19 +5,18 @@
 
 #ifndef nsIOService_h__
 #define nsIOService_h__
 
 #include "nsStringFwd.h"
 #include "nsIIOService.h"
 #include "nsTArray.h"
 #include "nsCOMPtr.h"
-#include "nsWeakPtr.h"
 #include "nsIObserver.h"
-#include "nsWeakReference.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsINetUtil.h"
 #include "nsIChannelEventSink.h"
 #include "nsCategoryCache.h"
 #include "nsISpeculativeConnect.h"
 #include "nsDataHashtable.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/Attributes.h"
 #include "prtime.h"
--- a/netwerk/base/nsLoadGroup.h
+++ b/netwerk/base/nsLoadGroup.h
@@ -6,17 +6,16 @@
 #ifndef nsLoadGroup_h__
 #define nsLoadGroup_h__
 
 #include "nsILoadGroup.h"
 #include "nsILoadGroupChild.h"
 #include "nsPILoadGroupInternal.h"
 #include "nsAgg.h"
 #include "nsCOMPtr.h"
-#include "nsWeakPtr.h"
 #include "nsWeakReference.h"
 #include "nsISupportsPriority.h"
 #include "PLDHashTable.h"
 #include "mozilla/TimeStamp.h"
 
 class nsIRequestContext;
 class nsIRequestContextService;
 class nsITimedChannel;
--- a/netwerk/cache/nsDiskCacheDeviceSQL.cpp
+++ b/netwerk/cache/nsDiskCacheDeviceSQL.cpp
@@ -2376,17 +2376,17 @@ nsOfflineCacheDevice::CreateApplicationC
                                   gNextTemporaryClientID++));
 
   nsCOMPtr<nsIApplicationCache> cache = new nsApplicationCache(this,
                                                                group,
                                                                clientID);
   if (!cache)
     return NS_ERROR_OUT_OF_MEMORY;
 
-  nsCOMPtr<nsIWeakReference> weak = do_GetWeakReference(cache);
+  nsWeakPtr weak = do_GetWeakReference(cache);
   if (!weak)
     return NS_ERROR_OUT_OF_MEMORY;
 
   MutexAutoLock lock(mLock);
   mCaches.Put(clientID, weak);
 
   cache.swap(*out);
 
--- a/netwerk/cache/nsDiskCacheDeviceSQL.h
+++ b/netwerk/cache/nsDiskCacheDeviceSQL.h
@@ -13,17 +13,17 @@
 #include "mozIStorageConnection.h"
 #include "mozIStorageFunction.h"
 #include "nsIFile.h"
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
 #include "nsInterfaceHashtable.h"
 #include "nsClassHashtable.h"
-#include "nsWeakReference.h"
+#include "nsIWeakReference.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/Mutex.h"
 
 class nsIURI;
 class nsOfflineCacheDevice;
 class mozIStorageService;
 class nsILoadContextInfo;
 namespace mozilla { class OriginAttributesPattern; }
--- a/netwerk/cache2/CacheIndex.h
+++ b/netwerk/cache2/CacheIndex.h
@@ -7,19 +7,19 @@
 
 #include "CacheLog.h"
 #include "CacheFileIOManager.h"
 #include "nsIRunnable.h"
 #include "CacheHashUtils.h"
 #include "nsICacheStorageService.h"
 #include "nsICacheEntry.h"
 #include "nsILoadContextInfo.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsTHashtable.h"
 #include "nsThreadUtils.h"
-#include "nsWeakReference.h"
 #include "mozilla/IntegerPrintfMacros.h"
 #include "mozilla/SHA1.h"
 #include "mozilla/StaticMutex.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/EndianUtils.h"
 #include "mozilla/TimeStamp.h"
 
 class nsIFile;
--- a/netwerk/cache2/CacheStorageService.cpp
+++ b/netwerk/cache2/CacheStorageService.cpp
@@ -24,17 +24,16 @@
 #include "nsIFile.h"
 #include "nsIURI.h"
 #include "nsCOMPtr.h"
 #include "nsContentUtils.h"
 #include "nsAutoPtr.h"
 #include "nsNetCID.h"
 #include "nsNetUtil.h"
 #include "nsServiceManagerUtils.h"
-#include "nsWeakReference.h"
 #include "nsXULAppAPI.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/Services.h"
 #include "mozilla/IntegerPrintfMacros.h"
 
 namespace mozilla {
 namespace net {
--- a/startupcache/StartupCache.cpp
+++ b/startupcache/StartupCache.cpp
@@ -21,17 +21,16 @@
 #include "nsIOutputStream.h"
 #include "nsIStorageStream.h"
 #include "nsIStreamBufferAccess.h"
 #include "nsIStringStream.h"
 #include "nsISupports.h"
 #include "nsITimer.h"
 #include "nsIZipWriter.h"
 #include "nsIZipReader.h"
-#include "nsWeakReference.h"
 #include "nsZipArchive.h"
 #include "mozilla/Omnijar.h"
 #include "prenv.h"
 #include "mozilla/Telemetry.h"
 #include "nsThreadUtils.h"
 #include "nsXULAppAPI.h"
 #include "nsIProtocolHandler.h"
 #include "GeckoProfiler.h"
--- a/toolkit/components/browser/nsWebBrowser.h
+++ b/toolkit/components/browser/nsWebBrowser.h
@@ -30,17 +30,17 @@
 #include "nsIWebNavigation.h"
 #include "nsIWebBrowserPersist.h"
 #include "nsIWindowWatcher.h"
 #include "nsIPrintSettings.h"
 #include "nsIWidgetListener.h"
 
 #include "mozilla/BasePrincipal.h"
 #include "nsTArray.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 
 class nsWebBrowserInitInfo
 {
 public:
   // nsIBaseWindow Stuff
   int32_t x;
   int32_t y;
   int32_t cx;
--- a/toolkit/components/extensions/webrequest/ChannelWrapper.h
+++ b/toolkit/components/extensions/webrequest/ChannelWrapper.h
@@ -25,17 +25,17 @@
 #include "nsCycleCollectionParticipant.h"
 #include "nsIChannel.h"
 #include "nsIHttpChannel.h"
 #include "nsIStreamListener.h"
 #include "nsITabParent.h"
 #include "nsIThreadRetargetableStreamListener.h"
 #include "nsPointerHashKeys.h"
 #include "nsInterfaceHashtable.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsWrapperCache.h"
 
 #define NS_CHANNELWRAPPER_IID \
 { 0xc06162d2, 0xb803, 0x43b4, \
   { 0xaa, 0x31, 0xcf, 0x69, 0x7f, 0x93, 0x68, 0x1c } }
 
 class nsILoadContext;
 class nsITraceableChannel;
--- a/toolkit/components/find/nsWebBrowserFind.h
+++ b/toolkit/components/find/nsWebBrowserFind.h
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsWebBrowserFindImpl_h__
 #define nsWebBrowserFindImpl_h__
 
 #include "nsIWebBrowserFind.h"
 
 #include "nsCOMPtr.h"
-#include "nsWeakReference.h"
+#include "nsIWeakReferenceUtils.h"
 
 #include "nsIFind.h"
 
 #include "nsString.h"
 
 class nsIDOMWindow;
 
 class nsIDocShell;
--- a/toolkit/components/places/nsMaybeWeakPtr.h
+++ b/toolkit/components/places/nsMaybeWeakPtr.h
@@ -3,17 +3,17 @@
  * 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 nsMaybeWeakPtr_h_
 #define nsMaybeWeakPtr_h_
 
 #include "mozilla/Attributes.h"
 #include "nsCOMPtr.h"
-#include "nsWeakReference.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsTArray.h"
 #include "nsCycleCollectionNoteChild.h"
 
 // nsMaybeWeakPtr is a helper object to hold a strong-or-weak reference
 // to the template class.  It's pretty minimal, but sufficient.
 
 template<class T>
 class nsMaybeWeakPtr
--- a/toolkit/components/remote/nsDBusRemoteService.cpp
+++ b/toolkit/components/remote/nsDBusRemoteService.cpp
@@ -9,17 +9,16 @@
 #include "nsRemoteService.h"
 
 #include "nsIBaseWindow.h"
 #include "nsIDocShell.h"
 #include "nsPIDOMWindow.h"
 #include "mozilla/ModuleUtils.h"
 #include "mozilla/Base64.h"
 #include "nsIServiceManager.h"
-#include "nsIWeakReference.h"
 #include "nsIWidget.h"
 #include "nsIAppShellService.h"
 #include "nsAppShellCID.h"
 #include "nsPrintfCString.h"
 
 #include "nsCOMPtr.h"
 
 #include "nsGTKToolkit.h"
--- a/toolkit/components/remote/nsGTKRemoteService.cpp
+++ b/toolkit/components/remote/nsGTKRemoteService.cpp
@@ -11,17 +11,17 @@
 #include <gdk/gdk.h>
 #include <gdk/gdkx.h>
 
 #include "nsIBaseWindow.h"
 #include "nsIDocShell.h"
 #include "nsPIDOMWindow.h"
 #include "mozilla/ModuleUtils.h"
 #include "nsIServiceManager.h"
-#include "nsIWeakReference.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsIWidget.h"
 #include "nsIAppShellService.h"
 #include "nsAppShellCID.h"
 
 #include "nsCOMPtr.h"
 
 #include "nsGTKToolkit.h"
 
@@ -65,17 +65,17 @@ nsGTKRemoteService::RegisterWindow(mozID
 {
   nsIWidget* mainWidget = GetMainWidget(nsPIDOMWindowInner::From(aWindow));
   NS_ENSURE_TRUE(mainWidget, NS_ERROR_FAILURE);
 
   GtkWidget* widget =
     (GtkWidget*) mainWidget->GetNativeData(NS_NATIVE_SHELLWIDGET);
   NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE);
 
-  nsCOMPtr<nsIWeakReference> weak = do_GetWeakReference(aWindow);
+  nsWeakPtr weak = do_GetWeakReference(aWindow);
   NS_ENSURE_TRUE(weak, NS_ERROR_FAILURE);
 
   mWindows.Put(widget, weak);
 
   // If Startup() has already been called, immediately register this window.
   if (mServerWindow) {
     HandleCommandsFor(widget, weak);
   }
--- a/toolkit/components/remote/nsGTKRemoteService.h
+++ b/toolkit/components/remote/nsGTKRemoteService.h
@@ -8,16 +8,17 @@
 #ifndef __nsGTKRemoteService_h__
 #define __nsGTKRemoteService_h__
 
 #include <gdk/gdk.h>
 #include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 
 #include "nsIRemoteService.h"
+#include "nsIWeakReference.h"
 #include "nsInterfaceHashtable.h"
 #include "nsXRemoteService.h"
 #include "mozilla/Attributes.h"
 
 class nsGTKRemoteService final : public nsIRemoteService,
                                  public nsXRemoteService
 {
 public:
--- a/toolkit/components/remote/nsRemoteService.cpp
+++ b/toolkit/components/remote/nsRemoteService.cpp
@@ -15,17 +15,16 @@
 #include <gdk/gdk.h>
 #include <gdk/gdkx.h>
 
 #include "nsIServiceManager.h"
 #include "nsIAppShellService.h"
 #include "nsAppShellCID.h"
 #include "nsInterfaceHashtable.h"
 #include "mozilla/ModuleUtils.h"
-#include "nsIWeakReference.h"
 #include "nsGTKToolkit.h"
 #include "nsICommandLineRunner.h"
 #include "nsCommandLine.h"
 #include "nsString.h"
 #include "nsIFile.h"
 
 NS_IMPL_ISUPPORTS(nsRemoteService,
                   nsIRemoteService,
--- a/toolkit/components/remote/nsXRemoteService.cpp
+++ b/toolkit/components/remote/nsXRemoteService.cpp
@@ -14,17 +14,17 @@
 #include "nsIServiceManager.h"
 #include "nsICommandLineRunner.h"
 #include "nsICommandLine.h"
 
 #include "nsIBaseWindow.h"
 #include "nsIDocShell.h"
 #include "nsIFile.h"
 #include "nsIServiceManager.h"
-#include "nsIWeakReference.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsIWidget.h"
 #include "nsIAppShellService.h"
 #include "nsAppShellCID.h"
 #include "nsPIDOMWindow.h"
 #include "mozilla/X11Util.h"
 
 #include "nsCOMPtr.h"
 #include "nsString.h"
--- a/uriloader/base/nsDocLoader.cpp
+++ b/uriloader/base/nsDocLoader.cpp
@@ -14,17 +14,17 @@
 #include "nsIWebProgressListener2.h"
 
 #include "nsIServiceManager.h"
 #include "nsString.h"
 
 #include "nsIURL.h"
 #include "nsCOMPtr.h"
 #include "nscore.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsAutoPtr.h"
 #include "nsQueryObject.h"
 
 #include "nsIDOMWindow.h"
 
 #include "nsIStringBundle.h"
 #include "nsIScriptSecurityManager.h"
 
--- a/uriloader/base/nsURILoader.cpp
+++ b/uriloader/base/nsURILoader.cpp
@@ -17,17 +17,17 @@
 #include "nsIStreamListener.h"
 #include "nsIURI.h"
 #include "nsIChannel.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIProgressEventSink.h"
 #include "nsIInputStream.h"
 #include "nsIStreamConverterService.h"
-#include "nsWeakReference.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsIHttpChannel.h"
 #include "nsIMultiPartChannel.h"
 #include "netCore.h"
 #include "nsCRT.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIThreadRetargetableStreamListener.h"
--- a/uriloader/prefetch/OfflineCacheUpdateChild.cpp
+++ b/uriloader/prefetch/OfflineCacheUpdateChild.cpp
@@ -322,17 +322,17 @@ NS_IMETHODIMP
 OfflineCacheUpdateChild::AddObserver(nsIOfflineCacheUpdateObserver *aObserver,
                                   bool aHoldWeak)
 {
     LOG(("OfflineCacheUpdateChild::AddObserver [%p]", this));
 
     NS_ENSURE_TRUE(mState >= STATE_INITIALIZED, NS_ERROR_NOT_INITIALIZED);
 
     if (aHoldWeak) {
-        nsCOMPtr<nsIWeakReference> weakRef = do_GetWeakReference(aObserver);
+        nsWeakPtr weakRef = do_GetWeakReference(aObserver);
         mWeakObservers.AppendObject(weakRef);
     } else {
         mObservers.AppendObject(aObserver);
     }
 
     return NS_OK;
 }
 
--- a/uriloader/prefetch/OfflineCacheUpdateChild.h
+++ b/uriloader/prefetch/OfflineCacheUpdateChild.h
@@ -10,18 +10,18 @@
 #include "nsIOfflineCacheUpdate.h"
 
 #include "nsCOMArray.h"
 #include "nsCOMPtr.h"
 #include "nsIDocument.h"
 #include "nsIObserver.h"
 #include "nsIObserverService.h"
 #include "nsIURI.h"
+#include "nsIWeakReference.h"
 #include "nsString.h"
-#include "nsWeakReference.h"
 
 class nsPIDOMWindowInner;
 
 namespace mozilla {
 namespace docshell {
 
 class OfflineCacheUpdateChild : public nsIOfflineCacheUpdate
                               , public POfflineCacheUpdateChild
--- a/uriloader/prefetch/nsOfflineCacheUpdate.cpp
+++ b/uriloader/prefetch/nsOfflineCacheUpdate.cpp
@@ -2429,17 +2429,17 @@ NS_IMETHODIMP
 nsOfflineCacheUpdate::AddObserver(nsIOfflineCacheUpdateObserver *aObserver,
                                   bool aHoldWeak)
 {
     LOG(("nsOfflineCacheUpdate::AddObserver [%p] to update [%p]", aObserver, this));
 
     NS_ENSURE_TRUE(mState >= STATE_INITIALIZED, NS_ERROR_NOT_INITIALIZED);
 
     if (aHoldWeak) {
-        nsCOMPtr<nsIWeakReference> weakRef = do_GetWeakReference(aObserver);
+        nsWeakPtr weakRef = do_GetWeakReference(aObserver);
         mWeakObservers.AppendObject(weakRef);
     } else {
         mObservers.AppendObject(aObserver);
     }
 
     return NS_OK;
 }
 
--- a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp
+++ b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp
@@ -111,17 +111,17 @@ public:
 
 private:
     ~nsOfflineCachePendingUpdate() {}
 
     RefPtr<nsOfflineCacheUpdateService> mService;
     nsCOMPtr<nsIURI> mManifestURI;
     nsCOMPtr<nsIURI> mDocumentURI;
     nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
-    nsCOMPtr<nsIWeakReference> mDocument;
+    nsWeakPtr mDocument;
     bool mDidReleaseThis;
 };
 
 NS_IMPL_ISUPPORTS(nsOfflineCachePendingUpdate,
                   nsIWebProgressListener,
                   nsISupportsWeakReference)
 
 //-----------------------------------------------------------------------------
--- a/uriloader/prefetch/nsPrefetchService.cpp
+++ b/uriloader/prefetch/nsPrefetchService.cpp
@@ -90,17 +90,17 @@ nsPrefetchNode::nsPrefetchNode(nsPrefetc
     , mReferrerURI(aReferrerURI)
     , mPolicyType(aPolicyType)
     , mPreload(aPreload)
     , mService(aService)
     , mChannel(nullptr)
     , mBytesRead(0)
     , mShouldFireLoadEvent(false)
 {
-    nsCOMPtr<nsIWeakReference> source = do_GetWeakReference(aSource);
+    nsWeakPtr source = do_GetWeakReference(aSource);
     mSources.AppendElement(source);
 }
 
 nsresult
 nsPrefetchNode::OpenChannel()
 {
     if (mSources.IsEmpty()) {
         // Don't attempt to prefetch if we don't have a source node
@@ -742,17 +742,17 @@ nsPrefetchService::Preload(nsIURI *aURI,
     //
     // Check whether it is being preloaded.
     //
     for (uint32_t i = 0; i < mCurrentNodes.Length(); ++i) {
         bool equals;
         if ((mCurrentNodes[i]->mPolicyType == aPolicyType) &&
             NS_SUCCEEDED(mCurrentNodes[i]->mURI->Equals(aURI, &equals)) &&
             equals) {
-            nsCOMPtr<nsIWeakReference> source = do_GetWeakReference(aSource);
+            nsWeakPtr source = do_GetWeakReference(aSource);
             if (mCurrentNodes[i]->mSources.IndexOf(source) ==
                 mCurrentNodes[i]->mSources.NoIndex) {
                 LOG(("URL is already being preloaded, add a new reference "
                      "document\n"));
                 mCurrentNodes[i]->mSources.AppendElement(source);
                 return NS_OK;
             } else {
                 LOG(("URL is already being preloaded by this document"));
@@ -826,17 +826,17 @@ nsPrefetchService::Prefetch(nsIURI *aURI
 
     //
     // Check whether it is being prefetched.
     //
     for (uint32_t i = 0; i < mCurrentNodes.Length(); ++i) {
         bool equals;
         if (NS_SUCCEEDED(mCurrentNodes[i]->mURI->Equals(aURI, &equals)) &&
             equals) {
-            nsCOMPtr<nsIWeakReference> source = do_GetWeakReference(aSource);
+            nsWeakPtr source = do_GetWeakReference(aSource);
             if (mCurrentNodes[i]->mSources.IndexOf(source) ==
                 mCurrentNodes[i]->mSources.NoIndex) {
                 LOG(("URL is already being prefetched, add a new reference "
                      "document\n"));
                 mCurrentNodes[i]->mSources.AppendElement(source);
                 return NS_OK;
             } else {
                 LOG(("URL is already being prefetched by this document"));
@@ -848,17 +848,17 @@ nsPrefetchService::Prefetch(nsIURI *aURI
     //
     // Check whether it is on the prefetch queue.
     //
     for (std::deque<RefPtr<nsPrefetchNode>>::iterator nodeIt = mPrefetchQueue.begin();
          nodeIt != mPrefetchQueue.end(); nodeIt++) {
         bool equals;
         RefPtr<nsPrefetchNode> node = nodeIt->get();
         if (NS_SUCCEEDED(node->mURI->Equals(aURI, &equals)) && equals) {
-            nsCOMPtr<nsIWeakReference> source = do_GetWeakReference(aSource);
+            nsWeakPtr source = do_GetWeakReference(aSource);
             if (node->mSources.IndexOf(source) ==
                 node->mSources.NoIndex) {
                 LOG(("URL is already being prefetched, add a new reference "
                      "document\n"));
                 node->mSources.AppendElement(do_GetWeakReference(aSource));
                 return NS_OK;
             } else {
                 LOG(("URL is already being prefetched by this document"));
@@ -895,17 +895,17 @@ nsPrefetchService::CancelPrefetchPreload
 
     //
     // look in current prefetches
     //
     for (uint32_t i = 0; i < mCurrentNodes.Length(); ++i) {
         bool equals;
         if (NS_SUCCEEDED(mCurrentNodes[i]->mURI->Equals(aURI, &equals)) &&
             equals) {
-            nsCOMPtr<nsIWeakReference> source = do_GetWeakReference(aSource);
+            nsWeakPtr source = do_GetWeakReference(aSource);
             if (mCurrentNodes[i]->mSources.IndexOf(source) !=
                 mCurrentNodes[i]->mSources.NoIndex) {
                 mCurrentNodes[i]->mSources.RemoveElement(source);
                 if (mCurrentNodes[i]->mSources.IsEmpty()) {
                     mCurrentNodes[i]->CancelChannel(NS_BINDING_ABORTED);
                     mCurrentNodes.RemoveElementAt(i);
                 }
                 return NS_OK;
@@ -917,17 +917,17 @@ nsPrefetchService::CancelPrefetchPreload
     //
     // look into the prefetch queue
     //
     for (std::deque<RefPtr<nsPrefetchNode>>::iterator nodeIt = mPrefetchQueue.begin();
          nodeIt != mPrefetchQueue.end(); nodeIt++) {
         bool equals;
         RefPtr<nsPrefetchNode> node = nodeIt->get();
         if (NS_SUCCEEDED(node->mURI->Equals(aURI, &equals)) && equals) {
-            nsCOMPtr<nsIWeakReference> source = do_GetWeakReference(aSource);
+            nsWeakPtr source = do_GetWeakReference(aSource);
             if (node->mSources.IndexOf(source) !=
                 node->mSources.NoIndex) {
 
 #ifdef DEBUG
                 int32_t inx = node->mSources.IndexOf(source);
                 nsCOMPtr<nsINode> domNode =
                     do_QueryReferent(node->mSources.ElementAt(inx));
                 MOZ_ASSERT(domNode);
--- a/uriloader/prefetch/nsPrefetchService.h
+++ b/uriloader/prefetch/nsPrefetchService.h
@@ -112,17 +112,17 @@ public:
                    nsContentPolicyType aPolicyType,
                    bool aPreload);
 
     nsresult OpenChannel();
     nsresult CancelChannel(nsresult error);
 
     nsCOMPtr<nsIURI>                      mURI;
     nsCOMPtr<nsIURI>                      mReferrerURI;
-    nsTArray<nsCOMPtr<nsIWeakReference>>  mSources;
+    nsTArray<nsWeakPtr>                   mSources;
 
     // The policy type to be used for fetching the resource.
     nsContentPolicyType                   mPolicyType;
     // nsPrefetchNode is used for prefetching and preloading resource.
     // mPreload is true if a resource is preloaded. Preloads and
     // prefetches are fetched in different phases (during load and
     // after a page load), therefore we need to distinguish them.
     bool                                  mPreload;
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -10,17 +10,17 @@
 #include "mozView.h"
 #ifdef ACCESSIBILITY
 #include "mozilla/a11y/Accessible.h"
 #include "mozAccessibleProtocol.h"
 #endif
 
 #include "nsISupports.h"
 #include "nsBaseWidget.h"
-#include "nsWeakPtr.h"
+#include "nsIWeakReferenceUtils.h"
 #include "TextInputHandler.h"
 #include "nsCocoaUtils.h"
 #include "gfxQuartzSurface.h"
 #include "GLContextTypes.h"
 #include "mozilla/Mutex.h"
 #include "nsRegion.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/UniquePtr.h"
--- a/widget/nsPrintSettingsImpl.h
+++ b/widget/nsPrintSettingsImpl.h
@@ -3,19 +3,19 @@
  * 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 nsPrintSettingsImpl_h__
 #define nsPrintSettingsImpl_h__
 
 #include "nsIPrintSettings.h"  
+#include "nsIWeakReferenceUtils.h"
 #include "nsMargin.h"  
 #include "nsString.h"
-#include "nsWeakReference.h"  
 
 #define NUM_HEAD_FOOT 3
 
 //*****************************************************************************
 //***    nsPrintSettings
 //*****************************************************************************
 
 class nsPrintSettings : public nsIPrintSettings
--- a/widget/nsTransferable.cpp
+++ b/widget/nsTransferable.cpp
@@ -28,17 +28,16 @@ Notes to self:
 #include "nsMemory.h"
 #include "nsPrimitiveHelpers.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsDirectoryService.h"
 #include "nsCRT.h"
 #include "nsNetUtil.h"
 #include "nsIOutputStream.h"
 #include "nsIInputStream.h"
-#include "nsIWeakReferenceUtils.h"
 #include "nsILoadContext.h"
 #include "mozilla/UniquePtr.h"
 
 using namespace mozilla;
 
 NS_IMPL_ISUPPORTS(nsTransferable, nsITransferable)
 
 DataStruct::DataStruct(DataStruct&& aRHS)
--- a/widget/windows/TaskbarPreview.h
+++ b/widget/windows/TaskbarPreview.h
@@ -11,17 +11,17 @@
 #include <windows.h>
 #include <shobjidl.h>
 #undef LogSeverity // SetupAPI.h #defines this as DWORD
 
 #include "mozilla/RefPtr.h"
 #include <nsITaskbarPreview.h>
 #include <nsITaskbarPreviewController.h>
 #include <nsString.h>
-#include <nsWeakPtr.h>
+#include <nsIWeakReferenceUtils.h>
 #include <nsIDocShell.h>
 #include "WindowHook.h"
 
 namespace mozilla {
 namespace widget {
 
 class TaskbarPreviewCallback;
 
--- a/widget/windows/TaskbarPreviewButton.h
+++ b/widget/windows/TaskbarPreviewButton.h
@@ -10,17 +10,17 @@
 
 #include <windows.h>
 #include <shobjidl.h>
 #undef LogSeverity // SetupAPI.h #defines this as DWORD
 
 #include "mozilla/RefPtr.h"
 #include <nsITaskbarPreviewButton.h>
 #include <nsString.h>
-#include <nsWeakReference.h>
+#include "nsWeakReference.h"
 
 namespace mozilla {
 namespace widget {
 
 class TaskbarWindowPreview;
 class TaskbarPreviewButton : public nsITaskbarPreviewButton, public nsSupportsWeakReference
 {
   virtual ~TaskbarPreviewButton();
--- a/widget/windows/TaskbarWindowPreview.h
+++ b/widget/windows/TaskbarWindowPreview.h
@@ -7,17 +7,17 @@
 
 #ifndef __mozilla_widget_TaskbarWindowPreview_h__
 #define __mozilla_widget_TaskbarWindowPreview_h__
 
 #include "nsITaskbarWindowPreview.h"
 #include "nsITaskbarProgress.h"
 #include "nsITaskbarOverlayIconController.h"
 #include "TaskbarPreview.h"
-#include <nsWeakReference.h>
+#include "nsWeakReference.h"
 
 namespace mozilla {
 namespace widget {
 
 class TaskbarPreviewButton;
 class TaskbarWindowPreview : public TaskbarPreview,
                              public nsITaskbarWindowPreview,
                              public nsITaskbarProgress,
--- a/xpcom/base/moz.build
+++ b/xpcom/base/moz.build
@@ -81,17 +81,16 @@ EXPORTS += [
     'nsIWeakReferenceUtils.h',
     'nsMemory.h',
     'nsObjCExceptions.h',
     'nsQueryObject.h',
     'nsSystemInfo.h',
     'nsTraceRefcnt.h',
     'nsTWeakRef.h',
     'nsVersionComparator.h',
-    'nsWeakPtr.h',
     'nsWeakReference.h',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     EXPORTS += [
         'nsWindowsHelpers.h',
     ]
     if CONFIG['CC_TYPE'] not in ('gcc', 'clang'):
--- a/xpcom/base/nsIWeakReference.idl
+++ b/xpcom/base/nsIWeakReference.idl
@@ -106,16 +106,8 @@ interface nsISupportsWeakReference : nsI
      * manage it with an |nsCOMPtr|.
      *
      * @see nsIWeakReference
      * @see nsWeakPtr
      * @see nsCOMPtr
      */
     nsIWeakReference GetWeakReference();
   };
-
-
-%{C++
-#ifdef MOZILLA_INTERNAL_API
-#include "nsIWeakReferenceUtils.h"
-#endif
-%}
-
deleted file mode 100644
--- a/xpcom/base/nsWeakPtr.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-#ifndef nsWeakPtr_h__
-#define nsWeakPtr_h__
-
-#include "nsIWeakReference.h"
-#include "nsCOMPtr.h"
-
-// typedef nsCOMPtr<nsIWeakReference> nsWeakPtr;
-
-#endif
--- a/xpcom/build/XPCOM.h
+++ b/xpcom/build/XPCOM.h
@@ -136,17 +136,16 @@
 #include "nsIMacUtils.h"
 #endif
 
 // xpcom/glue utility headers
 
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 
-#include "nsIWeakReferenceUtils.h"
 #include "nsWeakReference.h"
 
 #include "nsArrayEnumerator.h"
 #include "nsArrayUtils.h"
 #include "nsCRTGlue.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsDeque.h"
 #include "nsEnumeratorUtils.h"
--- a/xpcom/ds/nsObserverList.cpp
+++ b/xpcom/ds/nsObserverList.cpp
@@ -19,17 +19,17 @@ nsObserverList::AddObserver(nsIObserver*
     ObserverRef* o = mObservers.AppendElement(anObserver);
     if (!o) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
     return NS_OK;
   }
 
-  nsCOMPtr<nsIWeakReference> weak = do_GetWeakReference(anObserver);
+  nsWeakPtr weak = do_GetWeakReference(anObserver);
   if (!weak) {
     return NS_NOINTERFACE;
   }
 
   ObserverRef* o = mObservers.AppendElement(weak);
   if (!o) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
@@ -41,17 +41,17 @@ nsresult
 nsObserverList::RemoveObserver(nsIObserver* anObserver)
 {
   NS_ASSERTION(anObserver, "Null input");
 
   if (mObservers.RemoveElement(static_cast<nsISupports*>(anObserver))) {
     return NS_OK;
   }
 
-  nsCOMPtr<nsIWeakReference> observerRef = do_GetWeakReference(anObserver);
+  nsWeakPtr observerRef = do_GetWeakReference(anObserver);
   if (!observerRef) {
     return NS_ERROR_FAILURE;
   }
 
   if (!mObservers.RemoveElement(observerRef)) {
     return NS_ERROR_FAILURE;
   }
 
--- a/xpfe/appshell/nsXULWindow.h
+++ b/xpfe/appshell/nsXULWindow.h
@@ -26,17 +26,16 @@
 #include "nsIDocShellTreeItem.h"
 #include "nsIDOMWindow.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIXULWindow.h"
 #include "nsIPrompt.h"
 #include "nsIAuthPrompt.h"
 #include "nsIXULBrowserWindow.h"
-#include "nsIWeakReference.h"
 #include "nsIWidgetListener.h"
 #include "nsITabParent.h"
 #include "nsIXULStore.h"
 
 namespace mozilla {
 namespace dom {
 class Element;
 } // namespace dom
@@ -157,17 +156,17 @@ protected:
                                  const nsAString& aValue);
 
    nsChromeTreeOwner*      mChromeTreeOwner;
    nsContentTreeOwner*     mContentTreeOwner;
    nsContentTreeOwner*     mPrimaryContentTreeOwner;
    nsCOMPtr<nsIWidget>     mWindow;
    nsCOMPtr<nsIDocShell>   mDocShell;
    nsCOMPtr<nsPIDOMWindowOuter>  mDOMWindow;
-   nsCOMPtr<nsIWeakReference> mParentWindow;
+   nsWeakPtr               mParentWindow;
    nsCOMPtr<nsIPrompt>     mPrompter;
    nsCOMPtr<nsIAuthPrompt> mAuthPrompter;
    nsCOMPtr<nsIXULBrowserWindow> mXULBrowserWindow;
    nsCOMPtr<nsIDocShellTreeItem> mPrimaryContentShell;
    nsresult                mModalStatus;
    bool                    mContinueModalLoop;
    bool                    mDebuting;       // being made visible right now
    bool                    mChromeLoaded; // True when chrome has loaded