From 37fc52aff0aa5e1c4a2f65d1b92f082151532550 Mon Sep 17 00:00:00 2001 From: Bogdan Tara Date: Mon, 30 Mar 2020 14:43:38 +0300 Subject: [PATCH] Backed out changeset 05de83a88c61 (bug 1566780) for devtools failures complaining about browser_net_ws-early-connection.js CLOSED TREE --- .../locales/en-US/netmonitor.properties | 8 ---- .../netmonitor/src/actions/web-sockets.js | 12 ------ .../components/websockets/FrameFilterMenu.js | 39 ++----------------- .../src/components/websockets/Toolbar.js | 13 +------ devtools/client/netmonitor/src/constants.js | 1 - .../netmonitor/src/reducers/web-sockets.js | 15 ------- .../netmonitor/src/selectors/web-sockets.js | 23 ++--------- 7 files changed, 7 insertions(+), 104 deletions(-) diff --git a/devtools/client/locales/en-US/netmonitor.properties b/devtools/client/locales/en-US/netmonitor.properties index bfc42df3f7d9..38e2ed15bb3d 100644 --- a/devtools/client/locales/en-US/netmonitor.properties +++ b/devtools/client/locales/en-US/netmonitor.properties @@ -705,14 +705,6 @@ netmonitor.ws.context.received=Received # for the "Received" menu item displayed in the context menu in the websocket toolbar. netmonitor.ws.context.received.accesskey=R -# LOCALIZATION NOTE (netmonitor.ws.context.controlFrames): This is the label displayed -# on the context menu that shows "Control Frames" WebSocket frames. -netmonitor.ws.context.controlFrames=Control - -# LOCALIZATION NOTE (netmonitor.ws.context.controlFrames.accesskey): This is the access key -# for the "Control Frames" menu item displayed in the context menu in the websocket toolbar. -netmonitor.ws.context.controlFrames.accesskey=o - # LOCALIZATION NOTE (netmonitor.ws.context.copyFrame): This is the label displayed # on the context menu that shows "Copy Message". netmonitor.ws.context.copyFrame=Copy Message diff --git a/devtools/client/netmonitor/src/actions/web-sockets.js b/devtools/client/netmonitor/src/actions/web-sockets.js index fca062dbac9f..024bee46533e 100644 --- a/devtools/client/netmonitor/src/actions/web-sockets.js +++ b/devtools/client/netmonitor/src/actions/web-sockets.js @@ -10,7 +10,6 @@ const { WS_OPEN_FRAME_DETAILS, WS_CLEAR_FRAMES, WS_TOGGLE_FRAME_FILTER_TYPE, - WS_TOGGLE_CONTROL_FRAMES, WS_SET_REQUEST_FILTER_TEXT, WS_TOGGLE_COLUMN, WS_RESET_COLUMNS, @@ -78,16 +77,6 @@ function toggleFrameFilterType(filter) { }; } -/** - * Show control frames from the FrameListContent - * component belonging to the current channelId - */ -function toggleControlFrames() { - return { - type: WS_TOGGLE_CONTROL_FRAMES, - }; -} - /** * Set filter text in toolbar. * @@ -176,7 +165,6 @@ module.exports = { openFrameDetails, clearFrames, toggleFrameFilterType, - toggleControlFrames, setFrameFilterText, resetWebSocketsColumns, closeConnection, diff --git a/devtools/client/netmonitor/src/components/websockets/FrameFilterMenu.js b/devtools/client/netmonitor/src/components/websockets/FrameFilterMenu.js index 153b2d2f7f9a..132c4eacd1d1 100644 --- a/devtools/client/netmonitor/src/components/websockets/FrameFilterMenu.js +++ b/devtools/client/netmonitor/src/components/websockets/FrameFilterMenu.js @@ -22,11 +22,6 @@ class FrameFilterMenu extends PureComponent { return { frameFilterType: PropTypes.string.isRequired, toggleFrameFilterType: PropTypes.func.isRequired, - // showControlFrames decides if control frames - // will be shown in messages panel - showControlFrames: PropTypes.bool.isRequired, - // toggleControlFrames toggles the value for showControlFrames - toggleControlFrames: PropTypes.func.isRequired, }; } @@ -36,19 +31,13 @@ class FrameFilterMenu extends PureComponent { } onShowFilterMenu(event) { - const { - frameFilterType, - toggleFrameFilterType, - showControlFrames, - toggleControlFrames, - } = this.props; + const { frameFilterType, toggleFrameFilterType } = this.props; const menuItems = [ { id: "ws-frame-list-context-filter-all", label: L10N.getStr("netmonitor.ws.context.all"), accesskey: L10N.getStr("netmonitor.ws.context.all.accesskey"), - type: "checkbox", checked: frameFilterType === "all", click: () => { toggleFrameFilterType("all"); @@ -58,7 +47,6 @@ class FrameFilterMenu extends PureComponent { id: "ws-frame-list-context-filter-sent", label: L10N.getStr("netmonitor.ws.context.sent"), accesskey: L10N.getStr("netmonitor.ws.context.sent.accesskey"), - type: "checkbox", checked: frameFilterType === "sent", click: () => { toggleFrameFilterType("sent"); @@ -68,40 +56,19 @@ class FrameFilterMenu extends PureComponent { id: "ws-frame-list-context-filter-received", label: L10N.getStr("netmonitor.ws.context.received"), accesskey: L10N.getStr("netmonitor.ws.context.received.accesskey"), - type: "checkbox", checked: frameFilterType === "received", click: () => { toggleFrameFilterType("received"); }, }, - { - type: "separator", - }, - { - id: "ws-frame-list-context-filter-controlFrames", - label: L10N.getStr("netmonitor.ws.context.controlFrames"), - accesskey: L10N.getStr("netmonitor.ws.context.controlFrames.accesskey"), - type: "checkbox", - checked: showControlFrames, - click: () => { - toggleControlFrames(); - }, - }, ]; showMenu(menuItems, { button: event.target }); } render() { - const { frameFilterType, showControlFrames } = this.props; - const frameFilterTypeTitle = L10N.getStr( - `netmonitor.ws.context.${frameFilterType}` - ); - const title = - frameFilterTypeTitle + - (showControlFrames - ? " (" + L10N.getStr(`netmonitor.ws.context.controlFrames`) + ")" - : ""); + const { frameFilterType } = this.props; + const title = L10N.getStr(`netmonitor.ws.context.${frameFilterType}`); return dom.button( { diff --git a/devtools/client/netmonitor/src/components/websockets/Toolbar.js b/devtools/client/netmonitor/src/components/websockets/Toolbar.js index 45d6f4356b12..14d73b7bb34d 100644 --- a/devtools/client/netmonitor/src/components/websockets/Toolbar.js +++ b/devtools/client/netmonitor/src/components/websockets/Toolbar.js @@ -48,11 +48,9 @@ class Toolbar extends Component { return { searchboxRef: PropTypes.object.isRequired, toggleFrameFilterType: PropTypes.func.isRequired, - toggleControlFrames: PropTypes.func.isRequired, clearFrames: PropTypes.func.isRequired, setFrameFilterText: PropTypes.func.isRequired, frameFilterType: PropTypes.string.isRequired, - showControlFrames: PropTypes.bool.isRequired, }; } @@ -86,18 +84,11 @@ class Toolbar extends Component { * Render the frame filter menu button. */ renderFrameFilterMenu() { - const { - frameFilterType, - toggleFrameFilterType, - showControlFrames, - toggleControlFrames, - } = this.props; + const { frameFilterType, toggleFrameFilterType } = this.props; return FrameFilterMenu({ frameFilterType, toggleFrameFilterType, - showControlFrames, - toggleControlFrames, }); } @@ -135,13 +126,11 @@ class Toolbar extends Component { module.exports = connect( state => ({ frameFilterType: state.webSockets.frameFilterType, - showControlFrames: state.webSockets.showControlFrames, }), dispatch => ({ clearFrames: () => dispatch(Actions.clearFrames()), toggleFrameFilterType: filter => dispatch(Actions.toggleFrameFilterType(filter)), - toggleControlFrames: () => dispatch(Actions.toggleControlFrames()), setFrameFilterText: text => dispatch(Actions.setFrameFilterText(text)), }) )(Toolbar); diff --git a/devtools/client/netmonitor/src/constants.js b/devtools/client/netmonitor/src/constants.js index 70129b6132ba..a115a35fa90e 100644 --- a/devtools/client/netmonitor/src/constants.js +++ b/devtools/client/netmonitor/src/constants.js @@ -50,7 +50,6 @@ const actionTypes = { WS_OPEN_FRAME_DETAILS: "WS_OPEN_FRAME_DETAILS", WS_CLEAR_FRAMES: "WS_CLEAR_FRAMES", WS_TOGGLE_FRAME_FILTER_TYPE: "WS_TOGGLE_FRAME_FILTER_TYPE", - WS_TOGGLE_CONTROL_FRAMES: "WS_TOGGLE_CONTROL_FRAMES", WS_SET_REQUEST_FILTER_TEXT: "WS_SET_REQUEST_FILTER_TEXT", WS_TOGGLE_COLUMN: "WS_TOGGLE_COLUMN", WS_RESET_COLUMNS: "WS_RESET_COLUMNS", diff --git a/devtools/client/netmonitor/src/reducers/web-sockets.js b/devtools/client/netmonitor/src/reducers/web-sockets.js index ae502fc13743..08d73d6eb16d 100644 --- a/devtools/client/netmonitor/src/reducers/web-sockets.js +++ b/devtools/client/netmonitor/src/reducers/web-sockets.js @@ -11,7 +11,6 @@ const { WS_OPEN_FRAME_DETAILS, WS_CLEAR_FRAMES, WS_TOGGLE_FRAME_FILTER_TYPE, - WS_TOGGLE_CONTROL_FRAMES, WS_SET_REQUEST_FILTER_TEXT, WS_TOGGLE_COLUMN, WS_RESET_COLUMNS, @@ -48,7 +47,6 @@ function WebSockets(initialState = {}) { frameFilterText: "", // Default filter type is "all", frameFilterType: "all", - showControlFrames: false, selectedFrame: null, frameDetailsOpen: false, currentChannelId: null, @@ -126,7 +124,6 @@ function clearFrames(state) { columns: nextState.columns, frameFilterType: nextState.frameFilterType, frameFilterText: nextState.frameFilterText, - showControlFrames: nextState.showControlFrames, }; } @@ -140,16 +137,6 @@ function toggleFrameFilterType(state, action) { }; } -/** - * Toggle control frame for the WebSocket connection. - */ -function toggleControlFrames(state, action) { - return { - ...state, - showControlFrames: !state.showControlFrames, - }; -} - /** * Set the filter text of the current channelId. */ @@ -229,8 +216,6 @@ function webSockets(state = WebSockets(), action) { return clearFrames(state); case WS_TOGGLE_FRAME_FILTER_TYPE: return toggleFrameFilterType(state, action); - case WS_TOGGLE_CONTROL_FRAMES: - return toggleControlFrames(state, action); case WS_SET_REQUEST_FILTER_TEXT: return setFrameFilterText(state, action); case WS_TOGGLE_COLUMN: diff --git a/devtools/client/netmonitor/src/selectors/web-sockets.js b/devtools/client/netmonitor/src/selectors/web-sockets.js index 869d8e1e2bdb..26d629efacea 100644 --- a/devtools/client/netmonitor/src/selectors/web-sockets.js +++ b/devtools/client/netmonitor/src/selectors/web-sockets.js @@ -12,22 +12,14 @@ const { createSelector } = require("devtools/client/shared/vendor/reselect"); */ const getDisplayedFrames = createSelector( state => state.webSockets, - ({ - frames, - frameFilterType, - showControlFrames, - frameFilterText, - currentChannelId, - }) => { + ({ frames, frameFilterType, frameFilterText, currentChannelId }) => { if (!currentChannelId || !frames.get(currentChannelId)) { return []; } const framesArray = frames.get(currentChannelId); if (frameFilterType === "all" && frameFilterText.length === 0) { - return framesArray.filter(frame => - typeFilter(frame, frameFilterType, showControlFrames) - ); + return framesArray; } const filter = searchFilter(frameFilterText); @@ -38,20 +30,11 @@ const getDisplayedFrames = createSelector( (frame.payload.initial ? filter(frame.payload.initial) : filter(frame.payload)) && - typeFilter(frame, frameFilterType, showControlFrames) + (frameFilterType === "all" || frameFilterType === frame.type) ); } ); -function typeFilter(frame, frameFilterType, showControlFrames) { - const controlFrames = [0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]; - const isControlFrame = controlFrames.includes(frame.opCode); - if (frameFilterType === "all" || frameFilterType === frame.type) { - return showControlFrames || !isControlFrame; - } - return false; -} - function searchFilter(frameFilterText) { let regex; if (looksLikeRegex(frameFilterText)) {