[tbb-commits] [tor-browser] 09/12: Bug 1771774, r=kershaw, a=dmeehan

gitolite role git at cupani.torproject.org
Thu Jul 21 10:03:05 UTC 2022


This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to branch tor-browser-91.12.0esr-11.5-1
in repository tor-browser.

commit 41eb61960e55c095244c12ea2267d4b363a3c54f
Author: Gijs Kruitbosch <gijskruitbosch at gmail.com>
AuthorDate: Thu Jun 30 19:41:47 2022 +0000

    Bug 1771774, r=kershaw, a=dmeehan
    
    Differential Revision: https://phabricator.services.mozilla.com/D150457
---
 modules/libjar/nsJARChannel.cpp | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/modules/libjar/nsJARChannel.cpp b/modules/libjar/nsJARChannel.cpp
index be5cf64d740cc..f1723d9fc6879 100644
--- a/modules/libjar/nsJARChannel.cpp
+++ b/modules/libjar/nsJARChannel.cpp
@@ -16,6 +16,7 @@
 #include "nsComponentManagerUtils.h"
 
 #include "nsIFileURL.h"
+#include "nsIURIMutator.h"
 
 #include "mozilla/BasePrincipal.h"
 #include "mozilla/ErrorNames.h"
@@ -73,12 +74,18 @@ class nsJARInputThunk : public nsIInputStream {
         mJarReader(zipReader),
         mJarEntry(jarEntry),
         mContentLength(-1) {
-    if (fullJarURI) {
-#ifdef DEBUG
-      nsresult rv =
-#endif
-          fullJarURI->GetAsciiSpec(mJarDirSpec);
-      NS_ASSERTION(NS_SUCCEEDED(rv), "this shouldn't fail");
+    if (ENTRY_IS_DIRECTORY(mJarEntry) && fullJarURI) {
+      nsCOMPtr<nsIURI> urlWithoutQueryRef;
+      nsresult rv = NS_MutateURI(fullJarURI)
+                        .SetQuery(""_ns)
+                        .SetRef(""_ns)
+                        .Finalize(urlWithoutQueryRef);
+      if (NS_SUCCEEDED(rv) && urlWithoutQueryRef) {
+        rv = urlWithoutQueryRef->GetAsciiSpec(mJarDirSpec);
+        MOZ_ASSERT(NS_SUCCEEDED(rv), "Finding a jar dir spec shouldn't fail.");
+      } else {
+        MOZ_CRASH("Shouldn't fail to strip query and ref off jar URI.");
+      }
     }
   }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list