diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2015-03-23 00:26:59 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2015-03-23 10:40:12 +0100 |
commit | 7e88a9322c8f1b5393723d6f99590d750b097569 (patch) | |
tree | ef3f4d358d11d2db3b8c4a0ca75ad27e97e61ebe /src/node_internals.h | |
parent | 20c4498e76af9bd639a752aae3e36571251c3c2d (diff) | |
download | node-new-7e88a9322c8f1b5393723d6f99590d750b097569.tar.gz |
src: make accessors immune to context confusion
It's possible for an accessor or named interceptor to get called with
a different execution context than the one it lives in, see the test
case for an example using the debug API.
This commit fortifies against that by passing the environment as a
data property instead of looking it up through the current context.
Fixes: https://github.com/iojs/io.js/issues/1190 (again)
PR-URL: https://github.com/iojs/io.js/pull/1238
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Diffstat (limited to 'src/node_internals.h')
-rw-r--r-- | src/node_internals.h | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/src/node_internals.h b/src/node_internals.h index 9141355df6..c99b2feeb0 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -195,21 +195,6 @@ NODE_DEPRECATED("Use ThrowUVException(isolate)", return ThrowUVException(isolate, errorno, syscall, message, path); }) -inline void NODE_SET_EXTERNAL(v8::Handle<v8::ObjectTemplate> target, - const char* key, - v8::AccessorGetterCallback getter) { - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - v8::HandleScope handle_scope(isolate); - v8::Local<v8::String> prop = v8::String::NewFromUtf8(isolate, key); - target->SetAccessor(prop, - getter, - nullptr, - v8::Handle<v8::Value>(), - v8::DEFAULT, - static_cast<v8::PropertyAttribute>(v8::ReadOnly | - v8::DontDelete)); -} - enum NodeInstanceType { MAIN, WORKER }; class NodeInstanceData { |