Title: [107035] trunk
Revision
107035
Author
a...@chromium.org
Date
2012-02-07 20:23:34 -0800 (Tue, 07 Feb 2012)

Log 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:

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (107034 => 107035)


--- trunk/LayoutTests/ChangeLog	2012-02-08 04:14:02 UTC (rev 107034)
+++ trunk/LayoutTests/ChangeLog	2012-02-08 04:23:34 UTC (rev 107035)
@@ -1,3 +1,12 @@
+2012-02-07  Erik Arvidsson  <a...@chromium.org>
+
+        [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.
+
+        * platform/chromium/test_expectations.txt:
+
 2012-02-07  Julien Chaffraix  <jchaffr...@webkit.org>
 
         Unreviewed gardening.

Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (107034 => 107035)


--- trunk/LayoutTests/platform/chromium/test_expectations.txt	2012-02-08 04:14:02 UTC (rev 107034)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt	2012-02-08 04:23:34 UTC (rev 107035)
@@ -585,7 +585,6 @@
 BUGWK66377 : fast/dom/StyleSheet/gc-parent-rule.html = TEXT
 BUGWK66377 : fast/dom/StyleSheet/gc-parent-stylesheet.html = TEXT
 BUGWK66377 : fast/dom/StyleSheet/gc-rule-children-wrappers.html = TEXT
-BUGWK66377 : fast/dom/StyleSheet/gc-styleheet-wrapper.xhtml = TEXT
 
 // -----------------------------------------------------------------
 // PENDING TESTS (forked to pending/, need to be sent upstream)

Modified: trunk/Source/WebCore/ChangeLog (107034 => 107035)


--- trunk/Source/WebCore/ChangeLog	2012-02-08 04:14:02 UTC (rev 107034)
+++ trunk/Source/WebCore/ChangeLog	2012-02-08 04:23:34 UTC (rev 107035)
@@ -1,3 +1,25 @@
+2012-02-07  Erik Arvidsson  <a...@chromium.org>
+
+        [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.
+
+        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:
+
 2012-02-07  Kentaro Hara  <hara...@chromium.org>
 
         [GTK] Ignore [Custom] attributes in CodeGeneratorGObject.pm

Modified: trunk/Source/WebCore/Target.pri (107034 => 107035)


--- trunk/Source/WebCore/Target.pri	2012-02-08 04:14:02 UTC (rev 107034)
+++ trunk/Source/WebCore/Target.pri	2012-02-08 04:23:34 UTC (rev 107035)
@@ -158,8 +158,7 @@
         bindings/v8/custom/V8InjectedScriptHostCustom.cpp \
         bindings/v8/custom/V8InjectedScriptManager.cpp \
         bindings/v8/custom/V8InspectorFrontendHostCustom.cpp \
-        bindings/v8/custom/V8DOMStringMapCustom.cpp \
-        bindings/v8/custom/V8DOMTokenListCustom.cpp
+        bindings/v8/custom/V8DOMStringMapCustom.cpp
 
     SOURCES += \
         bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp \

Modified: trunk/Source/WebCore/UseV8.cmake (107034 => 107035)


--- trunk/Source/WebCore/UseV8.cmake	2012-02-08 04:14:02 UTC (rev 107034)
+++ trunk/Source/WebCore/UseV8.cmake	2012-02-08 04:23:34 UTC (rev 107035)
@@ -81,7 +81,6 @@
     bindings/v8/custom/V8CustomXPathNSResolver.cpp
     bindings/v8/custom/V8DOMFormDataCustom.cpp
     bindings/v8/custom/V8DOMStringMapCustom.cpp
-    bindings/v8/custom/V8DOMTokenListCustom.cpp
     bindings/v8/custom/V8DOMWindowCustom.cpp
     bindings/v8/custom/V8DataViewCustom.cpp
     bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp

Modified: trunk/Source/WebCore/WebCore.gypi (107034 => 107035)


--- trunk/Source/WebCore/WebCore.gypi	2012-02-08 04:14:02 UTC (rev 107034)
+++ trunk/Source/WebCore/WebCore.gypi	2012-02-08 04:23:34 UTC (rev 107035)
@@ -1816,7 +1816,6 @@
             'bindings/v8/custom/V8CustomXPathNSResolver.h',
             'bindings/v8/custom/V8DOMFormDataCustom.cpp',
             'bindings/v8/custom/V8DOMStringMapCustom.cpp',
-            'bindings/v8/custom/V8DOMTokenListCustom.cpp',
             'bindings/v8/custom/V8DOMWindowCustom.cpp',
             'bindings/v8/custom/V8DataViewCustom.cpp',
             'bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp',

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (107034 => 107035)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-02-08 04:14:02 UTC (rev 107034)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-02-08 04:23:34 UTC (rev 107035)
@@ -3,7 +3,7 @@
 # Copyright (C) 2006 Samuel Weinig <sam.wei...@gmail.com>
 # Copyright (C) 2006 Alexey Proskuryakov <a...@webkit.org>
 # Copyright (C) 2006 Apple Computer, Inc.
-# Copyright (C) 2007, 2008, 2009 Google Inc.
+# Copyright (C) 2007-2012 Google Inc.
 # Copyright (C) 2009 Cameron McCormack <c...@mcc.id.au>
 # Copyright (C) Research In Motion Limited 2010. All rights reserved.
 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
@@ -922,7 +922,7 @@
     # Special case for readonly or Replaceable attributes (with a few exceptions). This attempts to ensure that JS wrappers don't get
     # garbage-collected prematurely when their lifetime is strongly tied to their owner. We accomplish this by inserting a reference to
     # the newly created wrapper into an internal field of the holder object.
-    if (!IsNodeSubType($dataNode) && $attrName ne "self" && (IsWrapperType($returnType) && ($attribute->type =~ /^readonly/ || $attribute->signature->extendedAttributes->{"Replaceable"})
+    if ($attrName ne "self" && (IsWrapperType($returnType) && ($attribute->type =~ /^readonly/ || $attribute->signature->extendedAttributes->{"Replaceable"})
         && $returnType ne "EventTarget" && $returnType ne "SerializedScriptValue" && $returnType ne "DOMWindow" 
         && $returnType !~ /SVG/ && $returnType !~ /HTML/ && !IsDOMNodeType($returnType))) {
         AddIncludesForType($returnType);
@@ -3119,14 +3119,11 @@
     # We generate a custom converter (but JSC doesn't) for the following:
     return 1 if $interfaceName eq "CSSStyleSheet";
     return 1 if $interfaceName eq "CanvasPixelArray";
-    return 1 if $interfaceName eq "DOMStringMap";
     return 1 if $interfaceName eq "DOMWindow";
-    return 1 if $interfaceName eq "DOMTokenList";
     return 1 if $interfaceName eq "Element";
     return 1 if $interfaceName eq "HTMLDocument";
     return 1 if $interfaceName eq "HTMLElement";
     return 1 if $interfaceName eq "Location";
-    return 1 if $interfaceName eq "NamedNodeMap";
     return 1 if $interfaceName eq "SVGDocument";
     return 1 if $interfaceName eq "SVGElement";
     return 1 if $interfaceName eq "ScriptProfile";
@@ -3142,8 +3139,6 @@
     return 0 if $interfaceName eq "MediaList";
     return 0 if $interfaceName eq "StyleSheetList";
     return 0 if $interfaceName eq "DOMImplementation";
-    return 0 if $interfaceName eq "DOMStringMap";
-    return 0 if $interfaceName eq "DOMTokenList";
     return 0 if $interfaceName eq "TextTrack";
 
     # For everything else, do what JSC does.

Modified: trunk/Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp (107034 => 107035)


--- trunk/Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp	2012-02-08 04:14:02 UTC (rev 107034)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp	2012-02-08 04:23:34 UTC (rev 107035)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -84,19 +84,4 @@
     return value;
 }
 
-v8::Handle<v8::Value> toV8(DOMStringMap* impl)
-{
-    if (!impl)
-        return v8::Null();
-    v8::Handle<v8::Object> wrapper = V8DOMStringMap::wrap(impl);
-    // Add a hidden reference from the element to the DOMStringMap.
-    Element* element = impl->element();
-    if (!wrapper.IsEmpty() && element) {
-        v8::Handle<v8::Value> elementValue = toV8(element);
-        if (!elementValue.IsEmpty() && elementValue->IsObject())
-            V8DOMWrapper::setNamedHiddenReference(elementValue.As<v8::Object>(), "domStringMap", wrapper);
-    }
-    return wrapper;
-}
-
 } // namespace WebCore

Deleted: trunk/Source/WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp (107034 => 107035)


--- trunk/Source/WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp	2012-02-08 04:14:02 UTC (rev 107034)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp	2012-02-08 04:23:34 UTC (rev 107035)
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "V8DOMTokenList.h"
-
-#include "DOMTokenList.h"
-#include "V8Binding.h"
-#include "V8DOMWrapper.h"
-#include "V8Element.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> toV8(DOMTokenList* impl)
-{
-    if (!impl)
-        return v8::Null();
-    v8::Handle<v8::Object> wrapper = V8DOMTokenList::wrap(impl);
-    // Add a hidden reference from the element to the DOMTokenList.
-    Element* element = impl->element();
-    if (!wrapper.IsEmpty() && element) {
-        v8::Handle<v8::Value> elementValue = toV8(element);
-        if (!elementValue.IsEmpty() && elementValue->IsObject())
-            V8DOMWrapper::setNamedHiddenReference(elementValue.As<v8::Object>(), "domTokenList", wrapper);
-    }
-    return wrapper;
-}
-
-} // namespace WebCore

Modified: trunk/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp (107034 => 107035)


--- trunk/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp	2012-02-08 04:14:02 UTC (rev 107034)
+++ trunk/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp	2012-02-08 04:23:34 UTC (rev 107035)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2009 Google Inc. All rights reserved.
+ * Copyright (C) 2007-2012 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -71,16 +71,4 @@
     return toV8(result.release());
 }
 
-v8::Handle<v8::Value> toV8(NamedNodeMap* impl)
-{
-    if (!impl)
-        return v8::Null();
-    v8::Handle<v8::Object> wrapper = V8NamedNodeMap::wrap(impl);
-    // Add a hidden reference from named node map to its owner node.
-    Element* element = impl->element();
-    if (!wrapper.IsEmpty() && element)
-        V8DOMWrapper::setNamedHiddenReference(wrapper, "ownerNode", toV8(element));
-    return wrapper;
-}
-
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to