Title: [197620] trunk/Source/WebKit2
Revision
197620
Author
[email protected]
Date
2016-03-05 16:40:01 -0800 (Sat, 05 Mar 2016)

Log Message

Rename Automation protocol methods to use "BrowsingContext" instead of "Window".
Also flesh out the protocol commands more by adding switchToBrowsingContext
and return a BrowsingContextHandle for createBrowsingContext.

https://bugs.webkit.org/show_bug.cgi?id=154953
rdar://problem/24947489

Reviewed by Brian Burg.

* UIProcess/Automation/Automation.json:
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::getBrowsingContexts):
(WebKit::WebAutomationSession::createBrowsingContext):
(WebKit::WebAutomationSession::closeBrowsingContext):
(WebKit::WebAutomationSession::switchToBrowsingContext):
(WebKit::WebAutomationSession::getWindows): Deleted.
(WebKit::WebAutomationSession::openWindow): Deleted.
(WebKit::WebAutomationSession::closeWindow): Deleted.
* UIProcess/Automation/WebAutomationSession.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (197619 => 197620)


--- trunk/Source/WebKit2/ChangeLog	2016-03-06 00:28:39 UTC (rev 197619)
+++ trunk/Source/WebKit2/ChangeLog	2016-03-06 00:40:01 UTC (rev 197620)
@@ -1,3 +1,25 @@
+2016-03-05  Timothy Hatcher  <[email protected]>
+
+        Rename Automation protocol methods to use "BrowsingContext" instead of "Window".
+        Also flesh out the protocol commands more by adding switchToBrowsingContext
+        and return a BrowsingContextHandle for createBrowsingContext.
+
+        https://bugs.webkit.org/show_bug.cgi?id=154953
+        rdar://problem/24947489
+
+        Reviewed by Brian Burg.
+
+        * UIProcess/Automation/Automation.json:
+        * UIProcess/Automation/WebAutomationSession.cpp:
+        (WebKit::WebAutomationSession::getBrowsingContexts):
+        (WebKit::WebAutomationSession::createBrowsingContext):
+        (WebKit::WebAutomationSession::closeBrowsingContext):
+        (WebKit::WebAutomationSession::switchToBrowsingContext):
+        (WebKit::WebAutomationSession::getWindows): Deleted.
+        (WebKit::WebAutomationSession::openWindow): Deleted.
+        (WebKit::WebAutomationSession::closeWindow): Deleted.
+        * UIProcess/Automation/WebAutomationSession.h:
+
 2016-03-05  Yusuke Suzuki  <[email protected]>
 
         [ES6] Support Reflect.construct

Modified: trunk/Source/WebKit2/UIProcess/Automation/Automation.json (197619 => 197620)


