summaryrefslogtreecommitdiffstats
path: root/netwerk/base/nsURLHelper.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /netwerk/base/nsURLHelper.cpp
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-adbda400be353e676059e335c3c0aaf99e719475.tar.xz
firefox-adbda400be353e676059e335c3c0aaf99e719475.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'netwerk/base/nsURLHelper.cpp')
-rw-r--r--netwerk/base/nsURLHelper.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/netwerk/base/nsURLHelper.cpp b/netwerk/base/nsURLHelper.cpp
index 3850c6865a..ca82b0cd00 100644
--- a/netwerk/base/nsURLHelper.cpp
+++ b/netwerk/base/nsURLHelper.cpp
@@ -1236,8 +1236,8 @@ void URLParams::DecodeString(const nsACString& aInput, nsAString& aOutput) {
/* static */
bool URLParams::ParseNextInternal(const char*& aStart, const char* const aEnd,
- nsAString* aOutDecodedName,
- nsAString* aOutDecodedValue) {
+ bool aShouldDecode, nsAString* aOutputName,
+ nsAString* aOutputValue) {
nsDependentCSubstring string;
const char* const iter = std::find(aStart, aEnd, '&');
@@ -1267,9 +1267,14 @@ bool URLParams::ParseNextInternal(const char*& aStart, const char* const aEnd,
name.Rebind(string, 0);
}
- DecodeString(name, *aOutDecodedName);
- DecodeString(value, *aOutDecodedValue);
+ if (aShouldDecode) {
+ DecodeString(name, *aOutputName);
+ DecodeString(value, *aOutputValue);
+ return true;
+ }
+ ConvertString(name, *aOutputName);
+ ConvertString(value, *aOutputValue);
return true;
}
@@ -1278,7 +1283,7 @@ bool URLParams::Extract(const nsACString& aInput, const nsAString& aName,
nsAString& aValue) {
aValue.SetIsVoid(true);
return !URLParams::Parse(
- aInput, [&aName, &aValue](const nsAString& name, nsString&& value) {
+ aInput, true, [&aName, &aValue](const nsAString& name, nsString&& value) {
if (aName == name) {
aValue = std::move(value);
return false;
@@ -1291,7 +1296,7 @@ void URLParams::ParseInput(const nsACString& aInput) {
// Remove all the existing data before parsing a new input.
DeleteAll();
- URLParams::Parse(aInput, [this](nsString&& name, nsString&& value) {
+ URLParams::Parse(aInput, true, [this](nsString&& name, nsString&& value) {
mParams.AppendElement(Param{std::move(name), std::move(value)});
return true;
});