diff options
author | plesner@google.com <plesner@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-05 15:52:40 +0000 |
---|---|---|
committer | plesner@google.com <plesner@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-05 15:52:40 +0000 |
commit | f9c61c9a94741747d223fbd0ae902478205aba61 (patch) | |
tree | 933ab9e4b88b484223e97f75bbc40810fc824dbb /webkit/port/bindings | |
parent | 4e3b4209abdd6037f7a2329d54b4578524810af2 (diff) | |
download | chromium_src-f9c61c9a94741747d223fbd0ae902478205aba61.zip chromium_src-f9c61c9a94741747d223fbd0ae902478205aba61.tar.gz chromium_src-f9c61c9a94741747d223fbd0ae902478205aba61.tar.bz2 |
Reverted not-quite-working fix for hotmail issue.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6431 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port/bindings')
-rw-r--r-- | webkit/port/bindings/scripts/CodeGeneratorV8.pm | 5 | ||||
-rw-r--r-- | webkit/port/bindings/v8/v8_index.h | 1 | ||||
-rw-r--r-- | webkit/port/bindings/v8/v8_proxy.cpp | 48 | ||||
-rw-r--r-- | webkit/port/bindings/v8/v8_proxy.h | 5 |
4 files changed, 9 insertions, 50 deletions
diff --git a/webkit/port/bindings/scripts/CodeGeneratorV8.pm b/webkit/port/bindings/scripts/CodeGeneratorV8.pm index 72d5a80..44947c8 100644 --- a/webkit/port/bindings/scripts/CodeGeneratorV8.pm +++ b/webkit/port/bindings/scripts/CodeGeneratorV8.pm @@ -418,7 +418,10 @@ sub GenerateConstructorGetter V8ClassIndex::V8WrapperType type = V8ClassIndex::FromInt(data->Int32Value()); - return V8Proxy::retrieve()->GetConstructor(type); + v8::Handle<v8::FunctionTemplate> desc = V8Proxy::GetTemplate(type); + v8::Handle<v8::Function> func = desc->GetFunction(); + ASSERT(func->IsFunction()); + return func; } END diff --git a/webkit/port/bindings/v8/v8_index.h b/webkit/port/bindings/v8/v8_index.h index 2334773..fd5849c 100644 --- a/webkit/port/bindings/v8/v8_index.h +++ b/webkit/port/bindings/v8/v8_index.h @@ -443,7 +443,6 @@ class V8ClassIndex { ALL_WRAPPER_TYPES(DEFINE_ENUM) #undef DEFINE_ENUM CLASSINDEX_END, - WRAPPER_TYPE_COUNT = CLASSINDEX_END }; static int ToInt(V8WrapperType type) { return static_cast<int>(type); } diff --git a/webkit/port/bindings/v8/v8_proxy.cpp b/webkit/port/bindings/v8/v8_proxy.cpp index bfa26f3..5981ef8b 100644 --- a/webkit/port/bindings/v8/v8_proxy.cpp +++ b/webkit/port/bindings/v8/v8_proxy.cpp @@ -984,14 +984,6 @@ V8Proxy::~V8Proxy() { clearForClose(); DestroyGlobal(); - if (!m_constructor_cache.IsEmpty()) { - m_constructor_cache.Dispose(); - m_constructor_cache.Clear(); - } - if (!m_initial_object_prototype.IsEmpty()) { - m_initial_object_prototype.Dispose(); - m_initial_object_prototype.Clear(); - } } void V8Proxy::DestroyGlobal() @@ -1366,30 +1358,6 @@ v8::Local<v8::Value> V8Proxy::CallFunction(v8::Handle<v8::Function> function, } -v8::Local<v8::Function> V8Proxy::GetConstructor( - V8ClassIndex::V8WrapperType t) { - ASSERT(ContextInitialized()); - v8::Local<v8::Value> cached = m_constructor_cache->Get(v8::Integer::New(t)); - if (cached->IsUndefined()) { - static v8::Persistent<v8::String> proto; - if (proto.IsEmpty()) { - proto = v8::Persistent<v8::String>::New(v8::String::New("__proto__")); - } - v8::Handle<v8::FunctionTemplate> templ = GetTemplate(t); - v8::TryCatch try_catch; - // This might fail if we're running out of stack or memory. - v8::Local<v8::Function> value = templ->GetFunction(); - if (value.IsEmpty()) - return v8::Local<v8::Function>(); - m_constructor_cache->Set(v8::Integer::New(t), value); - value->Set(proto, m_initial_object_prototype); - return value; - } else { - return v8::Local<v8::Function>::Cast(cached); - } -} - - v8::Persistent<v8::FunctionTemplate> V8Proxy::GetTemplate( V8ClassIndex::V8WrapperType type) { @@ -2133,19 +2101,12 @@ void V8Proxy::initContextIfNeeded() #endif } - v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast( - m_global->Get(v8::String::New("Object"))); - m_initial_object_prototype = v8::Persistent<v8::Value>::New( - object->Get(v8::String::New("prototype"))); - m_constructor_cache = v8::Persistent<v8::Array>::New( - v8::Array::New(V8ClassIndex::WRAPPER_TYPE_COUNT)); - // Create a new JS window object and use it as the prototype for the // shadow global object. - v8::Handle<v8::Function> window_constructor = - GetConstructor(V8ClassIndex::DOMWINDOW); + v8::Persistent<v8::FunctionTemplate> window_descriptor = + GetTemplate(V8ClassIndex::DOMWINDOW); v8::Local<v8::Object> js_window = - SafeAllocation::NewInstance(window_constructor); + SafeAllocation::NewInstance(window_descriptor->GetFunction()); if (js_window.IsEmpty()) return; @@ -2459,7 +2420,8 @@ v8::Local<v8::Object> V8Proxy::InstantiateV8Object( desc_type = V8ClassIndex::UNDETECTABLEHTMLCOLLECTION; } - v8::Local<v8::Function> function = retrieve()->GetConstructor(desc_type); + v8::Persistent<v8::FunctionTemplate> desc = GetTemplate(desc_type); + v8::Local<v8::Function> function = desc->GetFunction(); v8::Local<v8::Object> instance = SafeAllocation::NewInstance(function); if (!instance.IsEmpty()) { // Avoid setting the DOM wrapper for failed allocations. diff --git a/webkit/port/bindings/v8/v8_proxy.h b/webkit/port/bindings/v8/v8_proxy.h index 912ffe0..4450dcc 100644 --- a/webkit/port/bindings/v8/v8_proxy.h +++ b/webkit/port/bindings/v8/v8_proxy.h @@ -238,9 +238,6 @@ class V8Proxy { int argc, v8::Handle<v8::Value> argv[]); - // Returns the dom constructor function for the given node type. - v8::Local<v8::Function> GetConstructor(V8ClassIndex::V8WrapperType type); - // Returns the window object of the currently executing context. static DOMWindow* retrieveWindow(); // Returns the window object associated with a context. @@ -519,8 +516,6 @@ class V8Proxy { v8::Persistent<v8::Object> m_global; v8::Persistent<v8::Value> m_document; - v8::Persistent<v8::Array> m_constructor_cache; - v8::Persistent<v8::Value> m_initial_object_prototype; // Utility context holding JavaScript functions used internally. static v8::Persistent<v8::Context> m_utilityContext; |