Changeset 109611 in webkit


Ignore:
Timestamp:
Mar 2, 2012 1:45:10 PM (12 years ago)
Author:
arv@chromium.org
Message:

[V8] Bindings for node always check if they are a Document.
https://bugs.webkit.org/show_bug.cgi?id=79947

Reviewed by Adam Barth.

This changes the generated bindings code to only generate the Document code for the Document wrappers.

No new tests. Covered by existing tests.

  • bindings/scripts/CodeGeneratorV8.pm:

(GenerateToV8Converters):

  • bindings/scripts/test/V8/V8Float64Array.cpp:

(WebCore::V8Float64Array::wrapSlow):

  • bindings/scripts/test/V8/V8TestActiveDOMObject.cpp:

(WebCore::V8TestActiveDOMObject::wrapSlow):

  • bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp:

(WebCore::V8TestCustomNamedGetter::wrapSlow):

  • bindings/scripts/test/V8/V8TestEventConstructor.cpp:

(WebCore::V8TestEventConstructor::wrapSlow):

  • bindings/scripts/test/V8/V8TestEventTarget.cpp:

(WebCore::V8TestEventTarget::wrapSlow):

  • bindings/scripts/test/V8/V8TestInterface.cpp:

(WebCore::V8TestInterface::wrapSlow):

  • bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp:

(WebCore::V8TestMediaQueryListListener::wrapSlow):

  • bindings/scripts/test/V8/V8TestNamedConstructor.cpp:

(WebCore::V8TestNamedConstructor::wrapSlow):

  • bindings/scripts/test/V8/V8TestObj.cpp:

(WebCore::V8TestObj::wrapSlow):

  • bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:

(WebCore::V8TestSerializedScriptValueInterface::wrapSlow):

