Bug 1462886 - Fix for filter flag breaking the netmonitor when using invalid values.r=Honza

MozReview-Commit-ID: 5cvUX2sb7k0

--HG--
extra : rebase_source : 57caba2b7b6927e2564a0894afc35f709402f386
This commit is contained in:
abhinav 2018-05-25 02:43:14 +05:30
parent 85cded7237
commit 131be93acd
2 changed files with 16 additions and 0 deletions

View File

@ -104,6 +104,10 @@ function processFlagFilter(type, value) {
}
function isFlagFilterMatch(item, { type, value, negative }) {
if (value == null) {
return false;
}
// Ensures when filter token is exactly a flag ie. "remote-ip:", all values are shown
if (value.length < 1) {
return true;

View File

@ -257,6 +257,9 @@ add_task(async function() {
setFreetextFilter("size:34");
await testContents([0, 0, 1, 1, 0, 0, 0, 0, 0, 0]);
setFreetextFilter("size:0kb");
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
// Testing the lower bound
setFreetextFilter("size:9.659k");
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 1, 0]);
@ -279,6 +282,9 @@ add_task(async function() {
setFreetextFilter("transferred:248");
await testContents([0, 0, 1, 1, 0, 0, 0, 0, 0, 1]);
setFreetextFilter("transferred:0kb");
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
// Test larger-than
setFreetextFilter("larger-than:-1");
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
@ -298,6 +304,9 @@ add_task(async function() {
setFreetextFilter("larger-than:10.732k");
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
setFreetextFilter("larger-than:0kb");
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
// Test transferred-larger-than
setFreetextFilter("transferred-larger-than:-1");
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
@ -314,6 +323,9 @@ add_task(async function() {
setFreetextFilter("transferred-larger-than:10.73k");
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
setFreetextFilter("transferred-larger-than:0kb");
await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
// Test cause
setFreetextFilter("cause:xhr");
await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);