0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 07:00:59 +01:00

Fix HTTPConnection javascript inheritance.

This commit is contained in:
Ryan 2009-05-04 16:23:30 +02:00
parent 38726e7272
commit 6149c6c49a
3 changed files with 15 additions and 14 deletions

View File

@ -70,7 +70,6 @@ appendHeaderValue (Handle<Value> message, Handle<Value> d)
_append_header_value->Call(message->ToObject(), 2, argv);
}
Persistent<FunctionTemplate> HTTPConnection::constructor_template;
void
@ -79,11 +78,11 @@ HTTPConnection::Initialize (Handle<Object> target)
HandleScope scope;
Local<FunctionTemplate> t = FunctionTemplate::New(HTTPConnection::v8NewClient);
t->InstanceTemplate()->SetInternalFieldCount(1);
t->Inherit(Connection::constructor_template);
target->Set(String::NewSymbol("HTTPClient"), t->GetFunction());
constructor_template = Persistent<FunctionTemplate>::New(t);
constructor_template->Inherit(Connection::constructor_template);
constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
target->Set(String::NewSymbol("HTTPClient"), constructor_template->GetFunction());
}
Handle<Value>

View File

@ -49,15 +49,16 @@ Connection::Initialize (v8::Handle<v8::Object> target)
HandleScope scope;
Local<FunctionTemplate> t = FunctionTemplate::New(v8New);
t->InstanceTemplate()->SetInternalFieldCount(1);
target->Set(String::NewSymbol("TCPConnection"), t->GetFunction());
NODE_SET_METHOD(t->InstanceTemplate(), "connect", v8Connect);
NODE_SET_METHOD(t->InstanceTemplate(), "close", v8Close);
NODE_SET_METHOD(t->InstanceTemplate(), "send", v8Send);
NODE_SET_METHOD(t->InstanceTemplate(), "sendEOF", v8SendEOF);
constructor_template = Persistent<FunctionTemplate>::New(t);
constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
NODE_SET_METHOD(constructor_template->PrototypeTemplate(), "connect", v8Connect);
NODE_SET_METHOD(constructor_template->PrototypeTemplate(), "close", v8Close);
NODE_SET_METHOD(constructor_template->PrototypeTemplate(), "send", v8Send);
NODE_SET_METHOD(constructor_template->PrototypeTemplate(), "sendEOF", v8SendEOF);
target->Set(String::NewSymbol("TCPConnection"), constructor_template->GetFunction());
}
Connection::Connection (Handle<Object> handle, Handle<Function> protocol_class)

View File

@ -245,10 +245,11 @@ main (int argc, char *argv[])
// BUILT-IN MODULES
Acceptor::Initialize(g);
Connection::Initialize(g);
node::Init_timer(g);
node::Init_file(g);
Acceptor::Initialize(g);
Connection::Initialize(g);
HTTPConnection::Initialize(g);
// NATIVE JAVASCRIPT MODULES