[Mac, iOS] AccessibilityController doesn't uninstall global notification handler
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 20 Sep 2015 15:30:09 +0000 (15:30 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 20 Sep 2015 15:30:09 +0000 (15:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=149384

Reviewed by Chris Fleizach.

Tools:

* DumpRenderTree/ios/AccessibilityControllerIOS.mm:
(AccessibilityController::addNotificationListener): Fixed a leak, and cleaned up the code.
(AccessibilityController::platformResetToConsistentState): Actually remove the handler,
regardless of whether someone else holds a reference (we also call -stopListening in
-dealloc).

* DumpRenderTree/mac/AccessibilityControllerMac.mm:
(AccessibilityController::platformResetToConsistentState):
(AccessibilityController::addNotificationListener):
Ditto.

LayoutTests:

* accessibility/mac/loaded-notification.html: Cleaned up the test - js-test-pre is
incompatible with directly using waitUntilDone.

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

LayoutTests/ChangeLog
LayoutTests/accessibility/mac/loaded-notification.html
Tools/ChangeLog
Tools/DumpRenderTree/ios/AccessibilityControllerIOS.mm
Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm

index c66857e..9f75d4c 100644 (file)
@@ -1,3 +1,13 @@
+2015-09-20  Alexey Proskuryakov  <ap@apple.com>
+
+        [Mac, iOS] AccessibilityController doesn't uninstall global notification handler
+        https://bugs.webkit.org/show_bug.cgi?id=149384
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/mac/loaded-notification.html: Cleaned up the test - js-test-pre is
+        incompatible with directly using waitUntilDone. 
+
 2015-09-19  Chris Dumez  <cdumez@apple.com>
 
         [WebIDL] Specify default parameter values where it is useful
index 940fe6b..c41a884 100644 (file)
     description("This tests that when enable enhanced accessibility is true and no other accessibility API is called, the load notification will successfully fire.");
 
     function notifyCallback(element, notification) {
-        if (notification == "AXLoadComplete") {
-            accessibilityController.removeNotificationListener();
-            window.testRunner.notifyDone();
-        }
+        if (notification == "AXLoadComplete")
+            finishJSTest();
     }
 
     if (window.accessibilityController) {
-        window.testRunner.waitUntilDone();
+        jsTestIsAsync = true;
         accessibilityController.enableEnhancedAccessibility(true);
         var addedNotification = accessibilityController.addNotificationListener(notifyCallback);
         shouldBe("addedNotification", "true");
index e8a422b..e991011 100644 (file)
@@ -1,3 +1,21 @@
+2015-09-20  Alexey Proskuryakov  <ap@apple.com>
+
+        [Mac, iOS] AccessibilityController doesn't uninstall global notification handler
+        https://bugs.webkit.org/show_bug.cgi?id=149384
+
+        Reviewed by Chris Fleizach.
+
+        * DumpRenderTree/ios/AccessibilityControllerIOS.mm:
+        (AccessibilityController::addNotificationListener): Fixed a leak, and cleaned up the code.
+        (AccessibilityController::platformResetToConsistentState): Actually remove the handler,
+        regardless of whether someone else holds a reference (we also call -stopListening in
+        -dealloc).
+
+        * DumpRenderTree/mac/AccessibilityControllerMac.mm:
+        (AccessibilityController::platformResetToConsistentState):
+        (AccessibilityController::addNotificationListener):
+        Ditto.
+
 2015-09-20  Youenn Fablet  <youenn.fablet@crf.canon.fr>
 
         Remove XHR_TIMEOUT compilation guard
index 8bc1f52..54e4a70 100644 (file)
@@ -126,15 +126,16 @@ bool AccessibilityController::addNotificationListener(JSObjectRef functionCallba
     // Other platforms may be different.
     if (m_globalNotificationHandler)
         return false;
-    m_globalNotificationHandler = [[AccessibilityNotificationHandler alloc] init];
-    [m_globalNotificationHandler.get() setCallback:functionCallback];
-    [m_globalNotificationHandler.get() startObserving];
+    m_globalNotificationHandler = adoptNS([[AccessibilityNotificationHandler alloc] init]);
+    [m_globalNotificationHandler setCallback:functionCallback];
+    [m_globalNotificationHandler startObserving];
     
     return true;
 }
 
 void AccessibilityController::platformResetToConsistentState()
 {
+    [m_globalNotificationHandler stopObserving];
     m_globalNotificationHandler.clear();
 }
 
index bfb9d0d..4c5e17c 100644 (file)
@@ -121,6 +121,7 @@ void AccessibilityController::setLogAccessibilityEvents(bool)
 
 void AccessibilityController::platformResetToConsistentState()
 {
+    [m_globalNotificationHandler stopObserving];
     m_globalNotificationHandler.clear();
 }
 
@@ -133,9 +134,9 @@ bool AccessibilityController::addNotificationListener(JSObjectRef functionCallba
     // Other platforms may be different.
     if (m_globalNotificationHandler)
         return false;
-    m_globalNotificationHandler = [[AccessibilityNotificationHandler alloc] init];
-    [m_globalNotificationHandler.get() setCallback:functionCallback];
-    [m_globalNotificationHandler.get() startObserving];
+    m_globalNotificationHandler = adoptNS([[AccessibilityNotificationHandler alloc] init]);
+    [m_globalNotificationHandler setCallback:functionCallback];
+    [m_globalNotificationHandler startObserving];
 
     return true;
 }