mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1224643. Fix handling of U+0000 in URLSearchParams serialization. r=baku
This commit is contained in:
parent
6c7ae69493
commit
1e471fc1dd
@ -253,8 +253,9 @@ namespace {
|
||||
void SerializeString(const nsCString& aInput, nsAString& aValue)
|
||||
{
|
||||
const unsigned char* p = (const unsigned char*) aInput.get();
|
||||
const unsigned char* end = p + aInput.Length();
|
||||
|
||||
while (p && *p) {
|
||||
while (p != end) {
|
||||
// ' ' to '+'
|
||||
if (*p == 0x20) {
|
||||
aValue.Append(0x2B);
|
||||
|
@ -289,6 +289,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=887836
|
||||
runTest();
|
||||
}
|
||||
|
||||
function testZeroHandling() {
|
||||
var u = new URLSearchParams;
|
||||
u.set("a", "b\0c");
|
||||
u.set("d\0e", "f");
|
||||
u.set("g\0h", "i\0j");
|
||||
is(u.toString(), "a=b%00c&d%00e=f&g%00h=i%00j",
|
||||
"Should encode U+0000 as %00");
|
||||
|
||||
runTest();
|
||||
}
|
||||
|
||||
var tests = [
|
||||
testSimpleURLSearchParams,
|
||||
testCopyURLSearchParams,
|
||||
@ -301,7 +312,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=887836
|
||||
testDelete,
|
||||
testGetNULL,
|
||||
testSet,
|
||||
testIterable
|
||||
testIterable,
|
||||
testZeroHandling,
|
||||
];
|
||||
|
||||
function runTest() {
|
||||
|
@ -1,5 +0,0 @@
|
||||
[send-usp.html]
|
||||
type: testharness
|
||||
[XMLHttpRequest.send(URLSearchParams) (0)]
|
||||
expected: FAIL
|
||||
|
@ -1,5 +0,0 @@
|
||||
[send-usp.worker]
|
||||
type: testharness
|
||||
[XMLHttpRequest.send(URLSearchParams) (0)]
|
||||
expected: FAIL
|
||||
|
Loading…
Reference in New Issue
Block a user