Changeset 107035 in webkit


Ignore:
Timestamp:
Feb 7, 2012 8:23:34 PM (12 years ago)
Author:
arv@chromium.org
Message:

[V8] Allow bindings for attributes on DOM nodes to also set a named hidden reference
https://bugs.webkit.org/show_bug.cgi?id=78052

Reviewed by Nate Chapin.

Source/WebCore:

Before this patch the code generator did not add the named hidden reference when the data node
was a DOM Node. This lead to us having to create custom toV8 bindings in a few places.

Covered by existing tests

  • Target.pri:
  • UseV8.cmake:
  • WebCore.gypi:
  • bindings/scripts/CodeGeneratorV8.pm:

(GenerateNormalAttrGetter):
(HasCustomToV8Implementation):

  • bindings/v8/custom/V8DOMStringMapCustom.cpp:
  • bindings/v8/custom/V8DOMTokenListCustom.cpp: Removed.
  • bindings/v8/custom/V8NamedNodeMapCustom.cpp:

LayoutTests:

  • platform/chromium/test_expectations.txt:
Location:
trunk
Files:
1 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r107031 r107035  
     12012-02-07  Erik Arvidsson  <arv@chromium.org>
     2
     3        [V8] Allow bindings for attributes on DOM nodes to also set a named hidden reference
     4        https://bugs.webkit.org/show_bug.cgi?id=78052
     5
     6        Reviewed by Nate Chapin.
     7
     8        * platform/chromium/test_expectations.txt:
     9
    1102012-02-07  Julien Chaffraix  <jchaffraix@webkit.org>
    211
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r106995 r107035  
    586586BUGWK66377 : fast/dom/StyleSheet/gc-parent-stylesheet.html = TEXT
    587587BUGWK66377 : fast/dom/StyleSheet/gc-rule-children-wrappers.html = TEXT
    588 BUGWK66377 : fast/dom/StyleSheet/gc-styleheet-wrapper.xhtml = TEXT
    589588
    590589// -----------------------------------------------------------------
  • trunk/Source/WebCore/ChangeLog

    r107034 r107035  
     12012-02-07  Erik Arvidsson  <arv@chromium.org>
     2
     3        [V8] Allow bindings for attributes on DOM nodes to also set a named hidden reference
     4        https://bugs.webkit.org/show_bug.cgi?id=78052
     5
     6        Reviewed by Nate Chapin.
     7
     8        Before this patch the code generator did not add the named hidden reference when the data node
     9        was a DOM Node. This lead to us having to create custom toV8 bindings in a few places.
     10
     11        Covered by existing tests
     12
     13        * Target.pri:
     14        * UseV8.cmake:
     15        * WebCore.gypi:
     16        * bindings/scripts/CodeGeneratorV8.pm:
     17        (GenerateNormalAttrGetter):
     18        (HasCustomToV8Implementation):
     19        * bindings/v8/custom/V8DOMStringMapCustom.cpp:
     20        * bindings/v8/custom/V8DOMTokenListCustom.cpp: Removed.
     21        * bindings/v8/custom/V8NamedNodeMapCustom.cpp:
     22
    1232012-02-07  Kentaro Hara  <haraken@chromium.org>
    224
  • trunk/Source/WebCore/Target.pri

    r106953 r107035  
    159159        bindings/v8/custom/V8InjectedScriptManager.cpp \
    160160        bindings/v8/custom/V8InspectorFrontendHostCustom.cpp \
    161         bindings/v8/custom/V8DOMStringMapCustom.cpp \
    162         bindings/v8/custom/V8DOMTokenListCustom.cpp
     161        bindings/v8/custom/V8DOMStringMapCustom.cpp
    163162
    164163    SOURCES += \
  • trunk/Source/WebCore/UseV8.cmake

    r103882 r107035  
    8282    bindings/v8/custom/V8DOMFormDataCustom.cpp
    8383    bindings/v8/custom/V8DOMStringMapCustom.cpp
    84     bindings/v8/custom/V8DOMTokenListCustom.cpp
    8584    bindings/v8/custom/V8DOMWindowCustom.cpp
    8685    bindings/v8/custom/V8DataViewCustom.cpp
  • trunk/Source/WebCore/WebCore.gypi

    r107027 r107035  
    18171817            'bindings/v8/custom/V8DOMFormDataCustom.cpp',
    18181818            'bindings/v8/custom/V8DOMStringMapCustom.cpp',
    1819             'bindings/v8/custom/V8DOMTokenListCustom.cpp',
    18201819            'bindings/v8/custom/V8DOMWindowCustom.cpp',
    18211820            'bindings/v8/custom/V8DataViewCustom.cpp',
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r107004 r107035  
    44# Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
    55# Copyright (C) 2006 Apple Computer, Inc.
    6 # Copyright (C) 2007, 2008, 2009 Google Inc.
     6# Copyright (C) 2007-2012 Google Inc.
    77# Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
    88# Copyright (C) Research In Motion Limited 2010. All rights reserved.
     
    923923    # garbage-collected prematurely when their lifetime is strongly tied to their owner. We accomplish this by inserting a reference to
    924924    # the newly created wrapper into an internal field of the holder object.
    925     if (!IsNodeSubType($dataNode) && $attrName ne "self" && (IsWrapperType($returnType) && ($attribute->type =~ /^readonly/ || $attribute->signature->extendedAttributes->{"Replaceable"})
     925    if ($attrName ne "self" && (IsWrapperType($returnType) && ($attribute->type =~ /^readonly/ || $attribute->signature->extendedAttributes->{"Replaceable"})
    926926        && $returnType ne "EventTarget" && $returnType ne "SerializedScriptValue" && $returnType ne "DOMWindow"
    927927        && $returnType !~ /SVG/ && $returnType !~ /HTML/ && !IsDOMNodeType($returnType))) {
     
    31203120    return 1 if $interfaceName eq "CSSStyleSheet";
    31213121    return 1 if $interfaceName eq "CanvasPixelArray";
    3122     return 1 if $interfaceName eq "DOMStringMap";
    31233122    return 1 if $interfaceName eq "DOMWindow";
    3124     return 1 if $interfaceName eq "DOMTokenList";
    31253123    return 1 if $interfaceName eq "Element";
    31263124    return 1 if $interfaceName eq "HTMLDocument";
    31273125    return 1 if $interfaceName eq "HTMLElement";
    31283126    return 1 if $interfaceName eq "Location";
    3129     return 1 if $interfaceName eq "NamedNodeMap";
    31303127    return 1 if $interfaceName eq "SVGDocument";
    31313128    return 1 if $interfaceName eq "SVGElement";
     
    31433140    return 0 if $interfaceName eq "StyleSheetList";
    31443141    return 0 if $interfaceName eq "DOMImplementation";
    3145     return 0 if $interfaceName eq "DOMStringMap";
    3146     return 0 if $interfaceName eq "DOMTokenList";
    31473142    return 0 if $interfaceName eq "TextTrack";
    31483143
  • trunk/Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp

    r100247 r107035  
    11/*
    2  * Copyright (C) 2010 Google Inc. All rights reserved.
     2 * Copyright (C) 2012 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    8585}
    8686
    87 v8::Handle<v8::Value> toV8(DOMStringMap* impl)
    88 {
    89     if (!impl)
    90         return v8::Null();
    91     v8::Handle<v8::Object> wrapper = V8DOMStringMap::wrap(impl);
    92     // Add a hidden reference from the element to the DOMStringMap.
    93     Element* element = impl->element();
    94     if (!wrapper.IsEmpty() && element) {
    95         v8::Handle<v8::Value> elementValue = toV8(element);
    96         if (!elementValue.IsEmpty() && elementValue->IsObject())
    97             V8DOMWrapper::setNamedHiddenReference(elementValue.As<v8::Object>(), "domStringMap", wrapper);
    98     }
    99     return wrapper;
    100 }
    101 
    10287} // namespace WebCore
  • trunk/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp

    r95901 r107035  
    11/*
    2  * Copyright (C) 2007-2009 Google Inc. All rights reserved.
     2 * Copyright (C) 2007-2012 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    7272}
    7373
    74 v8::Handle<v8::Value> toV8(NamedNodeMap* impl)
    75 {
    76     if (!impl)
    77         return v8::Null();
    78     v8::Handle<v8::Object> wrapper = V8NamedNodeMap::wrap(impl);
    79     // Add a hidden reference from named node map to its owner node.
    80     Element* element = impl->element();
    81     if (!wrapper.IsEmpty() && element)
    82         V8DOMWrapper::setNamedHiddenReference(wrapper, "ownerNode", toV8(element));
    83     return wrapper;
    84 }
    85 
    8674} // namespace WebCore
Note: See TracChangeset for help on using the changeset viewer.