@@ -1088,10 +1088,10 @@ index 78980810141a9e9b65b93e6cebe80daff9a52dc1..074e0e53b03f3453972c11e39d021baa
1088
1088
}
1089
1089
diff --git a/Source/JavaScriptCore/inspector/protocol/Playwright.json b/Source/JavaScriptCore/inspector/protocol/Playwright.json
1090
1090
new file mode 100644
1091
- index 0000000000000000000000000000000000000000..9cc2d3f122c1f3228b3298b07978201c72208eb1
1091
+ index 0000000000000000000000000000000000000000..b064c8fb400a57176e4051f8e80df4af57a9d575
1092
1092
--- /dev/null
1093
1093
+++ b/Source/JavaScriptCore/inspector/protocol/Playwright.json
1094
- @@ -0,0 +1,221 @@
1094
+ @@ -0,0 +1,228 @@
1095
1095
+{
1096
1096
+ "domain": "Playwright",
1097
1097
+ "availability": ["web"],
@@ -1305,6 +1305,13 @@ index 0000000000000000000000000000000000000000..9cc2d3f122c1f3228b3298b07978201c
1305
1305
+ ]
1306
1306
+ },
1307
1307
+ {
1308
+ + "name": "downloadFilenameSuggested",
1309
+ + "parameters": [
1310
+ + { "name": "uuid", "type": "string" },
1311
+ + { "name": "suggestedFilename", "type": "string" }
1312
+ + ]
1313
+ + },
1314
+ + {
1308
1315
+ "name": "downloadFinished",
1309
1316
+ "parameters": [
1310
1317
+ { "name": "uuid", "type": "string" },
@@ -8151,7 +8158,7 @@ index d7695088e7cfc4f638f157338754f9f157489749..ba114d47ac079661702e44f19853398f
8151
8158
bool m_isBackingStoreDiscardable { true };
8152
8159
std::unique_ptr<BackingStore> m_backingStore;
8153
8160
diff --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
8155
8162
--- a/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp
8156
8163
+++ b/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp
8157
8164
@@ -42,8 +42,10 @@
@@ -8176,12 +8183,15 @@ index 592fa4c4d9a45eb1e9b95e0cdabc8d404b40018d..50b310adfdea35e6194120f5b776632d
8176
8183
}
8177
8184
8178
8185
DownloadProxy::~DownloadProxy()
8179
- @@ -178,7 +183,18 @@ void DownloadProxy::decideDestinationWithSuggestedFilenameAsync(DownloadID downl
8186
+ @@ -178,7 +183,21 @@ void DownloadProxy::decideDestinationWithSuggestedFilenameAsync(DownloadID downl
8180
8187
{
8181
8188
if (!m_processPool)
8182
8189
return;
8183
8190
-
8184
8191
+
8192
+ + if (auto* instrumentation = m_dataStore->downloadInstrumentation())
8193
+ + instrumentation->downloadFilenameSuggested(m_uuid, suggestedFilename);
8194
+ +
8185
8195
+ if (m_processPool->networkProcess() && m_dataStore->allowDownloadForAutomation()) {
8186
8196
+ SandboxExtension::Handle sandboxExtensionHandle;
8187
8197
+ String destination;
@@ -8196,7 +8206,7 @@ index 592fa4c4d9a45eb1e9b95e0cdabc8d404b40018d..50b310adfdea35e6194120f5b776632d
8196
8206
m_processPool->downloadClient().decideDestinationWithSuggestedFilename(*this, ResourceResponseBase::sanitizeSuggestedFilename(suggestedFilename), [this, protectedThis = makeRef(*this), downloadID = downloadID] (AllowOverwrite allowOverwrite, String destination) {
8197
8207
SandboxExtension::Handle sandboxExtensionHandle;
8198
8208
if (!destination.isNull())
8199
- @@ -206,6 +222 ,8 @@ void DownloadProxy::didFinish()
8209
+ @@ -206,6 +225 ,8 @@ void DownloadProxy::didFinish()
8200
8210
return;
8201
8211
8202
8212
m_processPool->downloadClient().didFinish(*this);
@@ -8205,7 +8215,7 @@ index 592fa4c4d9a45eb1e9b95e0cdabc8d404b40018d..50b310adfdea35e6194120f5b776632d
8205
8215
8206
8216
// This can cause the DownloadProxy object to be deleted.
8207
8217
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
8209
8219
m_resumeData = createData(resumeData);
8210
8220
8211
8221
m_processPool->downloadClient().didFail(*this, error);
@@ -8214,7 +8224,7 @@ index 592fa4c4d9a45eb1e9b95e0cdabc8d404b40018d..50b310adfdea35e6194120f5b776632d
8214
8224
8215
8225
// This can cause the DownloadProxy object to be deleted.
8216
8226
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)
8218
8228
m_resumeData = createData(resumeData);
8219
8229
8220
8230
m_processPool->downloadClient().didCancel(*this);
@@ -8958,10 +8968,10 @@ index 0000000000000000000000000000000000000000..f356c613945fd263889bc74166bef2b2
8958
8968
+} // namespace WebKit
8959
8969
diff --git a/Source/WebKit/UIProcess/InspectorPlaywrightAgent.cpp b/Source/WebKit/UIProcess/InspectorPlaywrightAgent.cpp
8960
8970
new file mode 100644
8961
- index 0000000000000000000000000000000000000000..45eab7a43fcab9aea59f1c04113a3549f926c190
8971
+ index 0000000000000000000000000000000000000000..ca6d9848a80eba88d8b0d16066f9d9caef157345
8962
8972
--- /dev/null
8963
8973
+++ b/Source/WebKit/UIProcess/InspectorPlaywrightAgent.cpp
8964
- @@ -0,0 +1,605 @@
8974
+ @@ -0,0 +1,612 @@
8965
8975
+/*
8966
8976
+ * Copyright (C) 2019 Microsoft Corporation.
8967
8977
+ *
@@ -9525,6 +9535,13 @@ index 0000000000000000000000000000000000000000..45eab7a43fcab9aea59f1c04113a3549
9525
9535
+ frameID);
9526
9536
+}
9527
9537
+
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
+ +
9528
9545
+void InspectorPlaywrightAgent::downloadFinished(const String& uuid, const String& error)
9529
9546
+{
9530
9547
+ if (!m_isConnected)
@@ -9569,10 +9586,10 @@ index 0000000000000000000000000000000000000000..45eab7a43fcab9aea59f1c04113a3549
9569
9586
+#endif // ENABLE(REMOTE_INSPECTOR)
9570
9587
diff --git a/Source/WebKit/UIProcess/InspectorPlaywrightAgent.h b/Source/WebKit/UIProcess/InspectorPlaywrightAgent.h
9571
9588
new file mode 100644
9572
- index 0000000000000000000000000000000000000000..a38b9be4e699469fe9de746400dae7b222245909
9589
+ index 0000000000000000000000000000000000000000..751b0e403b7e9d7c31e3e1f191c9167f71bb0442
9573
9590
--- /dev/null
9574
9591
+++ b/Source/WebKit/UIProcess/InspectorPlaywrightAgent.h
9575
- @@ -0,0 +1,121 @@
9592
+ @@ -0,0 +1,122 @@
9576
9593
+/*
9577
9594
+ * Copyright (C) 2019 Microsoft Corporation.
9578
9595
+ *
@@ -9675,6 +9692,7 @@ index 0000000000000000000000000000000000000000..a38b9be4e699469fe9de746400dae7b2
9675
9692
+
9676
9693
+ // DownloadInstrumentation
9677
9694
+ void downloadCreated(const String& uuid, const WebCore::ResourceRequest&, const FrameInfoData& frameInfoData, WebPageProxy* page) override;
9695
+ + void downloadFilenameSuggested(const String& uuid, const String& suggestedFilename) override;
9678
9696
+ void downloadFinished(const String& uuid, const String& error) override;
9679
9697
+
9680
9698
+private:
@@ -11148,7 +11166,7 @@ index 50d97931d4c05c7046521bfa762f520fff3c1184..6934a161312d658e3a1c1f3a053070ab
11148
11166
+
11149
11167
}
11150
11168
diff --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
11152
11170
--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
11153
11171
+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
11154
11172
@@ -83,6 +83,7 @@ class WebResourceLoadStatisticsStore;
@@ -11159,21 +11177,22 @@ index e842313256ba31bdd8a750ca55b33abdab2c0092..bb639d919b7348f811abface22a6f5cd
11159
11177
struct WebsiteDataRecord;
11160
11178
struct WebsiteDataStoreParameters;
11161
11179
11162
- @@ -96,6 +97,13 @@ enum class StorageAccessPromptStatus;
11180
+ @@ -96,6 +97,14 @@ enum class StorageAccessPromptStatus;
11163
11181
struct PluginModuleInfo;
11164
11182
#endif
11165
11183
11166
11184
+class DownloadInstrumentation {
11167
11185
+public:
11168
11186
+ 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;
11169
11188
+ virtual void downloadFinished(const String& uuid, const String& error) = 0;
11170
11189
+ virtual ~DownloadInstrumentation() = default;
11171
11190
+};
11172
11191
+
11173
11192
class WebsiteDataStore : public API::ObjectImpl<API::Object::Type::WebsiteDataStore>, public Identified<WebsiteDataStore>, public CanMakeWeakPtr<WebsiteDataStore> {
11174
11193
public:
11175
11194
static Ref<WebsiteDataStore> defaultDataStore();
11176
- @@ -282,6 +290 ,14 @@ public:
11195
+ @@ -282,6 +291 ,14 @@ public:
11177
11196
static WTF::String defaultJavaScriptConfigurationDirectory();
11178
11197
static bool http3Enabled();
11179
11198
@@ -11188,7 +11207,7 @@ index e842313256ba31bdd8a750ca55b33abdab2c0092..bb639d919b7348f811abface22a6f5cd
11188
11207
void resetQuota(CompletionHandler<void()>&&);
11189
11208
void hasAppBoundSession(CompletionHandler<void(bool)>&&) const;
11190
11209
void setInAppBrowserPrivacyEnabled(bool enabled, CompletionHandler<void()>&&);
11191
- @@ -372,6 +388 ,11 @@ private:
11210
+ @@ -372,6 +389 ,11 @@ private:
11192
11211
11193
11212
RefPtr<API::HTTPCookieStore> m_cookieStore;
11194
11213
0 commit comments