Title: [198918] trunk/Source/WebKit2
Revision
198918
Author
[email protected]
Date
2016-03-31 14:51:40 -0700 (Thu, 31 Mar 2016)

Log Message

Web Automation: the interaction queue in WebAutomationSession::performKeyInteractions doesn't work
https://bugs.webkit.org/show_bug.cgi?id=156083

Reviewed by Timothy Hatcher.

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::performKeyboardInteractions):
Use Vector::reserveCapacity instead of the size constructor since we use append.
Empty the interaction queue outside of loops so all interactions are performed once.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (198917 => 198918)


--- trunk/Source/WebKit2/ChangeLog	2016-03-31 21:12:55 UTC (rev 198917)
+++ trunk/Source/WebKit2/ChangeLog	2016-03-31 21:51:40 UTC (rev 198918)
@@ -1,3 +1,15 @@
+2016-03-31  Brian Burg  <[email protected]>
+
+        Web Automation: the interaction queue in WebAutomationSession::performKeyInteractions doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=156083
+
+        Reviewed by Timothy Hatcher.
+
+        * UIProcess/Automation/WebAutomationSession.cpp:
+        (WebKit::WebAutomationSession::performKeyboardInteractions):
+        Use Vector::reserveCapacity instead of the size constructor since we use append.
+        Empty the interaction queue outside of loops so all interactions are performed once.
+
 2016-03-31  Timothy Hatcher  <[email protected]>
 
         Web Automation: Add support for script timeouts to the evaluateJavaScriptFunction command

Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp (198917 => 198918)


--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp	2016-03-31 21:12:55 UTC (rev 198917)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp	2016-03-31 21:51:40 UTC (rev 198918)
@@ -746,11 +746,12 @@
         FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InvalidParameter);
 
     // Validate all of the parameters before performing any interactions with the browsing context under test.
-    Vector<std::function<void()>> actionsToPerform(interactions.length());
+    Vector<std::function<void()>> actionsToPerform;
+    actionsToPerform.reserveCapacity(interactions.length());
 
-    for (auto it = interactions.begin(); it != interactions.end(); ++it) {
+    for (auto interaction : interactions) {
         RefPtr<InspectorObject> interactionObject;
-        if (!it->get()->asObject(interactionObject))
+        if (!interaction->asObject(interactionObject))
             FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InvalidParameter);
 
         String interactionTypeString;
@@ -767,7 +768,7 @@
             if (!virtualKey)
                 FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InvalidParameter);
 
-            actionsToPerform.append([this, page, interactionType, virtualKey] {
+            actionsToPerform.uncheckedAppend([this, page, interactionType, virtualKey] {
                 platformSimulateKeyStroke(*page, interactionType.value(), virtualKey.value());
             });
         }
@@ -782,7 +783,7 @@
                 FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InvalidParameter);
 
             case Inspector::Protocol::Automation::KeyboardInteractionType::InsertByKey:
-                actionsToPerform.append([this, page, keySequence] {
+                actionsToPerform.uncheckedAppend([this, page, keySequence] {
                     platformSimulateKeySequence(*page, keySequence);
                 });
                 break;
@@ -791,11 +792,12 @@
 
         if (!foundVirtualKey && !foundKeySequence)
             FAIL_WITH_PREDEFINED_ERROR_MESSAGE(MissingParameter);
+    }
 
-        ASSERT(actionsToPerform.size());
-        for (auto& action : actionsToPerform)
-            action();
-    }
+    ASSERT(actionsToPerform.size());
+    for (auto& action : actionsToPerform)
+        action();
+
 #endif // USE(APPKIT)
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to