Bug 1447191 - Pass loadFlags when creating FTP IPDL channel r=mayhemer
authorValentin Gosu <valentin.gosu@gmail.com>
Mon, 21 May 2018 22:24:25 +0200
changeset 419611 ab31d89c0164341b8347285d485ab6a00b7ae27c
parent 419610 10409544368a309c05446caa89f694cd1c862ba4
child 419612 541a8cda26a5fbdd18b260385b55fd95dca0ce9e
push id34040
push userebalazs@mozilla.com
push dateThu, 24 May 2018 09:37:05 +0000
treeherdermozilla-central@c411ccb6bb4a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1447191
milestone62.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 1447191 - Pass loadFlags when creating FTP IPDL channel r=mayhemer This fixes the "Assertion failure: PermissionAvailable(prin, aType), at nsPermissionManager.cpp:2341 when loading FTP URLs on debug builds" MozReview-Commit-ID: 4eRGQ3hrUWo
netwerk/ipc/NeckoChannelParams.ipdlh
netwerk/protocol/ftp/FTPChannelChild.cpp
netwerk/protocol/ftp/FTPChannelParent.cpp
netwerk/protocol/ftp/FTPChannelParent.h
--- a/netwerk/ipc/NeckoChannelParams.ipdlh
+++ b/netwerk/ipc/NeckoChannelParams.ipdlh
@@ -229,16 +229,17 @@ union HttpChannelCreationArgs
 
 struct FTPChannelOpenArgs
 {
   URIParams                 uri;
   uint64_t                  startPos;
   nsCString                 entityID;
   OptionalIPCStream         uploadStream;
   OptionalLoadInfoArgs      loadInfo;
+  uint32_t                  loadFlags;
 };
 
 struct FTPChannelConnectArgs
 {
   uint32_t channelId;
 };
 
 union FTPChannelCreationArgs
--- a/netwerk/protocol/ftp/FTPChannelChild.cpp
+++ b/netwerk/protocol/ftp/FTPChannelChild.cpp
@@ -188,21 +188,25 @@ FTPChannelChild::AsyncOpen(::nsIStreamLi
   // add ourselves to the load group.
   if (mLoadGroup)
     mLoadGroup->AddRequest(this, nullptr);
 
   mozilla::ipc::AutoIPCStream autoStream;
   autoStream.Serialize(mUploadStream,
                        static_cast<ContentChild*>(gNeckoChild->Manager()));
 
+  uint32_t loadFlags = 0;
+  GetLoadFlags(&loadFlags);
+
   FTPChannelOpenArgs openArgs;
   SerializeURI(nsBaseChannel::URI(), openArgs.uri());
   openArgs.startPos() = mStartPos;
   openArgs.entityID() = mEntityID;
   openArgs.uploadStream() = autoStream.TakeOptionalValue();
+  openArgs.loadFlags() = loadFlags;
 
   nsCOMPtr<nsILoadInfo> loadInfo;
   GetLoadInfo(getter_AddRefs(loadInfo));
   rv = mozilla::ipc::LoadInfoToLoadInfoArgs(loadInfo, &openArgs.loadInfo());
   NS_ENSURE_SUCCESS(rv, rv);
 
   // This must happen before the constructor message is sent.
   SetupNeckoTarget();
--- a/netwerk/protocol/ftp/FTPChannelParent.cpp
+++ b/netwerk/protocol/ftp/FTPChannelParent.cpp
@@ -96,17 +96,17 @@ NS_IMPL_ISUPPORTS(FTPChannelParent,
 bool
 FTPChannelParent::Init(const FTPChannelCreationArgs& aArgs)
 {
   switch (aArgs.type()) {
   case FTPChannelCreationArgs::TFTPChannelOpenArgs:
   {
     const FTPChannelOpenArgs& a = aArgs.get_FTPChannelOpenArgs();
     return DoAsyncOpen(a.uri(), a.startPos(), a.entityID(), a.uploadStream(),
-                       a.loadInfo());
+                       a.loadInfo(), a.loadFlags());
   }
   case FTPChannelCreationArgs::TFTPChannelConnectArgs:
   {
     const FTPChannelConnectArgs& cArgs = aArgs.get_FTPChannelConnectArgs();
     return ConnectChannel(cArgs.channelId());
   }
   default:
     NS_NOTREACHED("unknown open type");
@@ -114,17 +114,18 @@ FTPChannelParent::Init(const FTPChannelC
   }
 }
 
 bool
 FTPChannelParent::DoAsyncOpen(const URIParams& aURI,
                               const uint64_t& aStartPos,
                               const nsCString& aEntityID,
                               const OptionalIPCStream& aUploadStream,
-                              const OptionalLoadInfoArgs& aLoadInfoArgs)
+                              const OptionalLoadInfoArgs& aLoadInfoArgs,
+                              const uint32_t& aLoadFlags)
 {
   nsresult rv;
 
   nsCOMPtr<nsIURI> uri = DeserializeURI(aURI);
   if (!uri)
       return false;
 
 #ifdef DEBUG
@@ -148,17 +149,17 @@ FTPChannelParent::DoAsyncOpen(const URIP
   rv = loadInfo->GetOriginAttributes(&attrs);
   if (NS_FAILED(rv)) {
     return SendFailedAsyncOpen(rv);
   }
 
   nsCOMPtr<nsIChannel> chan;
   rv = NS_NewChannelInternal(getter_AddRefs(chan), uri, loadInfo,
                              nullptr, nullptr, nullptr,
-                             nsIRequest::LOAD_NORMAL, ios);
+                             aLoadFlags, ios);
 
   if (NS_FAILED(rv))
     return SendFailedAsyncOpen(rv);
 
   mChannel = chan;
 
   // later on mChannel may become an HTTP channel (we'll be redirected to one
   // if we're using a proxy), but for now this is safe
--- a/netwerk/protocol/ftp/FTPChannelParent.h
+++ b/netwerk/protocol/ftp/FTPChannelParent.h
@@ -75,17 +75,18 @@ protected:
   nsresult ResumeForDiversion();
 
   // Asynchronously calls NotifyDiversionFailed.
   void FailDiversion(nsresult aErrorCode, bool aSkipResume = true);
 
   bool DoAsyncOpen(const URIParams& aURI, const uint64_t& aStartPos,
                    const nsCString& aEntityID,
                    const OptionalIPCStream& aUploadStream,
-                   const OptionalLoadInfoArgs& aLoadInfoArgs);
+                   const OptionalLoadInfoArgs& aLoadInfoArgs,
+                   const uint32_t& aLoadFlags);
 
   // used to connect redirected-to channel in parent with just created
   // ChildChannel.  Used during HTTP->FTP redirects.
   bool ConnectChannel(const uint32_t& channelId);
 
   void DivertOnDataAvailable(const nsCString& data,
                              const uint64_t& offset,
                              const uint32_t& count);