Bug 1533159: Add MOZ_RELEASE_ASSERT to all SetLoadInfo implementations to ensure loadinfo is never null. r=valentin
authorChristoph Kerschbaumer <ckerschb@christophkerschbaumer.com>
Thu, 14 Mar 2019 11:38:23 +0000
changeset 521871 d8b7c29dcee0aca2593d1e0f015515ce185d208b
parent 521870 f101c9664b87addc3aa1399c56b5ea5c194df199
child 521872 8995d452cf894f44aae9f4efbe0c7efa57b70e0a
push id10870
push usernbeleuzu@mozilla.com
push dateFri, 15 Mar 2019 20:00:07 +0000
treeherdermozilla-beta@c594aee5b7a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1533159
milestone67.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 1533159: Add MOZ_RELEASE_ASSERT to all SetLoadInfo implementations to ensure loadinfo is never null. r=valentin Differential Revision: https://phabricator.services.mozilla.com/D23302
dom/jsurl/nsJSProtocolHandler.cpp
image/decoders/icon/mac/nsIconChannelCocoa.mm
image/decoders/icon/win/nsIconChannel.cpp
modules/libjar/nsJARChannel.cpp
netwerk/base/nsBaseChannel.cpp
netwerk/protocol/http/HttpBaseChannel.cpp
netwerk/protocol/http/TrackingDummyChannel.cpp
netwerk/protocol/viewsource/nsViewSourceChannel.cpp
netwerk/protocol/websocket/BaseWebSocketChannel.cpp
netwerk/streamconv/converters/nsMultiMixedConv.cpp
uriloader/exthandler/nsExternalProtocolHandler.cpp
--- a/dom/jsurl/nsJSProtocolHandler.cpp
+++ b/dom/jsurl/nsJSProtocolHandler.cpp
@@ -854,16 +854,17 @@ nsJSChannel::SetOwner(nsISupports* aOwne
 
 NS_IMETHODIMP
 nsJSChannel::GetLoadInfo(nsILoadInfo** aLoadInfo) {
   return mStreamChannel->GetLoadInfo(aLoadInfo);
 }
 
 NS_IMETHODIMP
 nsJSChannel::SetLoadInfo(nsILoadInfo* aLoadInfo) {
+  MOZ_RELEASE_ASSERT(aLoadInfo, "loadinfo can't be null");
   return mStreamChannel->SetLoadInfo(aLoadInfo);
 }
 
 NS_IMETHODIMP
 nsJSChannel::GetNotificationCallbacks(nsIInterfaceRequestor** aCallbacks) {
   return mStreamChannel->GetNotificationCallbacks(aCallbacks);
 }
 
--- a/image/decoders/icon/mac/nsIconChannelCocoa.mm
+++ b/image/decoders/icon/mac/nsIconChannelCocoa.mm
@@ -462,16 +462,17 @@ nsIconChannel::SetOwner(nsISupports* aOw
 NS_IMETHODIMP
 nsIconChannel::GetLoadInfo(nsILoadInfo** aLoadInfo) {
   NS_IF_ADDREF(*aLoadInfo = mLoadInfo);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsIconChannel::SetLoadInfo(nsILoadInfo* aLoadInfo) {
+  MOZ_RELEASE_ASSERT(aLoadInfo, "loadinfo can't be null");
   mLoadInfo = aLoadInfo;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsIconChannel::GetNotificationCallbacks(nsIInterfaceRequestor** aNotificationCallbacks) {
   *aNotificationCallbacks = mCallbacks.get();
   NS_IF_ADDREF(*aNotificationCallbacks);
--- a/image/decoders/icon/win/nsIconChannel.cpp
+++ b/image/decoders/icon/win/nsIconChannel.cpp
@@ -675,16 +675,17 @@ nsIconChannel::SetOwner(nsISupports* aOw
 NS_IMETHODIMP
 nsIconChannel::GetLoadInfo(nsILoadInfo** aLoadInfo) {
   NS_IF_ADDREF(*aLoadInfo = mLoadInfo);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsIconChannel::SetLoadInfo(nsILoadInfo* aLoadInfo) {
+  MOZ_RELEASE_ASSERT(aLoadInfo, "loadinfo can't be null");
   mLoadInfo = aLoadInfo;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsIconChannel::GetNotificationCallbacks(
     nsIInterfaceRequestor** aNotificationCallbacks) {
   *aNotificationCallbacks = mCallbacks.get();
--- a/modules/libjar/nsJARChannel.cpp
+++ b/modules/libjar/nsJARChannel.cpp
@@ -674,16 +674,17 @@ nsJARChannel::SetOwner(nsISupports *aOwn
 NS_IMETHODIMP
 nsJARChannel::GetLoadInfo(nsILoadInfo **aLoadInfo) {
   NS_IF_ADDREF(*aLoadInfo = mLoadInfo);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsJARChannel::SetLoadInfo(nsILoadInfo *aLoadInfo) {
+  MOZ_RELEASE_ASSERT(aLoadInfo, "loadinfo can't be null");
   mLoadInfo = aLoadInfo;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsJARChannel::GetNotificationCallbacks(nsIInterfaceRequestor **aCallbacks) {
   NS_IF_ADDREF(*aCallbacks = mCallbacks);
   return NS_OK;
--- a/netwerk/base/nsBaseChannel.cpp
+++ b/netwerk/base/nsBaseChannel.cpp
@@ -437,16 +437,17 @@ nsBaseChannel::GetOwner(nsISupports **aO
 NS_IMETHODIMP
 nsBaseChannel::SetOwner(nsISupports *aOwner) {
   mOwner = aOwner;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsBaseChannel::SetLoadInfo(nsILoadInfo *aLoadInfo) {
+  MOZ_RELEASE_ASSERT(aLoadInfo, "loadinfo can't be null");
   mLoadInfo = aLoadInfo;
 
   // Need to update |mNeckoTarget| when load info has changed.
   SetupNeckoTarget();
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -553,16 +553,17 @@ HttpBaseChannel::GetOwner(nsISupports** 
 NS_IMETHODIMP
 HttpBaseChannel::SetOwner(nsISupports* aOwner) {
   mOwner = aOwner;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HttpBaseChannel::SetLoadInfo(nsILoadInfo* aLoadInfo) {
+  MOZ_RELEASE_ASSERT(aLoadInfo, "loadinfo can't be null");
   mLoadInfo = aLoadInfo;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HttpBaseChannel::GetLoadInfo(nsILoadInfo** aLoadInfo) {
   NS_IF_ADDREF(*aLoadInfo = mLoadInfo);
   return NS_OK;
--- a/netwerk/protocol/http/TrackingDummyChannel.cpp
+++ b/netwerk/protocol/http/TrackingDummyChannel.cpp
@@ -231,16 +231,17 @@ TrackingDummyChannel::GetContentDisposit
 NS_IMETHODIMP
 TrackingDummyChannel::GetLoadInfo(nsILoadInfo** aLoadInfo) {
   NS_IF_ADDREF(*aLoadInfo = mLoadInfo);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 TrackingDummyChannel::SetLoadInfo(nsILoadInfo* aLoadInfo) {
+  MOZ_RELEASE_ASSERT(aLoadInfo, "loadinfo can't be null");
   mLoadInfo = aLoadInfo;
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // TrackingDummyChannel::nsIRequest
 //-----------------------------------------------------------------------------
 
--- a/netwerk/protocol/viewsource/nsViewSourceChannel.cpp
+++ b/netwerk/protocol/viewsource/nsViewSourceChannel.cpp
@@ -528,17 +528,17 @@ nsViewSourceChannel::GetLoadInfo(nsILoad
   NS_ENSURE_TRUE(mChannel, NS_ERROR_FAILURE);
 
   return mChannel->GetLoadInfo(aLoadInfo);
 }
 
 NS_IMETHODIMP
 nsViewSourceChannel::SetLoadInfo(nsILoadInfo *aLoadInfo) {
   NS_ENSURE_TRUE(mChannel, NS_ERROR_FAILURE);
-
+  MOZ_RELEASE_ASSERT(aLoadInfo, "loadinfo can't be null");
   return mChannel->SetLoadInfo(aLoadInfo);
 }
 
 NS_IMETHODIMP
 nsViewSourceChannel::GetIsDocument(bool *aIsDocument) {
   NS_ENSURE_TRUE(mChannel, NS_ERROR_FAILURE);
 
   return mChannel->GetIsDocument(aIsDocument);
--- a/netwerk/protocol/websocket/BaseWebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/BaseWebSocketChannel.cpp
@@ -116,16 +116,17 @@ NS_IMETHODIMP
 BaseWebSocketChannel::SetLoadGroup(nsILoadGroup *aLoadGroup) {
   LOG(("BaseWebSocketChannel::SetLoadGroup() %p\n", this));
   mLoadGroup = aLoadGroup;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 BaseWebSocketChannel::SetLoadInfo(nsILoadInfo *aLoadInfo) {
+  MOZ_RELEASE_ASSERT(aLoadInfo, "loadinfo can't be null");
   mLoadInfo = aLoadInfo;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 BaseWebSocketChannel::GetLoadInfo(nsILoadInfo **aLoadInfo) {
   NS_IF_ADDREF(*aLoadInfo = mLoadInfo);
   return NS_OK;
--- a/netwerk/streamconv/converters/nsMultiMixedConv.cpp
+++ b/netwerk/streamconv/converters/nsMultiMixedConv.cpp
@@ -230,16 +230,17 @@ nsPartChannel::SetOwner(nsISupports *aOw
 
 NS_IMETHODIMP
 nsPartChannel::GetLoadInfo(nsILoadInfo **aLoadInfo) {
   return mMultipartChannel->GetLoadInfo(aLoadInfo);
 }
 
 NS_IMETHODIMP
 nsPartChannel::SetLoadInfo(nsILoadInfo *aLoadInfo) {
+  MOZ_RELEASE_ASSERT(aLoadInfo, "loadinfo can't be null");
   return mMultipartChannel->SetLoadInfo(aLoadInfo);
 }
 
 NS_IMETHODIMP
 nsPartChannel::GetNotificationCallbacks(nsIInterfaceRequestor **aCallbacks) {
   return mMultipartChannel->GetNotificationCallbacks(aCallbacks);
 }
 
--- a/uriloader/exthandler/nsExternalProtocolHandler.cpp
+++ b/uriloader/exthandler/nsExternalProtocolHandler.cpp
@@ -306,16 +306,17 @@ NS_IMETHODIMP nsExtProtocolChannel::SetO
 }
 
 NS_IMETHODIMP nsExtProtocolChannel::GetLoadInfo(nsILoadInfo **aLoadInfo) {
   NS_IF_ADDREF(*aLoadInfo = mLoadInfo);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsExtProtocolChannel::SetLoadInfo(nsILoadInfo *aLoadInfo) {
+  MOZ_RELEASE_ASSERT(aLoadInfo, "loadinfo can't be null");
   mLoadInfo = aLoadInfo;
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // From nsIRequest
 ////////////////////////////////////////////////////////////////////////////////