C-Ares shouldn't iterate over all Object.prototype elements
and furthermore error out of one of them isn't a DNS option. Test case by Ben Lund <ben.lund@gmail.com>; additional help from Tim Caswell <tim@creationix.com>.
This commit is contained in:
parent
715e119eea
commit
cc9d5ab546
@ -422,22 +422,13 @@ Handle<Value> Channel::New(const Arguments& args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Local<Object> options_o = Local<Object>::Cast(args[0]);
|
Local<Object> options_o = Local<Object>::Cast(args[0]);
|
||||||
Local<Array> keys = options_o->GetPropertyNames();
|
|
||||||
int length = keys->Length();
|
|
||||||
|
|
||||||
for (int i = 0; i < length; ++i) {
|
Local<Value> cb = options_o->Get(String::NewSymbol("SOCK_STATE_CB"));
|
||||||
Local<String> opt = Local<String>::Cast(keys->Get(Integer::New(i)));
|
if (!cb.IsEmpty()) {
|
||||||
|
c->handle_->Set(callback_symbol, cb);
|
||||||
if (opt->Equals(String::New("SOCK_STATE_CB"))) {
|
options.sock_state_cb_data = c;
|
||||||
c->handle_->Set(callback_symbol, options_o->Get(opt));
|
options.sock_state_cb = Channel::SockStateCb;
|
||||||
options.sock_state_cb_data = c;
|
optmask |= ARES_OPT_SOCK_STATE_CB;
|
||||||
options.sock_state_cb = Channel::SockStateCb;
|
|
||||||
optmask |= ARES_OPT_SOCK_STATE_CB;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ThrowException(Exception::Error(
|
|
||||||
String::New("Unknown Option")));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
test/simple/test-regression-object-prototype.js
Normal file
8
test/simple/test-regression-object-prototype.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
var sys = require('sys');
|
||||||
|
|
||||||
|
//sys.puts('puts before');
|
||||||
|
|
||||||
|
Object.prototype.xadsadsdasasdxx = function () {
|
||||||
|
};
|
||||||
|
|
||||||
|
sys.puts('puts after');
|
Loading…
x
Reference in New Issue
Block a user