summaryrefslogtreecommitdiffstats
path: root/webkit/port
diff options
context:
space:
mode:
authorager@chromium.org <ager@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-18 07:41:19 +0000
committerager@chromium.org <ager@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-18 07:41:19 +0000
commit55a2c99dcdcf2a01e4462d73d6f0139a6370e82e (patch)
tree20901c5583817dfcf050597b35c010cb7899ba6e /webkit/port
parent212476da17fa6558cbb686eae3e087dfcd4f480d (diff)
downloadchromium_src-55a2c99dcdcf2a01e4462d73d6f0139a6370e82e.zip
chromium_src-55a2c99dcdcf2a01e4462d73d6f0139a6370e82e.tar.gz
chromium_src-55a2c99dcdcf2a01e4462d73d6f0139a6370e82e.tar.bz2
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
Diffstat (limited to 'webkit/port')
-rw-r--r--webkit/port/bindings/v8/v8_proxy.cpp8
1 files changed, 8 insertions, 0 deletions
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<v8::Value> 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::PropertyAttribute>(v8::ReadOnly | v8::DontDelete));