@@ -1088,10 +1088,10 @@ index 78980810141a9e9b65b93e6cebe80daff9a52dc1..074e0e53b03f3453972c11e39d021baa
10881088 }
10891089diff --git a/Source/JavaScriptCore/inspector/protocol/Playwright.json b/Source/JavaScriptCore/inspector/protocol/Playwright.json
10901090new file mode 100644
1091- index 0000000000000000000000000000000000000000..9cc2d3f122c1f3228b3298b07978201c72208eb1
1091+ index 0000000000000000000000000000000000000000..b064c8fb400a57176e4051f8e80df4af57a9d575
10921092--- /dev/null
10931093+++ b/Source/JavaScriptCore/inspector/protocol/Playwright.json
1094- @@ -0,0 +1,221 @@
1094+ @@ -0,0 +1,228 @@
10951095+{
10961096+ "domain": "Playwright",
10971097+ "availability": ["web"],
@@ -1305,6 +1305,13 @@ index 0000000000000000000000000000000000000000..9cc2d3f122c1f3228b3298b07978201c
13051305+ ]
13061306+ },
13071307+ {
1308+ + "name": "downloadFilenameSuggested",
1309+ + "parameters": [
1310+ + { "name": "uuid", "type": "string" },
1311+ + { "name": "suggestedFilename", "type": "string" }
1312+ + ]
1313+ + },
1314+ + {
13081315+ "name": "downloadFinished",
13091316+ "parameters": [
13101317+ { "name": "uuid", "type": "string" },
@@ -8151,7 +8158,7 @@ index d7695088e7cfc4f638f157338754f9f157489749..ba114d47ac079661702e44f19853398f
81518158 bool m_isBackingStoreDiscardable { true };
81528159 std::unique_ptr<BackingStore> m_backingStore;
81538160diff --git a/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp b/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp
8154- index 592fa4c4d9a45eb1e9b95e0cdabc8d404b40018d..50b310adfdea35e6194120f5b776632d2b2987ea 100644
8161+ index 592fa4c4d9a45eb1e9b95e0cdabc8d404b40018d..e7889c60fffb8979ee3965295b3221989ea48e05 100644
81558162--- a/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp
81568163+++ b/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp
81578164@@ -42,8 +42,10 @@
@@ -8176,12 +8183,15 @@ index 592fa4c4d9a45eb1e9b95e0cdabc8d404b40018d..50b310adfdea35e6194120f5b776632d
81768183 }
81778184
81788185 DownloadProxy::~DownloadProxy()
8179- @@ -178,7 +183,18 @@ void DownloadProxy::decideDestinationWithSuggestedFilenameAsync(DownloadID downl
8186+ @@ -178,7 +183,21 @@ void DownloadProxy::decideDestinationWithSuggestedFilenameAsync(DownloadID downl
81808187 {
81818188 if (!m_processPool)
81828189 return;
81838190-
81848191+
8192+ + if (auto* instrumentation = m_dataStore->downloadInstrumentation())
8193+ + instrumentation->downloadFilenameSuggested(m_uuid, suggestedFilename);
8194+ +
81858195+ if (m_processPool->networkProcess() && m_dataStore->allowDownloadForAutomation()) {
81868196+ SandboxExtension::Handle sandboxExtensionHandle;
81878197+ String destination;
@@ -8196,7 +8206,7 @@ index 592fa4c4d9a45eb1e9b95e0cdabc8d404b40018d..50b310adfdea35e6194120f5b776632d
81968206 m_processPool->downloadClient().decideDestinationWithSuggestedFilename(*this, ResourceResponseBase::sanitizeSuggestedFilename(suggestedFilename), [this, protectedThis = makeRef(*this), downloadID = downloadID] (AllowOverwrite allowOverwrite, String destination) {
81978207 SandboxExtension::Handle sandboxExtensionHandle;
81988208 if (!destination.isNull())
8199- @@ -206,6 +222 ,8 @@ void DownloadProxy::didFinish()
8209+ @@ -206,6 +225 ,8 @@ void DownloadProxy::didFinish()
82008210 return;
82018211
82028212 m_processPool->downloadClient().didFinish(*this);
@@ -8205,7 +8215,7 @@ index 592fa4c4d9a45eb1e9b95e0cdabc8d404b40018d..50b310adfdea35e6194120f5b776632d
82058215
82068216 // This can cause the DownloadProxy object to be deleted.
82078217 m_downloadProxyMap.downloadFinished(*this);
8208- @@ -227,6 +245 ,8 @@ void DownloadProxy::didFail(const ResourceError& error, const IPC::DataReference
8218+ @@ -227,6 +248 ,8 @@ void DownloadProxy::didFail(const ResourceError& error, const IPC::DataReference
82098219 m_resumeData = createData(resumeData);
82108220
82118221 m_processPool->downloadClient().didFail(*this, error);
@@ -8214,7 +8224,7 @@ index 592fa4c4d9a45eb1e9b95e0cdabc8d404b40018d..50b310adfdea35e6194120f5b776632d
82148224
82158225 // This can cause the DownloadProxy object to be deleted.
82168226 m_downloadProxyMap.downloadFinished(*this);
8217- @@ -237,6 +257 ,8 @@ void DownloadProxy::didCancel(const IPC::DataReference& resumeData)
8227+ @@ -237,6 +260 ,8 @@ void DownloadProxy::didCancel(const IPC::DataReference& resumeData)
82188228 m_resumeData = createData(resumeData);
82198229
82208230 m_processPool->downloadClient().didCancel(*this);
@@ -8958,10 +8968,10 @@ index 0000000000000000000000000000000000000000..f356c613945fd263889bc74166bef2b2
89588968+} // namespace WebKit
89598969diff --git a/Source/WebKit/UIProcess/InspectorPlaywrightAgent.cpp b/Source/WebKit/UIProcess/InspectorPlaywrightAgent.cpp
89608970new file mode 100644
8961- index 0000000000000000000000000000000000000000..45eab7a43fcab9aea59f1c04113a3549f926c190
8971+ index 0000000000000000000000000000000000000000..ca6d9848a80eba88d8b0d16066f9d9caef157345
89628972--- /dev/null
89638973+++ b/Source/WebKit/UIProcess/InspectorPlaywrightAgent.cpp
8964- @@ -0,0 +1,605 @@
8974+ @@ -0,0 +1,612 @@
89658975+/*
89668976+ * Copyright (C) 2019 Microsoft Corporation.
89678977+ *
@@ -9525,6 +9535,13 @@ index 0000000000000000000000000000000000000000..45eab7a43fcab9aea59f1c04113a3549
95259535+ frameID);
95269536+}
95279537+
9538+ +void InspectorPlaywrightAgent::downloadFilenameSuggested(const String& uuid, const String& suggestedFilename)
9539+ +{
9540+ + if (!m_isConnected)
9541+ + return;
9542+ + m_frontendDispatcher->downloadFilenameSuggested(uuid, suggestedFilename);
9543+ +}
9544+ +
95289545+void InspectorPlaywrightAgent::downloadFinished(const String& uuid, const String& error)
95299546+{
95309547+ if (!m_isConnected)
@@ -9569,10 +9586,10 @@ index 0000000000000000000000000000000000000000..45eab7a43fcab9aea59f1c04113a3549
95699586+#endif // ENABLE(REMOTE_INSPECTOR)
95709587diff --git a/Source/WebKit/UIProcess/InspectorPlaywrightAgent.h b/Source/WebKit/UIProcess/InspectorPlaywrightAgent.h
95719588new file mode 100644
9572- index 0000000000000000000000000000000000000000..a38b9be4e699469fe9de746400dae7b222245909
9589+ index 0000000000000000000000000000000000000000..751b0e403b7e9d7c31e3e1f191c9167f71bb0442
95739590--- /dev/null
95749591+++ b/Source/WebKit/UIProcess/InspectorPlaywrightAgent.h
9575- @@ -0,0 +1,121 @@
9592+ @@ -0,0 +1,122 @@
95769593+/*
95779594+ * Copyright (C) 2019 Microsoft Corporation.
95789595+ *
@@ -9675,6 +9692,7 @@ index 0000000000000000000000000000000000000000..a38b9be4e699469fe9de746400dae7b2
96759692+
96769693+ // DownloadInstrumentation
96779694+ void downloadCreated(const String& uuid, const WebCore::ResourceRequest&, const FrameInfoData& frameInfoData, WebPageProxy* page) override;
9695+ + void downloadFilenameSuggested(const String& uuid, const String& suggestedFilename) override;
96789696+ void downloadFinished(const String& uuid, const String& error) override;
96799697+
96809698+private:
@@ -11148,7 +11166,7 @@ index 50d97931d4c05c7046521bfa762f520fff3c1184..6934a161312d658e3a1c1f3a053070ab
1114811166+
1114911167 }
1115011168diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
11151- index e842313256ba31bdd8a750ca55b33abdab2c0092..bb639d919b7348f811abface22a6f5cded25a371 100644
11169+ index e842313256ba31bdd8a750ca55b33abdab2c0092..6d082863966f374657864275da68d0fc9fcb43b4 100644
1115211170--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
1115311171+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
1115411172@@ -83,6 +83,7 @@ class WebResourceLoadStatisticsStore;
@@ -11159,21 +11177,22 @@ index e842313256ba31bdd8a750ca55b33abdab2c0092..bb639d919b7348f811abface22a6f5cd
1115911177 struct WebsiteDataRecord;
1116011178 struct WebsiteDataStoreParameters;
1116111179
11162- @@ -96,6 +97,13 @@ enum class StorageAccessPromptStatus;
11180+ @@ -96,6 +97,14 @@ enum class StorageAccessPromptStatus;
1116311181 struct PluginModuleInfo;
1116411182 #endif
1116511183
1116611184+class DownloadInstrumentation {
1116711185+public:
1116811186+ virtual void downloadCreated(const String& uuid, const WebCore::ResourceRequest&, const FrameInfoData& frameInfoData, WebPageProxy* page) = 0;
11187+ + virtual void downloadFilenameSuggested(const String& uuid, const String& suggestedFilename) = 0;
1116911188+ virtual void downloadFinished(const String& uuid, const String& error) = 0;
1117011189+ virtual ~DownloadInstrumentation() = default;
1117111190+};
1117211191+
1117311192 class WebsiteDataStore : public API::ObjectImpl<API::Object::Type::WebsiteDataStore>, public Identified<WebsiteDataStore>, public CanMakeWeakPtr<WebsiteDataStore> {
1117411193 public:
1117511194 static Ref<WebsiteDataStore> defaultDataStore();
11176- @@ -282,6 +290 ,14 @@ public:
11195+ @@ -282,6 +291 ,14 @@ public:
1117711196 static WTF::String defaultJavaScriptConfigurationDirectory();
1117811197 static bool http3Enabled();
1117911198
@@ -11188,7 +11207,7 @@ index e842313256ba31bdd8a750ca55b33abdab2c0092..bb639d919b7348f811abface22a6f5cd
1118811207 void resetQuota(CompletionHandler<void()>&&);
1118911208 void hasAppBoundSession(CompletionHandler<void(bool)>&&) const;
1119011209 void setInAppBrowserPrivacyEnabled(bool enabled, CompletionHandler<void()>&&);
11191- @@ -372,6 +388 ,11 @@ private:
11210+ @@ -372,6 +389 ,11 @@ private:
1119211211
1119311212 RefPtr<API::HTTPCookieStore> m_cookieStore;
1119411213
0 commit comments