Location:
trunk/Source/WebCore
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r109610 r109611  
     12012-03-02  Erik Arvidsson  <arv@chromium.org>
     2
     3        [V8] Bindings for node always check if they are a Document.
     4        https://bugs.webkit.org/show_bug.cgi?id=79947
     5
     6        Reviewed by Adam Barth.
     7
     8        This changes the generated bindings code to only generate the Document code for the Document wrappers.
     9
     10        No new tests. Covered by existing tests.
     11
     12        * bindings/scripts/CodeGeneratorV8.pm:
     13        (GenerateToV8Converters):
     14        * bindings/scripts/test/V8/V8Float64Array.cpp:
     15        (WebCore::V8Float64Array::wrapSlow):
     16        * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp:
     17        (WebCore::V8TestActiveDOMObject::wrapSlow):
     18        * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp:
     19        (WebCore::V8TestCustomNamedGetter::wrapSlow):
     20        * bindings/scripts/test/V8/V8TestEventConstructor.cpp:
     21        (WebCore::V8TestEventConstructor::wrapSlow):
     22        * bindings/scripts/test/V8/V8TestEventTarget.cpp:
     23        (WebCore::V8TestEventTarget::wrapSlow):
     24        * bindings/scripts/test/V8/V8TestInterface.cpp:
     25        (WebCore::V8TestInterface::wrapSlow):
     26        * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp:
     27        (WebCore::V8TestMediaQueryListListener::wrapSlow):
     28        * bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
     29        (WebCore::V8TestNamedConstructor::wrapSlow):
     30        * bindings/scripts/test/V8/V8TestObj.cpp:
     31        (WebCore::V8TestObj::wrapSlow):
     32        * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
     33        (WebCore::V8TestSerializedScriptValueInterface::wrapSlow):
     34
    1352012-03-02  Igor Oliveira  <igor.o@sisa.samsung.com>
    236
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r109515 r109611  
    30383038{
    30393039    v8::Handle<v8::Object> wrapper;
    3040     V8Proxy* proxy = 0;
    3041 END
    3042 
     3040END
     3041
     3042    my $proxyInit;
    30433043    if (IsNodeSubType($dataNode)) {
     3044        $proxyInit = "V8Proxy::retrieve(impl->document()->frame())";
     3045        # DocumentType nodes are the only nodes that may have a NULL document.
     3046        if ($interfaceName eq "DocumentType") {
     3047            $proxyInit = "impl->document() ? $proxyInit : 0";
     3048        }
     3049    } else {
     3050        $proxyInit = "0";
     3051    }
     3052    push(@implContent, <<END);
     3053    V8Proxy* proxy = $proxyInit;
     3054END
     3055
     3056    if (IsSubType($dataNode, "Document")) {
    30443057        push(@implContent, <<END);
    3045     if (impl->document()) {
    3046         proxy = V8Proxy::retrieve(impl->document()->frame());
    3047         if (proxy && static_cast<Node*>(impl->document()) == static_cast<Node*>(impl)) {
    3048             if (proxy->windowShell()->context().IsEmpty() && proxy->windowShell()->initContextIfNeeded()) {
    3049                 // initContextIfNeeded may have created a wrapper for the object, retry from the start.
    3050                 return ${className}::wrap(impl);
    3051             }
    3052         }
    3053     }
    3054 
     3058    if (proxy && proxy->windowShell()->context().IsEmpty() && proxy->windowShell()->initContextIfNeeded()) {
     3059        // initContextIfNeeded may have created a wrapper for the object, retry from the start.
     3060        return ${className}::wrap(impl);
     3061    }
    30553062END
    30563063    }
     
    30943101
    30953102    push(@implContent, <<END);
    3096     if (wrapper.IsEmpty())
     3103    if (UNLIKELY(wrapper.IsEmpty()))
    30973104        return wrapper;
    30983105END
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp

    r107304 r109611  
    126126    V8Proxy* proxy = 0;
    127127    wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
    128     if (wrapper.IsEmpty())
     128    if (UNLIKELY(wrapper.IsEmpty()))
    129129        return wrapper;
    130130
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp

    r108201 r109611  
    180180    if (!context.IsEmpty())
    181181        context->Exit();
    182     if (wrapper.IsEmpty())
     182    if (UNLIKELY(wrapper.IsEmpty()))
    183183        return wrapper;
    184184
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp

    r107304 r109611  
    116116    V8Proxy* proxy = 0;
    117117    wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
    118     if (wrapper.IsEmpty())
     118    if (UNLIKELY(wrapper.IsEmpty()))
    119119        return wrapper;
    120120
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp

    r106644 r109611  
    151151    V8Proxy* proxy = 0;
    152152    wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
    153     if (wrapper.IsEmpty())
     153    if (UNLIKELY(wrapper.IsEmpty()))
    154154        return wrapper;
    155155
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp

    r107304 r109611  
    179179    V8Proxy* proxy = 0;
    180180    wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
    181     if (wrapper.IsEmpty())
     181    if (UNLIKELY(wrapper.IsEmpty()))
    182182        return wrapper;
    183183
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp

    r108757 r109611  
    312312    V8Proxy* proxy = 0;
    313313    wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
    314     if (wrapper.IsEmpty())
     314    if (UNLIKELY(wrapper.IsEmpty()))
    315315        return wrapper;
    316316
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp

    r107304 r109611  
    116116    V8Proxy* proxy = 0;
    117117    wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
    118     if (wrapper.IsEmpty())
     118    if (UNLIKELY(wrapper.IsEmpty()))
    119119        return wrapper;
    120120
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp

    r107304 r109611  
    161161    V8Proxy* proxy = 0;
    162162    wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
    163     if (wrapper.IsEmpty())
     163    if (UNLIKELY(wrapper.IsEmpty()))
    164164        return wrapper;
    165165
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp

    r108669 r109611  
    20942094    V8Proxy* proxy = 0;
    20952095    wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
    2096     if (wrapper.IsEmpty())
     2096    if (UNLIKELY(wrapper.IsEmpty()))
    20972097        return wrapper;
    20982098
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp

    r107304 r109611  
    198198    V8Proxy* proxy = 0;
    199199    wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
    200     if (wrapper.IsEmpty())
     200    if (UNLIKELY(wrapper.IsEmpty()))
    201201        return wrapper;
    202202
Note: See TracChangeset for help on using the changeset viewer.