-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Debugger: vm.runInDebugContext change behavior in 0.11.16 #9156
Comments
Looking |
I think it was broken during the merge 7ca5af8 |
Hm... may be not. |
Btw, doesn't seem to be working on v0.11.14 for me. |
And on v0.11.15 too. |
Same on v0.11.16 ... @3y3 am I missing something? This feature was introduced in v0.11.14 and your test case does not appear to be working with any versions after (and including) it. |
Hm... Win x64 works on 0.11.14 for me (downloaded from site). |
@tjfontaine @misterdjules can we confirm this on windows? (I don't have any machines at hand) |
I also backported this feature to previous versions in |
@3y3 it is failing on:
for me |
|
Gosh. I got this line removed somehow, sorry about this! :) |
SuccessD:\3y3\GIT\v8-debug [master +3 ~5 -0 !]> node -p "process.version + ' ' + process.arch"
v0.11.14 ia32
D:\3y3\GIT\v8-debug [master +3 ~5 -0 !]> cat test.js
var vm = require('vm');
var assert = require('assert');
var proto = vm.runInDebugContext('DebugCommandProcessor.prototype');
proto.option_ = true;
assert(proto.option_ === true);
proto = vm.runInDebugContext('DebugCommandProcessor.prototype');
assert(proto.option_ === true);
proto = vm.runInDebugContext('DebugCommandProcessor.prototype.option_ = true; DebugCommandProcessor.prototype');
assert(proto.option_ === true);
D:\3y3\GIT\v8-debug [master +3 ~5 -0 !]> node test
D:\3y3\GIT\v8-debug [master +3 ~5 -0 !]> FailureD:\3y3\GIT\v8-debug [master +3 ~5 -0 !]> node -p "process.version + ' ' + process.arch"
v0.11.15 ia32
D:\3y3\GIT\v8-debug [master +3 ~5 -0 !]> cat test.js
var vm = require('vm');
var assert = require('assert');
var proto = vm.runInDebugContext('DebugCommandProcessor.prototype');
proto.option_ = true;
assert(proto.option_ === true);
proto = vm.runInDebugContext('DebugCommandProcessor.prototype');
assert(proto.option_ === true);
proto = vm.runInDebugContext('DebugCommandProcessor.prototype.option_ = true; DebugCommandProcessor.prototype');
assert(proto.option_ === true);
D:\3y3\GIT\v8-debug [master +3 ~5 -0 !]> node test
assert.js:99
throw new assert.AssertionError({
^
AssertionError: false == true
at Object.<anonymous> (D:\3y3\GIT\v8-debug\test.js:8:1)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
D:\3y3\GIT\v8-debug [master +3 ~5 -0 !]> Not relative to error but I'm sorry for
I don't know why I use x32 arch in 0.11.15, but in 0.11.14 it was important for |
Ok, the offending commit seems to be 9116b24 |
Hah, actually 7a0cfe9 as you initially said :) This appears to be fixing the problem: diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index 6985a33..d4e284d 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -236,6 +236,10 @@ class ContextifyContext {
Local<String> script_source(args[0]->ToString(args.GetIsolate()));
if (script_source.IsEmpty())
return; // Exception pending.
+ Environment* env = Environment::GetCurrent(args);
+ Local<Context> ctx = Debug::GetDebugContext();
+ if (!ctx.IsEmpty())
+ ctx->SetSecurityToken(env->context()->GetSecurityToken());
Context::Scope context_scope(Debug::GetDebugContext());
Local<Script> script = Script::Compile(script_source);
if (script.IsEmpty()) @3y3 do you have resources to verify it? |
I'll try to rebuild my 0.11.16 now |
If security token does not match - no changes are allowed to the objects from different context. We already copy the security token to the newly created contexts in contextify.cc . Copy the security token to the debug context too. Fix: nodejs#9156
Just opened PR: #9157 |
If security token does not match - no changes are allowed to the objects from different context. We already copy the security token to the newly created contexts in contextify.cc . Copy the security token to the debug context too. Fix: nodejs/node-v0.x-archive#9156
@3y3 unfortunately, it does not fix the issue. Going to look into it tomorrow. |
Most likely |
Wow! It's a bad news. I subscribed on v8 issue. About new |
@3y3 I have no idea :) How are you using this |
I do the following DebugCommandProcessor.prototype.processDebugRequest = function WRAPPED_BY_NODE_INSPECTOR(request) {
return this.extendedProcessDebugJSONRequest_(request)
|| this.processDebugJSONRequest(request);
};
DebugCommandProcessor.prototype.extendedProcessDebugJSONRequest_ = function(request) {
// if request exists in extendedProcessDebugJSONRequestHandles_
// then process it
// else return false
}
DebugCommandProcessor.prototype.extendedProcessDebugJSONRequestHandles_ = {}; This way a hack this line of code. So in current time this line is unhackable =( I provide small api to write in From debug.registerCommand('Profiler.stop', function(request, response) {
var profile = profiler.stopProfiling();
profilingEnabled = false;
response.body = {header: profile.getHeader()};
debug.sendCommand(
'Profiler.addProfileHeader',
response.body
);
debug.sendCommand(
'Profiler.setRecordingProfile',
{isProfiling: false}
);
}); So |
Ok =) As temporary fix I use next strategy: Crazy pseudocode
|
@indutny , where I need to open isues for For example current iisue is |
@3y3 you could do it in node.js or io.js repo, depends on what works for you best. |
@indutny , is it possible to share It will be nice to use process._debugAPI.sendCommand = (function(originalSendCommand) {
return function(command) {
// do here something
originalSendCommand();
}
}(process._debugAPI.sendCommand)) v8 issue was accepted, but I don't know that it means for us (is this "ok, we well fix it in future" or "ok, we see it and we will think to fix it or not" ?) |
Temporary solution for nodejs/node-v0.x-archive#9156
Temporary solution for nodejs/node-v0.x-archive#9156
Temporary solution for nodejs/node-v0.x-archive#9156
This is what
|
Oh, yes! I'm already implement noop
I'm not sure that |
This test passes in 0.11.14 and fails in 0.11.16.
I think this is relative to 947408b
@indutny , please confirm this.
Previous behavior is very important for node-inspector. This is my current way to extend v8 debugger protocol. If new behavior is correct, can you propose any way to extend debugger protocol after 0.11.16 and in io.js
The text was updated successfully, but these errors were encountered: