Skip to content
This repository was archived by the owner on Aug 13, 2018. It is now read-only.

Commit 014afce

Browse files
committed
Merge branch 'master' of github.com:firebug/websocket-monitor
2 parents f8fb818 + 220038d commit 014afce

File tree

3 files changed

+52
-39
lines changed

3 files changed

+52
-39
lines changed

chrome/content/network-content-script.js

+45-36
Original file line numberDiff line numberDiff line change
@@ -17,47 +17,56 @@
1717
* The icons serves also as a link to the 'Web Socket'
1818
* panel.
1919
*/
20-
window.on(EVENTS.RECEIVED_REQUEST_HEADERS, (_, from) => {
21-
let item = NetMonitorView.RequestsMenu.getItemByValue(from);
22-
if (!isWsUpgradeRequest(item)) {
23-
return;
24-
}
20+
if (EVENTS.REQUEST_ITEM_CLICKED) {
21+
window.on(EVENTS.REQUEST_ITEM_CLICKED, (_, e, item) => {
22+
let target = ".request-list-item.websocket .requests-menu-method";
23+
if (e.target.closest(target)) {
24+
navigateToWebSocketPanel(item.id);
25+
}
26+
});
27+
} else {
28+
window.on(EVENTS.RECEIVED_REQUEST_HEADERS, (_, from) => {
29+
let item = NetMonitorView.RequestsMenu.getItemByValue(from);
30+
if (!isWsUpgradeRequest(item)) {
31+
return;
32+
}
2533

26-
// Append WebSocket icon in the UI
27-
let hbox = item._target;
34+
// Append WebSocket icon in the UI
35+
let hbox = item._target;
2836

29-
let method = hbox.querySelector(".requests-menu-method");
30-
method.classList.add("websocket");
37+
let method = hbox.querySelector(".requests-menu-method");
38+
method.classList.add("websocket");
3139

32-
// Fx 45 changed the DOM layout in the network panel and also
33-
// the WS icon isn't overlapping the original status icon now.
34-
// But, we need a little indentation for pre Fx45.
35-
let statusIconNode = hbox.querySelector(".requests-menu-status-icon");
36-
if (!statusIconNode) {
37-
// We are in pre Fx45 world, use a little indentation.
38-
method.classList.add("websocket-indent");
39-
}
40-
41-
// Register click handler and emit an event that is handled
42-
// in the 'WsmNetMonitorOverlay' overlay.
43-
// xxxHonza: this registers multiple listeners on the window
44-
// object that are all executed when the user clicks on the
45-
// WS icon. FIXME
46-
window.addEventListener("click", event => {
47-
if (event.target.classList.contains("websocket")) {
48-
navigateToWebSocketPanel(from);
40+
// Fx 45 changed the DOM layout in the network panel and also
41+
// the WS icon isn't overlapping the original status icon now.
42+
// But, we need a little indentation for pre Fx45.
43+
let statusIconNode = hbox.querySelector(".requests-menu-status-icon");
44+
if (!statusIconNode) {
45+
// We are in pre Fx45 world, use a little indentation.
46+
method.classList.add("websocket-indent");
4947
}
50-
});
5148

52-
// Do not open the Network panel side-bar if the user clicks
53-
// on the WS icon.
54-
window.addEventListener("mousedown", event => {
55-
if (event.target.classList.contains("websocket")) {
56-
event.stopPropagation();
57-
event.preventDefault();
58-
}
59-
}, true);
60-
});
49+
// Register click handler and emit an event that is handled
50+
// in the 'WsmNetMonitorOverlay' overlay.
51+
// xxxHonza: this registers multiple listeners on the window
52+
// object that are all executed when the user clicks on the
53+
// WS icon. FIXME
54+
window.addEventListener("click", event => {
55+
if (event.target.classList.contains("websocket")) {
56+
navigateToWebSocketPanel(from);
57+
}
58+
});
59+
60+
// Do not open the Network panel side-bar if the user clicks
61+
// on the WS icon.
62+
window.addEventListener("mousedown", event => {
63+
if (event.target.classList.contains("websocket")) {
64+
event.stopPropagation();
65+
event.preventDefault();
66+
}
67+
}, true);
68+
});
69+
}
6170

6271
/**
6372
* Handle Response body displayed event.

chrome/skin/classic/netmonitor.css

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
/* Network Panel */
55

66
/* Web Socket Icon */
7-
.requests-menu-method.websocket {
7+
.requests-menu-method.websocket,
8+
.request-list-item.websocket .requests-menu-method {
89
background-image: url("./tool-websockets.svg");
910
background-repeat: no-repeat;
10-
background-position: 0 1px;
11+
background-position: left center;
1112
}
1213

1314
/* Make sure the icon works in all themes */

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"license": "BSD-3-Clause",
1616
"icon": "chrome://websocketmonitor/skin/icon-32-color.png",
1717
"homepage": "https://github.com/firebug/websocket-monitor/wiki",
18-
"version": "0.6.4",
18+
"version": "0.6.5",
1919
"main": "lib/index",
2020
"repository": {
2121
"type": "git",
@@ -40,6 +40,9 @@
4040
"eslint:watch": "esw -w data/**/*.js chrome/"
4141
},
4242
"preferences-branch": "websocketmonitor",
43+
"permissions": {
44+
"multiprocess": true
45+
},
4346
"preferences": [
4447
{
4548
"name": "max_entries",

0 commit comments

Comments
 (0)