Unreviewed, rolling out r109969.
authorharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Mar 2012 03:53:17 +0000 (03:53 +0000)
committerharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Mar 2012 03:53:17 +0000 (03:53 +0000)
http://trac.webkit.org/changeset/109969
https://bugs.webkit.org/show_bug.cgi?id=80376

layout tests crash

* bindings/v8/V8HiddenPropertyName.cpp:
(WebCore):
(WebCore::V8HiddenPropertyName::hiddenReferenceName):
* bindings/v8/V8HiddenPropertyName.h:
(WebCore):
(V8HiddenPropertyName):
* bindings/v8/custom/V8DOMStringMapCustom.cpp:
(WebCore::toV8):
* bindings/v8/custom/V8DOMTokenListCustom.cpp:
(WebCore::toV8):
* bindings/v8/custom/V8NamedNodeMapCustom.cpp:
(WebCore::toV8):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110004 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/v8/V8HiddenPropertyName.cpp
Source/WebCore/bindings/v8/V8HiddenPropertyName.h
Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp
Source/WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp
Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp

index fd38838..048ffc8 100644 (file)
@@ -1,5 +1,26 @@
 2012-03-06  Kentaro Hara  <haraken@chromium.org>
 
+        Unreviewed, rolling out r109969.
+        http://trac.webkit.org/changeset/109969
+        https://bugs.webkit.org/show_bug.cgi?id=80376
+
+        layout tests crash
+
+        * bindings/v8/V8HiddenPropertyName.cpp:
+        (WebCore):
+        (WebCore::V8HiddenPropertyName::hiddenReferenceName):
+        * bindings/v8/V8HiddenPropertyName.h:
+        (WebCore):
+        (V8HiddenPropertyName):
+        * bindings/v8/custom/V8DOMStringMapCustom.cpp:
+        (WebCore::toV8):
+        * bindings/v8/custom/V8DOMTokenListCustom.cpp:
+        (WebCore::toV8):
+        * bindings/v8/custom/V8NamedNodeMapCustom.cpp:
+        (WebCore::toV8):
+
+2012-03-06  Kentaro Hara  <haraken@chromium.org>
+
         Unreviewed, rolling out r109999.
         http://trac.webkit.org/changeset/109999
 
index 228dcf2..93ac751 100644 (file)
@@ -33,7 +33,6 @@
 
 #include "V8Binding.h"
 #include <string.h>
