Changeset 62763 in webkit


Ignore:
Timestamp:
Jul 7, 2010 11:23:51 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-07-07 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Nate Chapin.

[V8] Fix document wrapper memory leak in bindings.
https://bugs.webkit.org/show_bug.cgi?id=41771

  • bindings/v8/custom/V8HTMLDocumentCustom.cpp: (WebCore::V8HTMLDocument::WrapInShadowObject): Do not create static persistent handle to shadowConstructor because it keeps the first context alive forever.
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r62762 r62763  
     12010-07-07  Pavel Podivilov  <podivilov@chromium.org>
     2
     3        Reviewed by Nate Chapin.
     4
     5        [V8] Fix document wrapper memory leak in bindings.
     6        https://bugs.webkit.org/show_bug.cgi?id=41771
     7
     8        * bindings/v8/custom/V8HTMLDocumentCustom.cpp:
     9        (WebCore::V8HTMLDocument::WrapInShadowObject): Do not create static persistent handle
     10        to shadowConstructor because it keeps the first context alive forever.
     11
    1122010-07-07  Andreas Kling  <andreas.kling@nokia.com>
    213
  • trunk/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp

    r60670 r62763  
    5252v8::Local<v8::Object> V8HTMLDocument::WrapInShadowObject(v8::Local<v8::Object> wrapper, Node* impl)
    5353{
    54     DEFINE_STATIC_LOCAL(v8::Persistent<v8::Function>, shadowConstructor, ());
    55     if (shadowConstructor.IsEmpty()) {
    56         v8::Local<v8::FunctionTemplate> shadowTemplate = v8::FunctionTemplate::New();
     54    DEFINE_STATIC_LOCAL(v8::Persistent<v8::FunctionTemplate>, shadowTemplate, ());
     55    if (shadowTemplate.IsEmpty()) {
     56        shadowTemplate = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New());
    5757        if (shadowTemplate.IsEmpty())
    5858            return v8::Local<v8::Object>();
     
    6060        shadowTemplate->Inherit(V8HTMLDocument::GetTemplate());
    6161        shadowTemplate->InstanceTemplate()->SetInternalFieldCount(V8HTMLDocument::internalFieldCount);
    62         shadowConstructor = v8::Persistent<v8::Function>::New(shadowTemplate->GetFunction());
    63         if (shadowConstructor.IsEmpty())
    64             return v8::Local<v8::Object>();
    6562    }
    6663
    67     ASSERT(!shadowConstructor.IsEmpty());
     64    v8::Local<v8::Function> shadowConstructor = shadowTemplate->GetFunction();
     65    if (shadowConstructor.IsEmpty())
     66        return v8::Local<v8::Object>();
     67
    6868    v8::Local<v8::Object> shadow = shadowConstructor->NewInstance();
    6969    if (shadow.IsEmpty())
Note: See TracChangeset for help on using the changeset viewer.