Revert "Make BrowserWindow inheritable. Fixed #23."
This reverts commit 5a0aab2e4f
.
This commit is contained in:
parent
3d267e2a9f
commit
dbaf8860a6
6 changed files with 47 additions and 95 deletions
|
@ -19,13 +19,9 @@ using content::NavigationController;
|
|||
using node::ObjectWrap;
|
||||
|
||||
#define UNWRAP_WINDOW_AND_CHECK \
|
||||
Window* self; \
|
||||
if (SafeUnwrap<Window>(args.This(), &self)) { \
|
||||
if (self == NULL) \
|
||||
return node::ThrowError("Window is already destroyed"); \
|
||||
} else { \
|
||||
return node::ThrowTypeError("Window methods are not generic");\
|
||||
}
|
||||
Window* self = ObjectWrap::Unwrap<Window>(args.This()); \
|
||||
if (self == NULL) \
|
||||
return node::ThrowError("Window is already destroyed")
|
||||
|
||||
namespace atom {
|
||||
|
||||
|
@ -40,9 +36,6 @@ v8::Handle<v8::String> UTF16ToV8String(const string16& s) {
|
|||
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
v8::Persistent<v8::FunctionTemplate> Window::constructor_template_;
|
||||
|
||||
Window::Window(v8::Handle<v8::Object> wrapper, base::DictionaryValue* options)
|
||||
: EventEmitter(wrapper),
|
||||
window_(NativeWindow::Create(options)) {
|
||||
|
@ -92,11 +85,11 @@ void Window::OnRendererCrashed() {
|
|||
|
||||
// static
|
||||
v8::Handle<v8::Value> Window::New(const v8::Arguments &args) {
|
||||
if (!args.IsConstructCall())
|
||||
return FromConstructorTemplate(constructor_template_, args);
|
||||
|
||||
v8::HandleScope scope;
|
||||
|
||||
if (!args.IsConstructCall())
|
||||
return node::ThrowError("Require constructor call");
|
||||
|
||||
if (!args[0]->IsObject())
|
||||
return node::ThrowTypeError("Need options creating Window");
|
||||
|
||||
|
@ -650,10 +643,7 @@ void Window::Initialize(v8::Handle<v8::Object> target) {
|
|||
|
||||
v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(Window::New);
|
||||
t->InstanceTemplate()->SetInternalFieldCount(1);
|
||||
t->SetClassName(v8::String::NewSymbol("Window"));
|
||||
|
||||
constructor_template_ = v8::Persistent<v8::FunctionTemplate>::New(
|
||||
node::node_isolate, t);
|
||||
t->SetClassName(v8::String::NewSymbol("BrowserWindow"));
|
||||
|
||||
NODE_SET_PROTOTYPE_METHOD(t, "destroy", Destroy);
|
||||
NODE_SET_PROTOTYPE_METHOD(t, "close", Close);
|
||||
|
@ -713,7 +703,7 @@ void Window::Initialize(v8::Handle<v8::Object> target) {
|
|||
NODE_SET_PROTOTYPE_METHOD(t, "reload", Reload);
|
||||
NODE_SET_PROTOTYPE_METHOD(t, "reloadIgnoringCache", ReloadIgnoringCache);
|
||||
|
||||
target->Set(v8::String::NewSymbol("Window"), t->GetFunction());
|
||||
target->Set(v8::String::NewSymbol("BrowserWindow"), t->GetFunction());
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue