author | Adrien-Marie Enault <schwartzmorn+bugzilla@gmail.com> |
Tue, 14 Feb 2017 20:41:05 +0100 | |
changeset 342918 | 366dc31565e39eaca60c55e3ebac8d821e9693cd |
parent 342917 | c0f715706c85bb40a645cadf8294f6ae6eb7cb36 |
child 342919 | 266f172505701ffe81f84cc9138db3fc7426dc25 |
push id | 31366 |
push user | cbook@mozilla.com |
push date | Wed, 15 Feb 2017 11:25:19 +0000 |
treeherder | mozilla-central@c0807d6938c1 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | Honza, rickychien |
bugs | 1327731 |
milestone | 54.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/devtools/client/netmonitor/components/request-list.js +++ b/devtools/client/netmonitor/components/request-list.js @@ -84,17 +84,16 @@ const RequestList = createClass({ { formDataSections: newFormDataSections }, true, )); }); } }, componentWillUnmount() { - Prefs.filters = this.props.activeFilters; this.splitter.removeEventListener("mouseup", this.resize); window.removeEventListener("resize", this.resize); }, resize() { const { dispatch } = this.props; // Allow requests to settle down first. setNamedTimeout("resize-events", 50, () => {
--- a/devtools/client/netmonitor/middleware/moz.build +++ b/devtools/client/netmonitor/middleware/moz.build @@ -1,7 +1,8 @@ # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. DevToolsModules( 'batching.js', + 'prefs.js', )
new file mode 100644 --- /dev/null +++ b/devtools/client/netmonitor/middleware/prefs.js @@ -0,0 +1,29 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +const { + ENABLE_REQUEST_FILTER_TYPE_ONLY, + TOGGLE_REQUEST_FILTER_TYPE, +} = require("../constants"); +const { Prefs } = require("../prefs"); +const { getActiveFilters } = require("../selectors/index"); + +/** + * Whenever the User clicks on a filter in the network monitor, save the new + * filters for future tabs + */ +function prefsMiddleware(store) { + return next => action => { + const res = next(action); + if (action.type === ENABLE_REQUEST_FILTER_TYPE_ONLY || + action.type === TOGGLE_REQUEST_FILTER_TYPE) { + Prefs.filters = getActiveFilters(store.getState()); + } + return res; + }; +} + +module.exports = prefsMiddleware;
--- a/devtools/client/netmonitor/store.js +++ b/devtools/client/netmonitor/store.js @@ -2,21 +2,23 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; const { createStore, applyMiddleware } = require("devtools/client/shared/vendor/redux"); const { thunk } = require("devtools/client/shared/redux/middleware/thunk"); const batching = require("./middleware/batching"); +const prefs = require("./middleware/prefs"); const rootReducer = require("./reducers/index"); function configureStore() { return createStore( rootReducer, applyMiddleware( thunk, + prefs, batching ) ); } exports.configureStore = configureStore;
--- a/devtools/client/netmonitor/test/browser_net_filter-04.js +++ b/devtools/client/netmonitor/test/browser_net_filter-04.js @@ -25,33 +25,31 @@ const REQUESTS_WITH_MEDIA_AND_FLASH = RE ]); const REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS = REQUESTS_WITH_MEDIA_AND_FLASH.concat([ /* "Upgrade" is a reserved header and can not be set on XMLHttpRequest */ { url: "sjs_content-type-test-server.sjs?fmt=ws" }, ]); add_task(function* () { - Services.prefs.setCharPref("devtools.netmonitor.filters", '["js", "bogus"]'); + Services.prefs.setCharPref("devtools.netmonitor.filters", '["bogus", "js", "alsobogus"]'); let { monitor } = yield initNetMonitor(FILTERING_URL); info("Starting test... "); let { gStore, windowRequire } = monitor.panelWin; let Actions = windowRequire("devtools/client/netmonitor/actions/index"); let { Prefs } = windowRequire("devtools/client/netmonitor/prefs"); gStore.dispatch(Actions.batchEnable(false)); - is(Prefs.filters.length, 2, - "All filter types were loaded as an array from the preferences."); + is(Prefs.filters.length, 1, + "Only the valid filter types should be loaded, the others should be ignored"); 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."); + "The only filter type is correct."); let wait = waitForNetworkEvents(monitor, 9); loadCommonFrameScript(); yield performRequestsInContent(REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS); yield wait; testFilterButtons(monitor, "js"); ok(true, "Only the correct filter type was taken into consideration.");