Bug 1164397 - Part 3: Add an API for overriding the original URI on nsJARChannel; r=jdm
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 02 Jun 2015 17:59:30 -0400
changeset 247522 24d7d4dfab29e291aed2da8b904b981bc3ac9031
parent 247521 7d5686845634c00a3525c91e45e98903e2bf211c
child 247523 435358bf7c12a323aef04b0605753ec586e1bfe6
push id28870
push usercbook@mozilla.com
push dateMon, 08 Jun 2015 09:58:36 +0000
treeherdermozilla-central@4700d1cdf489 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs1164397
milestone41.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 1164397 - Part 3: Add an API for overriding the original URI on nsJARChannel; r=jdm
modules/libjar/nsJARChannel.cpp
modules/libjar/nsJARChannel.h
--- a/modules/libjar/nsJARChannel.cpp
+++ b/modules/libjar/nsJARChannel.cpp
@@ -690,16 +690,26 @@ nsJARChannel::OverrideSecurityInfo(nsISu
   MOZ_RELEASE_ASSERT(aSecurityInfo,
                      "This can only be called with a valid security info object");
   MOZ_RELEASE_ASSERT(ShouldIntercept(),
                      "This can only be called on channels that can be intercepted");
   mSecurityInfo = aSecurityInfo;
   return NS_OK;
 }
 
+void
+nsJARChannel::OverrideURI(nsIURI* aRedirectedURI)
+{
+  MOZ_RELEASE_ASSERT(mLoadFlags & LOAD_REPLACE,
+                     "This can only happen if the LOAD_REPLACE flag is set");
+  MOZ_RELEASE_ASSERT(ShouldIntercept(),
+                     "This can only be called on channels that can be intercepted");
+  mAppURI = aRedirectedURI;
+}
+
 NS_IMETHODIMP
 nsJARChannel::GetSecurityInfo(nsISupports **aSecurityInfo)
 {
     NS_PRECONDITION(aSecurityInfo, "Null out param");
     NS_IF_ADDREF(*aSecurityInfo = mSecurityInfo);
     return NS_OK;
 }
 
--- a/modules/libjar/nsJARChannel.h
+++ b/modules/libjar/nsJARChannel.h
@@ -57,16 +57,17 @@ public:
     NS_DECL_NSITHREADRETARGETABLEREQUEST
     NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
 
     nsJARChannel();
 
     nsresult Init(nsIURI *uri);
 
     nsresult OverrideSecurityInfo(nsISupports* aSecurityInfo);
+    void OverrideURI(nsIURI* aRedirectedURI);
 
 private:
     virtual ~nsJARChannel();
 
     nsresult CreateJarInput(nsIZipReaderCache *, nsJARInputThunk **);
     nsresult LookupFile(bool aAllowAsync);
     nsresult OpenLocalFile();
     void NotifyError(nsresult aError);