[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-browser] 09/12: Bug 1771774, r=kershaw, a=dmeehan
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@xxxxxxxxx>
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.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits