diff --git a/devtools/client/netmonitor/src/utils/filter-text-utils.js b/devtools/client/netmonitor/src/utils/filter-text-utils.js index 771979e2ff3a..280e5d085359 100644 --- a/devtools/client/netmonitor/src/utils/filter-text-utils.js +++ b/devtools/client/netmonitor/src/utils/filter-text-utils.js @@ -116,10 +116,6 @@ function processFlagFilter(type, value) { } } -function getSizeOrder(size) { - return Math.round(Math.log10(size)); -} - function isFlagFilterMatch(item, { type, value, negative }) { let match = true; let { responseCookies = { cookies: [] } } = item; @@ -160,11 +156,11 @@ function isFlagFilterMatch(item, { type, value, negative }) { if (item.fromCache) { match = false; } else { - match = getSizeOrder(value) === getSizeOrder(item.transferredSize); + match = isSizeMatch(value, item.transferredSize); } break; case "size": - match = getSizeOrder(value) === getSizeOrder(item.contentSize); + match = isSizeMatch(value, item.contentSize); break; case "larger-than": match = item.contentSize > value; @@ -216,6 +212,10 @@ function isFlagFilterMatch(item, { type, value, negative }) { return match; } +function isSizeMatch(value, size) { + return value >= (size - size / 10) && value < (size + size / 10); +} + function isTextFilterMatch({ url }, text) { let lowerCaseUrl = url.toLowerCase(); let lowerCaseText = text.toLowerCase();