diff --git a/src/node_cares.cc b/src/node_cares.cc index 82d2a64b939d25..076540d8f732dc 100644 --- a/src/node_cares.cc +++ b/src/node_cares.cc @@ -422,22 +422,13 @@ Handle Channel::New(const Arguments& args) { } Local options_o = Local::Cast(args[0]); - Local keys = options_o->GetPropertyNames(); - int length = keys->Length(); - - for (int i = 0; i < length; ++i) { - Local opt = Local::Cast(keys->Get(Integer::New(i))); - - if (opt->Equals(String::New("SOCK_STATE_CB"))) { - c->handle_->Set(callback_symbol, options_o->Get(opt)); - options.sock_state_cb_data = c; - options.sock_state_cb = Channel::SockStateCb; - optmask |= ARES_OPT_SOCK_STATE_CB; - continue; - } - return ThrowException(Exception::Error( - String::New("Unknown Option"))); + Local cb = options_o->Get(String::NewSymbol("SOCK_STATE_CB")); + if (!cb.IsEmpty()) { + c->handle_->Set(callback_symbol, cb); + options.sock_state_cb_data = c; + options.sock_state_cb = Channel::SockStateCb; + optmask |= ARES_OPT_SOCK_STATE_CB; } } diff --git a/test/simple/test-regression-object-prototype.js b/test/simple/test-regression-object-prototype.js new file mode 100644 index 00000000000000..7c6f45138f7ccc --- /dev/null +++ b/test/simple/test-regression-object-prototype.js @@ -0,0 +1,8 @@ +var sys = require('sys'); + +//sys.puts('puts before'); + +Object.prototype.xadsadsdasasdxx = function () { +}; + +sys.puts('puts after');