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.
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

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

@ -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,

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

@ -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(
{

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

@ -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);

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

@ -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",

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

@ -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:

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

@ -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)) {