mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 06:09:19 +00:00
Bug 1905454 - Make sure the consumed data is erased, r=necko-reviewers,valentin
No matter what the consumedCount is, the previous code always erases 1 byte of data, which is not correct. We should ensure that the amount of data removed matches the consumedCount. Differential Revision: https://phabricator.services.mozilla.com/D218551
This commit is contained in:
parent
5f37c4fa62
commit
3f851f4ddf
@ -157,7 +157,8 @@ nsresult nsIncrementalStreamLoader::WriteSegmentFun(
|
||||
// Adopting elems back (at least its portion).
|
||||
self->mData.replaceRawBuffer(elems, length);
|
||||
if (consumedCount > 0) {
|
||||
self->mData.erase(self->mData.begin() + consumedCount);
|
||||
self->mData.erase(self->mData.begin(),
|
||||
self->mData.begin() + consumedCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,13 @@ var tests = [
|
||||
consume: [0],
|
||||
dataChunks: ["E", "E"],
|
||||
},
|
||||
{
|
||||
data: "123456789",
|
||||
chunks: [2, 3, 4],
|
||||
status: Cr.NS_OK,
|
||||
consume: [1, 2, 6],
|
||||
dataChunks: ["12", "2345", "456789", ""],
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user