mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1831467 - netwerk/test/unit/test_http_sfv.js avoid holding mutable borrow/ref of SFV object r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D178175
This commit is contained in:
parent
d542eff899
commit
c73dbc7f69
@ -480,27 +480,36 @@ add_task(async function test_sfv_list_parse_serialize() {
|
||||
);
|
||||
|
||||
// create new inner list with parameters
|
||||
let inner_list_params = gService.newParameters();
|
||||
inner_list_params.set("key1", gService.newString("value1"));
|
||||
inner_list_params.set("key2", gService.newBool(true));
|
||||
inner_list_params.set("key3", gService.newBool(false));
|
||||
let inner_list_items = [
|
||||
gService.newItem(
|
||||
gService.newDecimal(-1865.75653),
|
||||
gService.newParameters()
|
||||
),
|
||||
gService.newItem(gService.newToken("token"), gService.newParameters()),
|
||||
gService.newItem(gService.newString(`no"yes`), gService.newParameters()),
|
||||
];
|
||||
let new_list_member = gService.newInnerList(
|
||||
inner_list_items,
|
||||
inner_list_params
|
||||
);
|
||||
function params() {
|
||||
let inner_list_params = gService.newParameters();
|
||||
inner_list_params.set("key1", gService.newString("value1"));
|
||||
inner_list_params.set("key2", gService.newBool(true));
|
||||
inner_list_params.set("key3", gService.newBool(false));
|
||||
return inner_list_params;
|
||||
}
|
||||
|
||||
function changeMembers() {
|
||||
// set one of list members to inner list and check it's serialized as expected
|
||||
let members = list_field.members;
|
||||
members[1] = gService.newInnerList(
|
||||
[
|
||||
gService.newItem(
|
||||
gService.newDecimal(-1865.75653),
|
||||
gService.newParameters()
|
||||
),
|
||||
gService.newItem(gService.newToken("token"), gService.newParameters()),
|
||||
gService.newItem(
|
||||
gService.newString(`no"yes`),
|
||||
gService.newParameters()
|
||||
),
|
||||
],
|
||||
params()
|
||||
);
|
||||
return members;
|
||||
}
|
||||
|
||||
list_field.members = changeMembers();
|
||||
|
||||
// set one of list members to inner list and check it's serialized as expected
|
||||
let members = list_field.members;
|
||||
members[1] = new_list_member;
|
||||
list_field.members = members;
|
||||
Assert.equal(
|
||||
list_field.serialize(),
|
||||
`1, (-1865.757 token "no\\"yes");key1="value1";key2;key3=?0, (42 43)`,
|
||||
|
Loading…
Reference in New Issue
Block a user