Bug 971432 - Move baseURI to nsILoadInfo. r=bz
authorJames Kitchener <jkitch.bug@internode.on.net>
Wed, 05 Nov 2014 01:34:00 +0100
changeset 214057 80793ffb4e3c579d0462353e5ef8bfae15880f20
parent 214056 dffbf0a5595585183535eb864b6ed46ad72ec59c
child 214058 d23660998a7b4ec86ad4bb382dbfa5e56e538a36
push id51409
push usercbook@mozilla.com
push dateWed, 05 Nov 2014 12:39:19 +0000
treeherdermozilla-inbound@4e434f4b9d9d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs971432
milestone36.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 971432 - Move baseURI to nsILoadInfo. r=bz
docshell/base/LoadInfo.cpp
docshell/base/LoadInfo.h
docshell/base/nsDocShell.cpp
docshell/base/nsILoadInfo.idl
netwerk/base/public/nsIInputStreamChannel.idl
netwerk/base/public/nsNetUtil.h
netwerk/base/src/nsInputStreamChannel.cpp
netwerk/base/src/nsInputStreamChannel.h
netwerk/protocol/viewsource/nsIViewSourceChannel.idl
netwerk/protocol/viewsource/nsViewSourceChannel.cpp
netwerk/protocol/viewsource/nsViewSourceChannel.h
netwerk/protocol/viewsource/nsViewSourceHandler.cpp
netwerk/protocol/viewsource/nsViewSourceHandler.h
--- a/docshell/base/LoadInfo.cpp
+++ b/docshell/base/LoadInfo.cpp
@@ -12,21 +12,23 @@
 #include "nsISupportsImpl.h"
 #include "nsISupportsUtils.h"
 
 namespace mozilla {
 
 LoadInfo::LoadInfo(nsIPrincipal* aPrincipal,
                    nsINode* aLoadingContext,
                    nsSecurityFlags aSecurityFlags,
-                   nsContentPolicyType aContentPolicyType)
+                   nsContentPolicyType aContentPolicyType,
+                   nsIURI* aBaseURI)
   : mPrincipal(aPrincipal)
   , mLoadingContext(do_GetWeakReference(aLoadingContext))
   , mSecurityFlags(aSecurityFlags)
   , mContentPolicyType(aContentPolicyType)
+  , mBaseURI(aBaseURI)
 {
   MOZ_ASSERT(aPrincipal);
   // if the load is sandboxed, we can not also inherit the principal
   if (mSecurityFlags & nsILoadInfo::SEC_SANDBOXED) {
     mSecurityFlags ^= nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL;
   }
 }
 
@@ -90,9 +92,17 @@ LoadInfo::GetLoadingSandboxed(bool* aLoa
 
 NS_IMETHODIMP
 LoadInfo::GetContentPolicyType(nsContentPolicyType* outContentPolicyType)
 {
   *outContentPolicyType = mContentPolicyType;
   return NS_OK;
 }
 
+NS_IMETHODIMP
+LoadInfo::GetBaseURI(nsIURI** aBaseURI)
+{
+  *aBaseURI = mBaseURI;
+  NS_IF_ADDREF(*aBaseURI);
+  return NS_OK;
+}
+
 } // namespace mozilla
--- a/docshell/base/LoadInfo.h
+++ b/docshell/base/LoadInfo.h
@@ -6,16 +6,17 @@
 
 #ifndef mozilla_LoadInfo_h
 #define mozilla_LoadInfo_h
 
 #include "nsIContentPolicy.h"
 #include "nsILoadInfo.h"
 #include "nsIPrincipal.h"
 #include "nsIWeakReferenceUtils.h" // for nsWeakPtr
