Bug 1564105 - Enable WS Monitor in Nightly. r=Honza,jdescottes

Enable WS Monitor in Nightly

Differential Revision: https://phabricator.services.mozilla.com/D38230

--HG--
extra : moz-landing-system : lando
This commit is contained in:
tanhengyeow 2019-07-18 13:49:59 +00:00
Родитель c1640d7f9e
Коммит 60458cbfd4
3 изменённых файлов: 16 добавлений и 17 удалений

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

@ -189,8 +189,12 @@ pref("devtools.netmonitor.har.forceExport", false);
pref("devtools.netmonitor.har.pageLoadedTimeout", 1500);
pref("devtools.netmonitor.har.enableAutoExportToFile", false);
// Support for WebSocket monitoring pref (pending complete implementation)
// Enable WebSocket monitoring in Nightly builds.
#if defined(NIGHTLY_BUILD)
pref("devtools.netmonitor.features.webSockets", true);
#else
pref("devtools.netmonitor.features.webSockets", false);
#endif
// Scratchpad settings
// - recentFileMax: The maximum number of recently-opened files

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

@ -23,7 +23,7 @@ const WebSocketActor = ActorClassWithSpec(webSocketSpec, {
Actor.prototype.initialize.call(this, conn);
this.targetActor = targetActor;
this.listening = false;
this.innerWindowID = null;
// Each connection's webSocketSerialID is mapped to a httpChannelId
this.connections = new Map();
@ -54,22 +54,20 @@ const WebSocketActor = ActorClassWithSpec(webSocketSpec, {
// Actor API
startListening: function() {
// Register WS listener
if (!this.listening) {
const innerWindowID = this.targetActor.window.windowUtils
.currentInnerWindowID;
webSocketEventService.addListener(innerWindowID, this);
this.listening = true;
}
this.stopListening();
this.innerWindowID = this.targetActor.window.windowUtils.currentInnerWindowID;
webSocketEventService.addListener(this.innerWindowID, this);
},
stopListening() {
if (this.listening) {
const innerWindowID = this.targetActor.window.windowUtils
.currentInnerWindowID;
webSocketEventService.removeListener(innerWindowID, this);
this.listening = false;
if (!this.innerWindowID) {
return;
}
if (webSocketEventService.hasListenerFor(this.innerWindowID)) {
webSocketEventService.removeListener(this.innerWindowID, this);
}
this.innerWindowID = null;
},
// nsIWebSocketEventService

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

@ -37,9 +37,6 @@ class WebSocketFront extends FrontClassWithSpec(webSocketSpec) {
*
*/
destroy() {
if (!this._client) {
return null;
}
this.off("serverWebSocketOpened");
this.off("serverWebSocketClosed");
this.off("serverFrameSent");