From 55a2c99dcdcf2a01e4462d73d6f0139a6370e82e Mon Sep 17 00:00:00 2001 From: "ager@chromium.org" Date: Thu, 18 Jun 2009 07:41:19 +0000 Subject: Add missing null handle check to document wrapper caching code. If instantiation of the document wrapper fails (for instance in out of memory situations) we get a null handle which will lead to a crash when using ForceSet. BUG=14514 Review URL: http://codereview.chromium.org/133001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18697 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/port/bindings/v8/v8_proxy.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'webkit/port') diff --git a/webkit/port/bindings/v8/v8_proxy.cpp b/webkit/port/bindings/v8/v8_proxy.cpp index 6cffe3a..46bff01 100644 --- a/webkit/port/bindings/v8/v8_proxy.cpp +++ b/webkit/port/bindings/v8/v8_proxy.cpp @@ -1842,6 +1842,14 @@ void V8Proxy::UpdateDocumentWrapperCache() } v8::Handle document_wrapper = NodeToV8Object(m_frame->document()); + + // If instantiation of the document wrapper fails, clear the cache + // and let the DOMWindow accessor handle access to the document. + if (document_wrapper.IsEmpty()) { + ClearDocumentWrapperCache(); + return; + } + m_context->Global()->ForceSet(v8::String::New("document"), document_wrapper, static_cast(v8::ReadOnly | v8::DontDelete)); -- cgit v1.1