browser(webkit): introduce Playwright.windowOpen protocol event (#1420)

This commit is contained in:
Dmitry Gozman 2020-03-18 10:44:01 -07:00 committed by GitHub
parent dd850ada89
commit bfcffbb377
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 163 additions and 46 deletions

View File

@ -1 +1 @@
1179
1180

View File

@ -1035,10 +1035,10 @@ index a8fc5332ac92424b00a3dec62152fd3c5f28544e..6aa07fd2ee4e0dff43b151d1cee7497f
}
diff --git a/Source/JavaScriptCore/inspector/protocol/Playwright.json b/Source/JavaScriptCore/inspector/protocol/Playwright.json
new file mode 100644
index 0000000000000000000000000000000000000000..612d9f32dc50445747e97f07089b5c2e6713c7a2
index 0000000000000000000000000000000000000000..cb021782b238f318f4b09c6f99699a8e184c1d75
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/Playwright.json
@@ -0,0 +1,211 @@
@@ -0,0 +1,220 @@
+{
+ "domain": "Playwright",
+ "availability": ["web"],
@ -1240,6 +1240,15 @@ index 0000000000000000000000000000000000000000..612d9f32dc50445747e97f07089b5c2e
+ ]
+ },
+ {
+ "name": "windowOpen",
+ "description": "Fired when page opens a new window.",
+ "parameters": [
+ { "name": "pageProxyId", "$ref": "PageProxyID", "description": "Unique identifier of the page proxy." },
+ { "name": "url", "type": "string" },
+ { "name": "windowFeatures", "type": "array", "items": { "type": "string" } }
+ ]
+ },
+ {
+ "name": "provisionalLoadFailed",
+ "description": "Fired when provisional load fails.",
+ "parameters": [
@ -5544,6 +5553,33 @@ index 0fa557e9faa34ba81a7a4f7da5e32f30cbfad5d2..4f06afeb895fb1231d87e4304a4b588c
#if USE(APPKIT)
NSEvent* nativeEvent() const { return m_nativeEvent.get(); }
#elif PLATFORM(GTK)
diff --git a/Source/WebKit/Shared/WebCoreArgumentCoders.cpp b/Source/WebKit/Shared/WebCoreArgumentCoders.cpp
index 3ceb4c77e59084229a40593986db3ece0a1a78dc..fb91b3d7d979a16fcc695ae4f8d40532539d82ad 100644
--- a/Source/WebKit/Shared/WebCoreArgumentCoders.cpp
+++ b/Source/WebKit/Shared/WebCoreArgumentCoders.cpp
@@ -1459,6 +1459,9 @@ void ArgumentCoder<WindowFeatures>::encode(Encoder& encoder, const WindowFeature
encoder << windowFeatures.resizable;
encoder << windowFeatures.fullscreen;
encoder << windowFeatures.dialog;
+ encoder << windowFeatures.noopener;
+ encoder << windowFeatures.noreferrer;
+ encoder << windowFeatures.additionalFeatures;
}
bool ArgumentCoder<WindowFeatures>::decode(Decoder& decoder, WindowFeatures& windowFeatures)
@@ -1487,6 +1490,12 @@ bool ArgumentCoder<WindowFeatures>::decode(Decoder& decoder, WindowFeatures& win
return false;
if (!decoder.decode(windowFeatures.dialog))
return false;
+ if (!decoder.decode(windowFeatures.noopener))
+ return false;
+ if (!decoder.decode(windowFeatures.noreferrer))
+ return false;
+ if (!decoder.decode(windowFeatures.additionalFeatures))
+ return false;
return true;
}
diff --git a/Source/WebKit/Shared/WebEvent.h b/Source/WebKit/Shared/WebEvent.h
index 224ef51567fdf5eb7321a3411faccd283b5b2813..7c102952d5821486f0c6a0af0b8d3286ace96b93 100644
--- a/Source/WebKit/Shared/WebEvent.h
@ -6946,10 +6982,10 @@ index 02e258253e47fbf6594c20f743d0faeac8a4eefe..e051fdf396dc65717def6b36168b5538
#include <wpe/WebKitContextMenuItem.h>
diff --git a/Source/WebKit/UIProcess/BrowserInspectorController.cpp b/Source/WebKit/UIProcess/BrowserInspectorController.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..74b702953a54425bb80090f60b0a321b402e68eb
index 0000000000000000000000000000000000000000..300be76e7926ac5eb435ab62df1a973f04520327
--- /dev/null
+++ b/Source/WebKit/UIProcess/BrowserInspectorController.cpp
@@ -0,0 +1,238 @@
@@ -0,0 +1,244 @@
+/*
+ * Copyright (C) 2019 Microsoft Corporation.
+ *
@ -6991,6 +7027,7 @@ index 0000000000000000000000000000000000000000..74b702953a54425bb80090f60b0a321b
+#include <JavaScriptCore/InspectorFrontendChannel.h>
+#include <JavaScriptCore/InspectorFrontendRouter.h>
+#include <JavaScriptCore/InspectorTarget.h>
+#include <WebCore/WindowFeatures.h>
+#include <wtf/Ref.h>
+#include <wtf/RefPtr.h>
+
@ -7177,6 +7214,11 @@ index 0000000000000000000000000000000000000000..74b702953a54425bb80090f60b0a321b
+ m_browserAgent->didFailProvisionalLoad(page, navigationID, error);
+}
+
+void BrowserInspectorController::willCreateNewPage(WebPageProxy& page, const WebCore::WindowFeatures& features, const URL& url)
+{
+ m_browserAgent->willCreateNewPage(page, features, url);
+}
+
+WebPageProxy* BrowserInspectorController::findPageProxy(const String& pageProxyID)
+{
+ if (auto* pageProxyChannel = m_pageProxyChannels.get(pageProxyID))
@ -7190,10 +7232,10 @@ index 0000000000000000000000000000000000000000..74b702953a54425bb80090f60b0a321b
+#endif // ENABLE(REMOTE_INSPECTOR)
diff --git a/Source/WebKit/UIProcess/BrowserInspectorController.h b/Source/WebKit/UIProcess/BrowserInspectorController.h
new file mode 100644
index 0000000000000000000000000000000000000000..4516c31d02caabbb731f662e96436569daf3eaeb
index 0000000000000000000000000000000000000000..b8e7b1c9f301c99baf62dc52ad4591b0376f00b3
--- /dev/null
+++ b/Source/WebKit/UIProcess/BrowserInspectorController.h
@@ -0,0 +1,85 @@
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2019 Microsoft Corporation.
+ *
@ -7259,6 +7301,7 @@ index 0000000000000000000000000000000000000000..4516c31d02caabbb731f662e96436569
+ void didCreateInspectorController(WebPageProxy&) override;
+ void willDestroyInspectorController(WebPageProxy&) override;
+ void didFailProvisionalLoad(WebPageProxy&, uint64_t navigationID, const String& error) override;
+ void willCreateNewPage(WebPageProxy&, const WebCore::WindowFeatures&, const URL&) override;
+
+ // PageProxyIDMap
+ WebPageProxy* findPageProxy(const String& pageProxyID) override;
@ -7728,10 +7771,10 @@ index a2239cec8e18850f35f7f88a9c4ebadc62bf4023..79f3ff84327dc075ec96983e04db4b10
} // namespace WebKit
diff --git a/Source/WebKit/UIProcess/Inspector/WebPageInspectorController.cpp b/Source/WebKit/UIProcess/Inspector/WebPageInspectorController.cpp
index 1861cff806131196ea49b4f8aca6665beebbf6e8..7c44efa7cdb60642608fbbbbd4811f834f6f7545 100644
index 1861cff806131196ea49b4f8aca6665beebbf6e8..e1bade3da38ad2c1faa8bffcae623eb167b3232a 100644
--- a/Source/WebKit/UIProcess/Inspector/WebPageInspectorController.cpp
+++ b/Source/WebKit/UIProcess/Inspector/WebPageInspectorController.cpp
@@ -26,12 +26,18 @@
@@ -26,12 +26,19 @@
#include "config.h"
#include "WebPageInspectorController.h"
@ -7747,10 +7790,11 @@ index 1861cff806131196ea49b4f8aca6665beebbf6e8..7c44efa7cdb60642608fbbbbd4811f83
#include "WebPageProxy.h"
+#include "WebPreferences.h"
+#include <WebCore/ResourceError.h>
+#include <WebCore/WindowFeatures.h>
#include <JavaScriptCore/InspectorAgentBase.h>
#include <JavaScriptCore/InspectorBackendDispatcher.h>
#include <JavaScriptCore/InspectorBackendDispatchers.h>
@@ -48,27 +54,96 @@ static String getTargetID(const ProvisionalPageProxy& provisionalPage)
@@ -48,27 +55,102 @@ static String getTargetID(const ProvisionalPageProxy& provisionalPage)
return WebPageInspectorTarget::toTargetID(provisionalPage.webPageID());
}
@ -7831,6 +7875,12 @@ index 1861cff806131196ea49b4f8aca6665beebbf6e8..7c44efa7cdb60642608fbbbbd4811f83
+ return m_targetAgent->isConnected();
+}
+
+void WebPageInspectorController::willCreateNewPage(const WebCore::WindowFeatures& features, const URL& url)
+{
+ if (s_observer)
+ s_observer->willCreateNewPage(m_page, features, url);
+}
+
+void WebPageInspectorController::didShowPage()
+{
+ if (m_frontendRouter->hasFrontends())
@ -7850,7 +7900,7 @@ index 1861cff806131196ea49b4f8aca6665beebbf6e8..7c44efa7cdb60642608fbbbbd4811f83
}
bool WebPageInspectorController::hasLocalFrontend() const
@@ -82,6 +157,17 @@ void WebPageInspectorController::connectFrontend(Inspector::FrontendChannel& fro
@@ -82,6 +164,17 @@ void WebPageInspectorController::connectFrontend(Inspector::FrontendChannel& fro
bool connectingFirstFrontend = !m_frontendRouter->hasFrontends();
@ -7868,7 +7918,7 @@ index 1861cff806131196ea49b4f8aca6665beebbf6e8..7c44efa7cdb60642608fbbbbd4811f83
m_frontendRouter->connectFrontend(frontendChannel);
if (connectingFirstFrontend)
@@ -100,8 +186,10 @@ void WebPageInspectorController::disconnectFrontend(FrontendChannel& frontendCha
@@ -100,8 +193,10 @@ void WebPageInspectorController::disconnectFrontend(FrontendChannel& frontendCha
m_frontendRouter->disconnectFrontend(frontendChannel);
bool disconnectingLastFrontend = !m_frontendRouter->hasFrontends();
@ -7880,7 +7930,7 @@ index 1861cff806131196ea49b4f8aca6665beebbf6e8..7c44efa7cdb60642608fbbbbd4811f83
m_page.didChangeInspectorFrontendCount(m_frontendRouter->frontendCount());
@@ -124,6 +212,8 @@ void WebPageInspectorController::disconnectAllFrontends()
@@ -124,6 +219,8 @@ void WebPageInspectorController::disconnectAllFrontends()
// Disconnect any remaining remote frontends.
m_frontendRouter->disconnectAllFrontends();
@ -7889,7 +7939,7 @@ index 1861cff806131196ea49b4f8aca6665beebbf6e8..7c44efa7cdb60642608fbbbbd4811f83
m_page.didChangeInspectorFrontendCount(m_frontendRouter->frontendCount());
#if ENABLE(REMOTE_INSPECTOR)
@@ -136,6 +226,11 @@ void WebPageInspectorController::dispatchMessageFromFrontend(const String& messa
@@ -136,6 +233,11 @@ void WebPageInspectorController::dispatchMessageFromFrontend(const String& messa
m_backendDispatcher->dispatch(message);
}
@ -7901,7 +7951,7 @@ index 1861cff806131196ea49b4f8aca6665beebbf6e8..7c44efa7cdb60642608fbbbbd4811f83
#if ENABLE(REMOTE_INSPECTOR)
void WebPageInspectorController::setIndicating(bool indicating)
{
@@ -150,6 +245,55 @@ void WebPageInspectorController::setIndicating(bool indicating)
@@ -150,6 +252,55 @@ void WebPageInspectorController::setIndicating(bool indicating)
}
#endif
@ -7957,7 +8007,7 @@ index 1861cff806131196ea49b4f8aca6665beebbf6e8..7c44efa7cdb60642608fbbbbd4811f83
void WebPageInspectorController::createInspectorTarget(const String& targetId, Inspector::InspectorTargetType type)
{
addTarget(InspectorTargetProxy::create(m_page, targetId, type));
@@ -169,6 +313,33 @@ void WebPageInspectorController::sendMessageToInspectorFrontend(const String& ta
@@ -169,6 +320,33 @@ void WebPageInspectorController::sendMessageToInspectorFrontend(const String& ta
m_targetAgent->sendMessageFromTargetToFrontend(targetId, message);
}
@ -7991,7 +8041,7 @@ index 1861cff806131196ea49b4f8aca6665beebbf6e8..7c44efa7cdb60642608fbbbbd4811f83
bool WebPageInspectorController::shouldPauseLoading(const ProvisionalPageProxy& provisionalPage) const
{
if (!m_frontendRouter->hasFrontends())
@@ -188,7 +359,7 @@ void WebPageInspectorController::setContinueLoadingCallback(const ProvisionalPag
@@ -188,7 +366,7 @@ void WebPageInspectorController::setContinueLoadingCallback(const ProvisionalPag
void WebPageInspectorController::didCreateProvisionalPage(ProvisionalPageProxy& provisionalPage)
{
@ -8000,7 +8050,7 @@ index 1861cff806131196ea49b4f8aca6665beebbf6e8..7c44efa7cdb60642608fbbbbd4811f83
}
void WebPageInspectorController::willDestroyProvisionalPage(const ProvisionalPageProxy& provisionalPage)
@@ -241,4 +412,20 @@ void WebPageInspectorController::addTarget(std::unique_ptr<InspectorTargetProxy>
@@ -241,4 +419,20 @@ void WebPageInspectorController::addTarget(std::unique_ptr<InspectorTargetProxy>
m_targets.set(target->identifier(), WTFMove(target));
}
@ -8022,10 +8072,10 @@ index 1861cff806131196ea49b4f8aca6665beebbf6e8..7c44efa7cdb60642608fbbbbd4811f83
+
} // namespace WebKit
diff --git a/Source/WebKit/UIProcess/Inspector/WebPageInspectorController.h b/Source/WebKit/UIProcess/Inspector/WebPageInspectorController.h
index 9ce5ef36b652fd56a843c1d12a4c3c3cf639282c..5b6d5f4d28ccbde11df85782561ba1d9e6908490 100644
index 9ce5ef36b652fd56a843c1d12a4c3c3cf639282c..9b6a239b6db52a55f693654ed65d89dff8dd0ffb 100644
--- a/Source/WebKit/UIProcess/Inspector/WebPageInspectorController.h
+++ b/Source/WebKit/UIProcess/Inspector/WebPageInspectorController.h
@@ -26,6 +26,7 @@
@@ -26,17 +26,27 @@
#pragma once
#include "InspectorTargetProxy.h"
@ -8033,7 +8083,12 @@ index 9ce5ef36b652fd56a843c1d12a4c3c3cf639282c..5b6d5f4d28ccbde11df85782561ba1d9
#include <JavaScriptCore/InspectorAgentRegistry.h>
#include <JavaScriptCore/InspectorTargetAgent.h>
#include <WebCore/PageIdentifier.h>
@@ -37,6 +38,13 @@ namespace Inspector {
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <wtf/text/WTFString.h>
+#include <wtf/URL.h>
namespace Inspector {
class BackendDispatcher;
class FrontendChannel;
class FrontendRouter;
@ -8044,10 +8099,11 @@ index 9ce5ef36b652fd56a843c1d12a4c3c3cf639282c..5b6d5f4d28ccbde11df85782561ba1d9
+class ResourceError;
+class ResourceRequest;
+enum class PolicyAction : uint8_t;
+struct WindowFeatures;
}
namespace WebKit {
@@ -44,6 +52,20 @@ namespace WebKit {
@@ -44,6 +54,21 @@ namespace WebKit {
class InspectorBrowserAgent;
struct WebPageAgentContext;
@ -8060,6 +8116,7 @@ index 9ce5ef36b652fd56a843c1d12a4c3c3cf639282c..5b6d5f4d28ccbde11df85782561ba1d9
+ virtual void didCreateInspectorController(WebPageProxy&) = 0;
+ virtual void willDestroyInspectorController(WebPageProxy&) = 0;
+ virtual void didFailProvisionalLoad(WebPageProxy&, uint64_t navigationID, const String& error) = 0;
+ virtual void willCreateNewPage(WebPageProxy&, const WebCore::WindowFeatures&, const URL&) = 0;
+
+protected:
+ virtual ~WebPageInspectorControllerObserver() = default;
@ -8068,7 +8125,7 @@ index 9ce5ef36b652fd56a843c1d12a4c3c3cf639282c..5b6d5f4d28ccbde11df85782561ba1d9
class WebPageInspectorController {
WTF_MAKE_NONCOPYABLE(WebPageInspectorController);
WTF_MAKE_FAST_ALLOCATED;
@@ -51,7 +73,17 @@ public:
@@ -51,7 +76,19 @@ public:
WebPageInspectorController(WebPageProxy&);
void init();
@ -8079,6 +8136,8 @@ index 9ce5ef36b652fd56a843c1d12a4c3c3cf639282c..5b6d5f4d28ccbde11df85782561ba1d9
void pageClosed();
+ bool pageCrashed(ProcessTerminationReason);
+
+ void willCreateNewPage(const WebCore::WindowFeatures&, const URL&);
+
+ void didShowPage();
+
+ void didProcessAllPendingKeyboardEvents();
@ -8086,7 +8145,7 @@ index 9ce5ef36b652fd56a843c1d12a4c3c3cf639282c..5b6d5f4d28ccbde11df85782561ba1d9
bool hasLocalFrontend() const;
@@ -60,15 +92,28 @@ public:
@@ -60,15 +97,28 @@ public:
void disconnectAllFrontends();
void dispatchMessageFromFrontend(const String& message);
@ -8115,7 +8174,7 @@ index 9ce5ef36b652fd56a843c1d12a4c3c3cf639282c..5b6d5f4d28ccbde11df85782561ba1d9
bool shouldPauseLoading(const ProvisionalPageProxy&) const;
void setContinueLoadingCallback(const ProvisionalPageProxy&, WTF::Function<void()>&&);
@@ -84,6 +129,7 @@ private:
@@ -84,6 +134,7 @@ private:
void createLazyAgents();
void addTarget(std::unique_ptr<InspectorTargetProxy>&&);
@ -8123,7 +8182,7 @@ index 9ce5ef36b652fd56a843c1d12a4c3c3cf639282c..5b6d5f4d28ccbde11df85782561ba1d9
Ref<Inspector::FrontendRouter> m_frontendRouter;
Ref<Inspector::BackendDispatcher> m_backendDispatcher;
@@ -92,11 +138,16 @@ private:
@@ -92,11 +143,16 @@ private:
WebPageProxy& m_page;
Inspector::InspectorTargetAgent* m_targetAgent;
@ -8310,10 +8369,10 @@ index 0000000000000000000000000000000000000000..f356c613945fd263889bc74166bef2b2
+} // namespace WebKit
diff --git a/Source/WebKit/UIProcess/InspectorPlaywrightAgent.cpp b/Source/WebKit/UIProcess/InspectorPlaywrightAgent.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..aebf8bc2080aa7464a374b322489413bb2d91821
index 0000000000000000000000000000000000000000..66bf9c54ac5e882c5c725389ea19584438a94446
--- /dev/null
+++ b/Source/WebKit/UIProcess/InspectorPlaywrightAgent.cpp
@@ -0,0 +1,590 @@
@@ -0,0 +1,634 @@
+/*
+ * Copyright (C) 2019 Microsoft Corporation.
+ *
@ -8360,6 +8419,7 @@ index 0000000000000000000000000000000000000000..aebf8bc2080aa7464a374b322489413b
+#include <WebCore/GeolocationPositionData.h>
+#include <WebCore/ProcessIdentifier.h>
+#include <WebCore/ResourceRequest.h>
+#include <WebCore/WindowFeatures.h>
+#include <JavaScriptCore/InspectorFrontendRouter.h>
+#include <pal/SessionID.h>
+#include <stdlib.h>
@ -8373,6 +8433,41 @@ index 0000000000000000000000000000000000000000..aebf8bc2080aa7464a374b322489413b
+
+namespace {
+
+static RefPtr<JSON::ArrayOf<String>> getEnabledWindowFeatures(const WebCore::WindowFeatures& features) {
+ auto result = JSON::ArrayOf<String>::create();
+ if (features.x)
+ result->addItem("left=" + String::number(*features.x));
+ if (features.y)
+ result->addItem("top=" + String::number(*features.y));
+ if (features.width)
+ result->addItem("width=" + String::number(*features.width));
+ if (features.height)
+ result->addItem("height=" + String::number(*features.height));
+ if (features.menuBarVisible)
+ result->addItem("menubar");
+ if (features.toolBarVisible)
+ result->addItem("toolbar");
+ if (features.statusBarVisible)
+ result->addItem("status");
+ if (features.locationBarVisible)
+ result->addItem("location");
+ if (features.scrollbarsVisible)
+ result->addItem("scrollbars");
+ if (features.resizable)
+ result->addItem("resizable");
+ if (features.fullscreen)
+ result->addItem("fullscreen");
+ if (features.dialog)
+ result->addItem("dialog");
+ if (features.noopener)
+ result->addItem("noopener");
+ if (features.noreferrer)
+ result->addItem("noreferrer");
+ for (const auto& additionalFeature : features.additionalFeatures)
+ result->addItem(additionalFeature);
+ return result;
+}
+
+Inspector::Protocol::Playwright::CookieSameSitePolicy cookieSameSitePolicy(WebCore::Cookie::SameSitePolicy policy)
+{
+ switch (policy) {
@ -8510,6 +8605,14 @@ index 0000000000000000000000000000000000000000..aebf8bc2080aa7464a374b322489413b
+ m_frontendDispatcher->provisionalLoadFailed(toPageProxyIDProtocolString(page), String::number(navigationID), error);
+}
+
+void InspectorPlaywrightAgent::willCreateNewPage(WebPageProxy& page, const WebCore::WindowFeatures& features, const URL& url)
+{
+ if (!m_isConnected)
+ return;
+
+ m_frontendDispatcher->windowOpen(toPageProxyIDProtocolString(page), url.string(), getEnabledWindowFeatures(features));
+}
+
+void InspectorPlaywrightAgent::willDestroyFrontendAndBackend(DisconnectReason)
+{
+ m_isConnected = false;
@ -8906,10 +9009,10 @@ index 0000000000000000000000000000000000000000..aebf8bc2080aa7464a374b322489413b
+#endif // ENABLE(REMOTE_INSPECTOR)
diff --git a/Source/WebKit/UIProcess/InspectorPlaywrightAgent.h b/Source/WebKit/UIProcess/InspectorPlaywrightAgent.h
new file mode 100644
index 0000000000000000000000000000000000000000..b908ea9dd75d875e2e26807adef6e4370404e32f
index 0000000000000000000000000000000000000000..2b5518c9f7b054746a98552c24c8752eb7acb10b
--- /dev/null
+++ b/Source/WebKit/UIProcess/InspectorPlaywrightAgent.h
@@ -0,0 +1,116 @@
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2019 Microsoft Corporation.
+ *
@ -8946,6 +9049,7 @@ index 0000000000000000000000000000000000000000..b908ea9dd75d875e2e26807adef6e437
+#include <pal/SessionID.h>
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/URL.h>
+
+namespace Inspector {
+class BackendDispatcher;
@ -8958,6 +9062,10 @@ index 0000000000000000000000000000000000000000..b908ea9dd75d875e2e26807adef6e437
+class SessionID;
+}
+
+namespace WebCore {
+struct WindowFeatures;
+}
+
+namespace WebKit {
+
+class NetworkProcess;
@ -8982,6 +9090,7 @@ index 0000000000000000000000000000000000000000..b908ea9dd75d875e2e26807adef6e437
+ void didCreateWebPageProxy(const WebPageProxy&);
+ void willDestroyWebPageProxy(const WebPageProxy&);
+ void didFailProvisionalLoad(WebPageProxy&, uint64_t navigationID, const String& error);
+ void willCreateNewPage(WebPageProxy&, const WebCore::WindowFeatures&, const URL&);
+
+ // InspectorAgentBase
+ void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;
@ -9998,7 +10107,7 @@ index 0000000000000000000000000000000000000000..76290475097e756e3d932d22be4d8c79
+
+} // namespace WebKit
diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp
index 509faa03b0bf0c76ef0b74e7a503a3e537c42937..3eaa2499a962cc5921618ea35234668633d6ef57 100644
index 509faa03b0bf0c76ef0b74e7a503a3e537c42937..840f60b0cb37287977bc7a2b698b2f071a41d1b3 100644
--- a/Source/WebKit/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp
@@ -930,6 +930,7 @@ void WebPageProxy::finishAttachingToWebProcess(ProcessLaunchReason reason)
@ -10160,7 +10269,15 @@ index 509faa03b0bf0c76ef0b74e7a503a3e537c42937..3eaa2499a962cc5921618ea352346686
}
void WebPageProxy::decidePolicyForNavigationActionAsyncShared(Ref<WebProcessProxy>&& process, PageIdentifier webPageID, FrameIdentifier frameID, FrameInfoData&& frameInfo,
@@ -5490,6 +5566,7 @@ void WebPageProxy::createNewPage(FrameInfoData&& originatingFrameInfoData, Optio
@@ -5461,6 +5537,7 @@ void WebPageProxy::createNewPage(FrameInfoData&& originatingFrameInfoData, Optio
auto* originatingPage = m_process->webPage(*originatingPageID);
auto originatingFrameInfo = API::FrameInfo::create(WTFMove(originatingFrameInfoData), originatingPage);
auto mainFrameURL = m_mainFrame ? m_mainFrame->url() : URL();
+ m_inspectorController->willCreateNewPage(windowFeatures, request.url());
auto completionHandler = [this, protectedThis = makeRef(*this), mainFrameURL, request, reply = WTFMove(reply)] (RefPtr<WebPageProxy> newPage) mutable {
if (!newPage) {
reply(WTF::nullopt, WTF::nullopt);
@@ -5490,6 +5567,7 @@ void WebPageProxy::createNewPage(FrameInfoData&& originatingFrameInfoData, Optio
void WebPageProxy::showPage()
{
m_uiClient->showPage(this);
@ -10168,7 +10285,7 @@ index 509faa03b0bf0c76ef0b74e7a503a3e537c42937..3eaa2499a962cc5921618ea352346686
}
void WebPageProxy::exitFullscreenImmediately()
@@ -5546,6 +5623,8 @@ void WebPageProxy::runJavaScriptAlert(FrameIdentifier frameID, FrameInfoData&& f
@@ -5546,6 +5624,8 @@ void WebPageProxy::runJavaScriptAlert(FrameIdentifier frameID, FrameInfoData&& f
if (auto* automationSession = process().processPool().automationSession())
automationSession->willShowJavaScriptDialog(*this);
}
@ -10177,7 +10294,7 @@ index 509faa03b0bf0c76ef0b74e7a503a3e537c42937..3eaa2499a962cc5921618ea352346686
m_uiClient->runJavaScriptAlert(*this, message, frame, WTFMove(frameInfo), WTFMove(reply));
}
@@ -5565,6 +5644,8 @@ void WebPageProxy::runJavaScriptConfirm(FrameIdentifier frameID, FrameInfoData&&
@@ -5565,6 +5645,8 @@ void WebPageProxy::runJavaScriptConfirm(FrameIdentifier frameID, FrameInfoData&&
if (auto* automationSession = process().processPool().automationSession())
automationSession->willShowJavaScriptDialog(*this);
}
@ -10186,7 +10303,7 @@ index 509faa03b0bf0c76ef0b74e7a503a3e537c42937..3eaa2499a962cc5921618ea352346686
m_uiClient->runJavaScriptConfirm(*this, message, frame, WTFMove(frameInfo), WTFMove(reply));
}
@@ -5584,6 +5665,8 @@ void WebPageProxy::runJavaScriptPrompt(FrameIdentifier frameID, FrameInfoData&&
@@ -5584,6 +5666,8 @@ void WebPageProxy::runJavaScriptPrompt(FrameIdentifier frameID, FrameInfoData&&
if (auto* automationSession = process().processPool().automationSession())
automationSession->willShowJavaScriptDialog(*this);
}
@ -10195,7 +10312,7 @@ index 509faa03b0bf0c76ef0b74e7a503a3e537c42937..3eaa2499a962cc5921618ea352346686
m_uiClient->runJavaScriptPrompt(*this, message, defaultValue, frame, WTFMove(frameInfo), WTFMove(reply));
}
@@ -5743,6 +5826,8 @@ void WebPageProxy::runBeforeUnloadConfirmPanel(FrameIdentifier frameID, FrameInf
@@ -5743,6 +5827,8 @@ void WebPageProxy::runBeforeUnloadConfirmPanel(FrameIdentifier frameID, FrameInf
return;
}
}
@ -10204,7 +10321,7 @@ index 509faa03b0bf0c76ef0b74e7a503a3e537c42937..3eaa2499a962cc5921618ea352346686
// Since runBeforeUnloadConfirmPanel() can spin a nested run loop we need to turn off the responsiveness timer and the tryClose timer.
m_process->stopResponsivenessTimer();
@@ -6805,6 +6890,7 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
@@ -6805,6 +6891,7 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
if (auto* automationSession = process().processPool().automationSession())
automationSession->mouseEventsFlushedForPage(*this);
didFinishProcessingAllPendingMouseEvents();
@ -10212,7 +10329,7 @@ index 509faa03b0bf0c76ef0b74e7a503a3e537c42937..3eaa2499a962cc5921618ea352346686
}
break;
@@ -6831,7 +6917,6 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
@@ -6831,7 +6918,6 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
case WebEvent::RawKeyDown:
case WebEvent::Char: {
LOG(KeyHandling, "WebPageProxy::didReceiveEvent: %s (queue empty %d)", webKeyboardEventTypeString(type), m_keyEventQueue.isEmpty());
@ -10220,7 +10337,7 @@ index 509faa03b0bf0c76ef0b74e7a503a3e537c42937..3eaa2499a962cc5921618ea352346686
MESSAGE_CHECK(m_process, !m_keyEventQueue.isEmpty());
NativeWebKeyboardEvent event = m_keyEventQueue.takeFirst();
@@ -6851,7 +6936,6 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
@@ -6851,7 +6937,6 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
// The call to doneWithKeyEvent may close this WebPage.
// Protect against this being destroyed.
Ref<WebPageProxy> protect(*this);
@ -10228,7 +10345,7 @@ index 509faa03b0bf0c76ef0b74e7a503a3e537c42937..3eaa2499a962cc5921618ea352346686
pageClient().doneWithKeyEvent(event, handled);
if (!handled)
m_uiClient->didNotHandleKeyEvent(this, event);
@@ -6860,6 +6944,7 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
@@ -6860,6 +6945,7 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
if (!canProcessMoreKeyEvents) {
if (auto* automationSession = process().processPool().automationSession())
automationSession->keyboardEventsFlushedForPage(*this);
@ -10236,7 +10353,7 @@ index 509faa03b0bf0c76ef0b74e7a503a3e537c42937..3eaa2499a962cc5921618ea352346686
}
break;
}
@@ -7317,8 +7402,10 @@ static bool shouldReloadAfterProcessTermination(ProcessTerminationReason reason)
@@ -7317,8 +7403,10 @@ static bool shouldReloadAfterProcessTermination(ProcessTerminationReason reason)
void WebPageProxy::dispatchProcessDidTerminate(ProcessTerminationReason reason)
{
RELEASE_LOG_IF_ALLOWED(Loading, "dispatchProcessDidTerminate: reason = %d", reason);
@ -10248,7 +10365,7 @@ index 509faa03b0bf0c76ef0b74e7a503a3e537c42937..3eaa2499a962cc5921618ea352346686
if (m_loaderClient)
handledByClient = reason != ProcessTerminationReason::RequestedByClient && m_loaderClient->processDidCrash(*this);
else
@@ -7600,6 +7687,7 @@ void WebPageProxy::resetStateAfterProcessExited(ProcessTerminationReason termina
@@ -7600,6 +7688,7 @@ void WebPageProxy::resetStateAfterProcessExited(ProcessTerminationReason termina
WebPageCreationParameters WebPageProxy::creationParameters(WebProcessProxy& process, DrawingAreaProxy& drawingArea)
{
@ -10256,7 +10373,7 @@ index 509faa03b0bf0c76ef0b74e7a503a3e537c42937..3eaa2499a962cc5921618ea352346686
WebPageCreationParameters parameters;
parameters.processDisplayName = configuration().processDisplayName();
@@ -7734,6 +7822,8 @@ WebPageCreationParameters WebPageProxy::creationParameters(WebProcessProxy& proc
@@ -7734,6 +7823,8 @@ WebPageCreationParameters WebPageProxy::creationParameters(WebProcessProxy& proc
parameters.shouldRenderCanvasInGPUProcess = preferences().renderCanvasInGPUProcessEnabled();
parameters.shouldCaptureDisplayInUIProcess = m_process->processPool().configuration().shouldCaptureDisplayInUIProcess();
@ -10265,7 +10382,7 @@ index 509faa03b0bf0c76ef0b74e7a503a3e537c42937..3eaa2499a962cc5921618ea352346686
#if PLATFORM(GTK)
parameters.themeName = pageClient().themeName();
#endif
@@ -7797,6 +7887,14 @@ void WebPageProxy::gamepadActivity(const Vector<GamepadData>& gamepadDatas, bool
@@ -7797,6 +7888,14 @@ void WebPageProxy::gamepadActivity(const Vector<GamepadData>& gamepadDatas, bool
void WebPageProxy::didReceiveAuthenticationChallengeProxy(Ref<AuthenticationChallengeProxy>&& authenticationChallenge, NegotiatedLegacyTLS negotiatedLegacyTLS)
{
@ -10280,7 +10397,7 @@ index 509faa03b0bf0c76ef0b74e7a503a3e537c42937..3eaa2499a962cc5921618ea352346686
if (negotiatedLegacyTLS == NegotiatedLegacyTLS::Yes) {
m_navigationClient->shouldAllowLegacyTLS(*this, authenticationChallenge.get(), [this, protectedThis = makeRef(*this), authenticationChallenge = authenticationChallenge.copyRef()] (bool shouldAllowLegacyTLS) {
if (shouldAllowLegacyTLS)
@@ -7877,7 +7975,8 @@ void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID,
@@ -7877,7 +7976,8 @@ void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID,
MESSAGE_CHECK(m_process, frame);
// FIXME: Geolocation should probably be using toString() as its string representation instead of databaseIdentifier().
@ -10290,7 +10407,7 @@ index 509faa03b0bf0c76ef0b74e7a503a3e537c42937..3eaa2499a962cc5921618ea352346686
auto request = m_geolocationPermissionRequestManager.createRequest(geolocationID);
Function<void(bool)> completionHandler = [request = WTFMove(request)](bool allowed) {
if (allowed)
@@ -7886,6 +7985,14 @@ void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID,
@@ -7886,6 +7986,14 @@ void WebPageProxy::requestGeolocationPermissionForFrame(uint64_t geolocationID,
request->deny();
};