Title: [97260] trunk/Source/WebCore
Revision
97260
Author
[email protected]
Date
2011-10-12 07:22:25 -0700 (Wed, 12 Oct 2011)

Log Message

[v8] Use V8DOMWrapper::isWrapperOfType for determining global object type
https://bugs.webkit.org/show_bug.cgi?id=69923

Get rid of globalObjectPrototypeIsDOMWindow, use V8DOMWrapper::isWrapperOfType instead.

Reviewed by Pavel Feldman.

* bindings/v8/V8DOMWrapper.cpp:
(WebCore::V8DOMWrapper::instantiateV8Object):
(WebCore::V8DOMWrapper::getEventListener):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (97259 => 97260)


--- trunk/Source/WebCore/ChangeLog	2011-10-12 13:58:34 UTC (rev 97259)
+++ trunk/Source/WebCore/ChangeLog	2011-10-12 14:22:25 UTC (rev 97260)
@@ -1,5 +1,18 @@
 2011-10-12  Yury Semikhatsky  <[email protected]>
 
+        [v8] Use V8DOMWrapper::isWrapperOfType for determining global object type
+        https://bugs.webkit.org/show_bug.cgi?id=69923
+
+        Get rid of globalObjectPrototypeIsDOMWindow, use V8DOMWrapper::isWrapperOfType instead.
+
+        Reviewed by Pavel Feldman.
+
+        * bindings/v8/V8DOMWrapper.cpp:
+        (WebCore::V8DOMWrapper::instantiateV8Object):
+        (WebCore::V8DOMWrapper::getEventListener):
+
+2011-10-12  Yury Semikhatsky  <[email protected]>
+
         [Chromium] Web Inspector: assertion failure when evaluating _expression_ in worker inspector console
         https://bugs.webkit.org/show_bug.cgi?id=69922
 

Modified: trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp (97259 => 97260)


--- trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp	2011-10-12 13:58:34 UTC (rev 97259)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp	2011-10-12 14:22:25 UTC (rev 97260)
@@ -230,24 +230,6 @@
     return NodeFilter::create(V8NodeFilterCondition::create(filter));
 }
 
-static bool globalObjectPrototypeIsDOMWindow(v8::Handle<v8::Object> objectPrototype)
-{
-    // We can identify what type of context the global object is wrapping by looking at the
-    // internal field count of its prototype. This assumes WorkerContexts and DOMWindows have different numbers
-    // of internal fields, so a COMPILE_ASSERT is included to warn if this ever changes.
-#if ENABLE(WORKERS)
-    COMPILE_ASSERT(V8DOMWindow::internalFieldCount != V8WorkerContext::internalFieldCount,
-        DOMWindowAndWorkerContextHaveUnequalFieldCounts);
-    COMPILE_ASSERT(V8DOMWindow::internalFieldCount != V8DedicatedWorkerContext::internalFieldCount,
-        DOMWindowAndDedicatedWorkerContextHaveUnequalFieldCounts);
-#endif
-#if ENABLE(SHARED_WORKERS)
-    COMPILE_ASSERT(V8DOMWindow::internalFieldCount != V8SharedWorkerContext::internalFieldCount,
-        DOMWindowAndSharedWorkerContextHaveUnequalFieldCounts);
-#endif
-    return objectPrototype->InternalFieldCount() == V8DOMWindow::internalFieldCount;
-}
-
 v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, WrapperTypeInfo* type, void* impl)
 {
 #if ENABLE(WORKERS)
@@ -263,7 +245,7 @@
         v8::Handle<v8::Context> context = v8::Context::GetCurrent();
         if (!context.IsEmpty()) {
             v8::Handle<v8::Object> globalPrototype = v8::Handle<v8::Object>::Cast(context->Global()->GetPrototype());
-            if (globalObjectPrototypeIsDOMWindow(globalPrototype))
+            if (isWrapperOfType(globalPrototype, &V8DOMWindow::info))
                 proxy = V8Proxy::retrieve(V8DOMWindow::toNative(globalPrototype)->frame());
 #if ENABLE(WORKERS)
             else
@@ -468,7 +450,7 @@
     if (lookup == ListenerFindOnly)
         return V8EventListenerList::findWrapper(value, isAttribute);
     v8::Handle<v8::Object> globalPrototype = v8::Handle<v8::Object>::Cast(context->Global()->GetPrototype());
-    if (globalObjectPrototypeIsDOMWindow(globalPrototype))
+    if (isWrapperOfType(globalPrototype, &V8DOMWindow::info))
         return V8EventListenerList::findOrCreateWrapper<V8EventListener>(value, isAttribute);
 #if ENABLE(WORKERS)
     return V8EventListenerList::findOrCreateWrapper<V8WorkerContextEventListener>(value, isAttribute);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to