mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 987310 - Tentatively relanded, as a backout of changeset a26977bf2252, a possibly incorrect assumption that it caused orange in bc2 linux tests, r=me
This commit is contained in:
parent
16c4ba710d
commit
eec4c9195c
@ -699,6 +699,11 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
|
||||
* "flash" or "other".
|
||||
*/
|
||||
_enableFilter: function (aType) {
|
||||
// Make sure this is a valid filter type.
|
||||
if (Object.keys(this._allFilterPredicates).indexOf(aType) == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the filter to the list of active filters.
|
||||
this._activeFilters.push(aType);
|
||||
|
||||
@ -717,18 +722,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
|
||||
* the active filters.
|
||||
*/
|
||||
get _filterPredicate() {
|
||||
let filterPredicates = {
|
||||
"all": () => true,
|
||||
"html": this.isHtml,
|
||||
"css": this.isCss,
|
||||
"js": this.isJs,
|
||||
"xhr": this.isXHR,
|
||||
"fonts": this.isFont,
|
||||
"images": this.isImage,
|
||||
"media": this.isMedia,
|
||||
"flash": this.isFlash,
|
||||
"other": this.isOther
|
||||
};
|
||||
let filterPredicates = this._allFilterPredicates;
|
||||
|
||||
if (this._activeFilters.length === 1) {
|
||||
// The simplest case: only one filter active.
|
||||
@ -743,6 +737,22 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns an object with all the filter predicates as [key: function] pairs.
|
||||
*/
|
||||
get _allFilterPredicates() ({
|
||||
all: () => true,
|
||||
html: this.isHtml,
|
||||
css: this.isCss,
|
||||
js: this.isJs,
|
||||
xhr: this.isXHR,
|
||||
fonts: this.isFont,
|
||||
images: this.isImage,
|
||||
media: this.isMedia,
|
||||
flash: this.isFlash,
|
||||
other: this.isOther
|
||||
}),
|
||||
|
||||
/**
|
||||
* Sorts all network requests in this container by a specified detail.
|
||||
*
|
||||
|
@ -52,6 +52,7 @@ support-files =
|
||||
[browser_net_filter-01.js]
|
||||
[browser_net_filter-02.js]
|
||||
[browser_net_filter-03.js]
|
||||
[browser_net_filter-04.js]
|
||||
[browser_net_footer-summary.js]
|
||||
[browser_net_html-preview.js]
|
||||
[browser_net_icon-preview.js]
|
||||
|
38
browser/devtools/netmonitor/test/browser_net_filter-04.js
Normal file
38
browser/devtools/netmonitor/test/browser_net_filter-04.js
Normal file
@ -0,0 +1,38 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Tests if invalid filter types are sanitized when loaded from the preferences.
|
||||
*/
|
||||
|
||||
function test() {
|
||||
Services.prefs.setCharPref("devtools.netmonitor.filters", '["js", "bogus"]');
|
||||
|
||||
initNetMonitor(FILTERING_URL).then(([aTab, aDebuggee, aMonitor]) => {
|
||||
info("Starting test... ");
|
||||
|
||||
let { Prefs } = aMonitor.panelWin;
|
||||
|
||||
is(Prefs.filters.length, 2,
|
||||
"All filter types were loaded as an array from the preferences.");
|
||||
is(Prefs.filters[0], "js",
|
||||
"The first filter type is correct.");
|
||||
is(Prefs.filters[1], "bogus",
|
||||
"The second filter type is invalid, but loaded anyway.");
|
||||
|
||||
waitForNetworkEvents(aMonitor, 7).then(() => {
|
||||
testFilterButtons(aMonitor, "js");
|
||||
ok(true, "Only the correct filter type was taken into consideration.");
|
||||
|
||||
teardown(aMonitor).then(() => {
|
||||
let filters = Services.prefs.getCharPref("devtools.netmonitor.filters");
|
||||
is(filters, '["js"]',
|
||||
"The bogus filter type was ignored and removed from the preferences.");
|
||||
|
||||
finish();
|
||||
});
|
||||
});
|
||||
|
||||
aDebuggee.performRequests('{ "getMedia": true, "getFlash": true }');
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user