Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contextify: share security token with debug ctx #748

Closed
wants to merge 2 commits into from

Conversation

indutny
Copy link
Member

@indutny indutny commented Feb 6, 2015

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

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
@indutny
Copy link
Member Author

indutny commented Feb 6, 2015

cc @iojs/collaborators @domenic

@indutny
Copy link
Member Author

indutny commented Feb 6, 2015

Same PR for node.js: nodejs/node-v0.x-archive#9157

@indutny
Copy link
Member Author

indutny commented Feb 7, 2015

@@ -236,7 +236,13 @@ class ContextifyContext {
Local<String> script_source(args[0]->ToString(args.GetIsolate()));
if (script_source.IsEmpty())
return; // Exception pending.
Context::Scope context_scope(Debug::GetDebugContext());

Environment* env = Environment::GetCurrent(args.GetIsolate());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could move this into the if, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will account for 0% of cases, because debug context is empty only when we are hard on memory (i.e. allocation failure).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I meant to say that it'll be executed in 99.999% of cases anyway, not 0%.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah just thinking about keeping variables in their tightest scope. No big deal.

@domenic
Copy link
Contributor

domenic commented Feb 7, 2015

Needs a test

@indutny
Copy link
Member Author

indutny commented Feb 7, 2015

@domenic ! forgot to push a test, sorry.

@indutny
Copy link
Member Author

indutny commented Feb 7, 2015

CI is happy with the change

assert.equal(proto.prop, true);
proto = vm.runInDebugContext('DebugCommandProcessor.prototype');
assert.equal(proto.prop, true);
proto = vm.runInDebugContext('DebugCommandProcessor.prototype.prop = true;' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this line be setting to a different value than true? To be sure it actually does something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line could be removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding of this line was it was testing that if you set it inside the vm, instead of outside, it still works. So it might be good to leave it in but use a different value.

@indutny
Copy link
Member Author

indutny commented Feb 7, 2015

Wait... This does not fix the issue. Oh gosh.

@indutny
Copy link
Member Author

indutny commented Feb 8, 2015

@3y3 I hope you don't mind continuing the discussion here. I'm just tired of updating this issue in both places :)

I'm afraid that issue might be a wontfix. Basically, v8 has changed it's behavior and now it is creating new Debugger instance every time your try to access it.

Submitted v8 issue https://code.google.com/p/v8/issues/detail?id=3876&thanks=3876&ts=1423353590 . Going to close this PR for now.

@indutny indutny closed this Feb 8, 2015
@indutny indutny deleted the fix/gh-j-9156 branch February 8, 2015 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants