Title: [134666] trunk/Source/WebCore
Revision
134666
Author
mark....@apple.com
Date
2012-11-14 14:07:13 -0800 (Wed, 14 Nov 2012)

Log Message

Fixed regressions due to adding JSEventListener::m_wrapper null checks.
https://bugs.webkit.org/show_bug.cgi?id=102183.

Reviewed by Geoffrey Garen.

Fixed JSEventListener::operator==() to work within the contract that
when m_wrapper is 0, m_jsFunction is also expected to be 0. Also fixed
some typos in comments.

No new tests.

* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::visitJSFunction):
(WebCore::JSEventListener::operator==):
* bindings/js/JSEventListener.h:
(WebCore::JSEventListener::jsFunction):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (134665 => 134666)


--- trunk/Source/WebCore/ChangeLog	2012-11-14 22:02:05 UTC (rev 134665)
+++ trunk/Source/WebCore/ChangeLog	2012-11-14 22:07:13 UTC (rev 134666)
@@ -1,3 +1,22 @@
+2012-11-14  Mark Lam  <mark....@apple.com>
+
+        Fixed regressions due to adding JSEventListener::m_wrapper null checks.
+        https://bugs.webkit.org/show_bug.cgi?id=102183.
+
+        Reviewed by Geoffrey Garen.
+
+        Fixed JSEventListener::operator==() to work within the contract that
+        when m_wrapper is 0, m_jsFunction is also expected to be 0. Also fixed
+        some typos in comments.
+
+        No new tests.
+
+        * bindings/js/JSEventListener.cpp:
+        (WebCore::JSEventListener::visitJSFunction):
+        (WebCore::JSEventListener::operator==):
+        * bindings/js/JSEventListener.h:
+        (WebCore::JSEventListener::jsFunction):
+
 2012-11-14  Nate Chapin  <jap...@chromium.org>
 
         Fix chromium asserts from r134649.

Modified: trunk/Source/WebCore/bindings/js/JSEventListener.cpp (134665 => 134666)


--- trunk/Source/WebCore/bindings/js/JSEventListener.cpp	2012-11-14 22:02:05 UTC (rev 134665)
+++ trunk/Source/WebCore/bindings/js/JSEventListener.cpp	2012-11-14 22:07:13 UTC (rev 134666)
@@ -64,7 +64,7 @@
 
 void JSEventListener::visitJSFunction(SlotVisitor& visitor)
 {
-    // If m_wrapper is 0, then jsFunction is zombied, and should never be accessed.
+    // If m_wrapper is 0, then m_jsFunction is zombied, and should never be accessed.
     if (!m_wrapper)
         return;
 
@@ -163,12 +163,14 @@
 
 bool JSEventListener::operator==(const EventListener& listener)
 {
-    // If m_wrapper is 0, then jsFunction is zombied, and should never be accessed.
-    if (!m_wrapper)
-        return false;
-
-    if (const JSEventListener* jsEventListener = JSEventListener::cast(&listener))
-        return m_jsFunction == jsEventListener->m_jsFunction && m_isAttribute == jsEventListener->m_isAttribute;
+    if (const JSEventListener* jsEventListener = JSEventListener::cast(&listener)) {
+        // If m_wrapper is 0, then m_jsFunction is zombied, and should never be
+        // accessed. m_jsFunction should effectively be 0 in that case.
+        JSC::JSObject* jsFunction = m_wrapper ? m_jsFunction.get() : 0;
+        JSC::JSObject* otherJSFunction = jsEventListener->m_wrapper ?
+            jsEventListener->m_jsFunction.get() : 0;
+        return jsFunction == otherJSFunction && m_isAttribute == jsEventListener->m_isAttribute;
+    }
     return false;
 }
 

Modified: trunk/Source/WebCore/bindings/js/JSEventListener.h (134665 => 134666)


--- trunk/Source/WebCore/bindings/js/JSEventListener.h	2012-11-14 22:02:05 UTC (rev 134665)
+++ trunk/Source/WebCore/bindings/js/JSEventListener.h	2012-11-14 22:07:13 UTC (rev 134666)
@@ -90,7 +90,7 @@
         // world and can have zombie m_jsFunctions.
         ASSERT(!m_isolatedWorld->isNormal() || m_wrapper || !m_jsFunction);
 
-        // If m_wrapper is 0, then jsFunction is zombied, and should never be accessed.
+        // If m_wrapper is 0, then m_jsFunction is zombied, and should never be accessed.
         if (!m_wrapper)
             return 0;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to