зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1222583 - Negative url filtering for network monitor. r=vporof
This commit is contained in:
Родитель
44facd7aa4
Коммит
8c0ccea59a
|
@ -1166,8 +1166,15 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
|
|||
isFreetextMatch: function({ attachment: { url } }, text) {
|
||||
let lowerCaseUrl = url.toLowerCase();
|
||||
let lowerCaseText = text.toLowerCase();
|
||||
//no text is a positive match
|
||||
return !text || lowerCaseUrl.includes(lowerCaseText);
|
||||
let textLength = text.length;
|
||||
// Support negative filtering
|
||||
if (text.startsWith("-") && textLength > 1) {
|
||||
lowerCaseText = lowerCaseText.substring(1, textLength);
|
||||
return !lowerCaseUrl.includes(lowerCaseText);
|
||||
} else {
|
||||
//no text is a positive match
|
||||
return !text || lowerCaseUrl.includes(lowerCaseText);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -123,6 +123,12 @@ function test() {
|
|||
setFreetextFilter("SAMPLE");
|
||||
return testContents([1, 1, 1, 0, 0, 0, 0, 0]);
|
||||
})
|
||||
.then(() => {
|
||||
// Test negative filtering (only show unmatched items)
|
||||
EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-all-button"));
|
||||
setFreetextFilter("-sample");
|
||||
return testContents([0, 0, 0, 1, 1, 1, 1, 1]);
|
||||
})
|
||||
// ...then combine multiple filters together.
|
||||
.then(() => {
|
||||
// Enable filtering for html and css; should show request of both type.
|
||||
|
|
Загрузка…
Ссылка в новой задаче