-#include <wtf/StdLibExtras.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {
@@ -41,19 +40,24 @@ namespace WebCore {
 #define V8_AS_STRING(x) V8_AS_STRING_IMPL(x)
 #define V8_AS_STRING_IMPL(x) #x
 
-#define V8_DEFINE_HIDDEN_PROPERTY(name, prefix) \
+#define V8_DEFINE_PROPERTY(name) \
 v8::Handle<v8::String> V8HiddenPropertyName::name() \
 { \
-    DEFINE_STATIC_LOCAL(v8::Persistent<v8::String>, hiddenPropertyName, (createString(prefix V8_AS_STRING(name)))); \
-    return hiddenPropertyName; \
+    V8HiddenPropertyName* hiddenPropertyName = V8BindingPerIsolateData::current()->hiddenPropertyName(); \
+    if (hiddenPropertyName->m_##name.IsEmpty()) { \
+        hiddenPropertyName->m_##name = createString("WebCore::HiddenProperty::" V8_AS_STRING(name)); \
+    } \
+    return hiddenPropertyName->m_##name; \
 }
 
-V8_HIDDEN_PROPERTIES(V8_DEFINE_HIDDEN_PROPERTY);
+V8_HIDDEN_PROPERTIES(V8_DEFINE_PROPERTY);
+
+static const char hiddenReferenceNamePrefix[] = "WebCore::HiddenReference::";
 
 v8::Handle<v8::String> V8HiddenPropertyName::hiddenReferenceName(const char* name)
 {
     Vector<char, 64> prefixedName;
-    prefixedName.append(V8_HIDDEN_REFERENCE_PREFIX, sizeof(V8_HIDDEN_REFERENCE_PREFIX) - 1);
+    prefixedName.append(hiddenReferenceNamePrefix, sizeof(hiddenReferenceNamePrefix) - 1);
     ASSERT(name && strlen(name));
     prefixedName.append(name, strlen(name));
     return v8::String::NewSymbol(prefixedName.data(), static_cast<int>(prefixedName.size()));
index 0e4e18d..c8f5352 100644 (file)
 
 namespace WebCore {
 
-#define V8_HIDDEN_PROPERTY_PREFIX "WebCore::HiddenProperty::"
-#define V8_HIDDEN_REFERENCE_PREFIX "WebCore::HiddenReference::"
-
 #define V8_HIDDEN_PROPERTIES(V) \
-    V(objectPrototype, V8_HIDDEN_PROPERTY_PREFIX) \
-    V(listener, V8_HIDDEN_PROPERTY_PREFIX) \
-    V(attributeListener, V8_HIDDEN_PROPERTY_PREFIX) \
-    V(scriptState, V8_HIDDEN_PROPERTY_PREFIX) \
-    V(devtoolsInjectedScript, V8_HIDDEN_PROPERTY_PREFIX) \
-    V(sleepFunction, V8_HIDDEN_PROPERTY_PREFIX) \
-    V(toStringString, V8_HIDDEN_PROPERTY_PREFIX) \
-    V(event, V8_HIDDEN_PROPERTY_PREFIX) \
-    V(state, V8_HIDDEN_PROPERTY_PREFIX) \
-    V(domStringMap, V8_HIDDEN_REFERENCE_PREFIX) \
-    V(domTokenList, V8_HIDDEN_REFERENCE_PREFIX) \
-    V(ownerNode, V8_HIDDEN_REFERENCE_PREFIX)
+    V(objectPrototype) \
+    V(listener) \
+    V(attributeListener) \
+    V(scriptState) \
+    V(devtoolsInjectedScript) \
+    V(sleepFunction) \
+    V(toStringString) \
+    V(event) \
+    V(state)
+
 
     class V8HiddenPropertyName {
     public:
         V8HiddenPropertyName() { }
-#define V8_DECLARE_PROPERTY(name, prefix) static v8::Handle<v8::String> name();
+#define V8_DECLARE_PROPERTY(name) static v8::Handle<v8::String> name();
         V8_HIDDEN_PROPERTIES(V8_DECLARE_PROPERTY);
 #undef V8_DECLARE_PROPERTY
 
@@ -63,6 +58,9 @@ namespace WebCore {
 
     private:
         static v8::Persistent<v8::String> createString(const char* key);
+#define V8_DECLARE_FIELD(name) v8::Persistent<v8::String> m_##name;
+        V8_HIDDEN_PROPERTIES(V8_DECLARE_FIELD);
+#undef V8_DECLARE_FIELD
     };
 
 }
index 2d7fc34..2799ae2 100644 (file)
@@ -91,8 +91,11 @@ v8::Handle<v8::Value> toV8(DOMStringMap* impl)
     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)
-        toV8(element).As<v8::Object>()->SetHiddenValue(V8HiddenPropertyName::domStringMap(), wrapper);
+    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;
 }
 
index 6e35d8d..08051ab 100644 (file)
@@ -45,8 +45,11 @@ v8::Handle<v8::Value> toV8(DOMTokenList* impl)
     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)
-        toV8(element).As<v8::Object>()->SetHiddenValue(V8HiddenPropertyName::domTokenList(), wrapper);
+    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;
 }
 
index 111ce4d..4782dcc 100644 (file)
@@ -79,7 +79,7 @@ v8::Handle<v8::Value> toV8(NamedNodeMap* impl)
     // Add a hidden reference from named node map to its owner node.
     Element* element = impl->element();
     if (!wrapper.IsEmpty() && element)
-        toV8(element).As<v8::Object>()->SetHiddenValue(V8HiddenPropertyName::ownerNode(), wrapper);
+        V8DOMWrapper::setNamedHiddenReference(wrapper, "ownerNode", toV8(element));
     return wrapper;
 }