Title: [211831] trunk/Source/WebKit2
Revision
211831
Author
bb...@apple.com
Date
2017-02-07 12:44:48 -0800 (Tue, 07 Feb 2017)

Log Message

[Mac] Web Automation: NSEventType not initialized in WebAutomationSession::platformSimulateMouseInteraction
https://bugs.webkit.org/show_bug.cgi?id=167902

Reviewed by Joseph Pecoraro.

* UIProcess/Automation/mac/WebAutomationSessionMac.mm:
(WebKit::WebAutomationSession::platformSimulateMouseInteraction):
Initialize these to 0, which is not a valid NSEventType. Assert that
each NSEventType has a valid value before attempting to use it.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (211830 => 211831)


--- trunk/Source/WebKit2/ChangeLog	2017-02-07 20:19:09 UTC (rev 211830)
+++ trunk/Source/WebKit2/ChangeLog	2017-02-07 20:44:48 UTC (rev 211831)
@@ -1,3 +1,15 @@
+2017-02-07  Brian Burg  <bb...@apple.com>
+
+        [Mac] Web Automation: NSEventType not initialized in WebAutomationSession::platformSimulateMouseInteraction
+        https://bugs.webkit.org/show_bug.cgi?id=167902
+
+        Reviewed by Joseph Pecoraro.
+
+        * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
+        (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
+        Initialize these to 0, which is not a valid NSEventType. Assert that
+        each NSEventType has a valid value before attempting to use it.
+
 2017-02-07  Youenn Fablet  <youe...@gmail.com>
 
         [WebRTC] LibWebRTC WK2 network stack is not providing correct ports for ICE candidates

Modified: trunk/Source/WebKit2/UIProcess/Automation/mac/WebAutomationSessionMac.mm (211830 => 211831)


--- trunk/Source/WebKit2/UIProcess/Automation/mac/WebAutomationSessionMac.mm	2017-02-07 20:19:09 UTC (rev 211830)
+++ trunk/Source/WebKit2/UIProcess/Automation/mac/WebAutomationSessionMac.mm	2017-02-07 20:44:48 UTC (rev 211831)
@@ -214,9 +214,9 @@
     NSWindow *window = page.platformWindow();
     NSInteger windowNumber = window.windowNumber;
 
-    NSEventType downEventType;
-    NSEventType dragEventType;
-    NSEventType upEventType;
+    NSEventType downEventType = (NSEventType)0;
+    NSEventType dragEventType = (NSEventType)0;
+    NSEventType upEventType = (NSEventType)0;
     switch (button) {
     case Inspector::Protocol::Automation::MouseButton::None:
         downEventType = upEventType = dragEventType = NSEventTypeMouseMoved;
@@ -243,24 +243,35 @@
 
     switch (interaction) {
     case Inspector::Protocol::Automation::MouseInteraction::Move:
+        ASSERT(dragEventType);
         [eventsToBeSent addObject:[NSEvent mouseEventWithType:dragEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:0 pressure:0.0f]];
         break;
     case Inspector::Protocol::Automation::MouseInteraction::Down:
+        ASSERT(downEventType);
+
         // Hard-code the click count to one, since clients don't expect successive simulated
         // down/up events to be potentially counted as a double click event.
         [eventsToBeSent addObject:[NSEvent mouseEventWithType:downEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:1 pressure:WebCore::ForceAtClick]];
         break;
     case Inspector::Protocol::Automation::MouseInteraction::Up:
+        ASSERT(upEventType);
+
         // Hard-code the click count to one, since clients don't expect successive simulated
         // down/up events to be potentially counted as a double click event.
         [eventsToBeSent addObject:[NSEvent mouseEventWithType:upEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:1 pressure:0.0f]];
         break;
     case Inspector::Protocol::Automation::MouseInteraction::SingleClick:
+        ASSERT(upEventType);
+        ASSERT(downEventType);
+
         // Send separate down and up events. WebCore will see this as a single-click event.
         [eventsToBeSent addObject:[NSEvent mouseEventWithType:downEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:1 pressure:WebCore::ForceAtClick]];
         [eventsToBeSent addObject:[NSEvent mouseEventWithType:upEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:1 pressure:0.0f]];
         break;
     case Inspector::Protocol::Automation::MouseInteraction::DoubleClick:
+        ASSERT(upEventType);
+        ASSERT(downEventType);
+
         // Send multiple down and up events with proper click count.
         // WebCore will see this as a single-click event then double-click event.
         [eventsToBeSent addObject:[NSEvent mouseEventWithType:downEventType location:windowPosition modifierFlags:modifiers timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:eventNumber clickCount:1 pressure:WebCore::ForceAtClick]];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to