Title: [220115] trunk/Source/WebKit
Revision
220115
Author
[email protected]
Date
2017-08-01 16:31:47 -0700 (Tue, 01 Aug 2017)

Log Message

Web Automation: add event to notify service when a page's main frame window object has cleared
https://bugs.webkit.org/show_bug.cgi?id=174987
<rdar://problem/36602634>

Reviewed by Carlos Garcia Campos.

* UIProcess/Automation/Automation.json: Add new event.

* UIProcess/Automation/WebAutomationSession.h:
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::navigationOccurredForFrame):
(WebKit::WebAutomationSession::willClosePage):
When a WebPage navigates or closes, send the browsingContextCleared event.
Any element handles for elements in the browsing context are no longer valid.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::close):
Add a new hook into the active automation session so it is notified when a page closes.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (220114 => 220115)


--- trunk/Source/WebKit/ChangeLog	2017-08-01 23:00:46 UTC (rev 220114)
+++ trunk/Source/WebKit/ChangeLog	2017-08-01 23:31:47 UTC (rev 220115)
@@ -1,3 +1,24 @@
+2017-08-01  Brian Burg  <[email protected]>
+
+        Web Automation: add event to notify service when a page's main frame window object has cleared
+        https://bugs.webkit.org/show_bug.cgi?id=174987
+        <rdar://problem/36602634>
+
+        Reviewed by Carlos Garcia Campos.
+
+        * UIProcess/Automation/Automation.json: Add new event.
+
+        * UIProcess/Automation/WebAutomationSession.h:
+        * UIProcess/Automation/WebAutomationSession.cpp:
+        (WebKit::WebAutomationSession::navigationOccurredForFrame):
+        (WebKit::WebAutomationSession::willClosePage):
+        When a WebPage navigates or closes, send the browsingContextCleared event.
+        Any element handles for elements in the browsing context are no longer valid.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::close):
+        Add a new hook into the active automation session so it is notified when a page closes.
+
 2017-08-01  Brady Eidson  <[email protected]>
 
         API test URLSchemeHandler.Exceptions is Exiting out early on macOS Debug..

Modified: trunk/Source/WebKit/UIProcess/Automation/Automation.json (220114 => 220115)


--- trunk/Source/WebKit/UIProcess/Automation/Automation.json	2017-08-01 23:00:46 UTC (rev 220114)
+++ trunk/Source/WebKit/UIProcess/Automation/Automation.json	2017-08-01 23:31:47 UTC (rev 220115)
@@ -521,6 +521,13 @@
                 { "name": "browsingContextHandle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context." },
                 { "name": "selectionCancelled", "type": "boolean", "description": "If true, the chooser was dismissed because file selection was cancelled." }
             ]
+        },
+        {
+            "name": "browsingContextCleared",
+            "description": "Fired when the specified browsing context has navigated or closed. Existing element references from the browsing context are no longer valid.",
+            "parameters": [
+                { "name": "browsingContextHandle", "$ref": "BrowsingContextHandle" }
+            ]
         }
     ]
 }

Modified: trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp (220114 => 220115)


--- trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp	2017-08-01 23:00:46 UTC (rev 220114)
+++ trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp	2017-08-01 23:31:47 UTC (rev 220115)
@@ -499,6 +499,7 @@
             m_loadTimer.stop();
             callback->sendSuccess(InspectorObject::create());
         }
+        m_domainNotifier->browsingContextCleared(handleForWebPageProxy(*frame.page()));
     } else {
         if (auto callback = m_pendingNavigationInBrowsingContextCallbacksPerFrame.take(frame.frameID())) {
             m_loadTimer.stop();
@@ -519,6 +520,12 @@
         callback->sendSuccess(InspectorObject::create());
 }
 
+void WebAutomationSession::willClosePage(const WebPageProxy& page)
+{
+    String handle = handleForWebPageProxy(page);
+    m_domainNotifier->browsingContextCleared(handle);
+}
+    
 void WebAutomationSession::handleRunOpenPanel(const WebPageProxy& page, const WebFrameProxy&, const API::OpenPanelParameters& parameters, WebOpenPanelResultListenerProxy& resultListener)
 {
     if (!m_filesToSelectForFileUpload.size()) {

Modified: trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.h (220114 => 220115)


--- trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.h	2017-08-01 23:00:46 UTC (rev 220114)
+++ trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.h	2017-08-01 23:31:47 UTC (rev 220115)
@@ -96,6 +96,7 @@
     void navigationOccurredForFrame(const WebFrameProxy&);
     void inspectorFrontendLoaded(const WebPageProxy&);
     void keyboardEventsFlushedForPage(const WebPageProxy&);
+    void willClosePage(const WebPageProxy&);
     void handleRunOpenPanel(const WebPageProxy&, const WebFrameProxy&, const API::OpenPanelParameters&, WebOpenPanelResultListenerProxy&);
 
 #if ENABLE(REMOTE_INSPECTOR)

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (220114 => 220115)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2017-08-01 23:00:46 UTC (rev 220114)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2017-08-01 23:31:47 UTC (rev 220115)
@@ -740,6 +740,11 @@
     if (m_activePopupMenu)
         m_activePopupMenu->cancelTracking();
 
+    if (m_controlledByAutomation) {
+        if (auto* automationSession = process().processPool().automationSession())
+            automationSession->willClosePage(*this);
+    }
+
 #if ENABLE(CONTEXT_MENUS)
     m_activeContextMenu = nullptr;
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to