+#include "nsIURI.h"
 
 class nsINode;
 
 namespace mozilla {
 
 /**
  * Class that provides an nsILoadInfo implementation.
  */
@@ -24,23 +25,25 @@ class MOZ_EXPORT LoadInfo MOZ_FINAL : pu
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSILOADINFO
 
   // aPrincipal MUST NOT BE NULL.
   LoadInfo(nsIPrincipal* aPrincipal,
            nsINode* aLoadingContext,
            nsSecurityFlags aSecurityFlags,
-           nsContentPolicyType aContentPolicyType);
+           nsContentPolicyType aContentPolicyType,
+           nsIURI* aBaseURI = nullptr);
 
 private:
   ~LoadInfo();
 
   nsCOMPtr<nsIPrincipal> mPrincipal;
   nsWeakPtr              mLoadingContext;
   nsSecurityFlags        mSecurityFlags;
   nsContentPolicyType    mContentPolicyType;
+  nsCOMPtr<nsIURI>       mBaseURI;
 };
 
 } // namespace mozilla
 
 #endif // mozilla_LoadInfo_h
 
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -10263,22 +10263,25 @@ nsDocShell::DoURILoad(nsIURI * aURI,
     if (inherit) {
       securityFlags |= nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL;
     }
     if (isSandBoxed) {
       securityFlags |= nsILoadInfo::SEC_SANDBOXED;
     }
 
     if (!isSrcdoc) {
+      nsCOMPtr<nsILoadInfo> loadInfo =
+        new mozilla::LoadInfo(requestingPrincipal,
+                              requestingNode,
+                              securityFlags,
+                              aContentPolicyType,
+                              aBaseURI);
         rv = NS_NewChannelInternal(getter_AddRefs(channel),
                                    aURI,
-                                   requestingNode,
-                                   requestingPrincipal,
-                                   securityFlags,
-                                   aContentPolicyType,
+                                   loadInfo,
                                    nullptr,   // loadGroup
                                    static_cast<nsIInterfaceRequestor*>(this),
                                    loadFlags);
 
         if (NS_FAILED(rv)) {
             if (rv == NS_ERROR_UNKNOWN_PROTOCOL) {
                 // This is a uri with a protocol scheme we don't know how
                 // to handle.  Embedders might still be interested in
@@ -10288,58 +10291,50 @@ nsDocShell::DoURILoad(nsIURI * aURI,
                 nsresult rv2 = mContentListener->OnStartURIOpen(aURI, &abort);
                 if (NS_SUCCEEDED(rv2) && abort) {
                     // Hey, they're handling the load for us!  How convenient!
                     return NS_OK;
                 }
             }
             return rv;
         }
-        if (aBaseURI) {
-            nsCOMPtr<nsIViewSourceChannel> vsc = do_QueryInterface(channel);
-            if (vsc) {
-                vsc->SetBaseURI(aBaseURI);
-            }
-        }
     }
     else {
         nsAutoCString scheme;
         rv = aURI->GetScheme(scheme);
         NS_ENSURE_SUCCESS(rv,rv);
         bool isViewSource;
         aURI->SchemeIs("view-source",&isViewSource);
 
         if (isViewSource) {
             nsViewSourceHandler *vsh = nsViewSourceHandler::GetInstance();
             NS_ENSURE_TRUE(vsh,NS_ERROR_FAILURE);
 
-            rv = vsh->NewSrcdocChannel(aURI, aSrcdoc, aBaseURI,
-                                       getter_AddRefs(channel));
+            rv = vsh->NewSrcdocChannel(aURI, aSrcdoc, getter_AddRefs(channel));
             NS_ENSURE_SUCCESS(rv, rv);
             nsCOMPtr<nsILoadInfo> loadInfo =
               new LoadInfo(requestingPrincipal,
                            requestingNode,
                            securityFlags,
-                           aContentPolicyType);
+                           aContentPolicyType,
+                           aBaseURI);
             channel->SetLoadInfo(loadInfo);
         }
         else {
             rv = NS_NewInputStreamChannelInternal(getter_AddRefs(channel),
                                                   aURI,
                                                   aSrcdoc,
                                                   NS_LITERAL_CSTRING("text/html"),
                                                   requestingNode,
                                                   requestingPrincipal,
                                                   securityFlags,
                                                   aContentPolicyType,
-                                                  true);
+                                                  true,
+                                                  aBaseURI);
             NS_ENSURE_SUCCESS(rv, rv);
-            nsCOMPtr<nsIInputStreamChannel> isc = do_QueryInterface(channel);
-            MOZ_ASSERT(isc);
-            isc->SetBaseURI(aBaseURI);
         }
     }
 
     nsCOMPtr<nsIApplicationCacheChannel> appCacheChannel =
         do_QueryInterface(channel);
     if (appCacheChannel) {
         // Any document load should not inherit application cache.
         appCacheChannel->SetInheritApplicationCache(false);
@@ -11585,18 +11580,20 @@ nsDocShell::AddToSessionHistory(nsIURI *
     nsCOMPtr<nsIInputStreamChannel> inStrmChan = do_QueryInterface(aChannel);
     if (inStrmChan) {
         bool isSrcdocChannel;
         inStrmChan->GetIsSrcdocChannel(&isSrcdocChannel);
         if (isSrcdocChannel) {
             nsAutoString srcdoc;
             inStrmChan->GetSrcdocData(srcdoc);
             entry->SetSrcdocData(srcdoc);
+            nsCOMPtr<nsILoadInfo> loadInfo;
+            aChannel->GetLoadInfo(getter_AddRefs(loadInfo));
             nsCOMPtr<nsIURI> baseURI;
-            inStrmChan->GetBaseURI(getter_AddRefs(baseURI));
+            loadInfo->GetBaseURI(getter_AddRefs(baseURI));
             entry->SetBaseURI(baseURI);
         }
     }
     /* If cache got a 'no-store', ask SH not to store
      * HistoryLayoutState. By default, SH will set this
      * flag to true and save HistoryLayoutState.
      */    
     if (discardLayoutState) {
--- a/docshell/base/nsILoadInfo.idl
+++ b/docshell/base/nsILoadInfo.idl
@@ -5,23 +5,24 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 #include "nsIContentPolicy.idl"
 
 interface nsIDOMDocument;
 interface nsINode;
 interface nsIPrincipal;
+interface nsIURI;
 
 typedef unsigned long nsSecurityFlags;
 
 /**
  * An nsILoadOwner represents per-load information about who started the load.
  */
-[scriptable, builtinclass, uuid(046db047-a1c1-4519-8ec7-99f3054bc9ac)]
+[scriptable, builtinclass, uuid(b22b8ee7-047a-4351-a749-13c6d39f6b17)]
 interface nsILoadInfo : nsISupports
 {
   /**
    * No special security flags:
    */
   const unsigned long SEC_NORMAL = 0;
 
   /**
@@ -143,9 +144,15 @@ interface nsILoadInfo : nsISupports
   {
     nsContentPolicyType result;
     mozilla::DebugOnly<nsresult> rv = GetContentPolicyType(&result);
     MOZ_ASSERT(NS_SUCCEEDED(rv));
     return result;
   }
 %}
 
+  /**
+   * A base URI for use in situations where it cannot otherwise be inferred.
+   * This attribute may be null.  The value of this attribute may be
+   * ignored if the base URI can be inferred by the channel's URI.
+   */
+   readonly attribute nsIURI baseURI;
 };
--- a/netwerk/base/public/nsIInputStreamChannel.idl
+++ b/netwerk/base/public/nsIInputStreamChannel.idl
@@ -8,17 +8,17 @@ interface nsIInputStream;
 interface nsIURI;
 
 /**
  * nsIInputStreamChannel
  *
  * This interface provides methods to initialize an input stream channel.
  * The input stream channel serves as a data pump for an input stream.
  */
-[scriptable, uuid(17a17ce4-9a07-43fb-a0a3-947a6e21476c)]
+[scriptable, uuid(e1e95852-914b-4d83-b574-23f114db9b89)]
 interface nsIInputStreamChannel : nsISupports
 {
     /**
      * Sets the URI for this channel.  This must be called before the
      * channel is opened, and it may only be called once.
      */
     void setURI(in nsIURI aURI);
 
@@ -50,15 +50,9 @@ interface nsIInputStreamChannel : nsISup
      * functionality of the channel or input stream.
      */
     attribute AString srcdocData;
 
     /**
      * Returns true if srcdocData has been set within the channel.
      */
     readonly attribute boolean isSrcdocChannel;
-
-    /**
-     * The base URI to be used for the channel.  Used when the base URI cannot
-     * be inferred by other means, for example when this is a srcdoc channel.
-     */
-    attribute nsIURI baseURI;
 };
--- a/netwerk/base/public/nsNetUtil.h
+++ b/netwerk/base/public/nsNetUtil.h
@@ -600,17 +600,18 @@ inline nsresult
 NS_NewInputStreamChannelInternal(nsIChannel**        outChannel,
                                  nsIURI*             aUri,
                                  nsIInputStream*     aStream,
                                  const nsACString&   aContentType,
                                  const nsACString&   aContentCharset,
                                  nsINode*            aRequestingNode,
                                  nsIPrincipal*       aRequestingPrincipal,
                                  nsSecurityFlags     aSecurityFlags,
-                                 nsContentPolicyType aContentPolicyType)
+                                 nsContentPolicyType aContentPolicyType,
+                                 nsIURI*             aBaseURI = nullptr)
 {
   nsresult rv;
   nsCOMPtr<nsIInputStreamChannel> isc =
     do_CreateInstance(NS_INPUTSTREAMCHANNEL_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = isc->SetURI(aUri);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = isc->SetContentStream(aStream);
@@ -628,17 +629,18 @@ NS_NewInputStreamChannelInternal(nsIChan
     rv = channel->SetContentCharset(aContentCharset);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   nsCOMPtr<nsILoadInfo> loadInfo =
     new mozilla::LoadInfo(aRequestingPrincipal,
                           aRequestingNode,
                           aSecurityFlags,
-                          aContentPolicyType);
+                          aContentPolicyType,
+                          aBaseURI);
   if (!loadInfo) {
     return NS_ERROR_UNEXPECTED;
   }
   channel->SetLoadInfo(loadInfo);
 
   // If we're sandboxed, make sure to clear any owner the channel
   // might already have.
   if (loadInfo->GetLoadingSandboxed()) {
@@ -674,17 +676,18 @@ inline nsresult
 NS_NewInputStreamChannelInternal(nsIChannel**        outChannel,
                                  nsIURI*             aUri,
                                  const nsAString&    aData,
                                  const nsACString&   aContentType,
                                  nsINode*            aRequestingNode,
                                  nsIPrincipal*       aRequestingPrincipal,
                                  nsSecurityFlags     aSecurityFlags,
                                  nsContentPolicyType aContentPolicyType,
-                                 bool                aIsSrcdocChannel = false)
+                                 bool                aIsSrcdocChannel = false,
+                                 nsIURI*             aBaseURI = nullptr)
 {
   nsresult rv;
   nsCOMPtr<nsIStringInputStream> stream;
   stream = do_CreateInstance(NS_STRINGINPUTSTREAM_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
 #ifdef MOZILLA_INTERNAL_API
     uint32_t len;
@@ -699,17 +702,18 @@ NS_NewInputStreamChannelInternal(nsIChan
   rv = NS_NewInputStreamChannelInternal(getter_AddRefs(channel),
                                         aUri,
                                         stream,
                                         aContentType,
                                         NS_LITERAL_CSTRING("UTF-8"),
                                         aRequestingNode,
                                         aRequestingPrincipal,
                                         aSecurityFlags,
-                                        aContentPolicyType);
+                                        aContentPolicyType,
+                                        aBaseURI);
 
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (aIsSrcdocChannel) {
     nsCOMPtr<nsIInputStreamChannel> inStrmChan = do_QueryInterface(channel);
     NS_ENSURE_TRUE(inStrmChan, NS_ERROR_FAILURE);
     inStrmChan->SetSrcdocData(aData);
   }
@@ -720,27 +724,29 @@ NS_NewInputStreamChannelInternal(nsIChan
 inline nsresult
 NS_NewInputStreamChannel(nsIChannel**        outChannel,
                          nsIURI*             aUri,
                          const nsAString&    aData,
                          const nsACString&   aContentType,
                          nsIPrincipal*       aRequestingPrincipal,
                          nsSecurityFlags     aSecurityFlags,
                          nsContentPolicyType aContentPolicyType,
-                         bool                aIsSrcdocChannel = false)
+                         bool                aIsSrcdocChannel = false,
+                         nsIURI*             aBaseURI = nullptr)
 {
   return NS_NewInputStreamChannelInternal(outChannel,
                                           aUri,
                                           aData,
                                           aContentType,
                                           nullptr, // aRequestingNode
                                           aRequestingPrincipal,
                                           aSecurityFlags,
                                           aContentPolicyType,
-                                          aIsSrcdocChannel);
+                                          aIsSrcdocChannel,
+                                          aBaseURI);
 }
 
 inline nsresult
 NS_NewInputStreamPump(nsIInputStreamPump **result,
                       nsIInputStream      *stream,
                       int64_t              streamPos = int64_t(-1),
                       int64_t              streamLen = int64_t(-1),
                       uint32_t             segsize = 0,
--- a/netwerk/base/src/nsInputStreamChannel.cpp
+++ b/netwerk/base/src/nsInputStreamChannel.cpp
@@ -84,23 +84,8 @@ nsInputStreamChannel::SetSrcdocData(cons
 }
 
 NS_IMETHODIMP
 nsInputStreamChannel::GetIsSrcdocChannel(bool *aIsSrcdocChannel)
 {
   *aIsSrcdocChannel = mIsSrcdocChannel;
   return NS_OK;
 }
-
-NS_IMETHODIMP
-nsInputStreamChannel::GetBaseURI(nsIURI** aBaseURI)
-{
-  *aBaseURI = mBaseURI;
-  NS_IF_ADDREF(*aBaseURI);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsInputStreamChannel::SetBaseURI(nsIURI* aBaseURI)
-{
-  mBaseURI = aBaseURI;
-  return NS_OK;
-}
--- a/netwerk/base/src/nsInputStreamChannel.h
+++ b/netwerk/base/src/nsInputStreamChannel.h
@@ -28,14 +28,13 @@ protected:
                                        nsIChannel** channel);
 
     virtual void OnChannelDone() MOZ_OVERRIDE {
         mContentStream = nullptr;
     }
 
 private:
     nsCOMPtr<nsIInputStream> mContentStream;
-    nsCOMPtr<nsIURI> mBaseURI;
     nsString mSrcdocData;
     bool mIsSrcdocChannel;
 };
 
 #endif // !nsInputStreamChannel_h__
--- a/netwerk/protocol/viewsource/nsIViewSourceChannel.idl
+++ b/netwerk/protocol/viewsource/nsIViewSourceChannel.idl
@@ -1,16 +1,16 @@
 /* -*- 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/. */
 
 #include "nsIChannel.idl"
 
-[uuid(ac5bcfe9-fe54-4e9a-95fb-cd7aa558c5bc)]
+[uuid(72d9580a-b636-4392-b888-6c003c56f3d7)]
 interface nsIViewSourceChannel : nsIChannel
 {
     /**
      * The actual (MIME) content type of the data.
      *
      * nsIViewSourceChannel returns a content type of
      * "application/x-view-source" if you ask it for the contentType
      * attribute.
@@ -19,20 +19,11 @@ interface nsIViewSourceChannel : nsIChan
      * actual content type can utilize this attribute.
      */
     attribute ACString originalContentType;
 
     /**
      * Whether the channel was created to view the source of a srcdoc document.
      */
     readonly attribute boolean isSrcdocChannel;
-
-    /**
-     * Set to indicate the base URI.  If this channel is a srcdoc channel, it
-     * returns the base URI provided by the embedded channel.  It is used to
-     * provide an indication of the base URI in circumstances where it isn't
-     * otherwise recoverable.  Returns null when it isn't set and isn't a
-     * srcdoc channel.
-     */
-    attribute nsIURI baseURI;
 };
 
 
--- a/netwerk/protocol/viewsource/nsViewSourceChannel.cpp
+++ b/netwerk/protocol/viewsource/nsViewSourceChannel.cpp
@@ -67,18 +67,17 @@ nsViewSourceChannel::Init(nsIURI* uri)
     mCachingChannel = do_QueryInterface(mChannel);
     mApplicationCacheChannel = do_QueryInterface(mChannel);
     mUploadChannel = do_QueryInterface(mChannel);
     
     return NS_OK;
 }
 
 nsresult
-nsViewSourceChannel::InitSrcdoc(nsIURI* aURI, const nsAString &aSrcdoc,
-                                nsIURI* aBaseURI)
+nsViewSourceChannel::InitSrcdoc(nsIURI* aURI, const nsAString &aSrcdoc)
 {
 
     nsresult rv;
 
     nsCOMPtr<nsIURI> inStreamURI;
     // Need to strip view-source: from the URI.  Hardcoded to
     // about:srcdoc as this is the only permissible URI for srcdoc 
     // loads
@@ -93,19 +92,16 @@ nsViewSourceChannel::InitSrcdoc(nsIURI* 
                                   nsContentUtils::GetSystemPrincipal(),
                                   nsILoadInfo::SEC_NORMAL,
                                   nsIContentPolicy::TYPE_OTHER,
                                   true);
 
     NS_ENSURE_SUCCESS(rv, rv);
     mOriginalURI = aURI;
     mIsSrcdocChannel = true;
-    nsCOMPtr<nsIInputStreamChannel> isc = do_QueryInterface(mChannel);
-    MOZ_ASSERT(isc);
-    isc->SetBaseURI(aBaseURI);
 
     mChannel->SetOriginalURI(mOriginalURI);
     mHttpChannel = do_QueryInterface(mChannel);
     mHttpChannelInternal = do_QueryInterface(mChannel);
     mCachingChannel = do_QueryInterface(mChannel);
     mApplicationCacheChannel = do_QueryInterface(mChannel);
     mUploadChannel = do_QueryInterface(mChannel);
     return NS_OK;
@@ -519,37 +515,16 @@ nsViewSourceChannel::SetOriginalContentT
 
 NS_IMETHODIMP
 nsViewSourceChannel::GetIsSrcdocChannel(bool* aIsSrcdocChannel)
 {
     *aIsSrcdocChannel = mIsSrcdocChannel;
     return NS_OK;
 }
 
-NS_IMETHODIMP
-nsViewSourceChannel::GetBaseURI(nsIURI** aBaseURI)
-{
-  if (mIsSrcdocChannel) {
-    nsCOMPtr<nsIInputStreamChannel> isc = do_QueryInterface(mChannel);
-    if (isc) {
-      return isc->GetBaseURI(aBaseURI);
-    }
-  }
-  *aBaseURI = mBaseURI;
-  NS_IF_ADDREF(*aBaseURI);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsViewSourceChannel::SetBaseURI(nsIURI* aBaseURI)
-{
-  mBaseURI = aBaseURI;
-  return NS_OK;
-}
-
 // nsIRequestObserver methods
 NS_IMETHODIMP
 nsViewSourceChannel::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
 {
     NS_ENSURE_TRUE(mListener, NS_ERROR_FAILURE);
     // The channel may have gotten redirected... Time to update our info
     mChannel = do_QueryInterface(aRequest);
     mHttpChannel = do_QueryInterface(aRequest);
--- a/netwerk/protocol/viewsource/nsViewSourceChannel.h
+++ b/netwerk/protocol/viewsource/nsViewSourceChannel.h
@@ -44,30 +44,28 @@ public:
 
     // nsViewSourceChannel methods:
     nsViewSourceChannel()
         : mIsDocument(false)
         , mOpened(false) {}
 
     nsresult Init(nsIURI* uri);
 
-    nsresult InitSrcdoc(nsIURI* aURI, const nsAString &aSrcdoc,
-                                    nsIURI* aBaseURI);
+    nsresult InitSrcdoc(nsIURI* aURI, const nsAString &aSrcdoc);
 
 protected:
     ~nsViewSourceChannel() {}
 
     nsCOMPtr<nsIChannel>        mChannel;
     nsCOMPtr<nsIHttpChannel>    mHttpChannel;
     nsCOMPtr<nsIHttpChannelInternal>    mHttpChannelInternal;
     nsCOMPtr<nsICachingChannel> mCachingChannel;
     nsCOMPtr<nsIApplicationCacheChannel> mApplicationCacheChannel;
     nsCOMPtr<nsIUploadChannel>  mUploadChannel;
     nsCOMPtr<nsIStreamListener> mListener;
     nsCOMPtr<nsIURI>            mOriginalURI;
-    nsCOMPtr<nsIURI>            mBaseURI;
     nsCString                   mContentType;
     bool                        mIsDocument; // keeps track of the LOAD_DOCUMENT_URI flag
     bool                        mOpened;
     bool                        mIsSrcdocChannel;
 };
 
 #endif /* nsViewSourceChannel_h___ */
--- a/netwerk/protocol/viewsource/nsViewSourceHandler.cpp
+++ b/netwerk/protocol/viewsource/nsViewSourceHandler.cpp
@@ -113,25 +113,25 @@ nsViewSourceHandler::NewChannel2(nsIURI*
 NS_IMETHODIMP
 nsViewSourceHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
 {
     return NewChannel2(uri, nullptr, result);
 }
 
 nsresult
 nsViewSourceHandler::NewSrcdocChannel(nsIURI* uri, const nsAString &srcdoc,
-                                      nsIURI* baseURI, nsIChannel* *result)
+                                      nsIChannel* *result)
 {
     NS_ENSURE_ARG_POINTER(uri);
     nsViewSourceChannel *channel = new nsViewSourceChannel();
     if (!channel)
         return NS_ERROR_OUT_OF_MEMORY;
     NS_ADDREF(channel);
 
-    nsresult rv = channel->InitSrcdoc(uri, srcdoc, baseURI);
+    nsresult rv = channel->InitSrcdoc(uri, srcdoc);
     if (NS_FAILED(rv)) {
         NS_RELEASE(channel);
         return rv;
     }
 
     *result = static_cast<nsIViewSourceChannel*>(channel);
     return NS_OK;
 }
--- a/netwerk/protocol/viewsource/nsViewSourceHandler.h
+++ b/netwerk/protocol/viewsource/nsViewSourceHandler.h
@@ -15,17 +15,17 @@ public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIPROTOCOLHANDLER
 
     nsViewSourceHandler();
 
     // Creates a new nsViewSourceChannel to view the source of an about:srcdoc
     // URI with contents specified by srcdoc.
     nsresult NewSrcdocChannel(nsIURI* uri, const nsAString &srcdoc,
-                              nsIURI* baseURI, nsIChannel** result);
+                              nsIChannel** result);
 
     static nsViewSourceHandler* GetInstance();
 
 private:
     ~nsViewSourceHandler();
 
     static nsViewSourceHandler* gInstance;
 };