Skip to content

Commit 2953e92

Browse files
committed
Add method 'disableWebkitProtocol'
1 parent e4e5238 commit 2953e92

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

v8-debug.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ var overrides = {
6969
response = this.createResponse();
7070
}
7171
response.success = false;
72-
response.message = e.toString();
72+
response.message = e.stack;
7373
}
7474

7575
// Return the response as a JSON encoded string.
@@ -86,11 +86,11 @@ var overrides = {
8686
'"request_seq":' + request.seq + ',' +
8787
'"type":"response",' +
8888
'"success":false,' +
89-
'"message":"Internal error: ' + e.toString() + '"}';
89+
'"message":"Internal error: ' + e.stack + '"}';
9090
}
9191
} catch (e) {
9292
// Failed in one of the catch blocks above - most generic error.
93-
return '{"seq":0,"type":"response","success":false,"message":"Internal error"}';
93+
return '{"seq":0,"type":"response","success":false,"message":"' + e.stack + '"}';
9494
}
9595
},
9696
processDebugRequest: function WRAPPED_BY_NODE_INSPECTOR(request) {
@@ -117,9 +117,7 @@ function V8Debug() {
117117
this._unwrapDebugCommandProcessor();
118118
this._unshareSecurityToken();
119119
this._unsetDebugEventListener();
120-
process.nextTick(function() {
121-
this.removeAllListeners();
122-
}.bind(this));
120+
this.disableWebkitProtocol();
123121
});
124122
}
125123

@@ -150,7 +148,7 @@ V8Debug.prototype._wrapDebugCommandProcessor = function() {
150148
extend(proto, overrides);
151149
overrides.extendedProcessDebugJSONRequestHandles_['disconnect'] = function(request, response) {
152150
this.emit('close');
153-
this.processDebugJSONRequest(request);
151+
proto.processDebugJSONRequest(request);
154152
}.bind(this);
155153
};
156154

@@ -286,9 +284,9 @@ V8Debug.prototype.enableWebkitProtocol = function() {
286284
response.event = command;
287285

288286
new WebkitEventCallback(callback)(request, response);
287+
this.unregisterCommand(handlerName);
289288
}.bind(this));
290289
this.sendCommand(handlerName);
291-
this.unregisterCommand(handlerName);
292290
};
293291

294292
this.wrapCallFrames = function(execState, maximumLimit, scopeDetails) {
@@ -335,6 +333,13 @@ V8Debug.prototype.enableWebkitProtocol = function() {
335333
}
336334
};
337335

336+
V8Debug.prototype.disableWebkitProtocol = function() {
337+
if (!this._webkitProtocolEnabled) return;
338+
this._webkitProtocolEnabled = false;
339+
340+
this.runInDebugContext('ToggleMirrorCache()');
341+
};
342+
338343
V8Debug.prototype.releaseObject =
339344
V8Debug.prototype.releaseObjectGroup =
340345
V8Debug.prototype.wrapCallFrames =

0 commit comments

Comments
 (0)