--- trunk/Source/WebKit2/UIProcess/Automation/Automation.json	2016-03-06 00:28:39 UTC (rev 197619)
+++ trunk/Source/WebKit2/UIProcess/Automation/Automation.json	2016-03-06 00:40:01 UTC (rev 197620)
@@ -3,46 +3,58 @@
     "description": "Automation domain exposes commands for automating user interactions with the browser.",
     "types": [
         {
-            "id": "OpaqueWindowHandle",
+            "id": "BrowsingContextHandle",
             "type": "string",
-            "description": "An opaque identifier for a window."
+            "description": "An opaque identifier for a browsing context."
         },
         {
             "id": "ErrorMessage",
             "type": "string",
+            "description": "This enum contains predefined error messages that can be used to signal a well-defined error condition, such as a missing implementation, unknown window handle, and so forth. The backend signals one of these errors by using it as a prefix of the commands's error message (the errorString argument in generated C++ backend dispatchers). This will be reported to the frontend as a protocol error with a JSON-RPC error code of 'ServerError'. It is up to the frontend whether and how to deal with errors.",
             "enum": [
+                "InternalError",
+                "WindowNotFound",
                 "NotImplemented"
-            ],
-            "description": "This enum contains predefined error messages that can be used to signal a well-defined error condition, such as a missing implementation, unknown window handle, and so forth. The backend signals one of these errors by using it as a prefix of the commands's error message (the errorString argument in generated C++ backend dispatchers). This will be reported to the frontend as a protocol error with a JSON-RPC error code of 'ServerError'. It is up to the frontend whether and how to deal with errors."
+            ]
         },
         {
-            "id": "BrowsingWindow",
+            "id": "BrowsingContext",
             "type": "object",
             "description": "A handle representing an open window or tab in the automation session.",
             "properties": [
-                { "name": "handle", "$ref": "OpaqueWindowHandle", "description": "Opaque handle for the window. Used as a key for window-related commands." },
-                { "name": "active", "type": "boolean", "description": "Whether the window is active at the time the command is handled." }
+                { "name": "handle", "$ref": "BrowsingContextHandle", "description": "Opaque handle for a browsing context (window or tab). Used as a key for window-related commands." },
+                { "name": "active", "type": "boolean", "description": "Whether the browsing context has focus at the time the command is handled." }
             ]
         }
     ],
     "commands": [
         {
-            "name": "getWindows",
+            "name": "getBrowsingContexts",
+            "description": "Fetches information about all open browsing contexts (windows and tabs) in the automation session.",
             "returns": [
-                { "name": "windows", "type": "array", "items": { "$ref": "BrowsingWindow"}, "description": "All known windows and tabs in the browsing session." }
-            ],
-            "description": "Gets information about all open windows and tabs in the automation session."
+                { "name": "contexts", "type": "array", "items": { "$ref": "BrowsingContext" }, "description": "All known browsing contexts available to the session." }
+            ]
         },
         {
-            "name": "openWindow",
-            "description": "Opens a new automation window in the current browsing context."
+            "name": "createBrowsingContext",
+            "description": "Opens a new browsing context in the automation session and makes it the active browsing context for user interaction. This command creates a browsing context in a new window rather than adding a tab to an existing window.",
+            "returns": [
+                { "name": "handle", "$ref": "BrowsingContextHandle", "description": "An opaque handle for the newly created browsing context." }
+            ]
         },
         {
-            "name": "closeWindow",
+            "name": "closeBrowsingContext",
+            "description": "Try to close the specified browsing context. This can trigger an unload prompt and thereafter succeed or fail.",
             "parameters": [
-                { "name": "handle", "$ref": "OpaqueWindowHandle", "description": "The handle for the window that should be closed." }
-            ],
-            "description": "Closes the specified window."
+                { "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context that should be closed." }
+            ]
+        },
+        {
+            "name": "switchToBrowsingContext",
+            "description": "Activates the specified browsing context.",
+            "parameters": [
+                { "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context that should be made active." }
+            ]
         }
     ]
 }

Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp (197619 => 197620)


--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp	2016-03-06 00:28:39 UTC (rev 197619)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp	2016-03-06 00:40:01 UTC (rev 197620)
@@ -99,19 +99,24 @@
 
 // Inspector::AutomationBackendDispatcherHandler API
 
-void WebAutomationSession::getWindows(Inspector::ErrorString& errorString, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingWindow>>& out_windows)
+void WebAutomationSession::getBrowsingContexts(Inspector::ErrorString& errorString, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>>& contexts)
 {
     FAIL_WITH_PREDEFINED_ERROR_MESSAGE(NotImplemented);
 }
 
-void WebAutomationSession::openWindow(Inspector::ErrorString& errorString)
+void WebAutomationSession::createBrowsingContext(Inspector::ErrorString& errorString, String* handle)
 {
     FAIL_WITH_PREDEFINED_ERROR_MESSAGE(NotImplemented);
 }
 
-void WebAutomationSession::closeWindow(Inspector::ErrorString& errorString, const String& in_handle)
+void WebAutomationSession::closeBrowsingContext(Inspector::ErrorString& errorString, const String& handle)
 {
     FAIL_WITH_PREDEFINED_ERROR_MESSAGE(NotImplemented);
 }
 
+void WebAutomationSession::switchToBrowsingContext(Inspector::ErrorString& errorString, const String& handle)
+{
+    FAIL_WITH_PREDEFINED_ERROR_MESSAGE(NotImplemented);
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h (197619 => 197620)


--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h	2016-03-06 00:28:39 UTC (rev 197619)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h	2016-03-06 00:40:01 UTC (rev 197620)
@@ -71,9 +71,10 @@
 #endif
 
     // Inspector::AutomationBackendDispatcherHandler API
-    void getWindows(Inspector::ErrorString&, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingWindow>>& out_windows) override;
-    void openWindow(Inspector::ErrorString&) override;
-    void closeWindow(Inspector::ErrorString&, const String& in_handle) override;
+    void getBrowsingContexts(Inspector::ErrorString&, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>>&) override;
+    void createBrowsingContext(Inspector::ErrorString&, String*) override;
+    void closeBrowsingContext(Inspector::ErrorString&, const String&) override;
+    void switchToBrowsingContext(Inspector::ErrorString&, const String&) override;
 
 private:
     std::unique_ptr<API::AutomationSessionClient> m_client;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to