Backed out changeset 05de83a88c61 (bug 1566780) for devtools failures complaining about browser_net_ws-early-connection.js CLOSED TREE

This commit is contained in:
Bogdan Tara 2020-03-30 14:43:38 +03:00
Родитель 9199513a35
Коммит 37fc52aff0
7 изменённых файлов: 7 добавлений и 104 удалений

Просмотреть файл

@ -705,14 +705,6 @@ netmonitor.ws.context.received=Received
# for the "Received" menu item displayed in the context menu in the websocket toolbar. # for the "Received" menu item displayed in the context menu in the websocket toolbar.
netmonitor.ws.context.received.accesskey=R 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 # LOCALIZATION NOTE (netmonitor.ws.context.copyFrame): This is the label displayed
# on the context menu that shows "Copy Message". # on the context menu that shows "Copy Message".
netmonitor.ws.context.copyFrame=Copy Message netmonitor.ws.context.copyFrame=Copy Message

Просмотреть файл

@ -10,7 +10,6 @@ const {
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_SET_REQUEST_FILTER_TEXT, WS_SET_REQUEST_FILTER_TEXT,
WS_TOGGLE_COLUMN, WS_TOGGLE_COLUMN,
WS_RESET_COLUMNS, 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. * Set filter text in toolbar.
* *
@ -176,7 +165,6 @@ module.exports = {
openFrameDetails, openFrameDetails,
clearFrames, clearFrames,
toggleFrameFilterType, toggleFrameFilterType,
toggleControlFrames,
setFrameFilterText, setFrameFilterText,
resetWebSocketsColumns, resetWebSocketsColumns,
closeConnection, closeConnection,

Просмотреть файл

@ -22,11 +22,6 @@ class FrameFilterMenu extends PureComponent {
return { return {
frameFilterType: PropTypes.string.isRequired, frameFilterType: PropTypes.string.isRequired,
toggleFrameFilterType: PropTypes.func.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) { onShowFilterMenu(event) {
const { const { frameFilterType, toggleFrameFilterType } = this.props;
frameFilterType,
toggleFrameFilterType,
showControlFrames,
toggleControlFrames,
} = this.props;
const menuItems = [ const menuItems = [
{ {
id: "ws-frame-list-context-filter-all", id: "ws-frame-list-context-filter-all",
label: L10N.getStr("netmonitor.ws.context.all"), label: L10N.getStr("netmonitor.ws.context.all"),
accesskey: L10N.getStr("netmonitor.ws.context.all.accesskey"), accesskey: L10N.getStr("netmonitor.ws.context.all.accesskey"),
type: "checkbox",
checked: frameFilterType === "all", checked: frameFilterType === "all",
click: () => { click: () => {
toggleFrameFilterType("all"); toggleFrameFilterType("all");
@ -58,7 +47,6 @@ class FrameFilterMenu extends PureComponent {
id: "ws-frame-list-context-filter-sent", id: "ws-frame-list-context-filter-sent",
label: L10N.getStr("netmonitor.ws.context.sent"), label: L10N.getStr("netmonitor.ws.context.sent"),
accesskey: L10N.getStr("netmonitor.ws.context.sent.accesskey"), accesskey: L10N.getStr("netmonitor.ws.context.sent.accesskey"),
type: "checkbox",
checked: frameFilterType === "sent", checked: frameFilterType === "sent",
click: () => { click: () => {
toggleFrameFilterType("sent"); toggleFrameFilterType("sent");
@ -68,40 +56,19 @@ class FrameFilterMenu extends PureComponent {
id: "ws-frame-list-context-filter-received", id: "ws-frame-list-context-filter-received",
label: L10N.getStr("netmonitor.ws.context.received"), label: L10N.getStr("netmonitor.ws.context.received"),
accesskey: L10N.getStr("netmonitor.ws.context.received.accesskey"), accesskey: L10N.getStr("netmonitor.ws.context.received.accesskey"),
type: "checkbox",
checked: frameFilterType === "received", checked: frameFilterType === "received",
click: () => { click: () => {
toggleFrameFilterType("received"); 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 }); showMenu(menuItems, { button: event.target });
} }
render() { render() {
const { frameFilterType, showControlFrames } = this.props; const { frameFilterType } = this.props;
const frameFilterTypeTitle = L10N.getStr( const title = L10N.getStr(`netmonitor.ws.context.${frameFilterType}`);
`netmonitor.ws.context.${frameFilterType}`
);
const title =
frameFilterTypeTitle +
(showControlFrames
? " (" + L10N.getStr(`netmonitor.ws.context.controlFrames`) + ")"
: "");
return dom.button( return dom.button(
{ {

Просмотреть файл

@ -48,11 +48,9 @@ class Toolbar extends Component {
return { return {
searchboxRef: PropTypes.object.isRequired, searchboxRef: PropTypes.object.isRequired,
toggleFrameFilterType: PropTypes.func.isRequired, toggleFrameFilterType: PropTypes.func.isRequired,
toggleControlFrames: PropTypes.func.isRequired,
clearFrames: PropTypes.func.isRequired, clearFrames: PropTypes.func.isRequired,
setFrameFilterText: PropTypes.func.isRequired, setFrameFilterText: PropTypes.func.isRequired,
frameFilterType: PropTypes.string.isRequired, frameFilterType: PropTypes.string.isRequired,
showControlFrames: PropTypes.bool.isRequired,
}; };
} }
@ -86,18 +84,11 @@ class Toolbar extends Component {
* Render the frame filter menu button. * Render the frame filter menu button.
*/ */
renderFrameFilterMenu() { renderFrameFilterMenu() {
const { const { frameFilterType, toggleFrameFilterType } = this.props;
frameFilterType,
toggleFrameFilterType,
showControlFrames,
toggleControlFrames,
} = this.props;
return FrameFilterMenu({ return FrameFilterMenu({
frameFilterType, frameFilterType,
toggleFrameFilterType, toggleFrameFilterType,
showControlFrames,
toggleControlFrames,
}); });
} }
@ -135,13 +126,11 @@ class Toolbar extends Component {
module.exports = connect( module.exports = connect(
state => ({ state => ({
frameFilterType: state.webSockets.frameFilterType, frameFilterType: state.webSockets.frameFilterType,
showControlFrames: state.webSockets.showControlFrames,
}), }),
dispatch => ({ dispatch => ({
clearFrames: () => dispatch(Actions.clearFrames()), clearFrames: () => dispatch(Actions.clearFrames()),
toggleFrameFilterType: filter => toggleFrameFilterType: filter =>
dispatch(Actions.toggleFrameFilterType(filter)), dispatch(Actions.toggleFrameFilterType(filter)),
toggleControlFrames: () => dispatch(Actions.toggleControlFrames()),
setFrameFilterText: text => dispatch(Actions.setFrameFilterText(text)), setFrameFilterText: text => dispatch(Actions.setFrameFilterText(text)),
}) })
)(Toolbar); )(Toolbar);

Просмотреть файл

@ -50,7 +50,6 @@ const actionTypes = {
WS_OPEN_FRAME_DETAILS: "WS_OPEN_FRAME_DETAILS", WS_OPEN_FRAME_DETAILS: "WS_OPEN_FRAME_DETAILS",
WS_CLEAR_FRAMES: "WS_CLEAR_FRAMES", WS_CLEAR_FRAMES: "WS_CLEAR_FRAMES",
WS_TOGGLE_FRAME_FILTER_TYPE: "WS_TOGGLE_FRAME_FILTER_TYPE", 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_SET_REQUEST_FILTER_TEXT: "WS_SET_REQUEST_FILTER_TEXT",
WS_TOGGLE_COLUMN: "WS_TOGGLE_COLUMN", WS_TOGGLE_COLUMN: "WS_TOGGLE_COLUMN",
WS_RESET_COLUMNS: "WS_RESET_COLUMNS", WS_RESET_COLUMNS: "WS_RESET_COLUMNS",

Просмотреть файл

@ -11,7 +11,6 @@ const {
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_SET_REQUEST_FILTER_TEXT, WS_SET_REQUEST_FILTER_TEXT,
WS_TOGGLE_COLUMN, WS_TOGGLE_COLUMN,
WS_RESET_COLUMNS, WS_RESET_COLUMNS,
@ -48,7 +47,6 @@ function WebSockets(initialState = {}) {
frameFilterText: "", frameFilterText: "",
// Default filter type is "all", // Default filter type is "all",
frameFilterType: "all", frameFilterType: "all",
showControlFrames: false,
selectedFrame: null, selectedFrame: null,
frameDetailsOpen: false, frameDetailsOpen: false,
currentChannelId: null, currentChannelId: null,
@ -126,7 +124,6 @@ function clearFrames(state) {
columns: nextState.columns, columns: nextState.columns,
frameFilterType: nextState.frameFilterType, frameFilterType: nextState.frameFilterType,
frameFilterText: nextState.frameFilterText, 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. * Set the filter text of the current channelId.
*/ */
@ -229,8 +216,6 @@ function webSockets(state = WebSockets(), action) {
return clearFrames(state); return clearFrames(state);
case WS_TOGGLE_FRAME_FILTER_TYPE: case WS_TOGGLE_FRAME_FILTER_TYPE:
return toggleFrameFilterType(state, action); return toggleFrameFilterType(state, action);
case WS_TOGGLE_CONTROL_FRAMES:
return toggleControlFrames(state, action);
case WS_SET_REQUEST_FILTER_TEXT: case WS_SET_REQUEST_FILTER_TEXT:
return setFrameFilterText(state, action); return setFrameFilterText(state, action);
case WS_TOGGLE_COLUMN: case WS_TOGGLE_COLUMN:

Просмотреть файл

@ -12,22 +12,14 @@ const { createSelector } = require("devtools/client/shared/vendor/reselect");
*/ */
const getDisplayedFrames = createSelector( const getDisplayedFrames = createSelector(
state => state.webSockets, state => state.webSockets,
({ ({ frames, frameFilterType, frameFilterText, currentChannelId }) => {
frames,
frameFilterType,
showControlFrames,
frameFilterText,
currentChannelId,
}) => {
if (!currentChannelId || !frames.get(currentChannelId)) { if (!currentChannelId || !frames.get(currentChannelId)) {
return []; return [];
} }
const framesArray = frames.get(currentChannelId); const framesArray = frames.get(currentChannelId);
if (frameFilterType === "all" && frameFilterText.length === 0) { if (frameFilterType === "all" && frameFilterText.length === 0) {
return framesArray.filter(frame => return framesArray;
typeFilter(frame, frameFilterType, showControlFrames)
);
} }
const filter = searchFilter(frameFilterText); const filter = searchFilter(frameFilterText);
@ -38,20 +30,11 @@ const getDisplayedFrames = createSelector(
(frame.payload.initial (frame.payload.initial
? filter(frame.payload.initial) ? filter(frame.payload.initial)
: filter(frame.payload)) && : 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) { function searchFilter(frameFilterText) {
let regex; let regex;
if (looksLikeRegex(frameFilterText)) { if (looksLikeRegex(frameFilterText)) {